From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFD20A0559; Tue, 17 Mar 2020 10:24:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2FE791C08C; Tue, 17 Mar 2020 10:24:24 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id E49401C07B for ; Tue, 17 Mar 2020 10:24:20 +0100 (CET) X-ASG-Debug-ID: 1584436950-0a3dd134b200220002-TfluYd Received: from mail.chinasoftinc.com (inccas001.ito.icss [10.168.0.51]) by incedge.chinasoftinc.com with ESMTP id e6MZa5vnZi0C302X (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 17 Mar 2020 17:23:03 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.51 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS001.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 17 Mar 2020 17:13:13 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Tue, 17 Mar 2020 17:12:00 +0800 X-ASG-Orig-Subj: [PATCH 1/7] net/hns3: remove redundant MAC addr check when setting MAC Message-ID: <20200317091206.34928-2-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com> References: <20200317091206.34928-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas001.ito.icss[10.168.0.51] X-Barracuda-Start-Time: 1584436952 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://incspam.chinasofti.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2444 Subject: [dpdk-dev] [PATCH 1/7] net/hns3: remove redundant MAC addr check when setting MAC X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengchang Tang 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 Signed-off-by: Wei Hu (Xavier) --- 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