Skip to content

Commit 570ba37

Browse files
Hariprasad Kelamdavem330
authored andcommitted
octeontx2-af: Update RSS algorithm index
The RSS flow algorithm is not set up correctly for promiscuous or all multi MCAM entries. This has an impact on flow distribution. This patch fixes the issue by updating flow algorithm index in above mentioned MCAM entries. Fixes: 967db35 ("octeontx2-af: add support for multicast/promisc packet replication feature") Signed-off-by: Hariprasad Kelam <[email protected]> Signed-off-by: Sunil Kovvuri Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dbda436 commit 570ba37

File tree

1 file changed

+44
-11
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+44
-11
lines changed

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

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
671671
int blkaddr, ucast_idx, index;
672672
struct nix_rx_action action = { 0 };
673673
u64 relaxed_mask;
674+
u8 flow_key_alg;
674675

675676
if (!hw->cap.nix_rx_multicast && is_cgx_vf(rvu, pcifunc))
676677
return;
@@ -701,6 +702,8 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
701702
action.op = NIX_RX_ACTIONOP_UCAST;
702703
}
703704

705+
flow_key_alg = action.flow_key_alg;
706+
704707
/* RX_ACTION set to MCAST for CGX PF's */
705708
if (hw->cap.nix_rx_multicast && pfvf->use_mce_list &&
706709
is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc))) {
@@ -740,7 +743,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
740743
req.vf = pcifunc;
741744
req.index = action.index;
742745
req.match_id = action.match_id;
743-
req.flow_key_alg = action.flow_key_alg;
746+
req.flow_key_alg = flow_key_alg;
744747

745748
rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp);
746749
}
@@ -854,6 +857,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
854857
u8 mac_addr[ETH_ALEN] = { 0 };
855858
struct nix_rx_action action = { 0 };
856859
struct rvu_pfvf *pfvf;
860+
u8 flow_key_alg;
857861
u16 vf_func;
858862

859863
/* Only CGX PF/VF can add allmulticast entry */
@@ -888,6 +892,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
888892
*(u64 *)&action = npc_get_mcam_action(rvu, mcam,
889893
blkaddr, ucast_idx);
890894

895+
flow_key_alg = action.flow_key_alg;
891896
if (action.op != NIX_RX_ACTIONOP_RSS) {
892897
*(u64 *)&action = 0;
893898
action.op = NIX_RX_ACTIONOP_UCAST;
@@ -924,7 +929,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
924929
req.vf = pcifunc | vf_func;
925930
req.index = action.index;
926931
req.match_id = action.match_id;
927-
req.flow_key_alg = action.flow_key_alg;
932+
req.flow_key_alg = flow_key_alg;
928933

929934
rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp);
930935
}
@@ -990,11 +995,38 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
990995
mutex_unlock(&mcam->lock);
991996
}
992997

998+
static void npc_update_rx_action_with_alg_idx(struct rvu *rvu, struct nix_rx_action action,
999+
struct rvu_pfvf *pfvf, int mcam_index, int blkaddr,
1000+
int alg_idx)
1001+
1002+
{
1003+
struct npc_mcam *mcam = &rvu->hw->mcam;
1004+
struct rvu_hwinfo *hw = rvu->hw;
1005+
int bank, op_rss;
1006+
1007+
if (!is_mcam_entry_enabled(rvu, mcam, blkaddr, mcam_index))
1008+
return;
1009+
1010+
op_rss = (!hw->cap.nix_rx_multicast || !pfvf->use_mce_list);
1011+
1012+
bank = npc_get_bank(mcam, mcam_index);
1013+
mcam_index &= (mcam->banksize - 1);
1014+
1015+
/* If Rx action is MCAST update only RSS algorithm index */
1016+
if (!op_rss) {
1017+
*(u64 *)&action = rvu_read64(rvu, blkaddr,
1018+
NPC_AF_MCAMEX_BANKX_ACTION(mcam_index, bank));
1019+
1020+
action.flow_key_alg = alg_idx;
1021+
}
1022+
rvu_write64(rvu, blkaddr,
1023+
NPC_AF_MCAMEX_BANKX_ACTION(mcam_index, bank), *(u64 *)&action);
1024+
}
1025+
9931026
void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
9941027
int group, int alg_idx, int mcam_index)
9951028
{
9961029
struct npc_mcam *mcam = &rvu->hw->mcam;
997-
struct rvu_hwinfo *hw = rvu->hw;
9981030
struct nix_rx_action action;
9991031
int blkaddr, index, bank;
10001032
struct rvu_pfvf *pfvf;
@@ -1050,15 +1082,16 @@ void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
10501082
/* If PF's promiscuous entry is enabled,
10511083
* Set RSS action for that entry as well
10521084
*/
1053-
if ((!hw->cap.nix_rx_multicast || !pfvf->use_mce_list) &&
1054-
is_mcam_entry_enabled(rvu, mcam, blkaddr, index)) {
1055-
bank = npc_get_bank(mcam, index);
1056-
index &= (mcam->banksize - 1);
1085+
npc_update_rx_action_with_alg_idx(rvu, action, pfvf, index, blkaddr,
1086+
alg_idx);
10571087

1058-
rvu_write64(rvu, blkaddr,
1059-
NPC_AF_MCAMEX_BANKX_ACTION(index, bank),
1060-
*(u64 *)&action);
1061-
}
1088+
index = npc_get_nixlf_mcam_index(mcam, pcifunc,
1089+
nixlf, NIXLF_ALLMULTI_ENTRY);
1090+
/* If PF's allmulti entry is enabled,
1091+
* Set RSS action for that entry as well
1092+
*/
1093+
npc_update_rx_action_with_alg_idx(rvu, action, pfvf, index, blkaddr,
1094+
alg_idx);
10621095
}
10631096

10641097
void npc_enadis_default_mce_entry(struct rvu *rvu, u16 pcifunc,

0 commit comments

Comments
 (0)