[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108050950.8asuOx46-lkp@intel.com>
Date: Thu, 5 Aug 2021 14:37:35 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, Subbaraya Sundeep <sbhatta@...vell.com>
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
Sunil Kovvuri Goutham <sgoutham@...vell.com>
Subject: drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c:363
otx2_tc_parse_actions() error: uninitialized symbol 'rate'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 251a1524293d0a90c4d5060f65f42a3016280049
commit: 68fbff68dbea35f9e6f7649dd22fce492a5aedac octeontx2-pf: Add police action for TC flower
config: ia64-randconfig-m031-20210804 (attached as .config)
compiler: ia64-linux-gcc (GCC) 10.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
New smatch warnings:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c:363 otx2_tc_parse_actions() error: uninitialized symbol 'rate'.
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c:363 otx2_tc_parse_actions() error: uninitialized symbol 'burst'.
Old smatch warnings:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c:364 otx2_tc_parse_actions() error: uninitialized symbol 'pps'.
vim +/rate +363 drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 279 static int otx2_tc_parse_actions(struct otx2_nic *nic,
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 280 struct flow_action *flow_action,
5d2fdd86d517350 Subbaraya Sundeep 2021-06-15 281 struct npc_install_flow_req *req,
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 282 struct flow_cls_offload *f,
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 283 struct otx2_tc_flow *node)
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 284 {
5d2fdd86d517350 Subbaraya Sundeep 2021-06-15 285 struct netlink_ext_ack *extack = f->common.extack;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 286 struct flow_action_entry *act;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 287 struct net_device *target;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 288 struct otx2_nic *priv;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 289 u32 burst, mark = 0;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 290 u8 nr_police = 0;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 291 bool pps;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 292 u64 rate;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 293 int i;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 294
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 295 if (!flow_action_has_entries(flow_action)) {
5d2fdd86d517350 Subbaraya Sundeep 2021-06-15 296 NL_SET_ERR_MSG_MOD(extack, "no tc actions specified");
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 297 return -EINVAL;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 298 }
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 299
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 300 flow_action_for_each(i, act, flow_action) {
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 301 switch (act->id) {
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 302 case FLOW_ACTION_DROP:
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 303 req->op = NIX_RX_ACTIONOP_DROP;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 304 return 0;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 305 case FLOW_ACTION_ACCEPT:
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 306 req->op = NIX_RX_ACTION_DEFAULT;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 307 return 0;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 308 case FLOW_ACTION_REDIRECT_INGRESS:
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 309 target = act->dev;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 310 priv = netdev_priv(target);
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 311 /* npc_install_flow_req doesn't support passing a target pcifunc */
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 312 if (rvu_get_pf(nic->pcifunc) != rvu_get_pf(priv->pcifunc)) {
5d2fdd86d517350 Subbaraya Sundeep 2021-06-15 313 NL_SET_ERR_MSG_MOD(extack,
5d2fdd86d517350 Subbaraya Sundeep 2021-06-15 314 "can't redirect to other pf/vf");
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 315 return -EOPNOTSUPP;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 316 }
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 317 req->vf = priv->pcifunc & RVU_PFVF_FUNC_MASK;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 318 req->op = NIX_RX_ACTION_DEFAULT;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 319 return 0;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 320 case FLOW_ACTION_VLAN_POP:
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 321 req->vtag0_valid = true;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 322 /* use RX_VTAG_TYPE7 which is initialized to strip vlan tag */
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 323 req->vtag0_type = NIX_AF_LFX_RX_VTAG_TYPE7;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 324 break;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 325 case FLOW_ACTION_POLICE:
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 326 /* Ingress ratelimiting is not supported on OcteonTx2 */
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 327 if (is_dev_otx2(nic->pdev)) {
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 328 NL_SET_ERR_MSG_MOD(extack,
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 329 "Ingress policing not supported on this platform");
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 330 return -EOPNOTSUPP;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 331 }
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 332
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 333 if (act->police.rate_bytes_ps > 0) {
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 334 rate = act->police.rate_bytes_ps * 8;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 335 burst = act->police.burst;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 336 } else if (act->police.rate_pkt_ps > 0) {
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 337 /* The algorithm used to calculate rate
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 338 * mantissa, exponent values for a given token
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 339 * rate (token can be byte or packet) requires
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 340 * token rate to be mutiplied by 8.
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 341 */
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 342 rate = act->police.rate_pkt_ps * 8;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 343 burst = act->police.burst_pkt;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 344 pps = true;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 345 }
Smatch is complaining that maybe both these conditions are false.
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 346 nr_police++;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 347 break;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 348 case FLOW_ACTION_MARK:
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 349 mark = act->mark;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 350 break;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 351 default:
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 352 return -EOPNOTSUPP;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 353 }
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 354 }
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 355
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 356 if (nr_police > 1) {
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 357 NL_SET_ERR_MSG_MOD(extack,
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 358 "rate limit police offload requires a single action");
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 359 return -EOPNOTSUPP;
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 360 }
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 361
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 362 if (nr_police)
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 @363 return otx2_tc_act_set_police(nic, node, f, rate, burst,
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 364 mark, req, pps);
68fbff68dbea35f Subbaraya Sundeep 2021-06-15 365
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 366 return 0;
1d4d9e42c2406bc Naveen Mamindlapalli 2021-03-18 367 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists