public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Suman Ghosh <sumang@marvell.com>
Cc: Wojciech Drewek <wojciech.drewek@intel.com>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	Geethasowjanya Akula <gakula@marvell.com>,
	Subbaraya Sundeep Bhatta <sbhatta@marvell.com>,
	Hariprasad Kelam <hkelam@marvell.com>,
	Linu Cherian <lcherian@marvell.com>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [EXT] Re: [net PATCH] octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx queue than its PF
Date: Tue, 21 Nov 2023 15:55:11 +0000	[thread overview]
Message-ID: <20231121155511.GC269041@kernel.org> (raw)
In-Reply-To: <SJ0PR18MB52164E2721E056366EC30139DBBBA@SJ0PR18MB5216.namprd18.prod.outlook.com>

On Tue, Nov 21, 2023 at 09:54:00AM +0000, Suman Ghosh wrote:
> >> Signed-off-by: Suman Ghosh <sumang@marvell.com>
> >> ---
> >>  .../marvell/octeontx2/nic/otx2_flows.c        | 21
> >+++++++++++++++++++
> >>  1 file changed, 21 insertions(+)
> >>
> >> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> >> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> >> index 4762dbea64a1..4200f2d387f6 100644
> >> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> >> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
> >> @@ -1088,6 +1088,7 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct
> >ethtool_rxnfc *nfc)
> >>  	struct ethhdr *eth_hdr;
> >>  	bool new = false;
> >>  	int err = 0;
> >> +	u64 vf_num;
> >>  	u32 ring;
> >>
> >>  	if (!flow_cfg->max_flows) {
> >> @@ -1100,9 +1101,26 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct
> >ethtool_rxnfc *nfc)
> >>  	if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT))
> >>  		return -ENOMEM;
> >>
> >> +	/* Number of queues on a VF can be greater or less than
> >> +	 * the PF's queue. Hence no need to check for the
> >> +	 * queue count. Hence no need to check queue count if PF
> >> +	 * is installing for its VF. Below is the expected vf_num value
> >> +	 * based on the ethtool commands.
> >> +	 *
> >> +	 * e.g.
> >> +	 * 1. ethtool -U <netdev> ... action -1  ==> vf_num:255
> >> +	 * 2. ethtool -U <netdev> ... action <queue_num>  ==> vf_num:0
> >> +	 * 3. ethtool -U <netdev> ... vf <vf_idx> queue <queue_num>  ==>
> >> +	 *    vf_num:vf_idx+1
> >> +	 */
> >> +	vf_num = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
> >> +	if (!is_otx2_vf(pfvf->pcifunc) && vf_num)
> >> +		goto bypass_queue_check;
> >
> >Let's just add this condition to the next if, no need for goto.
> [Suman] I kept it a separate check to make the code more readable. Otherwise the next if condition will be complicated.

Readability is subjective, but, FWIIW, I'd also prefer
to avoid a goto here.

> >> +
> >>  	if (ring >= pfvf->hw.rx_queues && fsp->ring_cookie !=
> >RX_CLS_FLOW_DISC)
> >>  		return -EINVAL;
> >>
> >> +bypass_queue_check:
> >>  	if (fsp->location >= otx2_get_maxflows(flow_cfg))
> >>  		return -EINVAL;
> >>
> >> @@ -1182,6 +1200,9 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct
> >ethtool_rxnfc *nfc)
> >>  		flow_cfg->nr_flows++;
> >>  	}
> >>
> >> +	if (flow->is_vf)
> >> +		netdev_info(pfvf->netdev,
> >> +			    "Make sure that VF's queue number is within its queue
> >> +limit\n");
> >>  	return 0;
> >>  }
> >>

  reply	other threads:[~2023-11-21 15:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20  5:51 [net PATCH] octeontx2-pf: Fix ntuple rule creation to direct packet to VF with higher Rx queue than its PF Suman Ghosh
2023-11-20 12:02 ` Wojciech Drewek
2023-11-21  9:54   ` [EXT] " Suman Ghosh
2023-11-21 15:55     ` Simon Horman [this message]
2023-11-21 16:20       ` 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=20231121155511.GC269041@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --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 \
    --cc=wojciech.drewek@intel.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