All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next v7 0/2] net: sched: allow user to select txqueue
@ 2021-12-24 16:49 xiangxia.m.yue
  2021-12-24 16:49 ` [net-next v7 1/2] net: sched: use queue_mapping to pick tx queue xiangxia.m.yue
  2021-12-24 16:49 ` [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting " xiangxia.m.yue
  0 siblings, 2 replies; 8+ messages in thread
From: xiangxia.m.yue @ 2021-12-24 16:49 UTC (permalink / raw)
  To: netdev
  Cc: Tonghao Zhang, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	David S. Miller, Jakub Kicinski, Jonathan Lemon, Eric Dumazet,
	Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
	Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Patch 1 allow user to select txqueue in clsact hook.
Patch 2 support skbhash, classid, cpuid to select txqueue.

Tonghao Zhang (2):
  net: sched: use queue_mapping to pick tx queue
  net: sched: support hash/classid/cpuid selecting tx queue

 include/linux/netdevice.h              |  3 +
 include/linux/rtnetlink.h              |  1 +
 include/net/tc_act/tc_skbedit.h        |  1 +
 include/uapi/linux/tc_act/tc_skbedit.h |  8 +++
 net/core/dev.c                         | 31 +++++++++-
 net/sched/act_skbedit.c                | 84 ++++++++++++++++++++++++--
 6 files changed, 122 insertions(+), 6 deletions(-)

-- 
v7:
* 1/2 fix build warn, move pick tx queue into egress_needed_key for
  simplifing codes.
v6:
* 1/2 use static key and compiled when CONFIG_NET_EGRESS configured.
v5:
* 1/2 merge netdev_xmit_reset_txqueue(void),
  netdev_xmit_skip_txqueue(void), to netdev_xmit_skip_txqueue(bool skip). 
v4:
* 1/2 introduce netdev_xmit_reset_txqueue() and invoked in
  __dev_queue_xmit(), so ximt.skip_txqueue will not affect
  selecting tx queue in next netdev, or next packets.
  more details, see commit log.
* 2/2 fix the coding style, rename:
  SKBEDIT_F_QUEUE_MAPPING_HASH -> SKBEDIT_F_TXQ_SKBHASH
  SKBEDIT_F_QUEUE_MAPPING_CLASSID -> SKBEDIT_F_TXQ_CLASSID
  SKBEDIT_F_QUEUE_MAPPING_CPUID -> SKBEDIT_F_TXQ_CPUID
* 2/2 refactor tcf_skbedit_hash, if type of hash is not specified, use
  the queue_mapping, because hash % mapping_mod == 0 in "case 0:"
* 2/2 merge the check and add extack
v3:
* 2/2 fix the warning, add cpuid hash type.
v2:
* 1/2 change skb->tc_skip_txqueue to per-cpu var, add more commit message.
* 2/2 optmize the codes.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Lobakin <alobakin@pm.me>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Wei Wang <weiwan@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
--
2.27.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [net-next v7 1/2] net: sched: use queue_mapping to pick tx queue
  2021-12-24 16:49 [net-next v7 0/2] net: sched: allow user to select txqueue xiangxia.m.yue
@ 2021-12-24 16:49 ` xiangxia.m.yue
  2021-12-24 16:49 ` [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting " xiangxia.m.yue
  1 sibling, 0 replies; 8+ messages in thread
From: xiangxia.m.yue @ 2021-12-24 16:49 UTC (permalink / raw)
  To: netdev
  Cc: Tonghao Zhang, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	David S. Miller, Jakub Kicinski, Jonathan Lemon, Eric Dumazet,
	Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
	Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

This patch fixes issue:
* If we install tc filters with act_skbedit in clsact hook.
  It doesn't work, because netdev_core_pick_tx() overwrites
  queue_mapping.

  $ tc filter ... action skbedit queue_mapping 1

And this patch is useful:
* We can use FQ + EDT to implement efficient policies. Tx queues
  are picked by xps, ndo_select_queue of netdev driver, or skb hash
  in netdev_core_pick_tx(). In fact, the netdev driver, and skb
  hash are _not_ under control. xps uses the CPUs map to select Tx
  queues, but we can't figure out which task_struct of pod/containter
  running on this cpu in most case. We can use clsact filters to classify
  one pod/container traffic to one Tx queue. Why ?

  In containter networking environment, there are two kinds of pod/
  containter/net-namespace. One kind (e.g. P1, P2), the high throughput
  is key in these applications. But avoid running out of network resource,
  the outbound traffic of these pods is limited, using or sharing one
  dedicated Tx queues assigned HTB/TBF/FQ Qdisc. Other kind of pods
  (e.g. Pn), the low latency of data access is key. And the traffic is not
  limited. Pods use or share other dedicated Tx queues assigned FIFO Qdisc.
  This choice provides two benefits. First, contention on the HTB/FQ Qdisc
  lock is significantly reduced since fewer CPUs contend for the same queue.
  More importantly, Qdisc contention can be eliminated completely if each
  CPU has its own FIFO Qdisc for the second kind of pods.

  There must be a mechanism in place to support classifying traffic based on
  pods/container to different Tx queues. Note that clsact is outside of Qdisc
  while Qdisc can run a classifier to select a sub-queue under the lock.

  In general recording the decision in the skb seems a little heavy handed.
  This patch introduces a per-CPU variable, suggested by Eric.

  The xmit.skip_txqueue flag is firstly cleared in __dev_queue_xmit().
  - Tx Qdisc may install that skbedit actions, then xmit.skip_txqueue flag
    is set in qdisc->enqueue() though tx queue has been selected in
    netdev_tx_queue_mapping() or netdev_core_pick_tx(). That flag is cleared
    firstly in __dev_queue_xmit(), is useful:
  - Avoid picking Tx queue with netdev_tx_queue_mapping() in next netdev
    in such case: eth0 macvlan - eth0.3 vlan - eth0 ixgbe-phy:
    For example, eth0, macvlan in pod, which root Qdisc install skbedit
    queue_mapping, send packets to eth0.3, vlan in host. In __dev_queue_xmit() of
    eth0.3, clear the flag, does not select tx queue according to skb->queue_mapping
    because there is no filters in clsact or tx Qdisc of this netdev.
    Same action taked in eth0, ixgbe in Host.
  - Avoid picking Tx queue for next packet. If we set xmit.skip_txqueue
    in tx Qdisc (qdisc->enqueue()), the proper way to clear it is clearing it
    in __dev_queue_xmit when processing next packets.

  For performance reasons, use the static key. If user does not config the NET_EGRESS,
  the patch will not be compiled.

  +----+      +----+      +----+
  | P1 |      | P2 |      | Pn |
  +----+      +----+      +----+
    |           |           |
    +-----------+-----------+
                |
                | clsact/skbedit
                |      MQ
                v
    +-----------+-----------+
    | q0        | q1        | qn
    v           v           v
  HTB/FQ      HTB/FQ  ...  FIFO

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Lobakin <alobakin@pm.me>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Wei Wang <weiwan@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 include/linux/netdevice.h |  3 +++
 include/linux/rtnetlink.h |  1 +
 net/core/dev.c            | 31 +++++++++++++++++++++++++++++--
 net/sched/act_skbedit.c   |  6 +++++-
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8b0bdeb4734e..708e9f4cca01 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3010,6 +3010,9 @@ struct softnet_data {
 	struct {
 		u16 recursion;
 		u8  more;
+#ifdef CONFIG_NET_EGRESS
+		u8  skip_txqueue;
+#endif
 	} xmit;
 #ifdef CONFIG_RPS
 	/* input_queue_head should be written by cpu owning this struct,
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index bb9cb84114c1..e87c2dccc4d5 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -100,6 +100,7 @@ void net_dec_ingress_queue(void);
 #ifdef CONFIG_NET_EGRESS
 void net_inc_egress_queue(void);
 void net_dec_egress_queue(void);
+void netdev_xmit_skip_txqueue(bool skip);
 #endif
 
 void rtnetlink_init(void);
diff --git a/net/core/dev.c b/net/core/dev.c
index a855e41bbe39..f66648d11a47 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3860,6 +3860,25 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
 
 	return skb;
 }
+
+static inline struct netdev_queue *
+netdev_tx_queue_mapping(struct net_device *dev, struct sk_buff *skb)
+{
+	int qm = skb_get_queue_mapping(skb);
+
+	return netdev_get_tx_queue(dev, netdev_cap_txqueue(dev, qm));
+}
+
+static inline bool netdev_xmit_txqueue_skipped(void)
+{
+	return __this_cpu_read(softnet_data.xmit.skip_txqueue);
+}
+
+void netdev_xmit_skip_txqueue(bool skip)
+{
+	__this_cpu_write(softnet_data.xmit.skip_txqueue, skip);
+}
+EXPORT_SYMBOL_GPL(netdev_xmit_skip_txqueue);
 #endif /* CONFIG_NET_EGRESS */
 
 #ifdef CONFIG_XPS
@@ -4030,7 +4049,7 @@ struct netdev_queue *netdev_core_pick_tx(struct net_device *dev,
 static int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
 {
 	struct net_device *dev = skb->dev;
-	struct netdev_queue *txq;
+	struct netdev_queue *txq = NULL;
 	struct Qdisc *q;
 	int rc = -ENOMEM;
 	bool again = false;
@@ -4058,11 +4077,17 @@ static int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
 			if (!skb)
 				goto out;
 		}
+
+		netdev_xmit_skip_txqueue(false);
+
 		nf_skip_egress(skb, true);
 		skb = sch_handle_egress(skb, &rc, dev);
 		if (!skb)
 			goto out;
 		nf_skip_egress(skb, false);
+
+		if (netdev_xmit_txqueue_skipped())
+			txq = netdev_tx_queue_mapping(dev, skb);
 	}
 #endif
 	/* If device/qdisc don't need skb->dst, release it right now while
@@ -4073,7 +4098,9 @@ static int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
 	else
 		skb_dst_force(skb);
 
-	txq = netdev_core_pick_tx(dev, skb, sb_dev);
+	if (likely(!txq))
+		txq = netdev_core_pick_tx(dev, skb, sb_dev);
+
 	q = rcu_dereference_bh(txq->qdisc);
 
 	trace_net_dev_queue(skb);
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index ceba11b198bb..d5799b4fc499 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -58,8 +58,12 @@ static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a,
 		}
 	}
 	if (params->flags & SKBEDIT_F_QUEUE_MAPPING &&
-	    skb->dev->real_num_tx_queues > params->queue_mapping)
+	    skb->dev->real_num_tx_queues > params->queue_mapping) {
+#ifdef CONFIG_NET_EGRESS
+		netdev_xmit_skip_txqueue(true);
+#endif
 		skb_set_queue_mapping(skb, params->queue_mapping);
+	}
 	if (params->flags & SKBEDIT_F_MARK) {
 		skb->mark &= ~params->mask;
 		skb->mark |= params->mark & params->mask;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting tx queue
  2021-12-24 16:49 [net-next v7 0/2] net: sched: allow user to select txqueue xiangxia.m.yue
  2021-12-24 16:49 ` [net-next v7 1/2] net: sched: use queue_mapping to pick tx queue xiangxia.m.yue
@ 2021-12-24 16:49 ` xiangxia.m.yue
  2021-12-24 19:28   ` Cong Wang
  1 sibling, 1 reply; 8+ messages in thread
From: xiangxia.m.yue @ 2021-12-24 16:49 UTC (permalink / raw)
  To: netdev
  Cc: Tonghao Zhang, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	David S. Miller, Jakub Kicinski, Jonathan Lemon, Eric Dumazet,
	Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
	Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

This patch allows user to select queue_mapping, range
from A to B. And user can use skbhash, cgroup classid
and cpuid to select Tx queues. Then we can load balance
packets from A to B queue. The range is an unsigned 16bit
value in decimal format.

$ tc filter ... action skbedit queue_mapping skbhash A B

"skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
is enhanced with flags:
* SKBEDIT_F_TXQ_SKBHASH
* SKBEDIT_F_TXQ_CLASSID
* SKBEDIT_F_TXQ_CPUID

Use skb->hash, cgroup classid, or cpuid to distribute packets.
Then same range of tx queues can be shared for different flows,
cgroups, or CPUs in a variety of scenarios.

For example, F1 may share range R1 with F2. The best way to do
that is to set flag to SKBEDIT_F_TXQ_HASH, using skb->hash to
share the queues. If cgroup C1 want to share the R1 with cgroup
C2 .. Cn, use the SKBEDIT_F_TXQ_CLASSID. Of course, in some other
scenario, C1 use R1, while Cn can use the Rn.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Lobakin <alobakin@pm.me>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Wei Wang <weiwan@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 include/net/tc_act/tc_skbedit.h        |  1 +
 include/uapi/linux/tc_act/tc_skbedit.h |  8 +++
 net/sched/act_skbedit.c                | 78 +++++++++++++++++++++++++-
 3 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index 00bfee70609e..ee96e0fa6566 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -17,6 +17,7 @@ struct tcf_skbedit_params {
 	u32 mark;
 	u32 mask;
 	u16 queue_mapping;
+	u16 mapping_mod;
 	u16 ptype;
 	struct rcu_head rcu;
 };
diff --git a/include/uapi/linux/tc_act/tc_skbedit.h b/include/uapi/linux/tc_act/tc_skbedit.h
index 800e93377218..5ea1438a4d88 100644
--- a/include/uapi/linux/tc_act/tc_skbedit.h
+++ b/include/uapi/linux/tc_act/tc_skbedit.h
@@ -29,6 +29,13 @@
 #define SKBEDIT_F_PTYPE			0x8
 #define SKBEDIT_F_MASK			0x10
 #define SKBEDIT_F_INHERITDSFIELD	0x20
+#define SKBEDIT_F_TXQ_SKBHASH		0x40
+#define SKBEDIT_F_TXQ_CLASSID		0x80
+#define SKBEDIT_F_TXQ_CPUID		0x100
+
+#define SKBEDIT_F_TXQ_HASH_MASK (SKBEDIT_F_TXQ_SKBHASH | \
+				 SKBEDIT_F_TXQ_CLASSID | \
+				 SKBEDIT_F_TXQ_CPUID)
 
 struct tc_skbedit {
 	tc_gen;
@@ -45,6 +52,7 @@ enum {
 	TCA_SKBEDIT_PTYPE,
 	TCA_SKBEDIT_MASK,
 	TCA_SKBEDIT_FLAGS,
+	TCA_SKBEDIT_QUEUE_MAPPING_MAX,
 	__TCA_SKBEDIT_MAX
 };
 #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index d5799b4fc499..4c209689f8de 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/rtnetlink.h>
+#include <net/cls_cgroup.h>
 #include <net/netlink.h>
 #include <net/pkt_sched.h>
 #include <net/ip.h>
@@ -23,6 +24,38 @@
 static unsigned int skbedit_net_id;
 static struct tc_action_ops act_skbedit_ops;
 
+static u16 tcf_skbedit_hash(struct tcf_skbedit_params *params,
+			    struct sk_buff *skb)
+{
+	u32 mapping_hash_type = params->flags & SKBEDIT_F_TXQ_HASH_MASK;
+	u16 queue_mapping = params->queue_mapping;
+	u16 mapping_mod = params->mapping_mod;
+	u32 hash = 0;
+
+	switch (mapping_hash_type) {
+	case SKBEDIT_F_TXQ_CLASSID:
+		hash = task_get_classid(skb);
+		break;
+	case SKBEDIT_F_TXQ_SKBHASH:
+		hash = skb_get_hash(skb);
+		break;
+	case SKBEDIT_F_TXQ_CPUID:
+		hash = raw_smp_processor_id();
+		break;
+	case 0:
+		/* Hash type isn't specified. In this case:
+		 * hash % mapping_mod == 0
+		 */
+		break;
+	default:
+		net_warn_ratelimited("The type of queue_mapping hash is not supported. 0x%x\n",
+				     mapping_hash_type);
+	}
+
+	queue_mapping = queue_mapping + hash % mapping_mod;
+	return netdev_cap_txqueue(skb->dev, queue_mapping);
+}
+
 static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a,
 			   struct tcf_result *res)
 {
@@ -62,7 +95,7 @@ static int tcf_skbedit_act(struct sk_buff *skb, const struct tc_action *a,
 #ifdef CONFIG_NET_EGRESS
 		netdev_xmit_skip_txqueue(true);
 #endif
-		skb_set_queue_mapping(skb, params->queue_mapping);
+		skb_set_queue_mapping(skb, tcf_skbedit_hash(params, skb));
 	}
 	if (params->flags & SKBEDIT_F_MARK) {
 		skb->mark &= ~params->mask;
@@ -96,6 +129,7 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
 	[TCA_SKBEDIT_PTYPE]		= { .len = sizeof(u16) },
 	[TCA_SKBEDIT_MASK]		= { .len = sizeof(u32) },
 	[TCA_SKBEDIT_FLAGS]		= { .len = sizeof(u64) },
+	[TCA_SKBEDIT_QUEUE_MAPPING_MAX]	= { .len = sizeof(u16) },
 };
 
 static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
@@ -112,6 +146,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 	struct tcf_skbedit *d;
 	u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
 	u16 *queue_mapping = NULL, *ptype = NULL;
+	u16 mapping_mod = 1;
 	bool exists = false;
 	int ret = 0, err;
 	u32 index;
@@ -156,7 +191,34 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 
 	if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
 		u64 *pure_flags = nla_data(tb[TCA_SKBEDIT_FLAGS]);
-
+		u64 mapping_hash_type;
+
+		mapping_hash_type = *pure_flags & SKBEDIT_F_TXQ_HASH_MASK;
+		if (mapping_hash_type) {
+			u16 *queue_mapping_max;
+
+			/* Hash types are mutually exclusive. */
+			if (mapping_hash_type & (mapping_hash_type - 1)) {
+				NL_SET_ERR_MSG_MOD(extack, "Multi types of hash are specified.");
+				return -EINVAL;
+			}
+
+			if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
+			    !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
+				NL_SET_ERR_MSG_MOD(extack, "Missing required range of queue_mapping.");
+				return -EINVAL;
+			}
+
+			queue_mapping_max =
+				nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]);
+			if (*queue_mapping_max < *queue_mapping) {
+				NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid, max < min.");
+				return -EINVAL;
+			}
+
+			mapping_mod = *queue_mapping_max - *queue_mapping + 1;
+			flags |= mapping_hash_type;
+		}
 		if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
 			flags |= SKBEDIT_F_INHERITDSFIELD;
 	}
