Skip to content

Commit dbda436

Browse files
Hariprasad Kelamdavem330
authored andcommitted
octeontx2-pf: Fix promisc mcam entry action
Current implementation is such that, promisc mcam entry action is set as multicast even when there are no trusted VFs. multicast action causes the hardware to copy packet data, which reduces the performance. This patch fixes this issue by setting the promisc mcam entry action to unicast instead of multicast when there are no trusted VFs. The same change is made for the 'allmulti' mcam entry action. Fixes: ffd2f89 ("octeontx2-pf: Enable promisc/allmulti match MCAM entries.") 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 284f717 commit dbda436

File tree

1 file changed

+22
-3
lines changed
  • drivers/net/ethernet/marvell/octeontx2/nic

1 file changed

+22
-3
lines changed

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)