DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>,
	Long Wu <long.wu@corigine.com>
Subject: [PATCH 3/5] net/nfp: modify the logic of set MAC address
Date: Wed, 13 Dec 2023 11:24:14 +0800	[thread overview]
Message-ID: <20231213032416.1988817-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231213032416.1988817-1-chaoyong.he@corigine.com>

Modify the logic of set MAC address, add the check logic of MAC address.

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(+)

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


  parent reply	other threads:[~2023-12-13  3:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13  3:24 [PATCH 0/5] unify the usage of capacity and control Chaoyong He
2023-12-13  3:24 ` [PATCH 1/5] net/nfp: complete the logic of print capacity Chaoyong He
2023-12-13  3:24 ` [PATCH 2/5] net/nfp: modify the logic of set promisc mode Chaoyong He
2023-12-13  3:24 ` Chaoyong He [this message]
2023-12-13  3:24 ` [PATCH 4/5] net/nfp: use ctrl to check the mode of features Chaoyong He
2023-12-13  3:24 ` [PATCH 5/5] net/nfp: use ctrl extend " Chaoyong He
2023-12-14 16:08 ` [PATCH 0/5] unify the usage of capacity and control Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231213032416.1988817-4-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).