Commit f1656942 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'octeontx2-refactor'



Naveen Mamindlapalli says:

====================
refactor code related to npc install flow

This patchset refactors and cleans up the code associated with the
npc install flow API, specifically to eliminate different code paths
while installing MCAM rules by AF and PF. This makes the code easier
to understand and maintain. Also added support for multi channel NIX
promisc entry.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 930a3a62 058fa3d9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -605,6 +605,7 @@ enum nix_af_status {
	NIX_AF_INVAL_SSO_PF_FUNC    = -420,
	NIX_AF_ERR_TX_VTAG_NOSPC    = -421,
	NIX_AF_ERR_RX_VTAG_INUSE    = -422,
	NIX_AF_ERR_NPC_KEY_NOT_SUPP = -423,
};

/* For NIX RX vtag action  */
@@ -1141,6 +1142,7 @@ struct npc_install_flow_req {
	u64 features;
	u16 entry;
	u16 channel;
	u16 chan_mask;
	u8 intf;
	u8 set_cntr; /* If counter is available set counter for this entry ? */
	u8 default_rule;
+5 −0
Original line number Diff line number Diff line
@@ -420,6 +420,11 @@ struct nix_tx_action {
#define TX_VTAG1_LID_MASK		GENMASK_ULL(42, 40)
#define TX_VTAG1_RELPTR_MASK		GENMASK_ULL(39, 32)

/* NPC MCAM reserved entry index per nixlf */
#define NIXLF_UCAST_ENTRY	0
#define NIXLF_BCAST_ENTRY	1
#define NIXLF_PROMISC_ENTRY	2

struct npc_mcam_kex {
	/* MKEX Profle Header */
	u64 mkex_sign; /* "mcam-kex-profile" (8 bytes/ASCII characters) */
+13 −4
Original line number Diff line number Diff line
@@ -548,6 +548,12 @@ static inline int is_afvf(u16 pcifunc)
	return !(pcifunc & ~RVU_PFVF_FUNC_MASK);
}

/* check if PF_FUNC is AF */
static inline bool is_pffunc_af(u16 pcifunc)
{
	return !pcifunc;
}

static inline bool is_rvu_fwdata_valid(struct rvu *rvu)
{
	return (rvu->fwdata->header_magic == RVU_FWDATA_HEADER_MAGIC) &&
@@ -640,7 +646,8 @@ int npc_config_ts_kpuaction(struct rvu *rvu, int pf, u16 pcifunc, bool en);
void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
				 int nixlf, u64 chan, u8 *mac_addr);
void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
				   int nixlf, u64 chan, bool allmulti);
				   int nixlf, u64 chan, u8 chan_cnt,
				   bool allmulti);
void rvu_npc_disable_promisc_entry(struct rvu *rvu, u16 pcifunc, int nixlf);
void rvu_npc_enable_promisc_entry(struct rvu *rvu, u16 pcifunc, int nixlf);
void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc,
@@ -665,9 +672,6 @@ int rvu_npc_get_tx_nibble_cfg(struct rvu *rvu, u64 nibble_ena);
int npc_mcam_verify_channel(struct rvu *rvu, u16 pcifunc, u8 intf, u16 channel);
int npc_flow_steering_init(struct rvu *rvu, int blkaddr);
const char *npc_get_field_name(u8 hdr);
bool rvu_npc_write_default_rule(struct rvu *rvu, int blkaddr, int nixlf,
				u16 pcifunc, u8 intf, struct mcam_entry *entry,
				int *entry_index);
int npc_get_bank(struct npc_mcam *mcam, int index);
void npc_mcam_enable_flows(struct rvu *rvu, u16 target);
void npc_mcam_disable_flows(struct rvu *rvu, u16 target);
@@ -679,6 +683,11 @@ void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
u32  rvu_cgx_get_fifolen(struct rvu *rvu);

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);

/* CPT APIs */
int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot);

+1 −1
Original line number Diff line number Diff line
@@ -2145,7 +2145,7 @@ static int rvu_dbg_npc_mcam_show_rules(struct seq_file *s, void *unused)
		seq_printf(s, "\tmcam entry: %d\n", iter->entry);

		rvu_dbg_npc_mcam_show_flows(s, iter);
		if (iter->intf == NIX_INTF_RX) {
		if (is_npc_intf_rx(iter->intf)) {
			target = iter->rx_action.pf_func;
			pf = (target >> RVU_PFVF_PF_SHIFT) & RVU_PFVF_PF_MASK;
			seq_printf(s, "\tForward to: PF%d ", pf);
+5 −5
Original line number Diff line number Diff line
@@ -273,7 +273,8 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)
		pfvf->rx_chan_cnt = 1;
		pfvf->tx_chan_cnt = 1;
		rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
					      pfvf->rx_chan_base, false);
					      pfvf->rx_chan_base,
					      pfvf->rx_chan_cnt, false);
		break;
	}

@@ -3088,7 +3089,8 @@ int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req,
		rvu_npc_disable_promisc_entry(rvu, pcifunc, nixlf);
	else
		rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf,
					      pfvf->rx_chan_base, allmulti);
					      pfvf->rx_chan_base,
					      pfvf->rx_chan_cnt, allmulti);
	return 0;
}

@@ -3635,9 +3637,7 @@ int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req,
	if (err)
		return err;

	rvu_npc_disable_default_entries(rvu, pcifunc, nixlf);

	npc_mcam_disable_flows(rvu, pcifunc);
	rvu_npc_disable_mcam_entries(rvu, pcifunc, nixlf);

	return rvu_cgx_start_stop_io(rvu, pcifunc, false);
}
Loading