public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Kubiak <michal.kubiak@intel.com>
To: Suman Ghosh <sumang@marvell.com>
Cc: <sgoutham@marvell.com>, <gakula@marvell.com>,
	<sbhatta@marvell.com>, <hkelam@marvell.com>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [net PATCH V4] octeontx2-pf: Add additional check for MCAM rules
Date: Fri, 7 Jul 2023 21:01:41 +0200	[thread overview]
Message-ID: <ZKhhFeKmxlN3hFYD@localhost.localdomain> (raw)
In-Reply-To: <20230707035321.2227742-1-sumang@marvell.com>

On Fri, Jul 07, 2023 at 09:23:21AM +0530, Suman Ghosh wrote:
> Due to hardware limitation, MCAM drop rule with
> ether_type == 802.1Q and vlan_id == 0 is not supported. Hence rejecting
> such rules.
> 
> Fixes: dce677da57c0 ("octeontx2-pf: Add vlan-etype to ntuple filters")
> Signed-off-by: Suman Ghosh <sumang@marvell.com>

(...)

> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
> @@ -604,6 +604,19 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node,
>  			return -EOPNOTSUPP;
>  		}
>  
> +		if (!match.mask->vlan_id) {
> +			struct flow_action_entry *act;
> +			int i;
> +
> +			flow_action_for_each(i, act, &rule->action) {
> +				if (act->id == FLOW_ACTION_DROP) {
> +					netdev_err(nic->netdev, "vlan tpid 0x%x with vlan_id %d is not supported for DROP rule.\n",
> +						   ntohs(match.key->vlan_tpid), match.key->vlan_id);
> +					return -EOPNOTSUPP;

The code got very nested here.
Please consider moving the above check to a separate helper function,
or at least reformatting the error log to fix the checkpatch warning about
80 chars, for example:

			flow_action_for_each(i, act, &rule->action) {
				if (act->id == FLOW_ACTION_DROP) {
					netdev_err(nic->netdev,
						   "vlan tpid 0x%x with vlan_id %d is not supported for DROP rule.\n",
						   ntohs(match.key->vlan_tpid),
						   match.key->vlan_id);
					return -EOPNOTSUPP;
				}

Thanks,
Michal

  reply	other threads:[~2023-07-07 19:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07  3:53 [net PATCH V4] octeontx2-pf: Add additional check for MCAM rules Suman Ghosh
2023-07-07 19:01 ` Michal Kubiak [this message]
2023-07-10 10:28   ` [EXT] " Suman Ghosh

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=ZKhhFeKmxlN3hFYD@localhost.localdomain \
    --to=michal.kubiak@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=sumang@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