From: Chengchang Tang Date: Tue, 17 Mar 2020 09:12:01 +0000 (+0800) Subject: net/hns3: modify inappropriate names X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a90f557def6ec7744a4dce05ee0f15a35f86b9d8;p=dpdk.git net/hns3: modify inappropriate names 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) --- diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index ebf8dc9b78..fe6b21fd12 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;