@@ -208,8 +270,10 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 	params_new->flags = flags;
 	if (flags & SKBEDIT_F_PRIORITY)
 		params_new->priority = *priority;
-	if (flags & SKBEDIT_F_QUEUE_MAPPING)
+	if (flags & SKBEDIT_F_QUEUE_MAPPING) {
 		params_new->queue_mapping = *queue_mapping;
+		params_new->mapping_mod = mapping_mod;
+	}
 	if (flags & SKBEDIT_F_MARK)
 		params_new->mark = *mark;
 	if (flags & SKBEDIT_F_PTYPE)
@@ -276,6 +340,13 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
 		goto nla_put_failure;
 	if (params->flags & SKBEDIT_F_INHERITDSFIELD)
 		pure_flags |= SKBEDIT_F_INHERITDSFIELD;
+	if (params->flags & SKBEDIT_F_TXQ_HASH_MASK) {
+		if (nla_put_u16(skb, TCA_SKBEDIT_QUEUE_MAPPING_MAX,
+				params->queue_mapping + params->mapping_mod - 1))
+			goto nla_put_failure;
+
+		pure_flags |= params->flags & SKBEDIT_F_TXQ_HASH_MASK;
+	}
 	if (pure_flags != 0 &&
 	    nla_put(skb, TCA_SKBEDIT_FLAGS, sizeof(pure_flags), &pure_flags))
 		goto nla_put_failure;
