Commit c3e04142 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 284f7176 570ba378
...@@ -671,6 +671,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc, ...@@ -671,6 +671,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
int blkaddr, ucast_idx, index; int blkaddr, ucast_idx, index;
struct nix_rx_action action = { 0 }; struct nix_rx_action action = { 0 };
u64 relaxed_mask; u64 relaxed_mask;
u8 flow_key_alg;
if (!hw->cap.nix_rx_multicast && is_cgx_vf(rvu, pcifunc)) if (!hw->cap.nix_rx_multicast && is_cgx_vf(rvu, pcifunc))
return; return;
...@@ -701,6 +702,8 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc, ...@@ -701,6 +702,8 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
action.op = NIX_RX_ACTIONOP_UCAST; action.op = NIX_RX_ACTIONOP_UCAST;
} }
flow_key_alg = action.flow_key_alg;
/* RX_ACTION set to MCAST for CGX PF's */ /* RX_ACTION set to MCAST for CGX PF's */
if (hw->cap.nix_rx_multicast && pfvf->use_mce_list && if (hw->cap.nix_rx_multicast && pfvf->use_mce_list &&
is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc))) { is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc))) {
...@@ -740,7 +743,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc, ...@@ -740,7 +743,7 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
req.vf = pcifunc; req.vf = pcifunc;
req.index = action.index; req.index = action.index;
req.match_id = action.match_id; req.match_id = action.match_id;
req.flow_key_alg = action.flow_key_alg; req.flow_key_alg = flow_key_alg;
rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp); rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp);
} }
...@@ -854,6 +857,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf, ...@@ -854,6 +857,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
u8 mac_addr[ETH_ALEN] = { 0 }; u8 mac_addr[ETH_ALEN] = { 0 };
struct nix_rx_action action = { 0 }; struct nix_rx_action action = { 0 };
struct rvu_pfvf *pfvf; struct rvu_pfvf *pfvf;
u8 flow_key_alg;
u16 vf_func; u16 vf_func;
/* Only CGX PF/VF can add allmulticast entry */ /* 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, ...@@ -888,6 +892,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
*(u64 *)&action = npc_get_mcam_action(rvu, mcam, *(u64 *)&action = npc_get_mcam_action(rvu, mcam,
blkaddr, ucast_idx); blkaddr, ucast_idx);
flow_key_alg = action.flow_key_alg;
if (action.op != NIX_RX_ACTIONOP_RSS) { if (action.op != NIX_RX_ACTIONOP_RSS) {
*(u64 *)&action = 0; *(u64 *)&action = 0;
action.op = NIX_RX_ACTIONOP_UCAST; action.op = NIX_RX_ACTIONOP_UCAST;
...@@ -924,7 +929,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf, ...@@ -924,7 +929,7 @@ void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
req.vf = pcifunc | vf_func; req.vf = pcifunc | vf_func;
req.index = action.index; req.index = action.index;
req.match_id = action.match_id; req.match_id = action.match_id;
req.flow_key_alg = action.flow_key_alg; req.flow_key_alg = flow_key_alg;
rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp); rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp);
} }
...@@ -990,11 +995,38 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam, ...@@ -990,11 +995,38 @@ static void npc_update_vf_flow_entry(struct rvu *rvu, struct npc_mcam *mcam,
mutex_unlock(&mcam->lock); mutex_unlock(&mcam->lock);
} }
static void npc_update_rx_action_with_alg_idx(struct rvu *rvu, struct nix_rx_action action,
struct rvu_pfvf *pfvf, int mcam_index, int blkaddr,
int alg_idx)
{
struct npc_mcam *mcam = &rvu->hw->mcam;
struct rvu_hwinfo *hw = rvu->hw;
int bank, op_rss;
if (!is_mcam_entry_enabled(rvu, mcam, blkaddr, mcam_index))
return;
op_rss = (!hw->cap.nix_rx_multicast || !pfvf->use_mce_list);
bank = npc_get_bank(mcam, mcam_index);
mcam_index &= (mcam->banksize - 1);
/* If Rx action is MCAST update only RSS algorithm index */
if (!op_rss) {
*(u64 *)&action = rvu_read64(rvu, blkaddr,
NPC_AF_MCAMEX_BANKX_ACTION(mcam_index, bank));
action.flow_key_alg = alg_idx;
}
rvu_write64(rvu, blkaddr,
NPC_AF_MCAMEX_BANKX_ACTION(mcam_index, bank), *(u64 *)&action);
}
void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf, void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
int group, int alg_idx, int mcam_index) int group, int alg_idx, int mcam_index)
{ {
struct npc_mcam *mcam = &rvu->hw->mcam; struct npc_mcam *mcam = &rvu->hw->mcam;
struct rvu_hwinfo *hw = rvu->hw;
struct nix_rx_action action; struct nix_rx_action action;
int blkaddr, index, bank; int blkaddr, index, bank;
struct rvu_pfvf *pfvf; struct rvu_pfvf *pfvf;
...@@ -1050,15 +1082,16 @@ void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf, ...@@ -1050,15 +1082,16 @@ void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
/* If PF's promiscuous entry is enabled, /* If PF's promiscuous entry is enabled,
* Set RSS action for that entry as well * Set RSS action for that entry as well
*/ */
if ((!hw->cap.nix_rx_multicast || !pfvf->use_mce_list) && npc_update_rx_action_with_alg_idx(rvu, action, pfvf, index, blkaddr,
is_mcam_entry_enabled(rvu, mcam, blkaddr, index)) { alg_idx);
bank = npc_get_bank(mcam, index);
index &= (mcam->banksize - 1);
rvu_write64(rvu, blkaddr, index = npc_get_nixlf_mcam_index(mcam, pcifunc,
NPC_AF_MCAMEX_BANKX_ACTION(index, bank), nixlf, NIXLF_ALLMULTI_ENTRY);
*(u64 *)&action); /* If PF's allmulti entry is enabled,
} * Set RSS action for that entry as well
*/
npc_update_rx_action_with_alg_idx(rvu, action, pfvf, index, blkaddr,
alg_idx);
} }
void npc_enadis_default_mce_entry(struct rvu *rvu, u16 pcifunc, void npc_enadis_default_mce_entry(struct rvu *rvu, u16 pcifunc,
......
...@@ -1650,6 +1650,21 @@ static void otx2_free_hw_resources(struct otx2_nic *pf) ...@@ -1650,6 +1650,21 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
mutex_unlock(&mbox->lock); mutex_unlock(&mbox->lock);
} }
static bool otx2_promisc_use_mce_list(struct otx2_nic *pfvf)
{
int vf;
/* The AF driver will determine whether to allow the VF netdev or not */
if (is_otx2_vf(pfvf->pcifunc))
return true;
/* check if there are any trusted VFs associated with the PF netdev */
for (vf = 0; vf < pci_num_vf(pfvf->pdev); vf++)
if (pfvf->vf_configs[vf].trusted)
return true;
return false;
}
static void otx2_do_set_rx_mode(struct otx2_nic *pf) static void otx2_do_set_rx_mode(struct otx2_nic *pf)
{ {
struct net_device *netdev = pf->netdev; struct net_device *netdev = pf->netdev;
...@@ -1682,6 +1697,7 @@ static void otx2_do_set_rx_mode(struct otx2_nic *pf) ...@@ -1682,6 +1697,7 @@ static void otx2_do_set_rx_mode(struct otx2_nic *pf)
if (netdev->flags & (IFF_ALLMULTI | IFF_MULTICAST)) if (netdev->flags & (IFF_ALLMULTI | IFF_MULTICAST))
req->mode |= NIX_RX_MODE_ALLMULTI; req->mode |= NIX_RX_MODE_ALLMULTI;
if (otx2_promisc_use_mce_list(pf))
req->mode |= NIX_RX_MODE_USE_MCE; req->mode |= NIX_RX_MODE_USE_MCE;
otx2_sync_mbox_msg(&pf->mbox); otx2_sync_mbox_msg(&pf->mbox);
...@@ -2691,11 +2707,14 @@ static int otx2_ndo_set_vf_trust(struct net_device *netdev, int vf, ...@@ -2691,11 +2707,14 @@ static int otx2_ndo_set_vf_trust(struct net_device *netdev, int vf,
pf->vf_configs[vf].trusted = enable; pf->vf_configs[vf].trusted = enable;
rc = otx2_set_vf_permissions(pf, vf, OTX2_TRUSTED_VF); rc = otx2_set_vf_permissions(pf, vf, OTX2_TRUSTED_VF);
if (rc) if (rc) {
pf->vf_configs[vf].trusted = !enable; pf->vf_configs[vf].trusted = !enable;
else } else {
netdev_info(pf->netdev, "VF %d is %strusted\n", netdev_info(pf->netdev, "VF %d is %strusted\n",
vf, enable ? "" : "not "); vf, enable ? "" : "not ");
otx2_set_rx_mode(netdev);
}
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment