Modify the logic of set MAC address, add the check logic of MAC address. Signed-off-by: Chaoyong He <chaoyong...@corigine.com> Reviewed-by: Peng Zhang <peng.zh...@corigine.com> Reviewed-by: Long Wu <long...@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