@@ -325,6 +396,7 @@ static size_t tcf_skbedit_get_fill_size(const struct tc_action *act)
 	return nla_total_size(sizeof(struct tc_skbedit))
 		+ nla_total_size(sizeof(u32)) /* TCA_SKBEDIT_PRIORITY */
 		+ nla_total_size(sizeof(u16)) /* TCA_SKBEDIT_QUEUE_MAPPING */
+		+ nla_total_size(sizeof(u16)) /* TCA_SKBEDIT_QUEUE_MAPPING_MAX */
 		+ nla_total_size(sizeof(u32)) /* TCA_SKBEDIT_MARK */
 		+ nla_total_size(sizeof(u16)) /* TCA_SKBEDIT_PTYPE */
 		+ nla_total_size(sizeof(u32)) /* TCA_SKBEDIT_MASK */
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting tx queue
  2021-12-24 16:49 ` [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting " xiangxia.m.yue
@ 2021-12-24 19:28   ` Cong Wang
  2021-12-24 22:44     ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Cong Wang @ 2021-12-24 19:28 UTC (permalink / raw)
  To: Tonghao Zhang
  Cc: Linux Kernel Network Developers, Jamal Hadi Salim, Jiri Pirko,
	David S. Miller, Jakub Kicinski, Jonathan Lemon, Eric Dumazet,
	Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
	Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

On Fri, Dec 24, 2021 at 8:49 AM <xiangxia.m.yue@gmail.com> wrote:
>
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>
> This patch allows user to select queue_mapping, range
> from A to B. And user can use skbhash, cgroup classid
> and cpuid to select Tx queues. Then we can load balance
> packets from A to B queue. The range is an unsigned 16bit
> value in decimal format.
>
> $ tc filter ... action skbedit queue_mapping skbhash A B
>
> "skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
> is enhanced with flags:
> * SKBEDIT_F_TXQ_SKBHASH
> * SKBEDIT_F_TXQ_CLASSID
> * SKBEDIT_F_TXQ_CPUID

NACK.

These values can either obtained from user-space, or is nonsense
at all.

Sorry, we don't accept enforcing such bad policies in kernel. Please
drop this patch.

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting tx queue
  2021-12-24 19:28   ` Cong Wang
@ 2021-12-24 22:44     ` Jakub Kicinski
  2022-01-26 19:49       ` Cong Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2021-12-24 22:44 UTC (permalink / raw)
  To: Cong Wang
  Cc: Tonghao Zhang, Linux Kernel Network Developers, Jamal Hadi Salim,
	Jiri Pirko, David S. Miller, Jonathan Lemon, Eric Dumazet,
	Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
	Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

On Fri, 24 Dec 2021 11:28:45 -0800 Cong Wang wrote:
> On Fri, Dec 24, 2021 at 8:49 AM <xiangxia.m.yue@gmail.com> wrote:
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >
> > This patch allows user to select queue_mapping, range
> > from A to B. And user can use skbhash, cgroup classid
> > and cpuid to select Tx queues. Then we can load balance
> > packets from A to B queue. The range is an unsigned 16bit
> > value in decimal format.
> >
> > $ tc filter ... action skbedit queue_mapping skbhash A B
> >
> > "skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
> > is enhanced with flags:
> > * SKBEDIT_F_TXQ_SKBHASH
> > * SKBEDIT_F_TXQ_CLASSID
> > * SKBEDIT_F_TXQ_CPUID  
> 
> NACK.
> 
> These values can either obtained from user-space, or is nonsense
> at all.

Can you elaborate? What values can be obtained from user space?
What is nonsense?

> Sorry, we don't accept enforcing such bad policies in kernel. Please
> drop this patch.

Again, unclear what your objection is. There's plenty similar
functionality in TC. Please be more specific.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting tx queue
  2021-12-24 22:44     ` Jakub Kicinski
