2022-09-23 01:55:13

by huangguangbin (A)

[permalink] [raw]
Subject: [PATCH net-next 1/2] devlink: expand __DEVLINK_PARAM_MAX_STRING_VALUE to 256

From: Hao Chen <[email protected]>

The string length of devlink parameter is limited to 32, it may be not
enough if there are several parameters in one string, so expand it to 256.

Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
include/net/devlink.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index 264aa98e6da6..52aaafc92f56 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -400,7 +400,7 @@ typedef u64 devlink_resource_occ_get_t(void *priv);

#define DEVLINK_RESOURCE_GENERIC_NAME_PORTS "physical_ports"

-#define __DEVLINK_PARAM_MAX_STRING_VALUE 32
+#define __DEVLINK_PARAM_MAX_STRING_VALUE 256
enum devlink_param_type {
DEVLINK_PARAM_TYPE_U8,
DEVLINK_PARAM_TYPE_U16,
--
2.33.0


2022-09-23 06:51:38

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH net-next 1/2] devlink: expand __DEVLINK_PARAM_MAX_STRING_VALUE to 256

Hi Guangbin,

Thank you for the patch! Perhaps something to improve:

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

url: https://github.com/intel-lab-lkp/linux/commits/Guangbin-Huang/net-hns3-add-support-setting-parameters-of-congestion-control-algorithm-by-devlink-param/20220923-094236
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git bcff1a37bafc144d67192f2f5e1f4b9c49b37bd6
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20220923/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/e503c1118546fbb4e0d1274058f5ca0851f4b9a0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Guangbin-Huang/net-hns3-add-support-setting-parameters-of-congestion-control-algorithm-by-devlink-param/20220923-094236
git checkout e503c1118546fbb4e0d1274058f5ca0851f4b9a0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

net/core/devlink.c: In function 'devlink_nl_param_fill.constprop':
>> net/core/devlink.c:5382:1: warning: the frame size of 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=]
5382 | }
| ^


vim +5382 net/core/devlink.c

45f05def5c44c8 Moshe Shemesh 2018-07-04 5293
45f05def5c44c8 Moshe Shemesh 2018-07-04 5294 static int devlink_nl_param_fill(struct sk_buff *msg, struct devlink *devlink,
f4601dee25d5fe Vasundhara Volam 2019-01-28 5295 unsigned int port_index,
45f05def5c44c8 Moshe Shemesh 2018-07-04 5296 struct devlink_param_item *param_item,
45f05def5c44c8 Moshe Shemesh 2018-07-04 5297 enum devlink_command cmd,
45f05def5c44c8 Moshe Shemesh 2018-07-04 5298 u32 portid, u32 seq, int flags)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5299 {
45f05def5c44c8 Moshe Shemesh 2018-07-04 5300 union devlink_param_value param_value[DEVLINK_PARAM_CMODE_MAX + 1];
7c62cfb8c5744b Jiri Pirko 2019-02-07 5301 bool param_value_set[DEVLINK_PARAM_CMODE_MAX + 1] = {};
45f05def5c44c8 Moshe Shemesh 2018-07-04 5302 const struct devlink_param *param = param_item->param;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5303 struct devlink_param_gset_ctx ctx;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5304 struct nlattr *param_values_list;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5305 struct nlattr *param_attr;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5306 int nla_type;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5307 void *hdr;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5308 int err;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5309 int i;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5310
45f05def5c44c8 Moshe Shemesh 2018-07-04 5311 /* Get value from driver part to driverinit configuration mode */
45f05def5c44c8 Moshe Shemesh 2018-07-04 5312 for (i = 0; i <= DEVLINK_PARAM_CMODE_MAX; i++) {
45f05def5c44c8 Moshe Shemesh 2018-07-04 5313 if (!devlink_param_cmode_is_supported(param, i))
45f05def5c44c8 Moshe Shemesh 2018-07-04 5314 continue;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5315 if (i == DEVLINK_PARAM_CMODE_DRIVERINIT) {
45f05def5c44c8 Moshe Shemesh 2018-07-04 5316 if (!param_item->driverinit_value_valid)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5317 return -EOPNOTSUPP;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5318 param_value[i] = param_item->driverinit_value;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5319 } else {
45f05def5c44c8 Moshe Shemesh 2018-07-04 5320 ctx.cmode = i;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5321 err = devlink_param_get(devlink, param, &ctx);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5322 if (err)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5323 return err;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5324 param_value[i] = ctx.val;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5325 }
7c62cfb8c5744b Jiri Pirko 2019-02-07 5326 param_value_set[i] = true;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5327 }
45f05def5c44c8 Moshe Shemesh 2018-07-04 5328
45f05def5c44c8 Moshe Shemesh 2018-07-04 5329 hdr = genlmsg_put(msg, portid, seq, &devlink_nl_family, flags, cmd);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5330 if (!hdr)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5331 return -EMSGSIZE;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5332
45f05def5c44c8 Moshe Shemesh 2018-07-04 5333 if (devlink_nl_put_handle(msg, devlink))
45f05def5c44c8 Moshe Shemesh 2018-07-04 5334 goto genlmsg_cancel;
f4601dee25d5fe Vasundhara Volam 2019-01-28 5335
c1e5786d6771c6 Vasundhara Volam 2019-01-28 5336 if (cmd == DEVLINK_CMD_PORT_PARAM_GET ||
c1e5786d6771c6 Vasundhara Volam 2019-01-28 5337 cmd == DEVLINK_CMD_PORT_PARAM_NEW ||
c1e5786d6771c6 Vasundhara Volam 2019-01-28 5338 cmd == DEVLINK_CMD_PORT_PARAM_DEL)
f4601dee25d5fe Vasundhara Volam 2019-01-28 5339 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_INDEX, port_index))
f4601dee25d5fe Vasundhara Volam 2019-01-28 5340 goto genlmsg_cancel;
f4601dee25d5fe Vasundhara Volam 2019-01-28 5341
ae0be8de9a53cd Michal Kubecek 2019-04-26 5342 param_attr = nla_nest_start_noflag(msg, DEVLINK_ATTR_PARAM);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5343 if (!param_attr)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5344 goto genlmsg_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5345 if (nla_put_string(msg, DEVLINK_ATTR_PARAM_NAME, param->name))
45f05def5c44c8 Moshe Shemesh 2018-07-04 5346 goto param_nest_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5347 if (param->generic && nla_put_flag(msg, DEVLINK_ATTR_PARAM_GENERIC))
45f05def5c44c8 Moshe Shemesh 2018-07-04 5348 goto param_nest_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5349
45f05def5c44c8 Moshe Shemesh 2018-07-04 5350 nla_type = devlink_param_type_to_nla_type(param->type);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5351 if (nla_type < 0)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5352 goto param_nest_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5353 if (nla_put_u8(msg, DEVLINK_ATTR_PARAM_TYPE, nla_type))
45f05def5c44c8 Moshe Shemesh 2018-07-04 5354 goto param_nest_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5355
ae0be8de9a53cd Michal Kubecek 2019-04-26 5356 param_values_list = nla_nest_start_noflag(msg,
ae0be8de9a53cd Michal Kubecek 2019-04-26 5357 DEVLINK_ATTR_PARAM_VALUES_LIST);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5358 if (!param_values_list)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5359 goto param_nest_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5360
45f05def5c44c8 Moshe Shemesh 2018-07-04 5361 for (i = 0; i <= DEVLINK_PARAM_CMODE_MAX; i++) {
7c62cfb8c5744b Jiri Pirko 2019-02-07 5362 if (!param_value_set[i])
45f05def5c44c8 Moshe Shemesh 2018-07-04 5363 continue;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5364 err = devlink_nl_param_value_fill_one(msg, param->type,
45f05def5c44c8 Moshe Shemesh 2018-07-04 5365 i, param_value[i]);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5366 if (err)
45f05def5c44c8 Moshe Shemesh 2018-07-04 5367 goto values_list_nest_cancel;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5368 }
45f05def5c44c8 Moshe Shemesh 2018-07-04 5369
45f05def5c44c8 Moshe Shemesh 2018-07-04 5370 nla_nest_end(msg, param_values_list);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5371 nla_nest_end(msg, param_attr);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5372 genlmsg_end(msg, hdr);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5373 return 0;
45f05def5c44c8 Moshe Shemesh 2018-07-04 5374
45f05def5c44c8 Moshe Shemesh 2018-07-04 5375 values_list_nest_cancel:
45f05def5c44c8 Moshe Shemesh 2018-07-04 5376 nla_nest_end(msg, param_values_list);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5377 param_nest_cancel:
45f05def5c44c8 Moshe Shemesh 2018-07-04 5378 nla_nest_cancel(msg, param_attr);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5379 genlmsg_cancel:
45f05def5c44c8 Moshe Shemesh 2018-07-04 5380 genlmsg_cancel(msg, hdr);
45f05def5c44c8 Moshe Shemesh 2018-07-04 5381 return -EMSGSIZE;
45f05def5c44c8 Moshe Shemesh 2018-07-04 @5382 }
45f05def5c44c8 Moshe Shemesh 2018-07-04 5383

--
0-DAY CI Kernel Test Service
https://01.org/lkp