License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 14:07:57 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 22:20:36 +00:00
|
|
|
#ifndef __NET_PKT_SCHED_H
|
|
|
|
#define __NET_PKT_SCHED_H
|
|
|
|
|
2006-01-09 06:12:03 +00:00
|
|
|
#include <linux/jiffies.h>
|
2007-03-16 08:18:42 +00:00
|
|
|
#include <linux/ktime.h>
|
2015-01-13 16:13:43 +00:00
|
|
|
#include <linux/if_vlan.h>
|
2017-10-13 12:00:58 +00:00
|
|
|
#include <linux/netdevice.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <net/sch_generic.h>
|
2017-10-13 12:00:58 +00:00
|
|
|
#include <net/net_namespace.h>
|
2017-08-09 12:30:31 +00:00
|
|
|
#include <uapi/linux/pkt_sched.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2016-11-03 13:56:01 +00:00
|
|
|
#define DEFAULT_TX_QUEUE_LEN 1000
|
|
|
|
|
2009-11-03 03:26:03 +00:00
|
|
|
struct qdisc_walker {
|
2005-04-16 22:20:36 +00:00
|
|
|
int stop;
|
|
|
|
int skip;
|
|
|
|
int count;
|
|
|
|
int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void *qdisc_priv(struct Qdisc *q)
|
|
|
|
{
|
2020-10-07 16:51:11 +00:00
|
|
|
return &q->privdata;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2020-11-03 09:18:21 +00:00
|
|
|
static inline struct Qdisc *qdisc_from_priv(void *priv)
|
|
|
|
{
|
|
|
|
return container_of(priv, struct Qdisc, privdata);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
Timer resolution MUST BE < 10% of min_schedulable_packet_size/bandwidth
|
|
|
|
|
|
|
|
Normal IP packet size ~ 512byte, hence:
|
|
|
|
|
|
|
|
0.5Kbyte/1Mbyte/sec = 0.5msec, so that we need 50usec timer for
|
|
|
|
10Mbit ethernet.
|
|
|
|
|
|
|
|
10msec resolution -> <50Kbit/sec.
|
|
|
|
|
|
|
|
The result: [34]86 is not good choice for QoS router :-(
|
|
|
|
|
2011-03-31 01:57:33 +00:00
|
|
|
The things are not so bad, because we may use artificial
|
2005-04-16 22:20:36 +00:00
|
|
|
clock evaluated by integration of network data flow
|
|
|
|
in the most critical places.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef u64 psched_time_t;
|
|
|
|
typedef long psched_tdiff_t;
|
|
|
|
|
2009-06-08 22:05:13 +00:00
|
|
|
/* Avoid doing 64 bit divide */
|
|
|
|
#define PSCHED_SHIFT 6
|
2009-06-15 09:31:47 +00:00
|
|
|
#define PSCHED_TICKS2NS(x) ((s64)(x) << PSCHED_SHIFT)
|
|
|
|
#define PSCHED_NS2TICKS(x) ((x) >> PSCHED_SHIFT)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-06-15 09:31:47 +00:00
|
|
|
#define PSCHED_TICKS_PER_SEC PSCHED_NS2TICKS(NSEC_PER_SEC)
|
2007-03-23 18:28:30 +00:00
|
|
|
#define PSCHED_PASTPERFECT 0
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-03-23 18:29:25 +00:00
|
|
|
static inline psched_time_t psched_get_time(void)
|
|
|
|
{
|
2014-08-23 01:32:09 +00:00
|
|
|
return PSCHED_NS2TICKS(ktime_get_ns());
|
2007-03-23 18:29:25 +00:00
|
|
|
}
|
|
|
|
|
2007-03-23 18:29:11 +00:00
|
|
|
static inline psched_tdiff_t
|
|
|
|
psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
|
|
|
|
{
|
|
|
|
return min(tv1 - tv2, bound);
|
|
|
|
}
|
|
|
|
|
2007-03-16 08:19:15 +00:00
|
|
|
struct qdisc_watchdog {
|
2016-05-23 21:24:56 +00:00
|
|
|
u64 last_expires;
|
2007-03-16 08:19:15 +00:00
|
|
|
struct hrtimer timer;
|
|
|
|
struct Qdisc *qdisc;
|
|
|
|
};
|
|
|
|
|
2018-07-03 22:42:52 +00:00
|
|
|
void qdisc_watchdog_init_clockid(struct qdisc_watchdog *wd, struct Qdisc *qdisc,
|
|
|
|
clockid_t clockid);
|
2013-07-31 05:47:13 +00:00
|
|
|
void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
|
2020-03-17 02:12:49 +00:00
|
|
|
|
|
|
|
void qdisc_watchdog_schedule_range_ns(struct qdisc_watchdog *wd, u64 expires,
|
|
|
|
u64 delta_ns);
|
|
|
|
|
|
|
|
static inline void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd,
|
|
|
|
u64 expires)
|
|
|
|
{
|
|
|
|
return qdisc_watchdog_schedule_range_ns(wd, expires, 0ULL);
|
|
|
|
}
|
2013-02-12 00:12:04 +00:00
|
|
|
|
|
|
|
static inline void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
|
|
|
|
psched_time_t expires)
|
|
|
|
{
|
2016-06-10 23:41:39 +00:00
|
|
|
qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires));
|
2013-02-12 00:12:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-31 05:47:13 +00:00
|
|
|
void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
|
2007-03-16 08:19:15 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
extern struct Qdisc_ops pfifo_qdisc_ops;
|
|
|
|
extern struct Qdisc_ops bfifo_qdisc_ops;
|
2010-01-24 12:30:59 +00:00
|
|
|
extern struct Qdisc_ops pfifo_head_drop_qdisc_ops;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-07-31 05:47:13 +00:00
|
|
|
int fifo_set_limit(struct Qdisc *q, unsigned int limit);
|
|
|
|
struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
|
2017-12-20 17:35:21 +00:00
|
|
|
unsigned int limit,
|
|
|
|
struct netlink_ext_ack *extack);
|
2013-07-31 05:47:13 +00:00
|
|
|
|
|
|
|
int register_qdisc(struct Qdisc_ops *qops);
|
|
|
|
int unregister_qdisc(struct Qdisc_ops *qops);
|
2013-08-27 23:19:08 +00:00
|
|
|
void qdisc_get_default(char *id, size_t len);
|
|
|
|
int qdisc_set_default(const char *id);
|
|
|
|
|
2017-03-08 15:03:32 +00:00
|
|
|
void qdisc_hash_add(struct Qdisc *q, bool invisible);
|
2016-08-10 09:05:15 +00:00
|
|
|
void qdisc_hash_del(struct Qdisc *q);
|
2013-07-31 05:47:13 +00:00
|
|
|
struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
|
2018-09-24 16:22:51 +00:00
|
|
|
struct Qdisc *qdisc_lookup_rcu(struct net_device *dev, u32 handle);
|
2013-07-31 05:47:13 +00:00
|
|
|
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
|
2017-12-20 17:35:18 +00:00
|
|
|
struct nlattr *tab,
|
|
|
|
struct netlink_ext_ack *extack);
|
2013-07-31 05:47:13 +00:00
|
|
|
void qdisc_put_rtab(struct qdisc_rate_table *tab);
|
|
|
|
void qdisc_put_stab(struct qdisc_size_table *tab);
|
2014-06-11 18:35:18 +00:00
|
|
|
void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc);
|
2017-12-07 17:54:47 +00:00
|
|
|
bool sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
|
|
|
|
struct net_device *dev, struct netdev_queue *txq,
|
|
|
|
spinlock_t *root_lock, bool validate);
|
2013-07-31 05:47:13 +00:00
|
|
|
|
|
|
|
void __qdisc_run(struct Qdisc *q);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-07-16 09:15:04 +00:00
|
|
|
static inline void qdisc_run(struct Qdisc *q)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2017-12-07 17:54:06 +00:00
|
|
|
if (qdisc_run_begin(q)) {
|
2019-09-12 10:02:42 +00:00
|
|
|
/* NOLOCK qdisc must check 'state' under the qdisc seqlock
|
|
|
|
* to avoid racing with dev_qdisc_reset()
|
|
|
|
*/
|
|
|
|
if (!(q->flags & TCQ_F_NOLOCK) ||
|
|
|
|
likely(!test_bit(__QDISC_STATE_DEACTIVATED, &q->state)))
|
|
|
|
__qdisc_run(q);
|
2017-12-07 17:54:06 +00:00
|
|
|
qdisc_run_end(q);
|
|
|
|
}
|
2015-01-13 16:13:43 +00:00
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Calculate maximal size of packet seen by hard_start_xmit
|
|
|
|
routine of this device.
|
|
|
|
*/
|
2012-04-15 05:58:06 +00:00
|
|
|
static inline unsigned int psched_mtu(const struct net_device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-10-09 08:40:57 +00:00
|
|
|
return dev->mtu + dev->hard_header_len;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2017-10-13 12:00:58 +00:00
|
|
|
static inline struct net *qdisc_net(struct Qdisc *q)
|
|
|
|
{
|
|
|
|
return dev_net(q->dev_queue->dev);
|
|
|
|
}
|
|
|
|
|
2017-10-17 01:01:27 +00:00
|
|
|
struct tc_cbs_qopt_offload {
|
|
|
|
u8 enable;
|
|
|
|
s32 queue;
|
|
|
|
s32 hicredit;
|
|
|
|
s32 locredit;
|
|
|
|
s32 idleslope;
|
|
|
|
s32 sendslope;
|
|
|
|
};
|
|
|
|
|
2018-07-03 22:42:54 +00:00
|
|
|
struct tc_etf_qopt_offload {
|
|
|
|
u8 enable;
|
|
|
|
s32 queue;
|
|
|
|
};
|
|
|
|
|
taprio: Add support for hardware offloading
This allows taprio to offload the schedule enforcement to capable
network cards, resulting in more precise windows and less CPU usage.
The gate mask acts on traffic classes (groups of queues of same
priority), as specified in IEEE 802.1Q-2018, and following the existing
taprio and mqprio semantics.
It is up to the driver to perform conversion between tc and individual
netdev queues if for some reason it needs to make that distinction.
Full offload is requested from the network interface by specifying
"flags 2" in the tc qdisc creation command, which in turn corresponds to
the TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD bit.
The important detail here is the clockid which is implicitly /dev/ptpN
for full offload, and hence not configurable.
A reference counting API is added to support the use case where Ethernet
drivers need to keep the taprio offload structure locally (i.e. they are
a multi-port switch driver, and configuring a port depends on the
settings of other ports as well). The refcount_t variable is kept in a
private structure (__tc_taprio_qopt_offload) and not exposed to drivers.
In the future, the private structure might also be expanded with a
backpointer to taprio_sched *q, to implement the notification system
described in the patch (of when admin became oper, or an error occurred,
etc, so the offload can be monitored with 'tc qdisc show').
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-09-15 01:59:58 +00:00
|
|
|
struct tc_taprio_sched_entry {
|
|
|
|
u8 command; /* TC_TAPRIO_CMD_* */
|
|
|
|
|
|
|
|
/* The gate_mask in the offloading side refers to traffic classes */
|
|
|
|
u32 gate_mask;
|
|
|
|
u32 interval;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tc_taprio_qopt_offload {
|
|
|
|
u8 enable;
|
|
|
|
ktime_t base_time;
|
|
|
|
u64 cycle_time;
|
|
|
|
u64 cycle_time_extension;
|
|
|
|
|
|
|
|
size_t num_entries;
|
2020-02-27 20:58:44 +00:00
|
|
|
struct tc_taprio_sched_entry entries[];
|
taprio: Add support for hardware offloading
This allows taprio to offload the schedule enforcement to capable
network cards, resulting in more precise windows and less CPU usage.
The gate mask acts on traffic classes (groups of queues of same
priority), as specified in IEEE 802.1Q-2018, and following the existing
taprio and mqprio semantics.
It is up to the driver to perform conversion between tc and individual
netdev queues if for some reason it needs to make that distinction.
Full offload is requested from the network interface by specifying
"flags 2" in the tc qdisc creation command, which in turn corresponds to
the TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD bit.
The important detail here is the clockid which is implicitly /dev/ptpN
for full offload, and hence not configurable.
A reference counting API is added to support the use case where Ethernet
drivers need to keep the taprio offload structure locally (i.e. they are
a multi-port switch driver, and configuring a port depends on the
settings of other ports as well). The refcount_t variable is kept in a
private structure (__tc_taprio_qopt_offload) and not exposed to drivers.
In the future, the private structure might also be expanded with a
backpointer to taprio_sched *q, to implement the notification system
described in the patch (of when admin became oper, or an error occurred,
etc, so the offload can be monitored with 'tc qdisc show').
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-09-15 01:59:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Reference counting */
|
|
|
|
struct tc_taprio_qopt_offload *taprio_offload_get(struct tc_taprio_qopt_offload
|
|
|
|
*offload);
|
|
|
|
void taprio_offload_free(struct tc_taprio_qopt_offload *offload);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|