DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/7] net/hns3: remove redundant MAC addr check when setting MAC
Date: Tue, 17 Mar 2020 17:12:00 +0800	[thread overview]
Message-ID: <20200317091206.34928-2-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com>

From: Chengchang Tang <tangchengchang@huawei.com>

This patch removes unnecessary MAC address validity check operation in the
.mac_addr_set ops implementation function named hns3_set_default_mac_addr
and hns3vf_set_default_mac_addr, because it has been guaranteed that input
parameter named mac_addr is valid address in the rte layer of DPDK
framework.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 13 ++++---------
 drivers/net/hns3/hns3_ethdev_vf.c | 12 ++++--------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 26366013f..614a42466 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -1487,15 +1487,10 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev,
 	bool rm_succes = false;
 	int ret, ret_val;
 
-	/* check if mac addr is valid */
-	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
-		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-				      mac_addr);
-		hns3_err(hw, "Failed to set mac addr, addr(%s) invalid",
-			 mac_str);
-		return -EINVAL;
-	}
-
+	/*
+	 * It has been guaranteed that input parameter named mac_addr is valid
+	 * address in the rte layer of DPDK framework.
+	 */
 	oaddr = (struct rte_ether_addr *)hw->mac.mac_addr;
 	default_addr_setted = hw->mac.default_addr_setted;
 	if (default_addr_setted && !!rte_is_same_ether_addr(mac_addr, oaddr))
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 16b7f015f..1c508f06a 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -192,14 +192,10 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev,
 	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
 	int ret;
 
-	if (!rte_is_valid_assigned_ether_addr(mac_addr)) {
-		rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
-				      mac_addr);
-		hns3_err(hw, "Failed to set mac addr, addr(%s) invalid.",
-			 mac_str);
-		return -EINVAL;
-	}
-
+	/*
+	 * It has been guaranteed that input parameter named mac_addr is valid
+	 * address in the rte layer of DPDK framework.
+	 */
 	old_addr = (struct rte_ether_addr *)hw->mac.mac_addr;
 	rte_spinlock_lock(&hw->lock);
 	memcpy(addr_bytes, mac_addr->addr_bytes, RTE_ETHER_ADDR_LEN);
-- 
2.23.0


  reply	other threads:[~2020-03-17  9:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  9:11 [dpdk-dev] [PATCH 0/7] misc updates for hns3 PMD driver Wei Hu (Xavier)
2020-03-17  9:12 ` Wei Hu (Xavier) [this message]
2020-03-17  9:12 ` [dpdk-dev] [PATCH 2/7] net/hns3: modify inappropriate names Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 3/7] net/hns3: fix packets's offload features flags in Rx Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 4/7] net/hns3: fix default error code of command interface Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 5/7] net/hns3: fix crash when flushing RSS flow rules with FLR Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 6/7] net/hns3: fix configuring illeagl VLAN pvid Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 7/7] net/hns3: fix abnormal status after reset occurs repeatedly Wei Hu (Xavier)
2020-03-19  9:08 ` [dpdk-dev] [PATCH 0/7] misc updates for hns3 PMD driver 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=20200317091206.34928-2-huwei013@chinasoftinc.com \
    --to=huwei013@chinasoftinc.com \
    --cc=dev@dpdk.org \
    /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).