From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 2/7] net/hns3: modify inappropriate names
Date: Tue, 17 Mar 2020 17:12:01 +0800 [thread overview]
Message-ID: <20200317091206.34928-3-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com>
From: Chengchang Tang <tangchengchang@huawei.com>
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 <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
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
next prev parent 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 ` [dpdk-dev] [PATCH 1/7] net/hns3: remove redundant MAC addr check when setting MAC Wei Hu (Xavier)
2020-03-17 9:12 ` Wei Hu (Xavier) [this message]
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-3-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).