public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Kubiak <michal.kubiak@intel.com>
To: Srujana Challa <schalla@marvell.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<kuba@kernel.org>, <davem@davemloft.net>, <pabeni@redhat.com>,
	<sgoutham@marvell.com>, <lcherian@marvell.com>,
	<gakula@marvell.com>, <jerinj@marvell.com>, <hkelam@marvell.com>,
	<sbhatta@marvell.com>,
	"Nithin Dabilpuram" <ndabilpuram@marvell.com>
Subject: Re: [PATCH net,1/6] octeontx2-af: replace cpt slot with lf id on reg write
Date: Tue, 2 Jul 2024 14:54:32 +0200	[thread overview]
Message-ID: <ZoP4iG30sr9lZohg@localhost.localdomain> (raw)
In-Reply-To: <20240701090746.2171565-2-schalla@marvell.com>

On Mon, Jul 01, 2024 at 02:37:41PM +0530, Srujana Challa wrote:
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> Replace cpt slot id with lf id on reg read/write as
> CPTPF/VF driver would send slot number instead of lf id
> in the reg offset.
> 
> Fixes: ae454086e3c2 ("octeontx2-af: add mailbox interface for CPT")
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
> index f047185f38e0..98440a0241a2 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c
> @@ -663,6 +663,8 @@ static bool is_valid_offset(struct rvu *rvu, struct cpt_rd_wr_reg_msg *req)
>  		if (lf < 0)
>  			return false;
>  
> +		req->reg_offset &= 0xFF000;
> +		req->reg_offset += lf << 3;

I think it's not great to modify an input parameter from the function
named like "is_valid_offset()". From the function like that I would
rather expect doing just a simple check if the parameter is correct.
It seems calling that function from a different context can be risky
now.

>  		return true;
>  	} else if (!(req->hdr.pcifunc & RVU_PFVF_FUNC_MASK)) {
>  		/* Registers that can be accessed from PF */
> @@ -707,12 +709,13 @@ int rvu_mbox_handler_cpt_rd_wr_register(struct rvu *rvu,
>  	    !is_cpt_vf(rvu, req->hdr.pcifunc))
>  		return CPT_AF_ERR_ACCESS_DENIED;
>  
> +	if (!is_valid_offset(rvu, req))
> +		return CPT_AF_ERR_ACCESS_DENIED;
> +
>  	rsp->reg_offset = req->reg_offset;
>  	rsp->ret_val = req->ret_val;
>  	rsp->is_write = req->is_write;
>  
> -	if (!is_valid_offset(rvu, req))
> -		return CPT_AF_ERR_ACCESS_DENIED;

Is moving that call also a necessary part of the fix? Or is it just an extra
improvement?
Maybe it's worth mentioning in the commit message?

>  
>  	if (req->is_write)
>  		rvu_write64(rvu, blkaddr, req->reg_offset, req->val);
> -- 
> 2.25.1
> 
> 


Thanks,
Michal

  reply	other threads:[~2024-07-02 12:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  9:07 [PATCH net,0/6] Fixes for CPT and RSS configuration Srujana Challa
2024-07-01  9:07 ` [PATCH net,1/6] octeontx2-af: replace cpt slot with lf id on reg write Srujana Challa
2024-07-02 12:54   ` Michal Kubiak [this message]
2024-07-09 10:56     ` [EXTERNAL] " Srujana Challa
2024-07-01  9:07 ` [PATCH net,2/6] octeontx2-af: reduce cpt flt interrupt vectors for cn10kb Srujana Challa
2024-07-02 10:28   ` Simon Horman
2024-07-09 11:20     ` [EXTERNAL] " Srujana Challa
2024-07-01  9:07 ` [PATCH net,3/6] Fix CPT_LF_ALLOC mailbox error due to incompatible mailbox message format Srujana Challa
2024-07-02  3:58   ` Kalesh Anakkur Purayil
2024-07-01  9:07 ` [PATCH net,4/6] octeontx2-af: Fix issue with IPv6 ext match for RSS Srujana Challa
2024-07-02  3:57   ` Kalesh Anakkur Purayil
2024-07-01  9:07 ` [PATCH net,5/6] octeontx2-af: fix issue with IPv4 " Srujana Challa
2024-07-01  9:07 ` [PATCH net,6/6] octeontx2-af: fix detection of IP layer Srujana Challa

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=ZoP4iG30sr9lZohg@localhost.localdomain \
    --to=michal.kubiak@intel.com \
    --cc=davem@davemloft.net \
    --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=ndabilpuram@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=schalla@marvell.com \
    --cc=sgoutham@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