[2/5] net/nfp: modify the logic of set promisc mode

Message ID 20231213032416.1988817-3-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series unify the usage of capacity and control |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Dec. 13, 2023, 3:24 a.m. UTC
  Modify the logic of set promisc mode, add the check logic of
capacity.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_net_common.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 79ce1dd837..12b62c1958 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -592,6 +592,11 @@  nfp_net_promisc_disable(struct rte_eth_dev *dev)
 	net_hw = nfp_net_get_hw(dev);
 	hw = &net_hw->super;
 
+	if ((hw->cap & NFP_NET_CFG_CTRL_PROMISC) == 0) {
+		PMD_DRV_LOG(ERR, "Promiscuous mode not supported");
+		return -ENOTSUP;
+	}
+
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already disabled");
 		return 0;