Skip to content

Commit 616920a

Browse files
committed
Merge branch 'octeon-npc-fixes'
Subbaraya Sundeep says: ==================== octeontx2-af: Miscellaneous fixes in npc This patchset consists of consolidated fixes in rvu_npc file. Two of the patches prevent infinite loop which can happen in corner cases. One patch is for fixing static code analyzer reported issues. And the last patch is a minor change in npc protocol checker hardware block to report ipv4 checksum errors as a known error codes. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents dc56ad7 + 1e4428b commit 616920a

File tree

1 file changed

+12
-10
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+12
-10
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#define RSVD_MCAM_ENTRIES_PER_NIXLF 1 /* Ucast for LFs */
2121

2222
#define NPC_PARSE_RESULT_DMAC_OFFSET 8
23-
#define NPC_HW_TSTAMP_OFFSET 8
23+
#define NPC_HW_TSTAMP_OFFSET 8ULL
2424
#define NPC_KEX_CHAN_MASK 0xFFFULL
2525
#define NPC_KEX_PF_FUNC_MASK 0xFFFFULL
2626

@@ -915,7 +915,7 @@ void rvu_npc_enable_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
915915
static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
916916
int blkaddr, u16 pcifunc, u64 rx_action)
917917
{
918-
int actindex, index, bank;
918+
int actindex, index, bank, entry;
919919
bool enable;
920920

921921
if (!(pcifunc & RVU_PFVF_FUNC_MASK))
@@ -926,7 +926,7 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
926926
if (mcam->entry2target_pffunc[index] == pcifunc) {
927927
bank = npc_get_bank(mcam, index);
928928
actindex = index;
929-
index &= (mcam->banksize - 1);
929+
entry = index & (mcam->banksize - 1);
930930

931931
/* read vf flow entry enable status */
932932
enable = is_mcam_entry_enabled(rvu, mcam, blkaddr,
@@ -936,7 +936,7 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
936936
false);
937937
/* update 'action' */
938938
rvu_write64(rvu, blkaddr,
939-
NPC_AF_MCAMEX_BANKX_ACTION(index, bank),
939+
NPC_AF_MCAMEX_BANKX_ACTION(entry, bank),
940940
rx_action);
941941
if (enable)
942942
npc_enable_mcam_entry(rvu, mcam, blkaddr,
@@ -2020,14 +2020,15 @@ int rvu_npc_init(struct rvu *rvu)
20202020

20212021
/* Enable below for Rx pkts.
20222022
* - Outer IPv4 header checksum validation.
2023-
* - Detect outer L2 broadcast address and set NPC_RESULT_S[L2M].
2023+
* - Detect outer L2 broadcast address and set NPC_RESULT_S[L2B].
2024+
* - Detect outer L2 multicast address and set NPC_RESULT_S[L2M].
20242025
* - Inner IPv4 header checksum validation.
20252026
* - Set non zero checksum error code value
20262027
*/
20272028
rvu_write64(rvu, blkaddr, NPC_AF_PCK_CFG,
20282029
rvu_read64(rvu, blkaddr, NPC_AF_PCK_CFG) |
2029-
BIT_ULL(32) | BIT_ULL(24) | BIT_ULL(6) |
2030-
BIT_ULL(2) | BIT_ULL(1));
2030+
((u64)NPC_EC_OIP4_CSUM << 32) | (NPC_EC_IIP4_CSUM << 24) |
2031+
BIT_ULL(7) | BIT_ULL(6) | BIT_ULL(2) | BIT_ULL(1));
20312032

20322033
rvu_npc_setup_interfaces(rvu, blkaddr);
20332034

@@ -2154,7 +2155,7 @@ static void npc_unmap_mcam_entry_and_cntr(struct rvu *rvu,
21542155
int blkaddr, u16 entry, u16 cntr)
21552156
{
21562157
u16 index = entry & (mcam->banksize - 1);
2157-
u16 bank = npc_get_bank(mcam, entry);
2158+
u32 bank = npc_get_bank(mcam, entry);
21582159

21592160
/* Remove mapping and reduce counter's refcnt */
21602161
mcam->entry2cntr_map[entry] = NPC_MCAM_INVALID_MAP;
@@ -2777,8 +2778,8 @@ int rvu_mbox_handler_npc_mcam_shift_entry(struct rvu *rvu,
27772778
struct npc_mcam *mcam = &rvu->hw->mcam;
27782779
u16 pcifunc = req->hdr.pcifunc;
27792780
u16 old_entry, new_entry;
2781+
int blkaddr, rc = 0;
27802782
u16 index, cntr;
2781-
int blkaddr, rc;
27822783

27832784
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
27842785
if (blkaddr < 0)
@@ -2979,10 +2980,11 @@ int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu,
29792980
index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry);
29802981
if (index >= mcam->bmap_entries)
29812982
break;
2983+
entry = index + 1;
2984+
29822985
if (mcam->entry2cntr_map[index] != req->cntr)
29832986
continue;
29842987

2985-
entry = index + 1;
29862988
npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr,
29872989
index, req->cntr);
29882990
}

0 commit comments

Comments
 (0)