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
|
2021-09-24 02:35:58 +00:00
|
|
|
#define STAB_SIZE_LOG_MAX 30
|
2016-11-03 13:56:01 +00:00
|
|
|
|
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-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);
|
2022-08-15 03:04:17 +00:00
|
|
|
void 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)) {
|
net: sched: fix tx action rescheduling issue during deactivation
Currently qdisc_run() checks the STATE_DEACTIVATED of lockless
qdisc before calling __qdisc_run(), which ultimately clear the
STATE_MISSED when all the skb is dequeued. If STATE_DEACTIVATED
is set before clearing STATE_MISSED, there may be rescheduling
of net_tx_action() at the end of qdisc_run_end(), see below:
CPU0(net_tx_atcion) CPU1(__dev_xmit_skb) CPU2(dev_deactivate)
. . .
. set STATE_MISSED .
. __netif_schedule() .
. . set STATE_DEACTIVATED
. . qdisc_reset()
. . .
.<--------------- . synchronize_net()
clear __QDISC_STATE_SCHED | . .
. | . .
. | . some_qdisc_is_busy()
. | . return *false*
. | . .
test STATE_DEACTIVATED | . .
__qdisc_run() *not* called | . .
. | . .
test STATE_MISS | . .
__netif_schedule()--------| . .
. . .
. . .
__qdisc_run() is not called by net_tx_atcion() in CPU0 because
CPU2 has set STATE_DEACTIVATED flag during dev_deactivate(), and
STATE_MISSED is only cleared in __qdisc_run(), __netif_schedule
is called at the end of qdisc_run_end(), causing tx action
rescheduling problem.
qdisc_run() called by net_tx_action() runs in the softirq context,
which should has the same semantic as the qdisc_run() called by
__dev_xmit_skb() protected by rcu_read_lock_bh(). And there is a
synchronize_net() between STATE_DEACTIVATED flag being set and
qdisc_reset()/some_qdisc_is_busy in dev_deactivate(), we can safely
bail out for the deactived lockless qdisc in net_tx_action(), and
qdisc_reset() will reset all skb not dequeued yet.
So add the rcu_read_lock() explicitly to protect the qdisc_run()
and do the STATE_DEACTIVATED checking in net_tx_action() before
calling qdisc_run_begin(). Another option is to do the checking in
the qdisc_run_end(), but it will add unnecessary overhead for
non-tx_action case, because __dev_queue_xmit() will not see qdisc
with STATE_DEACTIVATED after synchronize_net(), the qdisc with
STATE_DEACTIVATED can only be seen by net_tx_action() because of
__netif_schedule().
The STATE_DEACTIVATED checking in qdisc_run() is to avoid race
between net_tx_action() and qdisc_reset(), see:
commit d518d2ed8640 ("net/sched: fix race between deactivation
and dequeue for NOLOCK qdisc"). As the bailout added above for
deactived lockless qdisc in net_tx_action() provides better
protection for the race without calling qdisc_run() at all, so
remove the STATE_DEACTIVATED checking in qdisc_run().
After qdisc_reset(), there is no skb in qdisc to be dequeued, so
clear the STATE_MISSED in dev_reset_queue() too.
Fixes: 6b3ba9146fe6 ("net: sched: allow qdiscs to handle locking")
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
V8: Clearing STATE_MISSED before calling __netif_schedule() has
avoid the endless rescheduling problem, but there may still
be a unnecessary rescheduling, so adjust the commit log.
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-05-14 03:17:00 +00:00
|
|
|
__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);
|
|
|
|
}
|
|
|
|
|
2022-09-28 09:51:57 +00:00
|
|
|
struct tc_query_caps_base {
|
|
|
|
enum tc_setup_type type;
|
|
|
|
void *caps;
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
net/sched: taprio: allow user input of per-tc max SDU
IEEE 802.1Q clause 12.29.1.1 "The queueMaxSDUTable structure and data
types" and 8.6.8.4 "Enhancements for scheduled traffic" talk about the
existence of a per traffic class limitation of maximum frame sizes, with
a fallback on the port-based MTU.
As far as I am able to understand, the 802.1Q Service Data Unit (SDU)
represents the MAC Service Data Unit (MSDU, i.e. L2 payload), excluding
any number of prepended VLAN headers which may be otherwise present in
the MSDU. Therefore, the queueMaxSDU is directly comparable to the
device MTU (1500 means L2 payload sizes are accepted, or frame sizes of
1518 octets, or 1522 plus one VLAN header). Drivers which offload this
are directly responsible of translating into other units of measurement.
To keep the fast path checks optimized, we keep 2 arrays in the qdisc,
one for max_sdu translated into frame length (so that it's comparable to
skb->len), and another for offloading and for dumping back to the user.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-09-28 09:51:58 +00:00
|
|
|
struct tc_taprio_caps {
|
|
|
|
bool supports_queue_max_sdu:1;
|
|
|
|
};
|
|
|
|
|
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;
|
net/sched: taprio: allow user input of per-tc max SDU
IEEE 802.1Q clause 12.29.1.1 "The queueMaxSDUTable structure and data
types" and 8.6.8.4 "Enhancements for scheduled traffic" talk about the
existence of a per traffic class limitation of maximum frame sizes, with
a fallback on the port-based MTU.
As far as I am able to understand, the 802.1Q Service Data Unit (SDU)
represents the MAC Service Data Unit (MSDU, i.e. L2 payload), excluding
any number of prepended VLAN headers which may be otherwise present in
the MSDU. Therefore, the queueMaxSDU is directly comparable to the
device MTU (1500 means L2 payload sizes are accepted, or frame sizes of
1518 octets, or 1522 plus one VLAN header). Drivers which offload this
are directly responsible of translating into other units of measurement.
To keep the fast path checks optimized, we keep 2 arrays in the qdisc,
one for max_sdu translated into frame length (so that it's comparable to
skb->len), and another for offloading and for dumping back to the user.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-09-28 09:51:58 +00:00
|
|
|
u32 max_sdu[TC_MAX_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
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2022-07-04 19:02:40 +00:00
|
|
|
#if IS_ENABLED(CONFIG_NET_SCH_TAPRIO)
|
|
|
|
|
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);
|
|
|
|
|
2022-07-04 19:02:40 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
/* Reference counting */
|
|
|
|
static inline struct tc_taprio_qopt_offload *
|
|
|
|
taprio_offload_get(struct tc_taprio_qopt_offload *offload)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void taprio_offload_free(struct tc_taprio_qopt_offload *offload)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-03-10 14:50:44 +00:00
|
|
|
/* Ensure skb_mstamp_ns, which might have been populated with the txtime, is
|
|
|
|
* not mistaken for a software timestamp, because this will otherwise prevent
|
|
|
|
* the dispatch of hardware timestamps to the socket.
|
|
|
|
*/
|
|
|
|
static inline void skb_txtime_consumed(struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
skb->tstamp = ktime_set(0, 0);
|
|
|
|
}
|
|
|
|
|
2021-12-14 17:24:33 +00:00
|
|
|
struct tc_skb_cb {
|
|
|
|
struct qdisc_skb_cb qdisc_cb;
|
|
|
|
|
|
|
|
u16 mru;
|
2022-01-06 15:38:04 +00:00
|
|
|
u8 post_ct:1;
|
|
|
|
u8 post_ct_snat:1;
|
|
|
|
u8 post_ct_dnat:1;
|
2021-12-14 17:24:34 +00:00
|
|
|
u16 zone; /* Only valid if post_ct = true */
|
2021-12-14 17:24:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
struct tc_skb_cb *cb = (struct tc_skb_cb *)skb->cb;
|
|
|
|
|
|
|
|
BUILD_BUG_ON(sizeof(*cb) > sizeof_field(struct sk_buff, cb));
|
|
|
|
return cb;
|
|
|
|
}
|
|
|
|
|
2022-09-21 02:41:04 +00:00
|
|
|
static inline bool tc_qdisc_stats_dump(struct Qdisc *sch,
|
|
|
|
unsigned long cl,
|
|
|
|
struct qdisc_walker *arg)
|
|
|
|
{
|
|
|
|
if (arg->count >= arg->skip && arg->fn(sch, cl, arg) < 0) {
|
|
|
|
arg->stop = 1;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
arg->count++;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|