kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] octeontx2-pf: Add police action for TC flower
@ 2021-06-18  9:17 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-06-18  9:17 UTC (permalink / raw)
  To: sbhatta; +Cc: kernel-janitors

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-18  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  9:17 [bug report] octeontx2-pf: Add police action for TC flower Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).