diff options
author | Sunil Goutham <sgoutham@marvell.com> | 2021-08-20 13:55:22 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-20 14:57:59 +0100 |
commit | a515e5b53cc699f1f3b60a5135f50657efa2758b (patch) | |
tree | a642b3a46dd25f13f45b3b7f354701a6c32b62c4 /drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c | |
parent | fa16ee77364f03d8565e5adeff1b119b29acca69 (diff) | |
download | linux-stable-a515e5b53cc699f1f3b60a5135f50657efa2758b.tar.gz linux-stable-a515e5b53cc699f1f3b60a5135f50657efa2758b.tar.bz2 linux-stable-a515e5b53cc699f1f3b60a5135f50657efa2758b.zip |
octeontx2-pf: Add check for non zero mcam flows
This patch ensures that mcam flows are allocated
before adding or destroying the flows.
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c')
-rw-r--r-- | drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c index 2a25588a01ed..55802b56e3b9 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c @@ -972,6 +972,12 @@ int otx2_add_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc) int err = 0; u32 ring; + if (!flow_cfg->max_flows) { + netdev_err(pfvf->netdev, + "Ntuple rule count is 0, allocate and retry\n"); + return -EINVAL; + } + ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT)) return -ENOMEM; @@ -1183,6 +1189,9 @@ int otx2_destroy_ntuple_flows(struct otx2_nic *pfvf) if (!(pfvf->flags & OTX2_FLAG_NTUPLE_SUPPORT)) return 0; + if (!flow_cfg->max_flows) + return 0; + mutex_lock(&pfvf->mbox.lock); req = otx2_mbox_alloc_msg_npc_delete_flow(&pfvf->mbox); if (!req) { |