2023-04-19 06:21:36

by Sai Krishna Gajula

[permalink] [raw]
Subject: [net PATCH v3 02/10] octeontx2-af: Fix start and end bit for scan config

From: Ratheesh Kannoth <[email protected]>

Fix the NPC nibble start and end positions in the bit
map. for_each_set_bit_from() needs start bit as one bit prior
and end bit as one bit post position in the bit map

Fixes: b747923afff8 ("octeontx2-af: Exact match support")
Signed-off-by: Ratheesh Kannoth <[email protected]>
Signed-off-by: Sunil Kovvuri Goutham <[email protected]>
Signed-off-by: Sai Krishna <[email protected]>
---
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
index 006beb5cf98d..27603078689a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
@@ -593,9 +593,8 @@ static int npc_scan_kex(struct rvu *rvu, int blkaddr, u8 intf)
* exact match code.
*/
masked_cfg = cfg & NPC_EXACT_NIBBLE;
- bitnr = NPC_EXACT_NIBBLE_START;
- for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg,
- NPC_EXACT_NIBBLE_START) {
+ bitnr = NPC_EXACT_NIBBLE_START - 1;
+ for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg, NPC_EXACT_NIBBLE_END + 1) {
npc_scan_exact_result(mcam, bitnr, key_nibble, intf);
key_nibble++;
}
--
2.25.1


2023-04-19 10:36:43

by Simon Horman

[permalink] [raw]
Subject: Re: [net PATCH v3 02/10] octeontx2-af: Fix start and end bit for scan config

On Wed, Apr 19, 2023 at 11:50:10AM +0530, Sai Krishna wrote:
> From: Ratheesh Kannoth <[email protected]>
>
> Fix the NPC nibble start and end positions in the bit
> map. for_each_set_bit_from() needs start bit as one bit prior
> and end bit as one bit post position in the bit map
>
> Fixes: b747923afff8 ("octeontx2-af: Exact match support")
> Signed-off-by: Ratheesh Kannoth <[email protected]>
> Signed-off-by: Sunil Kovvuri Goutham <[email protected]>
> Signed-off-by: Sai Krishna <[email protected]>

I think it would be nice to explain why, and what effect this has.

Also, TBH, I'm unsure why the start needs to be one bit prior.

> ---
> drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> index 006beb5cf98d..27603078689a 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> @@ -593,9 +593,8 @@ static int npc_scan_kex(struct rvu *rvu, int blkaddr, u8 intf)
> * exact match code.
> */
> masked_cfg = cfg & NPC_EXACT_NIBBLE;
> - bitnr = NPC_EXACT_NIBBLE_START;
> - for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg,
> - NPC_EXACT_NIBBLE_START) {
> + bitnr = NPC_EXACT_NIBBLE_START - 1;
> + for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg, NPC_EXACT_NIBBLE_END + 1) {
> npc_scan_exact_result(mcam, bitnr, key_nibble, intf);
> key_nibble++;
> }
> --
> 2.25.1
>

2023-04-20 07:48:43

by Sai Krishna Gajula

[permalink] [raw]
Subject: Re: [net PATCH v3 02/10] octeontx2-af: Fix start and end bit for scan config


> -----Original Message-----
> From: Simon Horman <[email protected]>
> Sent: Wednesday, April 19, 2023 4:05 PM
> To: Sai Krishna Gajula <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; Sunil Kovvuri Goutham
> <[email protected]>; Geethasowjanya Akula <[email protected]>;
> Linu Cherian <[email protected]>; Jerin Jacob Kollanukkaran
> <[email protected]>; Hariprasad Kelam <[email protected]>;
> Subbaraya Sundeep Bhatta <[email protected]>; Ratheesh Kannoth
> <[email protected]>
> Subject: Re: [net PATCH v3 02/10] octeontx2-af: Fix start and end bit for
> scan config
>
> On Wed, Apr 19, 2023 at 11:50:10AM +0530, Sai Krishna wrote:
> > From: Ratheesh Kannoth <[email protected]>
> >
> > Fix the NPC nibble start and end positions in the bit map.
> > for_each_set_bit_from() needs start bit as one bit prior and end bit
> > as one bit post position in the bit map
> >
> > Fixes: b747923afff8 ("octeontx2-af: Exact match support")
> > Signed-off-by: Ratheesh Kannoth <[email protected]>
> > Signed-off-by: Sunil Kovvuri Goutham <[email protected]>
> > Signed-off-by: Sai Krishna <[email protected]>
>
> I think it would be nice to explain why, and what effect this has.
>
> Also, TBH, I'm unsure why the start needs to be one bit prior.
>
Will expand the commit message with explanation of why, what effect of fix in v4 patch.

> > ---
> > drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> > b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> > index 006beb5cf98d..27603078689a 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
> > @@ -593,9 +593,8 @@ static int npc_scan_kex(struct rvu *rvu, int blkaddr,
> u8 intf)
> > * exact match code.
> > */
> > masked_cfg = cfg & NPC_EXACT_NIBBLE;
> > - bitnr = NPC_EXACT_NIBBLE_START;
> > - for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg,
> > - NPC_EXACT_NIBBLE_START) {
> > + bitnr = NPC_EXACT_NIBBLE_START - 1;
> > + for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg,
> > +NPC_EXACT_NIBBLE_END + 1) {
> > npc_scan_exact_result(mcam, bitnr, key_nibble, intf);
> > key_nibble++;
> > }
> > --
> > 2.25.1
> >