[1/7] net/hns3: remove redundant MAC addr check when setting MAC
Checks
Commit Message
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(-)
@@ -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))
@@ -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);