@ 2022-01-26 19:49       ` Cong Wang
  2022-01-27  1:13         ` Tonghao Zhang
  0 siblings, 1 reply; 8+ messages in thread
From: Cong Wang @ 2022-01-26 19:49 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Tonghao Zhang, Linux Kernel Network Developers, Jamal Hadi Salim,
	Jiri Pirko, David S. Miller, Jonathan Lemon, Eric Dumazet,
	Alexander Lobakin, Paolo Abeni, Talal Ahmad, Kevin Hao,
	Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

On Fri, Dec 24, 2021 at 2:44 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 24 Dec 2021 11:28:45 -0800 Cong Wang wrote:
> > On Fri, Dec 24, 2021 at 8:49 AM <xiangxia.m.yue@gmail.com> wrote:
> > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > >
> > > This patch allows user to select queue_mapping, range
> > > from A to B. And user can use skbhash, cgroup classid
> > > and cpuid to select Tx queues. Then we can load balance
> > > packets from A to B queue. The range is an unsigned 16bit
> > > value in decimal format.
> > >
> > > $ tc filter ... action skbedit queue_mapping skbhash A B
> > >
> > > "skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
> > > is enhanced with flags:
> > > * SKBEDIT_F_TXQ_SKBHASH
> > > * SKBEDIT_F_TXQ_CLASSID
> > > * SKBEDIT_F_TXQ_CPUID
> >
> > NACK.
> >
> > These values can either obtained from user-space, or is nonsense
> > at all.
>
> Can you elaborate? What values can be obtained from user space?
> What is nonsense?

Of course.

1. SKBHASH is nonsense, because from a user's point of view, it really
has no meaning at all, skb hash itself is not visible to user and setting
an invisible value to as an skb queue mapping is pretty much like setting
a random value here.

2. CLASSID is obviously easy to obtain from user-space, as it is passed
from user-space.

3. CPUID is nonsense, because a process can be migrated easily from
one CPU to another. Putting OOO packets side, users can't figure out
which CPU the process is running *in general*. (Of course you can bind
CPU but clearly you can't bind every process)

>
> > Sorry, we don't accept enforcing such bad policies in kernel. Please
> > drop this patch.
>
> Again, unclear what your objection is. There's plenty similar
> functionality in TC. Please be more specific.

What exact TC functionality are you talking about? Please be specific.

If you mean Qdisc's, it is virtually just impossible to have a programmable
Qdisc, even my eBPF Qdisc only provides very limited programmablities.

If you mean TC filter or action, we already have eBPF filter and eBPF
action.

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting tx queue
  2022-01-26 19:49       ` Cong Wang
@ 2022-01-27  1:13         ` Tonghao Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Tonghao Zhang @ 2022-01-27  1:13 UTC (permalink / raw)
  To: Cong Wang
  Cc: Jakub Kicinski, Linux Kernel Network Developers,
	Jamal Hadi Salim, Jiri Pirko, David S. Miller, Jonathan Lemon,
	Eric Dumazet, Alexander Lobakin, Paolo Abeni, Talal Ahmad,
	Kevin Hao, Ilias Apalodimas, Kees Cook, Kumar Kartikeya Dwivedi,
	Antoine Tenart, Wei Wang, Arnd Bergmann

On Thu, Jan 27, 2022 at 3:49 AM Cong Wang <xiyou.wangcong@gmail.com> wrote:
>
> On Fri, Dec 24, 2021 at 2:44 PM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Fri, 24 Dec 2021 11:28:45 -0800 Cong Wang wrote:
> > > On Fri, Dec 24, 2021 at 8:49 AM <xiangxia.m.yue@gmail.com> wrote:
> > > > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > > >
> > > > This patch allows user to select queue_mapping, range
> > > > from A to B. And user can use skbhash, cgroup classid
> > > > and cpuid to select Tx queues. Then we can load balance
> > > > packets from A to B queue. The range is an unsigned 16bit
> > > > value in decimal format.
> > > >
> > > > $ tc filter ... action skbedit queue_mapping skbhash A B
> > > >
> > > > "skbedit queue_mapping QUEUE_MAPPING" (from "man 8 tc-skbedit")
> > > > is enhanced with flags:
> > > > * SKBEDIT_F_TXQ_SKBHASH
> > > > * SKBEDIT_F_TXQ_CLASSID
> > > > * SKBEDIT_F_TXQ_CPUID
> > >
> > > NACK.
> > >
> > > These values can either obtained from user-space, or is nonsense
> > > at all.
> >
> > Can you elaborate? What values can be obtained from user space?
> > What is nonsense?
>
> Of course.
>
> 1. SKBHASH is nonsense, because from a user's point of view, it really
> has no meaning at all, skb hash itself is not visible to user and setting
> an invisible value to as an skb queue mapping is pretty much like setting
> a random value here.
Yes, use the skb hash as a random value, so different flows from same
pod can be balanced to different tx queues.
we can't pass a userspace value to do the balance, maybe we only match
the src ip of k8s pod.
> 2. CLASSID is obviously easy to obtain from user-space, as it is passed
> from user-space.
How about the case, multi pods share the same tx queue range, we use
the CLASSID to do balance, not as match filter.
> 3. CPUID is nonsense, because a process can be migrated easily from
> one CPU to another. Putting OOO packets side, users can't figure out
> which CPU the process is running *in general*. (Of course you can bind
> CPU but clearly you can't bind every process)
this is used for k8s pod, not for every applications on host. when the
pod share the tx queues range, so them can use
the tx queue according which cpu used.
> >
> > > Sorry, we don't accept enforcing such bad policies in kernel. Please
> > > drop this patch.
> >
> > Again, unclear what your objection is. There's plenty similar
> > functionality in TC. Please be more specific.
>
> What exact TC functionality are you talking about? Please be specific.
> If you mean Qdisc's, it is virtually just impossible to have a programmable
> Qdisc, even my eBPF Qdisc only provides very limited programmablities.
>
> If you mean TC filter or action, we already have eBPF filter and eBPF
> action.
>
> Thanks.



-- 
Best regards, Tonghao

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting tx queue
@ 2021-12-27 22:13 kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-12-27 22:13 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 53170 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211224164926.80733-3-xiangxia.m.yue@gmail.com>
References: <20211224164926.80733-3-xiangxia.m.yue@gmail.com>
TO: xiangxia.m.yue(a)gmail.com

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/xiangxia-m-yue-gmail-com/net-sched-allow-user-to-select-txqueue/20211225-005116
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7467d716583eec12ae84a33fb1fb27d22333fc64
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-c001-20211226 (https://download.01.org/0day-ci/archive/20211228/202112280602.UuBkQ7jr-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a9e8b1ee7fd44b53c555a7823ae8fd1a8209c520)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6ede36fda618b75206f5cd31a9c06c1667f1864b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review xiangxia-m-yue-gmail-com/net-sched-allow-user-to-select-txqueue/20211225-005116
        git checkout 6ede36fda618b75206f5cd31a9c06c1667f1864b
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                                ^
   fs/f2fs/segment.h:104:3: note: expanded from macro 'GET_SEC_FROM_SEG'
           (((segno) == -1) ? -1: (segno) / (sbi)->segs_per_sec)
            ^
   fs/f2fs/gc.c:319:2: note: 'usable_segs_per_sec' initialized here
           unsigned int usable_segs_per_sec = f2fs_usable_segs_in_sec(sbi, segno);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/gc.c:321:14: note: Assuming 'i' is >= 'usable_segs_per_sec'
           for (i = 0; i < usable_segs_per_sec; i++)
                       ^~~~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/gc.c:321:2: note: Loop condition is false. Execution continues on line 323
           for (i = 0; i < usable_segs_per_sec; i++)
           ^
   fs/f2fs/gc.c:325:25: note: Passing the value 0 via 2nd parameter 'divisor'
           mtime = div_u64(mtime, usable_segs_per_sec);
                                  ^~~~~~~~~~~~~~~~~~~
   fs/f2fs/gc.c:325:10: note: Calling 'div_u64'
           mtime = div_u64(mtime, usable_segs_per_sec);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:128:31: note: Passing the value 0 via 2nd parameter 'divisor'
           return div_u64_rem(dividend, divisor, &remainder);
                                        ^~~~~~~
   include/linux/math64.h:128:9: note: Calling 'div_u64_rem'
           return div_u64_rem(dividend, divisor, &remainder);
                  ^
   arch/x86/include/asm/div64.h:61:21: note: expanded from macro 'div_u64_rem'
   #define div_u64_rem     div_u64_rem
                           ^
   arch/x86/include/asm/div64.h:53:6: note: 'upper' is >= 'divisor'
           if (upper >= divisor) {
               ^~~~~
   arch/x86/include/asm/div64.h:53:2: note: Taking true branch
           if (upper >= divisor) {
           ^
   arch/x86/include/asm/div64.h:54:20: note: Division by zero
                   d.v32[1] = upper / divisor;
                              ~~~~~~^~~~~~~~~
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   drivers/mmc/core/sdio_cis.c:63:3: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcpy(string, buf);
                   ^~~~~~
   drivers/mmc/core/sdio_cis.c:63:3: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
                   strcpy(string, buf);
                   ^~~~~~
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   1 warning generated.
   Suppressed 1 warnings (1 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
>> net/sched/act_skbedit.c:272:26: warning: Dereference of null pointer (loaded from variable 'priority') [clang-analyzer-core.NullDereference]
                   params_new->priority = *priority;
                                          ^~~~~~~~~
   net/sched/act_skbedit.c:147:18: note: 'priority' initialized to a null pointer value
           u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
                           ^~~~~~~~
   net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
           if (nla == NULL)
               ^~~~~~~~~~~
   net/sched/act_skbedit.c:154:2: note: Taking false branch
           if (nla == NULL)
           ^
   net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
           return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:159:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:162:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
           ^
   net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:165:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
           ^
   net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:170:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
           ^
   net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:175:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
           ^
   net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:182:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
           ^
   net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:187:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
           ^
   net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:192:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
           ^
   net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
                   if (mapping_hash_type) {
                       ^~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:197:3: note: Taking true branch
                   if (mapping_hash_type) {
                   ^
   net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:201:4: note: Taking false branch
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                           ^
   net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                               ^
   net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
                               !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:206:4: note: Taking false branch
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                           ^
   net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
                           if (*queue_mapping_max < *queue_mapping) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:214:4: note: Taking false branch
                           if (*queue_mapping_max < *queue_mapping) {
                           ^
   net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:222:3: note: Taking false branch
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                   ^
   net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:229:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
           if (exists && bind)
               ^~~~~~
   net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
   net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
           if (exists && bind)
                         ^~~~
   net/sched/act_skbedit.c:232:2: note: Taking false branch
           if (exists && bind)
           ^
   net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
           if (!flags) {
                ^~~~~
   net/sched/act_skbedit.c:235:2: note: Taking false branch
           if (!flags) {
           ^
   net/sched/act_skbedit.c:243:7: note: 'exists' is true
           if (!exists) {
                ^~~~~~
   net/sched/act_skbedit.c:243:2: note: Taking false branch
           if (!exists) {
           ^
   net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
                   if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:255:3: note: Taking false branch
                   if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
                   ^
   net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:261:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
           if (unlikely(!params_new)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/sched/act_skbedit.c:265:2: note: Taking false branch
           if (unlikely(!params_new)) {
           ^
   net/sched/act_skbedit.c:271:6: note: Assuming the condition is true
           if (flags & SKBEDIT_F_PRIORITY)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:271:2: note: Taking true branch
           if (flags & SKBEDIT_F_PRIORITY)
           ^
   net/sched/act_skbedit.c:272:26: note: Dereference of null pointer (loaded from variable 'priority')
                   params_new->priority = *priority;
                                          ^~~~~~~~~
>> net/sched/act_skbedit.c:278:22: warning: Dereference of null pointer (loaded from variable 'mark') [clang-analyzer-core.NullDereference]
                   params_new->mark = *mark;
                                      ^~~~~
   net/sched/act_skbedit.c:147:36: note: 'mark' initialized to a null pointer value
           u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
                                             ^~~~
   net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
           if (nla == NULL)
               ^~~~~~~~~~~
   net/sched/act_skbedit.c:154:2: note: Taking false branch
           if (nla == NULL)
           ^
   net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
           return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:159:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:162:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
           ^
   net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:165:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
           ^
   net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:170:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
           ^
   net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:175:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
           ^
   net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:182:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
           ^
   net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:187:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
           ^
   net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:192:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
           ^
   net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
                   if (mapping_hash_type) {
                       ^~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:197:3: note: Taking true branch
                   if (mapping_hash_type) {
                   ^
   net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:201:4: note: Taking false branch
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                           ^
   net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                               ^
   net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
                               !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:206:4: note: Taking false branch
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                           ^
   net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
                           if (*queue_mapping_max < *queue_mapping) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:214:4: note: Taking false branch
                           if (*queue_mapping_max < *queue_mapping) {
                           ^
   net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:222:3: note: Taking false branch
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                   ^
   net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:229:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
           if (exists && bind)
               ^~~~~~
   net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
   net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
           if (exists && bind)
                         ^~~~
   net/sched/act_skbedit.c:232:2: note: Taking false branch
           if (exists && bind)
           ^
   net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
           if (!flags) {
                ^~~~~
   net/sched/act_skbedit.c:235:2: note: Taking false branch
           if (!flags) {
           ^
   net/sched/act_skbedit.c:243:7: note: 'exists' is true
           if (!exists) {
                ^~~~~~
   net/sched/act_skbedit.c:243:2: note: Taking false branch
           if (!exists) {
           ^
   net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
                   if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:255:3: note: Taking false branch
                   if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
                   ^
   net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:261:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
           if (unlikely(!params_new)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/sched/act_skbedit.c:265:2: note: Taking false branch
           if (unlikely(!params_new)) {
           ^
   net/sched/act_skbedit.c:271:6: note: Assuming the condition is false
           if (flags & SKBEDIT_F_PRIORITY)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:271:2: note: Taking false branch
           if (flags & SKBEDIT_F_PRIORITY)
           ^
   net/sched/act_skbedit.c:273:6: note: Assuming the condition is false
           if (flags & SKBEDIT_F_QUEUE_MAPPING) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:273:2: note: Taking false branch
           if (flags & SKBEDIT_F_QUEUE_MAPPING) {
           ^
   net/sched/act_skbedit.c:277:6: note: Assuming the condition is true
           if (flags & SKBEDIT_F_MARK)
               ^~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:277:2: note: Taking true branch
           if (flags & SKBEDIT_F_MARK)
           ^
   net/sched/act_skbedit.c:278:22: note: Dereference of null pointer (loaded from variable 'mark')
                   params_new->mark = *mark;
                                      ^~~~~
>> net/sched/act_skbedit.c:280:23: warning: Dereference of null pointer (loaded from variable 'ptype') [clang-analyzer-core.NullDereference]
                   params_new->ptype = *ptype;
                                       ^~~~~~
   net/sched/act_skbedit.c:148:30: note: 'ptype' initialized to a null pointer value
           u16 *queue_mapping = NULL, *ptype = NULL;
                                       ^~~~~
   net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
           if (nla == NULL)
               ^~~~~~~~~~~
   net/sched/act_skbedit.c:154:2: note: Taking false branch
           if (nla == NULL)
           ^
   net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
           return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:159:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:162:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
           ^
   net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:165:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
           ^
   net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:170:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
           ^
   net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:175:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
           ^
   net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:182:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
           ^
   net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:187:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
           ^
   net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:192:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
           ^
   net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
                   if (mapping_hash_type) {
                       ^~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:197:3: note: Taking true branch
                   if (mapping_hash_type) {
                   ^
   net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:201:4: note: Taking false branch
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                           ^
   net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                               ^
   net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
                               !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:206:4: note: Taking false branch
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                           ^
   net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
                           if (*queue_mapping_max < *queue_mapping) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:214:4: note: Taking false branch
                           if (*queue_mapping_max < *queue_mapping) {
                           ^
   net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:222:3: note: Taking false branch
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                   ^
   net/sched/act_skbedit.c:229:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:229:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:232:6: note: Assuming 'exists' is true
           if (exists && bind)
               ^~~~~~
   net/sched/act_skbedit.c:232:6: note: Left side of '&&' is true
   net/sched/act_skbedit.c:232:16: note: Assuming 'bind' is false
           if (exists && bind)
                         ^~~~
   net/sched/act_skbedit.c:232:2: note: Taking false branch
           if (exists && bind)
           ^
   net/sched/act_skbedit.c:235:7: note: 'flags' is not equal to 0
           if (!flags) {
                ^~~~~
   net/sched/act_skbedit.c:235:2: note: Taking false branch
           if (!flags) {
           ^
   net/sched/act_skbedit.c:243:7: note: 'exists' is true
           if (!exists) {
                ^~~~~~
   net/sched/act_skbedit.c:243:2: note: Taking false branch
           if (!exists) {
           ^
   net/sched/act_skbedit.c:255:7: note: Assuming the condition is false
                   if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:255:3: note: Taking false branch
                   if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
                   ^
   net/sched/act_skbedit.c:261:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:261:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:265:15: note: Assuming 'params_new' is non-null
           if (unlikely(!params_new)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   net/sched/act_skbedit.c:265:2: note: Taking false branch
           if (unlikely(!params_new)) {
           ^
   net/sched/act_skbedit.c:271:6: note: Assuming the condition is false
           if (flags & SKBEDIT_F_PRIORITY)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:271:2: note: Taking false branch
           if (flags & SKBEDIT_F_PRIORITY)
           ^
   net/sched/act_skbedit.c:273:6: note: Assuming the condition is false
           if (flags & SKBEDIT_F_QUEUE_MAPPING) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:273:2: note: Taking false branch
           if (flags & SKBEDIT_F_QUEUE_MAPPING) {
           ^
   net/sched/act_skbedit.c:277:6: note: Assuming the condition is false
           if (flags & SKBEDIT_F_MARK)
               ^~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:277:2: note: Taking false branch
           if (flags & SKBEDIT_F_MARK)
           ^
   net/sched/act_skbedit.c:279:6: note: Assuming the condition is true
           if (flags & SKBEDIT_F_PTYPE)
               ^~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:279:2: note: Taking true branch
           if (flags & SKBEDIT_F_PTYPE)
           ^
   net/sched/act_skbedit.c:280:23: note: Dereference of null pointer (loaded from variable 'ptype')
                   params_new->ptype = *ptype;
                                       ^~~~~~
>> net/sched/act_skbedit.c:284:22: warning: Dereference of null pointer (loaded from variable 'mask') [clang-analyzer-core.NullDereference]
                   params_new->mask = *mask;
                                      ^~~~~
   net/sched/act_skbedit.c:147:50: note: 'mask' initialized to a null pointer value
           u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
                                                           ^~~~
   net/sched/act_skbedit.c:154:6: note: Assuming 'nla' is not equal to NULL
           if (nla == NULL)
               ^~~~~~~~~~~
   net/sched/act_skbedit.c:154:2: note: Taking false branch
           if (nla == NULL)
           ^
   net/sched/act_skbedit.c:157:8: note: Calling 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/net/netlink.h:1231:9: note: Assigning value, which participates in a condition later
           return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:157:8: note: Returning from 'nla_parse_nested_deprecated'
           err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:159:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   net/sched/act_skbedit.c:159:2: note: Taking false branch
           if (err < 0)
           ^
   net/sched/act_skbedit.c:162:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:162:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PARMS] == NULL)
           ^
   net/sched/act_skbedit.c:165:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:165:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
           ^
   net/sched/act_skbedit.c:170:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:170:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
           ^
   net/sched/act_skbedit.c:175:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:175:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
           ^
   net/sched/act_skbedit.c:182:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:182:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MARK] != NULL) {
           ^
   net/sched/act_skbedit.c:187:6: note: Assuming the condition is false
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:187:2: note: Taking false branch
           if (tb[TCA_SKBEDIT_MASK] != NULL) {
           ^
   net/sched/act_skbedit.c:192:6: note: Assuming the condition is true
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:192:2: note: Taking true branch
           if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
           ^
   net/sched/act_skbedit.c:197:7: note: Assuming 'mapping_hash_type' is not equal to 0
                   if (mapping_hash_type) {
                       ^~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:197:3: note: Taking true branch
                   if (mapping_hash_type) {
                   ^
   net/sched/act_skbedit.c:201:8: note: Assuming the condition is false
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:201:4: note: Taking false branch
                           if (mapping_hash_type & (mapping_hash_type - 1)) {
                           ^
   net/sched/act_skbedit.c:206:8: note: Left side of '||' is false
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                               ^
   net/sched/act_skbedit.c:207:8: note: Assuming the condition is false
                               !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:206:4: note: Taking false branch
                           if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
                           ^
   net/sched/act_skbedit.c:214:8: note: Assuming the condition is false
                           if (*queue_mapping_max < *queue_mapping) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:214:4: note: Taking false branch
                           if (*queue_mapping_max < *queue_mapping) {
                           ^
   net/sched/act_skbedit.c:222:7: note: Assuming the condition is false
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/act_skbedit.c:222:3: note: Taking false branch
                   if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)

vim +/priority +272 net/sched/act_skbedit.c

ca9b0e27e072be Alexander Duyck   2008-09-12  134  
c1b52739e45f59 Benjamin LaHaise  2013-01-14  135  static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
a85a970af265f1 WANG Cong         2016-07-25  136  			    struct nlattr *est, struct tc_action **a,
abbb0d33632ce9 Vlad Buslov       2019-10-30  137  			    struct tcf_proto *tp, u32 act_flags,
789871bb2a0381 Vlad Buslov       2018-07-05  138  			    struct netlink_ext_ack *extack)
ca9b0e27e072be Alexander Duyck   2008-09-12  139  {
ddf97ccdd7cb7e WANG Cong         2016-02-22  140  	struct tc_action_net *tn = net_generic(net, skbedit_net_id);
695176bfe5dec2 Cong Wang         2021-07-29  141  	bool bind = act_flags & TCA_ACT_FLAGS_BIND;
6d7a8df6dfe4d6 Vlad Buslov       2018-09-03  142  	struct tcf_skbedit_params *params_new;
ca9b0e27e072be Alexander Duyck   2008-09-12  143  	struct nlattr *tb[TCA_SKBEDIT_MAX + 1];
ec7727bb24b01e Davide Caratti    2019-03-20  144  	struct tcf_chain *goto_ch = NULL;
ca9b0e27e072be Alexander Duyck   2008-09-12  145  	struct tc_skbedit *parm;
ca9b0e27e072be Alexander Duyck   2008-09-12  146  	struct tcf_skbedit *d;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  147  	u32 flags = 0, *priority = NULL, *mark = NULL, *mask = NULL;
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  148  	u16 *queue_mapping = NULL, *ptype = NULL;
6ede36fda618b7 Tonghao Zhang     2021-12-25  149  	u16 mapping_mod = 1;
b2313077ed0db3 WANG Cong         2016-06-13  150  	bool exists = false;
b2313077ed0db3 WANG Cong         2016-06-13  151  	int ret = 0, err;
7be8ef2cdbfe41 Dmytro Linkin     2019-08-01  152  	u32 index;
ca9b0e27e072be Alexander Duyck   2008-09-12  153  
ca9b0e27e072be Alexander Duyck   2008-09-12  154  	if (nla == NULL)
ca9b0e27e072be Alexander Duyck   2008-09-12  155  		return -EINVAL;
ca9b0e27e072be Alexander Duyck   2008-09-12  156  
8cb081746c031f Johannes Berg     2019-04-26  157  	err = nla_parse_nested_deprecated(tb, TCA_SKBEDIT_MAX, nla,
8cb081746c031f Johannes Berg     2019-04-26  158  					  skbedit_policy, NULL);
ca9b0e27e072be Alexander Duyck   2008-09-12  159  	if (err < 0)
ca9b0e27e072be Alexander Duyck   2008-09-12  160  		return err;
ca9b0e27e072be Alexander Duyck   2008-09-12  161  
ca9b0e27e072be Alexander Duyck   2008-09-12  162  	if (tb[TCA_SKBEDIT_PARMS] == NULL)
ca9b0e27e072be Alexander Duyck   2008-09-12  163  		return -EINVAL;
ca9b0e27e072be Alexander Duyck   2008-09-12  164  
ca9b0e27e072be Alexander Duyck   2008-09-12  165  	if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
ca9b0e27e072be Alexander Duyck   2008-09-12  166  		flags |= SKBEDIT_F_PRIORITY;
ca9b0e27e072be Alexander Duyck   2008-09-12  167  		priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]);
ca9b0e27e072be Alexander Duyck   2008-09-12  168  	}
ca9b0e27e072be Alexander Duyck   2008-09-12  169  
ca9b0e27e072be Alexander Duyck   2008-09-12  170  	if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
ca9b0e27e072be Alexander Duyck   2008-09-12  171  		flags |= SKBEDIT_F_QUEUE_MAPPING;
ca9b0e27e072be Alexander Duyck   2008-09-12  172  		queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]);
ca9b0e27e072be Alexander Duyck   2008-09-12  173  	}
1c55d62e77fa16 jamal             2009-10-15  174  
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  175  	if (tb[TCA_SKBEDIT_PTYPE] != NULL) {
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  176  		ptype = nla_data(tb[TCA_SKBEDIT_PTYPE]);
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  177  		if (!skb_pkt_type_ok(*ptype))
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  178  			return -EINVAL;
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  179  		flags |= SKBEDIT_F_PTYPE;
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  180  	}
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  181  
1c55d62e77fa16 jamal             2009-10-15  182  	if (tb[TCA_SKBEDIT_MARK] != NULL) {
1c55d62e77fa16 jamal             2009-10-15  183  		flags |= SKBEDIT_F_MARK;
1c55d62e77fa16 jamal             2009-10-15  184  		mark = nla_data(tb[TCA_SKBEDIT_MARK]);
1c55d62e77fa16 jamal             2009-10-15  185  	}
1c55d62e77fa16 jamal             2009-10-15  186  
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  187  	if (tb[TCA_SKBEDIT_MASK] != NULL) {
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  188  		flags |= SKBEDIT_F_MASK;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  189  		mask = nla_data(tb[TCA_SKBEDIT_MASK]);
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  190  	}
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  191  
e7e3728bd776d1 Qiaobin Fu        2018-07-01  192  	if (tb[TCA_SKBEDIT_FLAGS] != NULL) {
e7e3728bd776d1 Qiaobin Fu        2018-07-01  193  		u64 *pure_flags = nla_data(tb[TCA_SKBEDIT_FLAGS]);
6ede36fda618b7 Tonghao Zhang     2021-12-25  194  		u64 mapping_hash_type;
e7e3728bd776d1 Qiaobin Fu        2018-07-01  195  
6ede36fda618b7 Tonghao Zhang     2021-12-25  196  		mapping_hash_type = *pure_flags & SKBEDIT_F_TXQ_HASH_MASK;
6ede36fda618b7 Tonghao Zhang     2021-12-25  197  		if (mapping_hash_type) {
6ede36fda618b7 Tonghao Zhang     2021-12-25  198  			u16 *queue_mapping_max;
6ede36fda618b7 Tonghao Zhang     2021-12-25  199  
6ede36fda618b7 Tonghao Zhang     2021-12-25  200  			/* Hash types are mutually exclusive. */
6ede36fda618b7 Tonghao Zhang     2021-12-25  201  			if (mapping_hash_type & (mapping_hash_type - 1)) {
6ede36fda618b7 Tonghao Zhang     2021-12-25  202  				NL_SET_ERR_MSG_MOD(extack, "Multi types of hash are specified.");
6ede36fda618b7 Tonghao Zhang     2021-12-25  203  				return -EINVAL;
6ede36fda618b7 Tonghao Zhang     2021-12-25  204  			}
6ede36fda618b7 Tonghao Zhang     2021-12-25  205  
6ede36fda618b7 Tonghao Zhang     2021-12-25  206  			if (!tb[TCA_SKBEDIT_QUEUE_MAPPING] ||
6ede36fda618b7 Tonghao Zhang     2021-12-25  207  			    !tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]) {
6ede36fda618b7 Tonghao Zhang     2021-12-25  208  				NL_SET_ERR_MSG_MOD(extack, "Missing required range of queue_mapping.");
6ede36fda618b7 Tonghao Zhang     2021-12-25  209  				return -EINVAL;
6ede36fda618b7 Tonghao Zhang     2021-12-25  210  			}
6ede36fda618b7 Tonghao Zhang     2021-12-25  211  
6ede36fda618b7 Tonghao Zhang     2021-12-25  212  			queue_mapping_max =
6ede36fda618b7 Tonghao Zhang     2021-12-25  213  				nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING_MAX]);
6ede36fda618b7 Tonghao Zhang     2021-12-25  214  			if (*queue_mapping_max < *queue_mapping) {
6ede36fda618b7 Tonghao Zhang     2021-12-25  215  				NL_SET_ERR_MSG_MOD(extack, "The range of queue_mapping is invalid, max < min.");
6ede36fda618b7 Tonghao Zhang     2021-12-25  216  				return -EINVAL;
6ede36fda618b7 Tonghao Zhang     2021-12-25  217  			}
6ede36fda618b7 Tonghao Zhang     2021-12-25  218  
6ede36fda618b7 Tonghao Zhang     2021-12-25  219  			mapping_mod = *queue_mapping_max - *queue_mapping + 1;
6ede36fda618b7 Tonghao Zhang     2021-12-25  220  			flags |= mapping_hash_type;
6ede36fda618b7 Tonghao Zhang     2021-12-25  221  		}
e7e3728bd776d1 Qiaobin Fu        2018-07-01  222  		if (*pure_flags & SKBEDIT_F_INHERITDSFIELD)
e7e3728bd776d1 Qiaobin Fu        2018-07-01  223  			flags |= SKBEDIT_F_INHERITDSFIELD;
e7e3728bd776d1 Qiaobin Fu        2018-07-01  224  	}
e7e3728bd776d1 Qiaobin Fu        2018-07-01  225  
ca9b0e27e072be Alexander Duyck   2008-09-12  226  	parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
7be8ef2cdbfe41 Dmytro Linkin     2019-08-01  227  	index = parm->index;
7be8ef2cdbfe41 Dmytro Linkin     2019-08-01  228  	err = tcf_idr_check_alloc(tn, &index, a, bind);
0190c1d452a91c Vlad Buslov       2018-07-05  229  	if (err < 0)
0190c1d452a91c Vlad Buslov       2018-07-05  230  		return err;
0190c1d452a91c Vlad Buslov       2018-07-05  231  	exists = err;
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  232  	if (exists && bind)
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  233  		return 0;
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  234  
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  235  	if (!flags) {
af5d01842fe1fb Roman Mashak      2018-05-11  236  		if (exists)
65a206c01e8e7f Chris Mi          2017-08-30  237  			tcf_idr_release(*a, bind);
0190c1d452a91c Vlad Buslov       2018-07-05  238  		else
7be8ef2cdbfe41 Dmytro Linkin     2019-08-01  239  			tcf_idr_cleanup(tn, index);
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  240  		return -EINVAL;
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  241  	}
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  242  
5e1567aeb7fe0c Jamal Hadi Salim  2016-05-10  243  	if (!exists) {
7be8ef2cdbfe41 Dmytro Linkin     2019-08-01  244  		ret = tcf_idr_create(tn, index, est, a,
40bd094d65fc9f Baowen Zheng      2021-12-17  245  				     &act_skbedit_ops, bind, true, act_flags);
0190c1d452a91c Vlad Buslov       2018-07-05  246  		if (ret) {
7be8ef2cdbfe41 Dmytro Linkin     2019-08-01  247  			tcf_idr_cleanup(tn, index);
86062033feb8a1 WANG Cong         2014-02-11  248  			return ret;
0190c1d452a91c Vlad Buslov       2018-07-05  249  		}
ca9b0e27e072be Alexander Duyck   2008-09-12  250  
a85a970af265f1 WANG Cong         2016-07-25  251  		d = to_skbedit(*a);
ca9b0e27e072be Alexander Duyck   2008-09-12  252  		ret = ACT_P_CREATED;
ca9b0e27e072be Alexander Duyck   2008-09-12  253  	} else {
a85a970af265f1 WANG Cong         2016-07-25  254  		d = to_skbedit(*a);
695176bfe5dec2 Cong Wang         2021-07-29  255  		if (!(act_flags & TCA_ACT_FLAGS_REPLACE)) {
65a206c01e8e7f Chris Mi          2017-08-30  256  			tcf_idr_release(*a, bind);
ca9b0e27e072be Alexander Duyck   2008-09-12  257  			return -EEXIST;
ca9b0e27e072be Alexander Duyck   2008-09-12  258  		}
4e8ddd7f1758ca Vlad Buslov       2018-07-05  259  	}
ec7727bb24b01e Davide Caratti    2019-03-20  260  	err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
ec7727bb24b01e Davide Caratti    2019-03-20  261  	if (err < 0)
ec7727bb24b01e Davide Caratti    2019-03-20  262  		goto release_idr;
ca9b0e27e072be Alexander Duyck   2008-09-12  263  
c749cdda9089eb Davide Caratti    2018-07-11  264  	params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
c749cdda9089eb Davide Caratti    2018-07-11  265  	if (unlikely(!params_new)) {
ec7727bb24b01e Davide Caratti    2019-03-20  266  		err = -ENOMEM;
ec7727bb24b01e Davide Caratti    2019-03-20  267  		goto put_chain;
c749cdda9089eb Davide Caratti    2018-07-11  268  	}
ca9b0e27e072be Alexander Duyck   2008-09-12  269  
c749cdda9089eb Davide Caratti    2018-07-11  270  	params_new->flags = flags;
ca9b0e27e072be Alexander Duyck   2008-09-12  271  	if (flags & SKBEDIT_F_PRIORITY)
c749cdda9089eb Davide Caratti    2018-07-11 @272  		params_new->priority = *priority;
6ede36fda618b7 Tonghao Zhang     2021-12-25  273  	if (flags & SKBEDIT_F_QUEUE_MAPPING) {
c749cdda9089eb Davide Caratti    2018-07-11  274  		params_new->queue_mapping = *queue_mapping;
6ede36fda618b7 Tonghao Zhang     2021-12-25  275  		params_new->mapping_mod = mapping_mod;
6ede36fda618b7 Tonghao Zhang     2021-12-25  276  	}
1c55d62e77fa16 jamal             2009-10-15  277  	if (flags & SKBEDIT_F_MARK)
c749cdda9089eb Davide Caratti    2018-07-11 @278  		params_new->mark = *mark;
ff202ee1ed8f03 Jamal Hadi Salim  2016-07-02  279  	if (flags & SKBEDIT_F_PTYPE)
c749cdda9089eb Davide Caratti    2018-07-11 @280  		params_new->ptype = *ptype;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  281  	/* default behaviour is to use all the bits */
c749cdda9089eb Davide Caratti    2018-07-11  282  	params_new->mask = 0xffffffff;
4fe77d82ef80c7 Antonio Quartulli 2016-10-24  283  	if (flags & SKBEDIT_F_MASK)
c749cdda9089eb Davide Caratti    2018-07-11 @284  		params_new->mask = *mask;
1c55d62e77fa16 jamal             2009-10-15  285  
6d7a8df6dfe4d6 Vlad Buslov       2018-09-03  286  	spin_lock_bh(&d->tcf_lock);
ec7727bb24b01e Davide Caratti    2019-03-20  287  	goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
445d3749315f34 Paul E. McKenney  2019-09-23  288  	params_new = rcu_replace_pointer(d->params, params_new,
6d7a8df6dfe4d6 Vlad Buslov       2018-09-03  289  					 lockdep_is_held(&d->tcf_lock));
6d7a8df6dfe4d6 Vlad Buslov       2018-09-03  290  	spin_unlock_bh(&d->tcf_lock);
6d7a8df6dfe4d6 Vlad Buslov       2018-09-03  291  	if (params_new)
6d7a8df6dfe4d6 Vlad Buslov       2018-09-03  292  		kfree_rcu(params_new, rcu);
ec7727bb24b01e Davide Caratti    2019-03-20  293  	if (goto_ch)
ec7727bb24b01e Davide Caratti    2019-03-20  294  		tcf_chain_put_by_act(goto_ch);
ca9b0e27e072be Alexander Duyck   2008-09-12  295  
ca9b0e27e072be Alexander Duyck   2008-09-12  296  	return ret;
ec7727bb24b01e Davide Caratti    2019-03-20  297  put_chain:
ec7727bb24b01e Davide Caratti    2019-03-20  298  	if (goto_ch)
ec7727bb24b01e Davide Caratti    2019-03-20  299  		tcf_chain_put_by_act(goto_ch);
ec7727bb24b01e Davide Caratti    2019-03-20  300  release_idr:
ec7727bb24b01e Davide Caratti    2019-03-20  301  	tcf_idr_release(*a, bind);
ec7727bb24b01e Davide Caratti    2019-03-20  302  	return err;
ca9b0e27e072be Alexander Duyck   2008-09-12  303  }
ca9b0e27e072be Alexander Duyck   2008-09-12  304  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-27  1:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-24 16:49 [net-next v7 0/2] net: sched: allow user to select txqueue xiangxia.m.yue
2021-12-24 16:49 ` [net-next v7 1/2] net: sched: use queue_mapping to pick tx queue xiangxia.m.yue
2021-12-24 16:49 ` [net-next v7 2/2] net: sched: support hash/classid/cpuid selecting " xiangxia.m.yue
2021-12-24 19:28   ` Cong Wang
2021-12-24 22:44     ` Jakub Kicinski
2022-01-26 19:49       ` Cong Wang
2022-01-27  1:13         ` Tonghao Zhang
2021-12-27 22:13 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.