Subject: Re: [PATCH net-next 3/8] devlink: Extend devlink rate API with traffic classes bandwidth management

From: kernel test robot <[email-masked]>
Date: Thu, 14 Nov 2024 08:46:46 +0800

Hi Tariq,

kernel test robot noticed the following build warnings:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Tariq-Toukan/net-mlx5-DR-expand-SWS-STE-callbacks-and-consolidate-common-structs/20241114-022031
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241113180034.714102-4-tariqt%40nvidia.com
patch subject: [PATCH net-next 3/8] devlink: Extend devlink rate API with traffic classes bandwidth management
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20241114/[email-masked]/config)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241114/[email-masked]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All warnings (new ones prefixed by >>):

   In file included from net/devlink/devl_internal.h:14,
                    from net/devlink/rate.c:7:
   include/net/devlink.h:121:19: error: 'IEEE_8021QAZ_MAX_TCS' undeclared here (not in a function)
     121 |         u32 tc_bw[IEEE_8021QAZ_MAX_TCS];
         |                   ^~~~~~~~~~~~~~~~~~~~
   net/devlink/rate.c: In function 'devlink_nl_rate_set':
>> net/devlink/rate.c:335:13: warning: unused variable 'tc_bw' [-Wunused-variable]
     335 |         u32 tc_bw[IEEE_8021QAZ_MAX_TCS];
         |             ^~~~~

vim +/tc_bw +335 net/devlink/rate.c

   329	
   330	static int devlink_nl_rate_set(struct devlink_rate *devlink_rate,
   331				       const struct devlink_ops *ops,
   332				       struct genl_info *info)
   333	{
   334		struct nlattr *nla_parent, **attrs = info->attrs;
 > 335		u32 tc_bw[IEEE_8021QAZ_MAX_TCS];
   336		int err = -EOPNOTSUPP;
   337		u32 priority;
   338		u32 weight;
   339		u64 rate;
   340	
   341		if (attrs[DEVLINK_ATTR_RATE_TX_SHARE]) {
   342			rate = nla_get_u64(attrs[DEVLINK_ATTR_RATE_TX_SHARE]);
   343			if (devlink_rate_is_leaf(devlink_rate))
   344				err = ops->rate_leaf_tx_share_set(devlink_rate, devlink_rate->priv,
   345								  rate, info->extack);
   346			else if (devlink_rate_is_node(devlink_rate))
   347				err = ops->rate_node_tx_share_set(devlink_rate, devlink_rate->priv,
   348								  rate, info->extack);
   349			if (err)
   350				return err;
   351			devlink_rate->tx_share = rate;
   352		}
   353	
   354		if (attrs[DEVLINK_ATTR_RATE_TX_MAX]) {
   355			rate = nla_get_u64(attrs[DEVLINK_ATTR_RATE_TX_MAX]);
   356			if (devlink_rate_is_leaf(devlink_rate))
   357				err = ops->rate_leaf_tx_max_set(devlink_rate, devlink_rate->priv,
   358								rate, info->extack);
   359			else if (devlink_rate_is_node(devlink_rate))
   360				err = ops->rate_node_tx_max_set(devlink_rate, devlink_rate->priv,
   361								rate, info->extack);
   362			if (err)
   363				return err;
   364			devlink_rate->tx_max = rate;
   365		}
   366	
   367		if (attrs[DEVLINK_ATTR_RATE_TX_PRIORITY]) {
   368			priority = nla_get_u32(attrs[DEVLINK_ATTR_RATE_TX_PRIORITY]);
   369			if (devlink_rate_is_leaf(devlink_rate))
   370				err = ops->rate_leaf_tx_priority_set(devlink_rate, devlink_rate->priv,
   371								     priority, info->extack);
   372			else if (devlink_rate_is_node(devlink_rate))
   373				err = ops->rate_node_tx_priority_set(devlink_rate, devlink_rate->priv,
   374								     priority, info->extack);
   375	
   376			if (err)
   377				return err;
   378			devlink_rate->tx_priority = priority;
   379		}
   380	
   381		if (attrs[DEVLINK_ATTR_RATE_TX_WEIGHT]) {
   382			weight = nla_get_u32(attrs[DEVLINK_ATTR_RATE_TX_WEIGHT]);
   383			if (devlink_rate_is_leaf(devlink_rate))
   384				err = ops->rate_leaf_tx_weight_set(devlink_rate, devlink_rate->priv,
   385								   weight, info->extack);
   386			else if (devlink_rate_is_node(devlink_rate))
   387				err = ops->rate_node_tx_weight_set(devlink_rate, devlink_rate->priv,
   388								   weight, info->extack);
   389	
   390			if (err)
   391				return err;
   392			devlink_rate->tx_weight = weight;
   393		}
   394	
   395		if (attrs[DEVLINK_ATTR_RATE_TC_BW]) {
   396			struct nlattr *nla_tc_bw = attrs[DEVLINK_ATTR_RATE_TC_BW];
   397			struct nlattr *tb[DEVLINK_ATTR_RATE_TC_7_BW + 1];
   398			int i;
   399	
   400			err = nla_parse_nested(tb, DEVLINK_ATTR_RATE_TC_7_BW, nla_tc_bw,
   401					       devlink_dl_rate_tc_bw_nl_policy, info->extack);
   402			if (err)
   403				return err;
   404	
   405			for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
   406				if (tb[DEVLINK_ATTR_RATE_TC_0_BW + i])
   407					tc_bw[i] = nla_get_u32(tb[DEVLINK_ATTR_RATE_TC_0_BW + i]);
   408				else
   409					tc_bw[i] = 0;
   410			}
   411	
   412			if (devlink_rate_is_leaf(devlink_rate))
   413				err = ops->rate_leaf_tc_bw_set(devlink_rate, devlink_rate->priv,
   414							       tc_bw, info->extack);
   415			else if (devlink_rate_is_node(devlink_rate))
   416				err = ops->rate_node_tc_bw_set(devlink_rate, devlink_rate->priv,
   417							       tc_bw, info->extack);
   418	
   419			if (err)
   420				return err;
   421	
   422			memcpy(devlink_rate->tc_bw, tc_bw, sizeof(tc_bw));
   423		}
   424	
   425		nla_parent = attrs[DEVLINK_ATTR_RATE_PARENT_NODE_NAME];
   426		if (nla_parent) {
   427			err = devlink_nl_rate_parent_node_set(devlink_rate, info,
   428							      nla_parent);
   429			if (err)
   430				return err;
   431		}
   432	
   433		return 0;
   434	}
   435	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki