Skip to content

Commit c3e0414

Browse files
committed
Merge branch 'octeontx2-fixes'
Hariprasad Kelam says: ==================== octeontx2: Fix issues with promisc/allmulti mode When interface is configured in promisc/all multi mode, low network performance observed. This series patches address the same. Patch1: Change the promisc/all multi mcam entry action to unicast if there are no trusted vfs associated with PF. Patch2: Configures RSS flow algorithm in promisc/all multi mcam entries to address flow distribution issues. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 284f717 + 570ba37 commit c3e0414

File tree

2 files changed

+66
-14
lines changed

2 files changed

+66
-14
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,

drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,21 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
16501650
mutex_unlock(&mbox->lock);
16511651
}
16521652

1653+
static bool otx2_promisc_use_mce_list(struct otx2_nic *pfvf)
1654+
{
1655+
int vf;
1656+
1657+
/* The AF driver will determine whether to allow the VF netdev or not */
1658+
if (is_otx2_vf(pfvf->pcifunc))
1659+
return true;
1660+
1661+
/* check if there are any trusted VFs associated with the PF netdev */
1662+
for (vf = 0; vf < pci_num_vf(pfvf->pdev); vf++)
1663+
if (pfvf->vf_configs[vf].trusted)
1664+
return true;
1665+
return false;
1666+
}
1667+
16531668
static void otx2_do_set_rx_mode(struct otx2_nic *pf)
16541669
{
16551670
struct net_device *netdev = pf->netdev;
@@ -1682,7 +1697,8 @@ static void otx2_do_set_rx_mode(struct otx2_nic *pf)
16821697
if (netdev->flags & (IFF_ALLMULTI | IFF_MULTICAST))
16831698
req->mode |= NIX_RX_MODE_ALLMULTI;
16841699

1685-
req->mode |= NIX_RX_MODE_USE_MCE;
1700+
if (otx2_promisc_use_mce_list(pf))
1701+
req->mode |= NIX_RX_MODE_USE_MCE;
16861702

16871703
otx2_sync_mbox_msg(&pf->mbox);
16881704
mutex_unlock(&pf->mbox.lock);
@@ -2691,11 +2707,14 @@ static int otx2_ndo_set_vf_trust(struct net_device *netdev, int vf,
26912707
pf->vf_configs[vf].trusted = enable;
26922708
rc = otx2_set_vf_permissions(pf, vf, OTX2_TRUSTED_VF);
26932709

2694-
if (rc)
2710+
if (rc) {
26952711
pf->vf_configs[vf].trusted = !enable;
2696-
else
2712+
} else {
26972713
netdev_info(pf->netdev, "VF %d is %strusted\n",
26982714
vf, enable ? "" : "not ");
2715+
otx2_set_rx_mode(netdev);
2716+
}
2717+
26992718
return rc;
27002719
}
27012720

0 commit comments

Comments
 (0)