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 6126BA0559; Tue, 17 Mar 2020 10:24:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3FD571C045; Tue, 17 Mar 2020 10:24:15 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id D0F281C045 for ; Tue, 17 Mar 2020 10:24:13 +0100 (CET) X-ASG-Debug-ID: 1584436944-0a3dd134b0001f0005-TfluYd Received: from mail.chinasoftinc.com (inccas001.ito.icss [10.168.0.51]) by incedge.chinasoftinc.com with ESMTP id eygOuOzijMFJDMKj (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:01 +0800 X-ASG-Orig-Subj: [PATCH 2/7] net/hns3: modify inappropriate names Message-ID: <20200317091206.34928-3-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: 1584436982 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: 1868 Subject: [dpdk-dev] [PATCH 2/7] net/hns3: modify inappropriate names 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 modifies the name of some macro and local variable to avoid devil number and increase code readability in the internal interface function named hns3_set_port_vlan_filter. Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_ethdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 614a42466..15ef03cfe 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -232,23 +232,25 @@ hns3_interrupt_handler(void *param) static int hns3_set_port_vlan_filter(struct hns3_adapter *hns, uint16_t vlan_id, int on) { -#define HNS3_VLAN_OFFSET_160 160 +#define HNS3_VLAN_ID_OFFSET_STEP 160 +#define HNS3_VLAN_BYTE_SIZE 8 struct hns3_vlan_filter_pf_cfg_cmd *req; struct hns3_hw *hw = &hns->hw; uint8_t vlan_offset_byte_val; struct hns3_cmd_desc desc; uint8_t vlan_offset_byte; - uint8_t vlan_offset_160; + uint8_t vlan_offset_base; int ret; hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_VLAN_FILTER_PF_CFG, false); - vlan_offset_160 = vlan_id / HNS3_VLAN_OFFSET_160; - vlan_offset_byte = (vlan_id % HNS3_VLAN_OFFSET_160) / 8; - vlan_offset_byte_val = 1 << (vlan_id % 8); + vlan_offset_base = vlan_id / HNS3_VLAN_ID_OFFSET_STEP; + vlan_offset_byte = (vlan_id % HNS3_VLAN_ID_OFFSET_STEP) / + HNS3_VLAN_BYTE_SIZE; + vlan_offset_byte_val = 1 << (vlan_id % HNS3_VLAN_BYTE_SIZE); req = (struct hns3_vlan_filter_pf_cfg_cmd *)desc.data; - req->vlan_offset = vlan_offset_160; + req->vlan_offset = vlan_offset_base; req->vlan_cfg = on ? 0 : 1; req->vlan_offset_bitmap[vlan_offset_byte] = vlan_offset_byte_val; -- 2.23.0