Commit 616920a6 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents dc56ad70 1e4428b6
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define RSVD_MCAM_ENTRIES_PER_NIXLF 1 /* Ucast for LFs */ #define RSVD_MCAM_ENTRIES_PER_NIXLF 1 /* Ucast for LFs */
#define NPC_PARSE_RESULT_DMAC_OFFSET 8 #define NPC_PARSE_RESULT_DMAC_OFFSET 8
#define NPC_HW_TSTAMP_OFFSET 8 #define NPC_HW_TSTAMP_OFFSET 8ULL
#define NPC_KEX_CHAN_MASK 0xFFFULL #define NPC_KEX_CHAN_MASK 0xFFFULL
#define NPC_KEX_PF_FUNC_MASK 0xFFFFULL #define NPC_KEX_PF_FUNC_MASK 0xFFFFULL
...@@ -915,7 +915,7 @@ void rvu_npc_enable_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf, ...@@ -915,7 +915,7 @@ void rvu_npc_enable_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
int blkaddr, u16 pcifunc, u64 rx_action) int blkaddr, u16 pcifunc, u64 rx_action)
{ {
int actindex, index, bank; int actindex, index, bank, entry;
bool enable; bool enable;
if (!(pcifunc & RVU_PFVF_FUNC_MASK)) if (!(pcifunc & RVU_PFVF_FUNC_MASK))
...@@ -926,7 +926,7 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -926,7 +926,7 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
if (mcam->entry2target_pffunc[index] == pcifunc) { if (mcam->entry2target_pffunc[index] == pcifunc) {
bank = npc_get_bank(mcam, index); bank = npc_get_bank(mcam, index);
actindex = index; actindex = index;
index &= (mcam->banksize - 1); entry = index & (mcam->banksize - 1);
/* read vf flow entry enable status */ /* read vf flow entry enable status */
enable = is_mcam_entry_enabled(rvu, mcam, blkaddr, 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, ...@@ -936,7 +936,7 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
false); false);
/* update 'action' */ /* update 'action' */
rvu_write64(rvu, blkaddr, rvu_write64(rvu, blkaddr,
NPC_AF_MCAMEX_BANKX_ACTION(index, bank), NPC_AF_MCAMEX_BANKX_ACTION(entry, bank),
rx_action); rx_action);
if (enable) if (enable)
npc_enable_mcam_entry(rvu, mcam, blkaddr, npc_enable_mcam_entry(rvu, mcam, blkaddr,
...@@ -2020,14 +2020,15 @@ int rvu_npc_init(struct rvu *rvu) ...@@ -2020,14 +2020,15 @@ int rvu_npc_init(struct rvu *rvu)
/* Enable below for Rx pkts. /* Enable below for Rx pkts.
* - Outer IPv4 header checksum validation. * - Outer IPv4 header checksum validation.
* - Detect outer L2 broadcast address and set NPC_RESULT_S[L2M]. * - Detect outer L2 broadcast address and set NPC_RESULT_S[L2B].
* - Detect outer L2 multicast address and set NPC_RESULT_S[L2M].
* - Inner IPv4 header checksum validation. * - Inner IPv4 header checksum validation.
* - Set non zero checksum error code value * - Set non zero checksum error code value
*/ */
rvu_write64(rvu, blkaddr, NPC_AF_PCK_CFG, rvu_write64(rvu, blkaddr, NPC_AF_PCK_CFG,
rvu_read64(rvu, blkaddr, NPC_AF_PCK_CFG) | rvu_read64(rvu, blkaddr, NPC_AF_PCK_CFG) |
BIT_ULL(32) | BIT_ULL(24) | BIT_ULL(6) | ((u64)NPC_EC_OIP4_CSUM << 32) | (NPC_EC_IIP4_CSUM << 24) |
BIT_ULL(2) | BIT_ULL(1)); BIT_ULL(7) | BIT_ULL(6) | BIT_ULL(2) | BIT_ULL(1));
rvu_npc_setup_interfaces(rvu, blkaddr); rvu_npc_setup_interfaces(rvu, blkaddr);
...@@ -2154,7 +2155,7 @@ static void npc_unmap_mcam_entry_and_cntr(struct rvu *rvu, ...@@ -2154,7 +2155,7 @@ static void npc_unmap_mcam_entry_and_cntr(struct rvu *rvu,
int blkaddr, u16 entry, u16 cntr) int blkaddr, u16 entry, u16 cntr)
{ {
u16 index = entry & (mcam->banksize - 1); u16 index = entry & (mcam->banksize - 1);
u16 bank = npc_get_bank(mcam, entry); u32 bank = npc_get_bank(mcam, entry);
/* Remove mapping and reduce counter's refcnt */ /* Remove mapping and reduce counter's refcnt */
mcam->entry2cntr_map[entry] = NPC_MCAM_INVALID_MAP; mcam->entry2cntr_map[entry] = NPC_MCAM_INVALID_MAP;
...@@ -2777,8 +2778,8 @@ int rvu_mbox_handler_npc_mcam_shift_entry(struct rvu *rvu, ...@@ -2777,8 +2778,8 @@ int rvu_mbox_handler_npc_mcam_shift_entry(struct rvu *rvu,
struct npc_mcam *mcam = &rvu->hw->mcam; struct npc_mcam *mcam = &rvu->hw->mcam;
u16 pcifunc = req->hdr.pcifunc; u16 pcifunc = req->hdr.pcifunc;
u16 old_entry, new_entry; u16 old_entry, new_entry;
int blkaddr, rc = 0;
u16 index, cntr; u16 index, cntr;
int blkaddr, rc;
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0); blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
if (blkaddr < 0) if (blkaddr < 0)
...@@ -2979,10 +2980,11 @@ int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu, ...@@ -2979,10 +2980,11 @@ int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu,
index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry); index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry);
if (index >= mcam->bmap_entries) if (index >= mcam->bmap_entries)
break; break;
entry = index + 1;
if (mcam->entry2cntr_map[index] != req->cntr) if (mcam->entry2cntr_map[index] != req->cntr)
continue; continue;
entry = index + 1;
npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr, npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr,
index, req->cntr); index, req->cntr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment