Commit b747923a authored by Ratheesh Kannoth's avatar Ratheesh Kannoth Committed by Jakub Kicinski
Browse files

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: default avatarRatheesh Kannoth <rkannoth@marvell.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 56d9f5fd
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -388,6 +388,22 @@ struct nix_rx_action {
#endif
};

/* NPC_AF_INTFX_KEX_CFG field masks */
#define NPC_EXACT_NIBBLE_START		40
#define NPC_EXACT_NIBBLE_END		43
#define NPC_EXACT_NIBBLE		GENMASK_ULL(43, 40)

/* NPC_EXACT_KEX_S nibble definitions for each field */
#define NPC_EXACT_NIBBLE_HIT		BIT_ULL(40)
#define NPC_EXACT_NIBBLE_OPC		BIT_ULL(40)
#define NPC_EXACT_NIBBLE_WAY		BIT_ULL(40)
#define NPC_EXACT_NIBBLE_INDEX		GENMASK_ULL(43, 41)

#define NPC_EXACT_RESULT_HIT		BIT_ULL(0)
#define NPC_EXACT_RESULT_OPC		GENMASK_ULL(2, 1)
#define NPC_EXACT_RESULT_WAY		GENMASK_ULL(4, 3)
#define NPC_EXACT_RESULT_IDX		GENMASK_ULL(15, 5)

/* NPC_AF_INTFX_KEX_CFG field masks */
#define NPC_PARSE_NIBBLE		GENMASK_ULL(30, 0)

+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "ptp.h"

#include "rvu_trace.h"
#include "rvu_npc_hash.h"

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

	if (is_rvu_pre_96xx_C0(rvu)) {
+8 −1
Original line number Diff line number Diff line
@@ -339,6 +339,7 @@ struct hw_cap {
	bool	programmable_chans; /* Channels programmable ? */
	bool	ipolicer;
	bool	npc_hash_extract; /* Hash extract enabled ? */
	bool	npc_exact_match_enabled; /* Exact match supported ? */
};

struct rvu_hwinfo {
@@ -370,6 +371,7 @@ struct rvu_hwinfo {
	struct rvu	 *rvu;
	struct npc_pkind pkind;
	struct npc_mcam  mcam;
	struct npc_exact_table *table;
};

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

/* NPC APIs */
int rvu_npc_init(struct rvu *rvu);
void rvu_npc_freemem(struct rvu *rvu);
int rvu_npc_get_pkind(struct rvu *rvu, u16 pf);
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,
				    u64 chan);
void rvu_npc_enable_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
				   bool enable);

void npc_enadis_default_mce_entry(struct rvu *rvu, u16 pcifunc,
				  int nixlf, int type, bool enable);
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);
void rvu_npc_enable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
				    int group, int alg_idx, int mcam_index);

void rvu_npc_get_mcam_entry_alloc_info(struct rvu *rvu, u16 pcifunc,
				       int blkaddr, int *alloc_cnt,
				       int *enable_cnt);
@@ -828,6 +831,10 @@ int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
			     int type);
bool is_mcam_entry_enabled(struct rvu *rvu, struct npc_mcam *mcam, int blkaddr,
			   int index);
int rvu_npc_init(struct rvu *rvu);
int npc_install_mcam_drop_rule(struct rvu *rvu, int mcam_idx, u16 *counter_idx,
			       u64 chan_val, u64 chan_mask, u64 exact_val, u64 exact_mask,
			       u64 bcast_mcast_val, u64 bcast_mcast_mask);

/* CPT APIs */
int rvu_cpt_register_interrupts(struct rvu *rvu);
+938 −0

File changed.

Preview size limit exceeded, changes collapsed.

+56 −0
Original line number Diff line number Diff line
@@ -129,4 +129,60 @@ static struct npc_mcam_kex_hash npc_mkex_hash_default __maybe_unused = {
	},
};

enum npc_exact_opc_type {
	NPC_EXACT_OPC_MEM,
	NPC_EXACT_OPC_CAM,
};

struct npc_exact_table_entry {
	struct list_head list;
	struct list_head glist;
	u32 seq_id;	/* Sequence number of entry */
	u32 index;	/* Mem table or cam table index */
	u32 mcam_idx;
		/* Mcam index. This is valid only if "cmd" field is false */
	enum npc_exact_opc_type opc_type;
	u16 chan;
	u16 pcifunc;
	u8 ways;
	u8 mac[ETH_ALEN];
	u8 ctype;
	u8 cgx_id;
	u8 lmac_id;
	bool cmd;	/* Is added by ethtool command ? */
};

struct npc_exact_table {
	struct mutex lock;	/* entries update lock */
	unsigned long *id_bmap;
	u32 tot_ids;
	struct {
		int ways;
		int depth;
		unsigned long *bmap;
		u64 mask;	// Masks before hash calculation.
		u16 hash_mask;	// 11 bits for hash mask
		u16 hash_offset; // 11 bits offset
	} mem_table;

	struct {
		int depth;
		unsigned long *bmap;
	} cam_table;
#define NPC_EXACT_TBL_MAX_WAYS 4

	struct list_head lhead_mem_tbl_entry[NPC_EXACT_TBL_MAX_WAYS];
	int mem_tbl_entry_cnt;

	struct list_head lhead_cam_tbl_entry;
	int cam_tbl_entry_cnt;

	struct list_head lhead_gbl;
};

bool rvu_npc_exact_has_match_table(struct rvu *rvu);
int rvu_npc_exact_del_table_entry_by_id(struct rvu *rvu, u32 seq_id);
u32 rvu_npc_exact_get_max_entries(struct rvu *rvu);
int rvu_npc_exact_init(struct rvu *rvu);

#endif /* RVU_NPC_HASH_H */
Loading