Skip to contentSkip to conversation

octeontx2-pf: Add police action for TC flower

bug report Dan Carpenter 1 participant 1 message Jun 18, 2021 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Subbaraya Sundeep,

The patch 68fbff68dbea: "octeontx2-pf: Add police action for TC flower" from Jun 15, 2021, leads to the following static checker warning:

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'. drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c:364 otx2_tc_parse_actions() error: uninitialized symbol 'pps'.

drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
325 case FLOW_ACTION_POLICE:
326 /* Ingress ratelimiting is not supported on OcteonTx2 */
327 if (is_dev_otx2(nic->pdev)) {
328 NL_SET_ERR_MSG_MOD(extack,
329 "Ingress policing not supported on this platform");
330 return -EOPNOTSUPP;
331 }
332
333 if (act->police.rate_bytes_ps > 0) {
334 rate = act->police.rate_bytes_ps * 8;
335 burst = act->police.burst;
336 } else if (act->police.rate_pkt_ps > 0) {
337 /* The algorithm used to calculate rate

   338                                   * mantissa, exponent values for a given token
   339                                   * rate (token can be byte or packet) requires
   340                                   * token rate to be mutiplied by 8.
   341                                   */
   342                                  rate = act->police.rate_pkt_ps * 8;
   343                                  burst = act->police.burst_pkt;
   344                                  pps = true;

345 }

Maybe:

	else {
		return -EINVAL;
	}

346 nr_police++;
347 break;
348 case FLOW_ACTION_MARK:
349 mark = act->mark;
350 break;
351 default:
352 return -EOPNOTSUPP;
353 }
354 }
355
356 if (nr_police > 1) {
357 NL_SET_ERR_MSG_MOD(extack,
358 "rate limit police offload requires a single action");
359 return -EOPNOTSUPP;
360 }
361
362 if (nr_police)
363 return otx2_tc_act_set_police(nic, node, f, rate, burst,
364 mark, req, pps);
365
366 return 0;
367 }

regards,
dan carpenter