public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sbhatta@marvell.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] octeontx2-pf: Add police action for TC flower
Date: Fri, 18 Jun 2021 12:17:42 +0300	[thread overview]
Message-ID: <YMxktv1mY74cOjTN@mwanda> (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

                 reply	other threads:[~2021-06-18  9:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMxktv1mY74cOjTN@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=sbhatta@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox