Skip to content

Commit b747923

Browse files
rkannoth1kuba-moo
authored andcommitted
octeontx2-af: Exact match support
CN10KB silicon has support for exact match table. This table can be used to match maimum 64 bit value of KPU parsed output. Hit/non hit in exact match table can be used as a KEX key to NPC mcam. This patch makes use of Exact match table to increase number of DMAC filters supported. NPC mcam is no more need for each of these DMAC entries as will be populated in Exact match table. This patch implements following 1. Initialization of exact match table only for CN10KB. 2. Add/del/update interface function for exact match table. Signed-off-by: Ratheesh Kannoth <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 56d9f5f commit b747923

File tree

6 files changed

+1029
-1
lines changed

6 files changed

+1029
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/af/npc.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,22 @@ struct nix_rx_action {
388388
#endif
389389
};
390390

391+
/* NPC_AF_INTFX_KEX_CFG field masks */
392+
#define NPC_EXACT_NIBBLE_START 40
393+
#define NPC_EXACT_NIBBLE_END 43
394+
#define NPC_EXACT_NIBBLE GENMASK_ULL(43, 40)
395+
396+
/* NPC_EXACT_KEX_S nibble definitions for each field */
397+
#define NPC_EXACT_NIBBLE_HIT BIT_ULL(40)
398+
#define NPC_EXACT_NIBBLE_OPC BIT_ULL(40)
399+
#define NPC_EXACT_NIBBLE_WAY BIT_ULL(40)
400+
#define NPC_EXACT_NIBBLE_INDEX GENMASK_ULL(43, 41)
401+
402+
#define NPC_EXACT_RESULT_HIT BIT_ULL(0)
403+
#define NPC_EXACT_RESULT_OPC GENMASK_ULL(2, 1)
404+
#define NPC_EXACT_RESULT_WAY GENMASK_ULL(4, 3)
405+
#define NPC_EXACT_RESULT_IDX GENMASK_ULL(15, 5)
406+
391407
/* NPC_AF_INTFX_KEX_CFG field masks */
392408
#define NPC_PARSE_NIBBLE GENMASK_ULL(30, 0)
393409

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "ptp.h"
1919

2020
#include "rvu_trace.h"
21+
#include "rvu_npc_hash.h"
2122

2223
#define DRV_NAME "rvu_af"
2324
#define DRV_STRING "Marvell OcteonTX2 RVU Admin Function Driver"
@@ -69,6 +70,7 @@ static void rvu_setup_hw_capabilities(struct rvu *rvu)
6970
hw->cap.nix_rx_multicast = true;
7071
hw->cap.nix_shaper_toggle_wait = false;
7172
hw->cap.npc_hash_extract = false;
73+
hw->cap.npc_exact_match_enabled = false;
7274
hw->rvu = rvu;
7375

7476
if (is_rvu_pre_96xx_C0(rvu)) {

drivers/net/ethernet/marvell/octeontx2/af/rvu.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ struct hw_cap {
339339
bool programmable_chans; /* Channels programmable ? */
340340
bool ipolicer;
341341
bool npc_hash_extract; /* Hash extract enabled ? */
342+
bool npc_exact_match_enabled; /* Exact match supported ? */
342343
};
343344

344345
struct rvu_hwinfo {
@@ -370,6 +371,7 @@ struct rvu_hwinfo {
370371
struct rvu *rvu;
371372
struct npc_pkind pkind;
372373
struct npc_mcam mcam;
374+
struct npc_exact_table *table;
373375
};
374376

375377
struct mbox_wq_info {
@@ -767,7 +769,6 @@ u32 convert_dwrr_mtu_to_bytes(u8 dwrr_mtu);
767769
u32 convert_bytes_to_dwrr_mtu(u32 bytes);
768770

769771
/* NPC APIs */
770-
int rvu_npc_init(struct rvu *rvu);
771772
void rvu_npc_freemem(struct rvu *rvu);
772773
int rvu_npc_get_pkind(struct rvu *rvu, u16 pf);
773774
void rvu_npc_set_pkind(struct rvu *rvu, int pkind, struct rvu_pfvf *pfvf);
@@ -786,6 +787,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
786787
u64 chan);
787788
void rvu_npc_enable_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
788789
bool enable);
790+
789791
void npc_enadis_default_mce_entry(struct rvu *rvu, u16 pcifunc,
790792
int nixlf, int type, bool enable);
791793
void rvu_npc_disable_mcam_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
@@ -794,6 +796,7 @@ void rvu_npc_disable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
794796
void rvu_npc_enable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
795797
void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
796798
int group, int alg_idx, int mcam_index);
799+
797800
void rvu_npc_get_mcam_entry_alloc_info(struct rvu *rvu, u16 pcifunc,
798801
int blkaddr, int *alloc_cnt,
799802
int *enable_cnt);
@@ -828,6 +831,10 @@ int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
828831
int type);
829832
bool is_mcam_entry_enabled(struct rvu *rvu, struct npc_mcam *mcam, int blkaddr,
830833
int index);
834+
int rvu_npc_init(struct rvu *rvu);
835+
int npc_install_mcam_drop_rule(struct rvu *rvu, int mcam_idx, u16 *counter_idx,
836+
u64 chan_val, u64 chan_mask, u64 exact_val, u64 exact_mask,
837+
u64 bcast_mcast_val, u64 bcast_mcast_mask);
831838

832839
/* CPT APIs */
833840
int rvu_cpt_register_interrupts(struct rvu *rvu);

0 commit comments

Comments
 (0)