All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next,RFC PATCH] net: Extend TC limit beyond 16 to 255
@ 2021-04-23 21:12 Amritha Nambiar
  2021-04-23 21:19 ` Stephen Hemminger
  2021-04-23 23:02 ` [net-next, RFC " kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Amritha Nambiar @ 2021-04-23 21:12 UTC (permalink / raw)
  To: netdev, davem, kuba
  Cc: jhs, jiri, xiyou.wangcong, john.fastabend, alexander.duyck,
	vinicius.gomes, vedang.patel, sridhar.samudrala, amritha.nambiar

Extend the max limit of TCs to 255 (max value of 8-bit num_tc)
from current max of 16. This would allow creating more than 16
queue-sets and offloading them on devices with large number of
queues using the mqprio scheduler.
Also, changed the static allocation of struct
tc_mqprio_qopt_offload mqprio to dynamic allocation on heap to
fit within frame size as the size of attributes increases
proportionally with the max number of TCs.

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
 include/linux/netdevice.h      |    6 ++---
 include/uapi/linux/pkt_sched.h |    6 ++---
 net/core/dev.c                 |    2 +-
 net/sched/sch_mqprio.c         |   52 +++++++++++++++++++++++++++-------------
 net/sched/sch_taprio.c         |    6 ++---
 5 files changed, 45 insertions(+), 27 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5cbc950b34df..676f245651d9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -804,8 +804,8 @@ struct xps_dev_maps {
 
 #endif /* CONFIG_XPS */
 
-#define TC_MAX_QUEUE	16
-#define TC_BITMASK	15
+#define TC_MAX_QUEUE	255
+#define TC_BITMASK	255
 /* HW offloaded queuing disciplines txq count and offset maps */
 struct netdev_tc_txq {
 	u16 count;
@@ -2219,7 +2219,7 @@ struct net_device {
 #endif
 	s16			num_tc;
 	struct netdev_tc_txq	tc_to_txq[TC_MAX_QUEUE];
-	u8			prio_tc_map[TC_BITMASK + 1];
+	u8			prio_tc_map[TC_BITMASK];
 
 #if IS_ENABLED(CONFIG_FCOE)
 	unsigned int		fcoe_ddp_xid;
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 79a699f106b1..b5d733135900 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -692,8 +692,8 @@ struct tc_drr_stats {
 };
 
 /* MQPRIO */
-#define TC_QOPT_BITMASK 15
-#define TC_QOPT_MAX_QUEUE 16
+#define TC_QOPT_BITMASK 255
+#define TC_QOPT_MAX_QUEUE 255
 
 enum {
 	TC_MQPRIO_HW_OFFLOAD_NONE,	/* no offload requested */
@@ -721,7 +721,7 @@ enum {
 
 struct tc_mqprio_qopt {
 	__u8	num_tc;
-	__u8	prio_tc_map[TC_QOPT_BITMASK + 1];
+	__u8	prio_tc_map[TC_QOPT_BITMASK];
 	__u8	hw;
 	__u16	count[TC_QOPT_MAX_QUEUE];
 	__u16	offset[TC_QOPT_MAX_QUEUE];
diff --git a/net/core/dev.c b/net/core/dev.c
index d9bf63dbe4fd..fe1b0bd812a5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2476,7 +2476,7 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq)
 	}
 
 	/* Invalidated prio to tc mappings set to TC0 */
-	for (i = 1; i < TC_BITMASK + 1; i++) {
+	for (i = 1; i < TC_BITMASK; i++) {
 		int q = netdev_get_prio_tc_map(dev, i);
 
 		tc = &dev->tc_to_txq[q];
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index 8766ab5b8788..70b1267ac92c 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -42,15 +42,21 @@ static void mqprio_destroy(struct Qdisc *sch)
 	}
 
 	if (priv->hw_offload && dev->netdev_ops->ndo_setup_tc) {
-		struct tc_mqprio_qopt_offload mqprio = { { 0 } };
-
 		switch (priv->mode) {
 		case TC_MQPRIO_MODE_DCB:
 		case TC_MQPRIO_MODE_CHANNEL:
+		{
+			struct tc_mqprio_qopt_offload *mqprio;
+
+			mqprio = kzalloc(sizeof(*mqprio), GFP_KERNEL);
+			if (!mqprio)
+				return;
 			dev->netdev_ops->ndo_setup_tc(dev,
 						      TC_SETUP_QDISC_MQPRIO,
-						      &mqprio);
+						      mqprio);
+			kfree(mqprio);
 			break;
+		}
 		default:
 			return;
 		}
@@ -68,7 +74,7 @@ static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt)
 		return -EINVAL;
 
 	/* Verify priority mapping uses valid tcs */
-	for (i = 0; i < TC_BITMASK + 1; i++) {
+	for (i = 0; i < TC_BITMASK; i++) {
 		if (qopt->prio_tc_map[i] >= qopt->num_tc)
 			return -EINVAL;
 	}
@@ -241,36 +247,48 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt,
 	 * supplied and verified mapping
 	 */
 	if (qopt->hw) {
-		struct tc_mqprio_qopt_offload mqprio = {.qopt = *qopt};
+		struct tc_mqprio_qopt_offload *mqprio;
+
+		mqprio = kzalloc(sizeof(*mqprio), GFP_KERNEL);
+		if (!mqprio)
+			return -ENOMEM;
+
+		mqprio->qopt = *qopt;
 
 		switch (priv->mode) {
 		case TC_MQPRIO_MODE_DCB:
-			if (priv->shaper != TC_MQPRIO_SHAPER_DCB)
+			if (priv->shaper != TC_MQPRIO_SHAPER_DCB) {
+				kfree(mqprio);
 				return -EINVAL;
+			}
 			break;
 		case TC_MQPRIO_MODE_CHANNEL:
-			mqprio.flags = priv->flags;
+			mqprio->flags = priv->flags;
 			if (priv->flags & TC_MQPRIO_F_MODE)
-				mqprio.mode = priv->mode;
+				mqprio->mode = priv->mode;
 			if (priv->flags & TC_MQPRIO_F_SHAPER)
-				mqprio.shaper = priv->shaper;
+				mqprio->shaper = priv->shaper;
 			if (priv->flags & TC_MQPRIO_F_MIN_RATE)
-				for (i = 0; i < mqprio.qopt.num_tc; i++)
-					mqprio.min_rate[i] = priv->min_rate[i];
+				for (i = 0; i < mqprio->qopt.num_tc; i++)
+					mqprio->min_rate[i] = priv->min_rate[i];
 			if (priv->flags & TC_MQPRIO_F_MAX_RATE)
-				for (i = 0; i < mqprio.qopt.num_tc; i++)
-					mqprio.max_rate[i] = priv->max_rate[i];
+				for (i = 0; i < mqprio->qopt.num_tc; i++)
+					mqprio->max_rate[i] = priv->max_rate[i];
 			break;
 		default:
+			kfree(mqprio);
 			return -EINVAL;
 		}
 		err = dev->netdev_ops->ndo_setup_tc(dev,
 						    TC_SETUP_QDISC_MQPRIO,
-						    &mqprio);
-		if (err)
+						    mqprio);
+		if (err) {
+			kfree(mqprio);
 			return err;
+		}
 
-		priv->hw_offload = mqprio.qopt.hw;
+		priv->hw_offload = mqprio->qopt.hw;
+		kfree(mqprio);
 	} else {
 		netdev_set_num_tc(dev, qopt->num_tc);
 		for (i = 0; i < qopt->num_tc; i++)
@@ -279,7 +297,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt,
 	}
 
 	/* Always use supplied priority mappings */
-	for (i = 0; i < TC_BITMASK + 1; i++)
+	for (i = 0; i < TC_BITMASK; i++)
 		netdev_set_prio_tc_map(dev, i, qopt->prio_tc_map[i]);
 
 	sch->flags |= TCQ_F_MQROOT;
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 922ed6b91abb..3878c77ce91d 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -982,7 +982,7 @@ static int taprio_parse_mqprio_opt(struct net_device *dev,
 	}
 
 	/* Verify priority mapping uses valid tcs */
-	for (i = 0; i <= TC_BITMASK; i++) {
+	for (i = 0; i < TC_BITMASK; i++) {
 		if (qopt->prio_tc_map[i] >= qopt->num_tc) {
 			NL_SET_ERR_MSG(extack, "Invalid traffic class in priority to traffic class mapping");
 			return -EINVAL;
@@ -1437,7 +1437,7 @@ static int taprio_mqprio_cmp(const struct net_device *dev,
 		    dev->tc_to_txq[i].offset != mqprio->offset[i])
 			return -1;
 
-	for (i = 0; i <= TC_BITMASK; i++)
+	for (i = 0; i < TC_BITMASK; i++)
 		if (dev->prio_tc_map[i] != mqprio->prio_tc_map[i])
 			return -1;
 
@@ -1548,7 +1548,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 					    mqprio->offset[i]);
 
 		/* Always use supplied priority mappings */
-		for (i = 0; i <= TC_BITMASK; i++)
+		for (i = 0; i < TC_BITMASK; i++)
 			netdev_set_prio_tc_map(dev, i,
 					       mqprio->prio_tc_map[i]);
 	}


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

* Re: [net-next,RFC PATCH] net: Extend TC limit beyond 16 to 255
  2021-04-23 21:12 [net-next,RFC PATCH] net: Extend TC limit beyond 16 to 255 Amritha Nambiar
@ 2021-04-23 21:19 ` Stephen Hemminger
  2021-04-23 23:02 ` [net-next, RFC " kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2021-04-23 21:19 UTC (permalink / raw)
  To: Amritha Nambiar
  Cc: netdev, davem, kuba, jhs, jiri, xiyou.wangcong, john.fastabend,
	alexander.duyck, vinicius.gomes, vedang.patel, sridhar.samudrala

On Fri, 23 Apr 2021 14:12:20 -0700
Amritha Nambiar <amritha.nambiar@intel.com> wrote:

> Extend the max limit of TCs to 255 (max value of 8-bit num_tc)
> from current max of 16. This would allow creating more than 16
> queue-sets and offloading them on devices with large number of
> queues using the mqprio scheduler.
> Also, changed the static allocation of struct
> tc_mqprio_qopt_offload mqprio to dynamic allocation on heap to
> fit within frame size as the size of attributes increases
> proportionally with the max number of TCs.
> 
> Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>

This breaks the userspace API, similar things have been proposed
before and rejected.

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

* Re: [net-next, RFC PATCH] net: Extend TC limit beyond 16 to 255
  2021-04-23 21:12 [net-next,RFC PATCH] net: Extend TC limit beyond 16 to 255 Amritha Nambiar
  2021-04-23 21:19 ` Stephen Hemminger
@ 2021-04-23 23:02 ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-04-23 23:02 UTC (permalink / raw)
  To: kbuild-all

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

Hi Amritha,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on ipvs/master]
[also build test WARNING on linus/master sparc-next/master v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Amritha-Nambiar/net-Extend-TC-limit-beyond-16-to-255/20210424-051007
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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/b6076aeb9c919985034d1e89d560d5378d7c55ec
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Amritha-Nambiar/net-Extend-TC-limit-beyond-16-to-255/20210424-051007
        git checkout b6076aeb9c919985034d1e89d560d5378d7c55ec
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=arc 

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

All warnings (new ones prefixed by >>):

   net/sched/sch_mqprio.c: In function 'mqprio_dump':
>> net/sched/sch_mqprio.c:475:1: warning: the frame size of 1280 bytes is larger than 1024 bytes [-Wframe-larger-than=]
     475 | }
         | ^
--
   net/sched/sch_taprio.c: In function 'taprio_dump':
>> net/sched/sch_taprio.c:1884:1: warning: the frame size of 1284 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    1884 | }
         | ^


vim +475 net/sched/sch_mqprio.c

4e8b86c0626954 Amritha Nambiar    2017-09-07  400  
b8970f0bfc7810 John Fastabend     2011-01-17  401  static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb)
b8970f0bfc7810 John Fastabend     2011-01-17  402  {
b8970f0bfc7810 John Fastabend     2011-01-17  403  	struct net_device *dev = qdisc_dev(sch);
b8970f0bfc7810 John Fastabend     2011-01-17  404  	struct mqprio_sched *priv = qdisc_priv(sch);
4e8b86c0626954 Amritha Nambiar    2017-09-07  405  	struct nlattr *nla = (struct nlattr *)skb_tail_pointer(skb);
144ce879b057c7 Eric Dumazet       2011-01-26  406  	struct tc_mqprio_qopt opt = { 0 };
b8970f0bfc7810 John Fastabend     2011-01-17  407  	struct Qdisc *qdisc;
ce679e8df7ed2a John Fastabend     2017-12-07  408  	unsigned int ntx, tc;
b8970f0bfc7810 John Fastabend     2011-01-17  409  
b8970f0bfc7810 John Fastabend     2011-01-17  410  	sch->q.qlen = 0;
b8970f0bfc7810 John Fastabend     2011-01-17  411  	memset(&sch->bstats, 0, sizeof(sch->bstats));
b8970f0bfc7810 John Fastabend     2011-01-17  412  	memset(&sch->qstats, 0, sizeof(sch->qstats));
b8970f0bfc7810 John Fastabend     2011-01-17  413  
ce679e8df7ed2a John Fastabend     2017-12-07  414  	/* MQ supports lockless qdiscs. However, statistics accounting needs
ce679e8df7ed2a John Fastabend     2017-12-07  415  	 * to account for all, none, or a mix of locked and unlocked child
ce679e8df7ed2a John Fastabend     2017-12-07  416  	 * qdiscs. Percpu stats are added to counters in-band and locking
ce679e8df7ed2a John Fastabend     2017-12-07  417  	 * qdisc totals are added at end.
ce679e8df7ed2a John Fastabend     2017-12-07  418  	 */
ce679e8df7ed2a John Fastabend     2017-12-07  419  	for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
ce679e8df7ed2a John Fastabend     2017-12-07  420  		qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping;
b8970f0bfc7810 John Fastabend     2011-01-17  421  		spin_lock_bh(qdisc_lock(qdisc));
ce679e8df7ed2a John Fastabend     2017-12-07  422  
ce679e8df7ed2a John Fastabend     2017-12-07  423  		if (qdisc_is_percpu_stats(qdisc)) {
ce679e8df7ed2a John Fastabend     2017-12-07  424  			__u32 qlen = qdisc_qlen_sum(qdisc);
ce679e8df7ed2a John Fastabend     2017-12-07  425  
ce679e8df7ed2a John Fastabend     2017-12-07  426  			__gnet_stats_copy_basic(NULL, &sch->bstats,
ce679e8df7ed2a John Fastabend     2017-12-07  427  						qdisc->cpu_bstats,
ce679e8df7ed2a John Fastabend     2017-12-07  428  						&qdisc->bstats);
ce679e8df7ed2a John Fastabend     2017-12-07  429  			__gnet_stats_copy_queue(&sch->qstats,
ce679e8df7ed2a John Fastabend     2017-12-07  430  						qdisc->cpu_qstats,
ce679e8df7ed2a John Fastabend     2017-12-07  431  						&qdisc->qstats, qlen);
2f23cd42e19c22 Dust Li            2019-12-03  432  			sch->q.qlen		+= qlen;
ce679e8df7ed2a John Fastabend     2017-12-07  433  		} else {
b8970f0bfc7810 John Fastabend     2011-01-17  434  			sch->q.qlen		+= qdisc->q.qlen;
b8970f0bfc7810 John Fastabend     2011-01-17  435  			sch->bstats.bytes	+= qdisc->bstats.bytes;
b8970f0bfc7810 John Fastabend     2011-01-17  436  			sch->bstats.packets	+= qdisc->bstats.packets;
b8970f0bfc7810 John Fastabend     2011-01-17  437  			sch->qstats.backlog	+= qdisc->qstats.backlog;
b8970f0bfc7810 John Fastabend     2011-01-17  438  			sch->qstats.drops	+= qdisc->qstats.drops;
b8970f0bfc7810 John Fastabend     2011-01-17  439  			sch->qstats.requeues	+= qdisc->qstats.requeues;
b8970f0bfc7810 John Fastabend     2011-01-17  440  			sch->qstats.overlimits	+= qdisc->qstats.overlimits;
ce679e8df7ed2a John Fastabend     2017-12-07  441  		}
ce679e8df7ed2a John Fastabend     2017-12-07  442  
b8970f0bfc7810 John Fastabend     2011-01-17  443  		spin_unlock_bh(qdisc_lock(qdisc));
b8970f0bfc7810 John Fastabend     2011-01-17  444  	}
b8970f0bfc7810 John Fastabend     2011-01-17  445  
b8970f0bfc7810 John Fastabend     2011-01-17  446  	opt.num_tc = netdev_get_num_tc(dev);
b8970f0bfc7810 John Fastabend     2011-01-17  447  	memcpy(opt.prio_tc_map, dev->prio_tc_map, sizeof(opt.prio_tc_map));
2026fecf516bc0 Alexander Duyck    2017-03-15  448  	opt.hw = priv->hw_offload;
b8970f0bfc7810 John Fastabend     2011-01-17  449  
ce679e8df7ed2a John Fastabend     2017-12-07  450  	for (tc = 0; tc < netdev_get_num_tc(dev); tc++) {
ce679e8df7ed2a John Fastabend     2017-12-07  451  		opt.count[tc] = dev->tc_to_txq[tc].count;
ce679e8df7ed2a John Fastabend     2017-12-07  452  		opt.offset[tc] = dev->tc_to_txq[tc].offset;
b8970f0bfc7810 John Fastabend     2011-01-17  453  	}
b8970f0bfc7810 John Fastabend     2011-01-17  454  
9f104c7736904a Vladyslav Tarasiuk 2019-12-06  455  	if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
4e8b86c0626954 Amritha Nambiar    2017-09-07  456  		goto nla_put_failure;
4e8b86c0626954 Amritha Nambiar    2017-09-07  457  
4e8b86c0626954 Amritha Nambiar    2017-09-07  458  	if ((priv->flags & TC_MQPRIO_F_MODE) &&
4e8b86c0626954 Amritha Nambiar    2017-09-07  459  	    nla_put_u16(skb, TCA_MQPRIO_MODE, priv->mode))
4e8b86c0626954 Amritha Nambiar    2017-09-07  460  		goto nla_put_failure;
4e8b86c0626954 Amritha Nambiar    2017-09-07  461  
4e8b86c0626954 Amritha Nambiar    2017-09-07  462  	if ((priv->flags & TC_MQPRIO_F_SHAPER) &&
4e8b86c0626954 Amritha Nambiar    2017-09-07  463  	    nla_put_u16(skb, TCA_MQPRIO_SHAPER, priv->shaper))
4e8b86c0626954 Amritha Nambiar    2017-09-07  464  		goto nla_put_failure;
4e8b86c0626954 Amritha Nambiar    2017-09-07  465  
4e8b86c0626954 Amritha Nambiar    2017-09-07  466  	if ((priv->flags & TC_MQPRIO_F_MIN_RATE ||
4e8b86c0626954 Amritha Nambiar    2017-09-07  467  	     priv->flags & TC_MQPRIO_F_MAX_RATE) &&
4e8b86c0626954 Amritha Nambiar    2017-09-07  468  	    (dump_rates(priv, &opt, skb) != 0))
1b34ec43c9b3de David S. Miller    2012-03-29  469  		goto nla_put_failure;
b8970f0bfc7810 John Fastabend     2011-01-17  470  
4e8b86c0626954 Amritha Nambiar    2017-09-07  471  	return nla_nest_end(skb, nla);
b8970f0bfc7810 John Fastabend     2011-01-17  472  nla_put_failure:
4e8b86c0626954 Amritha Nambiar    2017-09-07  473  	nlmsg_trim(skb, nla);
b8970f0bfc7810 John Fastabend     2011-01-17  474  	return -1;
b8970f0bfc7810 John Fastabend     2011-01-17 @475  }
b8970f0bfc7810 John Fastabend     2011-01-17  476  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 67526 bytes --]

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

* Re: [net-next, RFC PATCH] net: Extend TC limit beyond 16 to 255
@ 2021-05-04 19:22 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-05-04 19:22 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <161921234046.33211.14393307850365339307.stgit@anambiarhost.jf.intel.com>
References: <161921234046.33211.14393307850365339307.stgit@anambiarhost.jf.intel.com>
TO: Amritha Nambiar <amritha.nambiar@intel.com>

Hi Amritha,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on ipvs/master]
[also build test WARNING on linus/master v5.12 next-20210504]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Amritha-Nambiar/net-Extend-TC-limit-beyond-16-to-255/20210424-051007
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
:::::: branch date: 11 days ago
:::::: commit date: 11 days ago
config: x86_64-randconfig-m031-20210503 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
net/sched/sch_taprio.c:929 taprio_parse_mqprio_opt() warn: impossible condition '(qopt->num_tc > 255) => (0-255 > 255)'

vim +929 net/sched/sch_taprio.c

5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  909  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  910  static int taprio_parse_mqprio_opt(struct net_device *dev,
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  911  				   struct tc_mqprio_qopt *qopt,
4cfd5779bd6efe Vedang Patel         2019-06-25  912  				   struct netlink_ext_ack *extack,
4cfd5779bd6efe Vedang Patel         2019-06-25  913  				   u32 taprio_flags)
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  914  {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  915  	int i, j;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  916  
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  917  	if (!qopt && !dev->num_tc) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  918  		NL_SET_ERR_MSG(extack, "'mqprio' configuration is necessary");
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  919  		return -EINVAL;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  920  	}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  921  
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  922  	/* If num_tc is already set, it means that the user already
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  923  	 * configured the mqprio part
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  924  	 */
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  925  	if (dev->num_tc)
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  926  		return 0;
a3d43c0d56f1b9 Vinicius Costa Gomes 2019-04-29  927  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  928  	/* Verify num_tc is not out of max range */
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28 @929  	if (qopt->num_tc > TC_MAX_QUEUE) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  930  		NL_SET_ERR_MSG(extack, "Number of traffic classes is outside valid range");
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  931  		return -EINVAL;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  932  	}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  933  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  934  	/* taprio imposes that traffic classes map 1:n to tx queues */
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  935  	if (qopt->num_tc > dev->num_tx_queues) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  936  		NL_SET_ERR_MSG(extack, "Number of traffic classes is greater than number of HW queues");
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  937  		return -EINVAL;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  938  	}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  939  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  940  	/* Verify priority mapping uses valid tcs */
b6076aeb9c9199 Amritha Nambiar      2021-04-23  941  	for (i = 0; i < TC_BITMASK; i++) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  942  		if (qopt->prio_tc_map[i] >= qopt->num_tc) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  943  			NL_SET_ERR_MSG(extack, "Invalid traffic class in priority to traffic class mapping");
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  944  			return -EINVAL;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  945  		}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  946  	}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  947  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  948  	for (i = 0; i < qopt->num_tc; i++) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  949  		unsigned int last = qopt->offset[i] + qopt->count[i];
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  950  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  951  		/* Verify the queue count is in tx range being equal to the
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  952  		 * real_num_tx_queues indicates the last queue is in use.
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  953  		 */
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  954  		if (qopt->offset[i] >= dev->num_tx_queues ||
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  955  		    !qopt->count[i] ||
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  956  		    last > dev->real_num_tx_queues) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  957  			NL_SET_ERR_MSG(extack, "Invalid queue in traffic class to queue mapping");
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  958  			return -EINVAL;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  959  		}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  960  
4cfd5779bd6efe Vedang Patel         2019-06-25  961  		if (TXTIME_ASSIST_IS_ENABLED(taprio_flags))
4cfd5779bd6efe Vedang Patel         2019-06-25  962  			continue;
4cfd5779bd6efe Vedang Patel         2019-06-25  963  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  964  		/* Verify that the offset and counts do not overlap */
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  965  		for (j = i + 1; j < qopt->num_tc; j++) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  966  			if (last > qopt->offset[j]) {
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  967  				NL_SET_ERR_MSG(extack, "Detected overlap in the traffic class to queue mapping");
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  968  				return -EINVAL;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  969  			}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  970  		}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  971  	}
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  972  
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  973  	return 0;
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  974  }
5a781ccbd19e46 Vinicius Costa Gomes 2018-09-28  975  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37094 bytes --]

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

* Re: [net-next, RFC PATCH] net: Extend TC limit beyond 16 to 255
@ 2021-04-24  1:48 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-04-24  1:48 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <161921234046.33211.14393307850365339307.stgit@anambiarhost.jf.intel.com>
References: <161921234046.33211.14393307850365339307.stgit@anambiarhost.jf.intel.com>
TO: Amritha Nambiar <amritha.nambiar@intel.com>

Hi Amritha,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on ipvs/master]
[also build test WARNING on linus/master v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Amritha-Nambiar/net-Extend-TC-limit-beyond-16-to-255/20210424-051007
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: microblaze-randconfig-m031-20210423 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

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

smatch warnings:
net/sched/sch_mqprio.c:73 mqprio_parse_opt() warn: impossible condition '(qopt->num_tc > 255) => (0-255 > 255)'

vim +73 net/sched/sch_mqprio.c

b8970f0bfc7810 John Fastabend  2011-01-17   67  
b8970f0bfc7810 John Fastabend  2011-01-17   68  static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt)
b8970f0bfc7810 John Fastabend  2011-01-17   69  {
b8970f0bfc7810 John Fastabend  2011-01-17   70  	int i, j;
b8970f0bfc7810 John Fastabend  2011-01-17   71  
b8970f0bfc7810 John Fastabend  2011-01-17   72  	/* Verify num_tc is not out of max range */
b8970f0bfc7810 John Fastabend  2011-01-17  @73  	if (qopt->num_tc > TC_MAX_QUEUE)
b8970f0bfc7810 John Fastabend  2011-01-17   74  		return -EINVAL;
b8970f0bfc7810 John Fastabend  2011-01-17   75  
b8970f0bfc7810 John Fastabend  2011-01-17   76  	/* Verify priority mapping uses valid tcs */
b6076aeb9c9199 Amritha Nambiar 2021-04-23   77  	for (i = 0; i < TC_BITMASK; i++) {
b8970f0bfc7810 John Fastabend  2011-01-17   78  		if (qopt->prio_tc_map[i] >= qopt->num_tc)
b8970f0bfc7810 John Fastabend  2011-01-17   79  			return -EINVAL;
b8970f0bfc7810 John Fastabend  2011-01-17   80  	}
b8970f0bfc7810 John Fastabend  2011-01-17   81  
2026fecf516bc0 Alexander Duyck 2017-03-15   82  	/* Limit qopt->hw to maximum supported offload value.  Drivers have
2026fecf516bc0 Alexander Duyck 2017-03-15   83  	 * the option of overriding this later if they don't support the a
2026fecf516bc0 Alexander Duyck 2017-03-15   84  	 * given offload type.
2026fecf516bc0 Alexander Duyck 2017-03-15   85  	 */
2026fecf516bc0 Alexander Duyck 2017-03-15   86  	if (qopt->hw > TC_MQPRIO_HW_OFFLOAD_MAX)
2026fecf516bc0 Alexander Duyck 2017-03-15   87  		qopt->hw = TC_MQPRIO_HW_OFFLOAD_MAX;
b8970f0bfc7810 John Fastabend  2011-01-17   88  
2026fecf516bc0 Alexander Duyck 2017-03-15   89  	/* If hardware offload is requested we will leave it to the device
2026fecf516bc0 Alexander Duyck 2017-03-15   90  	 * to either populate the queue counts itself or to validate the
2026fecf516bc0 Alexander Duyck 2017-03-15   91  	 * provided queue counts.  If ndo_setup_tc is not present then
2026fecf516bc0 Alexander Duyck 2017-03-15   92  	 * hardware doesn't support offload and we should return an error.
b8970f0bfc7810 John Fastabend  2011-01-17   93  	 */
b8970f0bfc7810 John Fastabend  2011-01-17   94  	if (qopt->hw)
2026fecf516bc0 Alexander Duyck 2017-03-15   95  		return dev->netdev_ops->ndo_setup_tc ? 0 : -EINVAL;
b8970f0bfc7810 John Fastabend  2011-01-17   96  
b8970f0bfc7810 John Fastabend  2011-01-17   97  	for (i = 0; i < qopt->num_tc; i++) {
b8970f0bfc7810 John Fastabend  2011-01-17   98  		unsigned int last = qopt->offset[i] + qopt->count[i];
b8970f0bfc7810 John Fastabend  2011-01-17   99  
b8970f0bfc7810 John Fastabend  2011-01-17  100  		/* Verify the queue count is in tx range being equal to the
b8970f0bfc7810 John Fastabend  2011-01-17  101  		 * real_num_tx_queues indicates the last queue is in use.
b8970f0bfc7810 John Fastabend  2011-01-17  102  		 */
b8970f0bfc7810 John Fastabend  2011-01-17  103  		if (qopt->offset[i] >= dev->real_num_tx_queues ||
b8970f0bfc7810 John Fastabend  2011-01-17  104  		    !qopt->count[i] ||
b8970f0bfc7810 John Fastabend  2011-01-17  105  		    last > dev->real_num_tx_queues)
b8970f0bfc7810 John Fastabend  2011-01-17  106  			return -EINVAL;
b8970f0bfc7810 John Fastabend  2011-01-17  107  
b8970f0bfc7810 John Fastabend  2011-01-17  108  		/* Verify that the offset and counts do not overlap */
b8970f0bfc7810 John Fastabend  2011-01-17  109  		for (j = i + 1; j < qopt->num_tc; j++) {
b8970f0bfc7810 John Fastabend  2011-01-17  110  			if (last > qopt->offset[j])
b8970f0bfc7810 John Fastabend  2011-01-17  111  				return -EINVAL;
b8970f0bfc7810 John Fastabend  2011-01-17  112  		}
b8970f0bfc7810 John Fastabend  2011-01-17  113  	}
b8970f0bfc7810 John Fastabend  2011-01-17  114  
b8970f0bfc7810 John Fastabend  2011-01-17  115  	return 0;
b8970f0bfc7810 John Fastabend  2011-01-17  116  }
b8970f0bfc7810 John Fastabend  2011-01-17  117  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29774 bytes --]

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

* Re: [net-next, RFC PATCH] net: Extend TC limit beyond 16 to 255
@ 2021-04-24  0:49 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-04-24  0:49 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <161921234046.33211.14393307850365339307.stgit@anambiarhost.jf.intel.com>
References: <161921234046.33211.14393307850365339307.stgit@anambiarhost.jf.intel.com>
TO: Amritha Nambiar <amritha.nambiar@intel.com>

Hi Amritha,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on ipvs/master]
[also build test WARNING on linus/master sparc-next/master v5.12-rc8 next-20210423]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Amritha-Nambiar/net-Extend-TC-limit-beyond-16-to-255/20210424-051007
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-m021-20210423 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
net/core/dev.c:2897 netdev_set_num_tc() warn: impossible condition '(num_tc > 255) => (0-255 > 255)'

vim +2897 net/core/dev.c

9cf1f6a8c4cbb7 Alexander Duyck 2016-10-28  2894  
9cf1f6a8c4cbb7 Alexander Duyck 2016-10-28  2895  int netdev_set_num_tc(struct net_device *dev, u8 num_tc)
9cf1f6a8c4cbb7 Alexander Duyck 2016-10-28  2896  {
9cf1f6a8c4cbb7 Alexander Duyck 2016-10-28 @2897  	if (num_tc > TC_MAX_QUEUE)
9cf1f6a8c4cbb7 Alexander Duyck 2016-10-28  2898  		return -EINVAL;
9cf1f6a8c4cbb7 Alexander Duyck 2016-10-28  2899  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32053 bytes --]

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

end of thread, other threads:[~2021-05-04 19:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 21:12 [net-next,RFC PATCH] net: Extend TC limit beyond 16 to 255 Amritha Nambiar
2021-04-23 21:19 ` Stephen Hemminger
2021-04-23 23:02 ` [net-next, RFC " kernel test robot
2021-04-24  0:49 kernel test robot
2021-04-24  1:48 kernel test robot
2021-05-04 19:22 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.