[PATCH 3/5] net/nfp: modify the logic of set MAC address
Chaoyong He
chaoyong.he at corigine.com
Wed Dec 13 04:24:14 CET 2023
Modify the logic of set MAC address, add the check logic of MAC address.
Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
---
drivers/net/nfp/nfp_net_common.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 12b62c1958..99e2fc54e0 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -417,6 +417,11 @@ nfp_net_set_mac_addr(struct rte_eth_dev *dev,
return -EBUSY;
}
+ if (rte_is_valid_assigned_ether_addr(mac_addr) == 0) {
+ PMD_DRV_LOG(ERR, "Invalid MAC address");
+ return -EINVAL;
+ }
+
/* Writing new MAC to the specific port BAR address */
nfp_write_mac(hw, (uint8_t *)mac_addr);
--
2.39.1
More information about the dev
mailing list