Skip to content

Commit bd69476

Browse files
Geetha sowjanyadavem330
authored andcommitted
octeontx2-af: cn10k: mcs: Install a default TCAM for normal traffic
Out of all the TCAM entries, reserve last TX and RX TCAM flow entry(low priority) so that normal traffic can be sent out and received. The traffic which needs macsec processing hits the high priority TCAM flows. Also install a FLR handler to free the allocated resources for PF/VF. Signed-off-by: Geetha sowjanya <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent cfc1418 commit bd69476

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,51 @@ void mcs_flowid_entry_write(struct mcs *mcs, u64 *data, u64 *mask, int flow_id,
181181
}
182182
}
183183

184+
int mcs_install_flowid_bypass_entry(struct mcs *mcs)
185+
{
186+
int flow_id, secy_id, reg_id;
187+
struct secy_mem_map map;
188+
u64 reg, plcy = 0;
189+
190+
/* Flow entry */
191+
flow_id = mcs->hw->tcam_entries - MCS_RSRC_RSVD_CNT;
192+
for (reg_id = 0; reg_id < 4; reg_id++) {
193+
reg = MCSX_CPM_RX_SLAVE_FLOWID_TCAM_MASKX(reg_id, flow_id);
194+
mcs_reg_write(mcs, reg, GENMASK_ULL(63, 0));
195+
}
196+
for (reg_id = 0; reg_id < 4; reg_id++) {
197+
reg = MCSX_CPM_TX_SLAVE_FLOWID_TCAM_MASKX(reg_id, flow_id);
198+
mcs_reg_write(mcs, reg, GENMASK_ULL(63, 0));
199+
}
200+
/* secy */
201+
secy_id = mcs->hw->secy_entries - MCS_RSRC_RSVD_CNT;
202+
203+
/* Set validate frames to NULL and enable control port */
204+
plcy = 0x7ull;
205+
if (mcs->hw->mcs_blks > 1)
206+
plcy = BIT_ULL(0) | 0x3ull << 4;
207+
mcs_secy_plcy_write(mcs, plcy, secy_id, MCS_RX);
208+
209+
/* Enable control port and set mtu to max */
210+
plcy = BIT_ULL(0) | GENMASK_ULL(43, 28);
211+
if (mcs->hw->mcs_blks > 1)
212+
plcy = BIT_ULL(0) | GENMASK_ULL(63, 48);
213+
mcs_secy_plcy_write(mcs, plcy, secy_id, MCS_TX);
214+
215+
/* Map flowid to secy */
216+
map.secy = secy_id;
217+
map.ctrl_pkt = 0;
218+
map.flow_id = flow_id;
219+
mcs->mcs_ops->mcs_flowid_secy_map(mcs, &map, MCS_RX);
220+
map.sc = secy_id;
221+
mcs->mcs_ops->mcs_flowid_secy_map(mcs, &map, MCS_TX);
222+
223+
/* Enable Flowid entry */
224+
mcs_ena_dis_flowid_entry(mcs, flow_id, MCS_RX, true);
225+
mcs_ena_dis_flowid_entry(mcs, flow_id, MCS_TX, true);
226+
return 0;
227+
}
228+
184229
void mcs_clear_secy_plcy(struct mcs *mcs, int secy_id, int dir)
185230
{
186231
struct mcs_rsrc_map *map;

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,27 @@ int rvu_mbox_handler_mcs_custom_tag_cfg_get(struct rvu *rvu, struct mcs_custom_t
133133
return 0;
134134
}
135135

136+
int rvu_mcs_flr_handler(struct rvu *rvu, u16 pcifunc)
137+
{
138+
struct mcs *mcs;
139+
int mcs_id;
140+
141+
/* CNF10K-B mcs0-6 are mapped to RPM2-8*/
142+
if (rvu->mcs_blk_cnt > 1) {
143+
for (mcs_id = 0; mcs_id < rvu->mcs_blk_cnt; mcs_id++) {
144+
mcs = mcs_get_pdata(mcs_id);
145+
mcs_free_all_rsrc(mcs, MCS_RX, pcifunc);
146+
mcs_free_all_rsrc(mcs, MCS_TX, pcifunc);
147+
}
148+
} else {
149+
/* CN10K-B has only one mcs block */
150+
mcs = mcs_get_pdata(0);
151+
mcs_free_all_rsrc(mcs, MCS_RX, pcifunc);
152+
mcs_free_all_rsrc(mcs, MCS_TX, pcifunc);
153+
}
154+
return 0;
155+
}
156+
136157
int rvu_mbox_handler_mcs_flowid_ena_entry(struct rvu *rvu,
137158
struct mcs_flowid_ena_dis_entry *req,
138159
struct msg_rsp *rsp)
@@ -543,8 +564,10 @@ int rvu_mcs_init(struct rvu *rvu)
543564
rvu_mcs_set_lmac_bmap(rvu);
544565
}
545566

567+
/* Install default tcam bypass entry and set port to operational mode */
546568
for (mcs_id = 0; mcs_id < rvu->mcs_blk_cnt; mcs_id++) {
547569
mcs = mcs_get_pdata(mcs_id);
570+
mcs_install_flowid_bypass_entry(mcs);
548571
for (lmac = 0; lmac < mcs->hw->lmac_cnt; lmac++)
549572
mcs_set_lmac_mode(mcs, lmac, 0);
550573
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,5 +875,6 @@ int rvu_npc_set_parse_mode(struct rvu *rvu, u16 pcifunc, u64 mode, u8 dir,
875875

876876
/* CN10K MCS */
877877
int rvu_mcs_init(struct rvu *rvu);
878+
int rvu_mcs_flr_handler(struct rvu *rvu, u16 pcifunc);
878879

879880
#endif /* RVU_H */

0 commit comments

Comments
 (0)