Skip to content

Commit 21f4968

Browse files
committed
Merge branch 'octeontx2-multicast-mirror-offload'
Suman Ghosh says: ==================== octeontx2: Multicast/mirror offload changes This patchset includes changes to support TC multicast/mirror offload. Patch #1: Adds changes to support new mailbox to offload multicast/mirror offload. Patch #2: Adds TC related changes which uses the newly added mailboxes to offload multicast/mirror rules. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 8470e43 + df094d8 commit 21f4968

File tree

7 files changed

+978
-41
lines changed

7 files changed

+978
-41
lines changed

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

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ M(NIX_BANDPROF_GET_HWINFO, 0x801f, nix_bandprof_get_hwinfo, msg_req, \
304304
nix_bandprof_get_hwinfo_rsp) \
305305
M(NIX_READ_INLINE_IPSEC_CFG, 0x8023, nix_read_inline_ipsec_cfg, \
306306
msg_req, nix_inline_ipsec_cfg) \
307+
M(NIX_MCAST_GRP_CREATE, 0x802b, nix_mcast_grp_create, nix_mcast_grp_create_req, \
308+
nix_mcast_grp_create_rsp) \
309+
M(NIX_MCAST_GRP_DESTROY, 0x802c, nix_mcast_grp_destroy, nix_mcast_grp_destroy_req, \
310+
msg_rsp) \
311+
M(NIX_MCAST_GRP_UPDATE, 0x802d, nix_mcast_grp_update, \
312+
nix_mcast_grp_update_req, \
313+
nix_mcast_grp_update_rsp) \
307314
/* MCS mbox IDs (range 0xA000 - 0xBFFF) */ \
308315
M(MCS_ALLOC_RESOURCES, 0xa000, mcs_alloc_resources, mcs_alloc_rsrc_req, \
309316
mcs_alloc_rsrc_rsp) \
@@ -830,6 +837,9 @@ enum nix_af_status {
830837
NIX_AF_ERR_CQ_CTX_WRITE_ERR = -429,
831838
NIX_AF_ERR_AQ_CTX_RETRY_WRITE = -430,
832839
NIX_AF_ERR_LINK_CREDITS = -431,
840+
NIX_AF_ERR_INVALID_MCAST_GRP = -436,
841+
NIX_AF_ERR_INVALID_MCAST_DEL_REQ = -437,
842+
NIX_AF_ERR_NON_CONTIG_MCE_LIST = -438,
833843
};
834844

835845
/* For NIX RX vtag action */
@@ -1204,6 +1214,68 @@ struct nix_bp_cfg_rsp {
12041214
u8 chan_cnt; /* Number of channel for which bpids are assigned */
12051215
};
12061216

1217+
struct nix_mcast_grp_create_req {
1218+
struct mbox_msghdr hdr;
1219+
#define NIX_MCAST_INGRESS 0
1220+
#define NIX_MCAST_EGRESS 1
1221+
u8 dir;
1222+
u8 reserved[11];
1223+
/* Reserving few bytes for future requirement */
1224+
};
1225+
1226+
struct nix_mcast_grp_create_rsp {
1227+
struct mbox_msghdr hdr;
1228+
/* This mcast_grp_idx should be passed during MCAM
1229+
* write entry for multicast. AF will identify the
1230+
* corresponding multicast table index associated
1231+
* with the group id and program the same to MCAM entry.
1232+
* This group id is also needed during group delete
1233+
* and update request.
1234+
*/
1235+
u32 mcast_grp_idx;
1236+
};
1237+
1238+
struct nix_mcast_grp_destroy_req {
1239+
struct mbox_msghdr hdr;
1240+
/* Group id returned by nix_mcast_grp_create_rsp */
1241+
u32 mcast_grp_idx;
1242+
/* If AF is requesting for destroy, then set
1243+
* it to '1'. Otherwise keep it to '0'
1244+
*/
1245+
u8 is_af;
1246+
};
1247+
1248+
struct nix_mcast_grp_update_req {
1249+
struct mbox_msghdr hdr;
1250+
/* Group id returned by nix_mcast_grp_create_rsp */
1251+
u32 mcast_grp_idx;
1252+
/* Number of multicast/mirror entries requested */
1253+
u32 num_mce_entry;
1254+
#define NIX_MCE_ENTRY_MAX 64
1255+
#define NIX_RX_RQ 0
1256+
#define NIX_RX_RSS 1
1257+
/* Receive queue or RSS index within pf_func */
1258+
u32 rq_rss_index[NIX_MCE_ENTRY_MAX];
1259+
/* pcifunc is required for both ingress and egress multicast */
1260+
u16 pcifunc[NIX_MCE_ENTRY_MAX];
1261+
/* channel is required for egress multicast */
1262+
u16 channel[NIX_MCE_ENTRY_MAX];
1263+
#define NIX_MCAST_OP_ADD_ENTRY 0
1264+
#define NIX_MCAST_OP_DEL_ENTRY 1
1265+
/* Destination type. 0:Receive queue, 1:RSS*/
1266+
u8 dest_type[NIX_MCE_ENTRY_MAX];
1267+
u8 op;
1268+
/* If AF is requesting for update, then set
1269+
* it to '1'. Otherwise keep it to '0'
1270+
*/
1271+
u8 is_af;
1272+
};
1273+
1274+
struct nix_mcast_grp_update_rsp {
1275+
struct mbox_msghdr hdr;
1276+
u32 mce_start_index;
1277+
};
1278+
12071279
/* Global NIX inline IPSec configuration */
12081280
struct nix_inline_ipsec_cfg {
12091281
struct mbox_msghdr hdr;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ int rvu_alloc_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc)
156156
return start;
157157
}
158158

159-
static void rvu_free_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc, int start)
159+
void rvu_free_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc, int start)
160160
{
161161
if (!rsrc->bmap)
162162
return;
@@ -2614,6 +2614,10 @@ static void __rvu_flr_handler(struct rvu *rvu, u16 pcifunc)
26142614
* 2. Flush and reset SSO/SSOW
26152615
* 3. Cleanup pools (NPA)
26162616
*/
2617+
2618+
/* Free multicast/mirror node associated with the 'pcifunc' */
2619+
rvu_nix_mcast_flr_free_entries(rvu, pcifunc);
2620+
26172621
rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NIX0);
26182622
rvu_blklf_teardown(rvu, pcifunc, BLKADDR_NIX1);
26192623
rvu_blklf_teardown(rvu, pcifunc, BLKADDR_CPT0);

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

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ struct rvu_block {
116116
};
117117

118118
struct nix_mcast {
119-
struct qmem *mce_ctx;
120-
struct qmem *mcast_buf;
121-
int replay_pkind;
122-
int next_free_mce;
123-
struct mutex mce_lock; /* Serialize MCE updates */
119+
struct qmem *mce_ctx;
120+
struct qmem *mcast_buf;
121+
int replay_pkind;
122+
struct rsrc_bmap mce_counter[2];
123+
/* Counters for both ingress and egress mcast lists */
124+
struct mutex mce_lock; /* Serialize MCE updates */
124125
};
125126

126127
struct nix_mce_list {
@@ -129,6 +130,23 @@ struct nix_mce_list {
129130
int max;
130131
};
131132

133+
struct nix_mcast_grp_elem {
134+
struct nix_mce_list mcast_mce_list;
135+
u32 mcast_grp_idx;
136+
u32 pcifunc;
137+
int mcam_index;
138+
int mce_start_index;
139+
struct list_head list;
140+
u8 dir;
141+
};
142+
143+
struct nix_mcast_grp {
144+
struct list_head mcast_grp_head;
145+
int count;
146+
int next_grp_index;
147+
struct mutex mcast_grp_lock; /* Serialize MCE updates */
148+
};
149+
132150
/* layer metadata to uniquely identify a packet header field */
133151
struct npc_layer_mdata {
134152
u8 lid;
@@ -339,6 +357,7 @@ struct nix_hw {
339357
struct rvu *rvu;
340358
struct nix_txsch txsch[NIX_TXSCH_LVL_CNT]; /* Tx schedulers */
341359
struct nix_mcast mcast;
360+
struct nix_mcast_grp mcast_grp;
342361
struct nix_flowkey flowkey;
343362
struct nix_mark_format mark_format;
344363
struct nix_lso lso;
@@ -741,6 +760,7 @@ void rvu_free_rsrc(struct rsrc_bmap *rsrc, int id);
741760
bool is_rsrc_free(struct rsrc_bmap *rsrc, int id);
742761
int rvu_rsrc_free_count(struct rsrc_bmap *rsrc);
743762
int rvu_alloc_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc);
763+
void rvu_free_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc, int start);
744764
bool rvu_rsrc_check_contig(struct rsrc_bmap *rsrc, int nrsrc);
745765
u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blkaddr);
746766
int rvu_get_pf(u16 pcifunc);
@@ -847,6 +867,11 @@ u32 convert_dwrr_mtu_to_bytes(u8 dwrr_mtu);
847867
u32 convert_bytes_to_dwrr_mtu(u32 bytes);
848868
void rvu_nix_tx_tl2_cfg(struct rvu *rvu, int blkaddr, u16 pcifunc,
849869
struct nix_txsch *txsch, bool enable);
870+
void rvu_nix_mcast_flr_free_entries(struct rvu *rvu, u16 pcifunc);
871+
int rvu_nix_mcast_get_mce_index(struct rvu *rvu, u16 pcifunc,
872+
u32 mcast_grp_idx);
873+
int rvu_nix_mcast_update_mcam_entry(struct rvu *rvu, u16 pcifunc,
874+
u32 mcast_grp_idx, u16 mcam_index);
850875

851876
/* NPC APIs */
852877
void rvu_npc_freemem(struct rvu *rvu);
@@ -895,6 +920,10 @@ void npc_mcam_enable_flows(struct rvu *rvu, u16 target);
895920
void npc_mcam_disable_flows(struct rvu *rvu, u16 target);
896921
void npc_enable_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
897922
int blkaddr, int index, bool enable);
923+
u64 npc_get_mcam_action(struct rvu *rvu, struct npc_mcam *mcam,
924+
int blkaddr, int index);
925+
void npc_set_mcam_action(struct rvu *rvu, struct npc_mcam *mcam,
926+
int blkaddr, int index, u64 cfg);
898927
void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
899928
int blkaddr, u16 src, struct mcam_entry *entry,
900929
u8 *intf, u8 *ena);

0 commit comments

Comments
 (0)