From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
HCLGE_MAC_DEL_FAIL is a middle state for mac address handling, it can be merged with HCLGE_MAC_TO_DEL.
Btw, this patch also change the enum name from HCLGE_MAC_ADDR_STATE to HCLGE_MAC_NODE_STATE, for it's used to indicate the state of mac node.
Signed-off-by: Jian Shen shenjian15@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 46 ++++++++++------------ .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 9 ++--- 2 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 478a3b5..d985c68 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -7422,14 +7422,13 @@ static void hclge_update_umv_space(struct hclge_vport *vport, bool is_free) return NULL; }
-static void hclge_mac_node_convert(struct hclge_vport_mac_addr_cfg *mac_node, - enum HCLGE_MAC_ADDR_STATE state) +static void hclge_update_mac_node(struct hclge_vport_mac_addr_cfg *mac_node, + enum HCLGE_MAC_NODE_STATE state) { switch (state) { /* from set_rx_mode or tmp_add_list */ case HCLGE_MAC_TO_ADD: - if (mac_node->state == HCLGE_MAC_TO_DEL || - mac_node->state == HCLGE_MAC_DEL_FAIL) + if (mac_node->state == HCLGE_MAC_TO_DEL) mac_node->state = HCLGE_MAC_ACTIVE; break; /* only from set_rx_mode */ @@ -7442,14 +7441,7 @@ static void hclge_mac_node_convert(struct hclge_vport_mac_addr_cfg *mac_node, } break; /* only from tmp_add_list, the mac_node->state won't be - * HCLGE_MAC_ACTIVE/HCLGE_MAC_DEL_FAIL/HCLGE_MAC_ADD_FAIL - */ - case HCLGE_MAC_DEL_FAIL: - if (mac_node->state == HCLGE_MAC_TO_ADD) - mac_node->state = HCLGE_MAC_ACTIVE; - break; - /* only from tmp_add_list, the mac_node->state won't be - * HCLGE_MAC_ACTIVE/HCLGE_MAC_DEL_FAIL/HCLGE_MAC_ADD_FAIL + * ACTIVE. */ case HCLGE_MAC_ACTIVE: if (mac_node->state == HCLGE_MAC_TO_ADD) @@ -7460,7 +7452,7 @@ static void hclge_mac_node_convert(struct hclge_vport_mac_addr_cfg *mac_node, }
int hclge_update_mac_list(struct hclge_vport *vport, - enum HCLGE_MAC_ADDR_STATE state, + enum HCLGE_MAC_NODE_STATE state, enum HCLGE_MAC_ADDR_TYPE mac_type, const unsigned char *addr) { @@ -7480,7 +7472,7 @@ int hclge_update_mac_list(struct hclge_vport *vport, */ mac_node = hclge_find_mac_node(list, addr); if (mac_node) { - hclge_mac_node_convert(mac_node, state); + hclge_update_mac_node(mac_node, state); spin_unlock_bh(&vport->mac_list_lock); return 0; } @@ -7731,7 +7723,6 @@ static void hclge_unsync_mac_list(struct hclge_vport *vport, list_del(&mac_node->node); kfree(mac_node); } else { - mac_node->state = HCLGE_MAC_DEL_FAIL; set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, &vport->state); break; @@ -7753,13 +7744,13 @@ static bool hclge_sync_from_add_list(struct list_head *add_list, * uc/mc_mac_list, it means have received a TO_DEL request * during the time window of adding the mac address into mac * table. if mac_node state is ACTIVE, then change it to TO_DEL, - * then it will be removed at next time. else it must be TO_ADD - * or ADD_FAIL, this address hasn't been added into mac table, + * then it will be removed at next time. else it must be TO_ADD, + * this address hasn't been added into mac table, * so just remove the mac node. */ new_node = hclge_find_mac_node(mac_list, mac_node->mac_addr); if (new_node) { - hclge_mac_node_convert(new_node, mac_node->state); + hclge_update_mac_node(new_node, mac_node->state); list_del(&mac_node->node); kfree(mac_node); } else if (mac_node->state == HCLGE_MAC_ACTIVE) { @@ -7782,7 +7773,16 @@ static void hclge_sync_from_del_list(struct list_head *del_list, list_for_each_entry_safe(mac_node, tmp, del_list, node) { new_node = hclge_find_mac_node(mac_list, mac_node->mac_addr); if (new_node) { - hclge_mac_node_convert(new_node, mac_node->state); + /* If the mac addr exists in the mac list, it means + * received a new TO_ADD request during the time window + * of configuring the mac address. For the mac node + * state is TO_ADD, and the address is already in the + * in the hardware(due to delete fail), so we just need + * to change the mac node state to ACTIVE. + */ + new_node->state = HCLGE_MAC_ACTIVE; + list_del(&mac_node->node); + kfree(mac_node); } else { list_del(&mac_node->node); list_add_tail(&mac_node->node, mac_list); @@ -7850,7 +7850,6 @@ static void hclge_sync_vport_mac_table(struct hclge_vport *vport, list_for_each_entry_safe(mac_node, tmp, list, node) { switch (mac_node->state) { case HCLGE_MAC_TO_DEL: - case HCLGE_MAC_DEL_FAIL: list_del(&mac_node->node); list_add_tail(&mac_node->node, &tmp_del_list); break; @@ -7962,7 +7961,6 @@ void hclge_rm_vport_all_mac_table(struct hclge_vport *vport, bool is_del_list, list_for_each_entry_safe(mac_cfg, tmp, list, node) { switch (mac_cfg->state) { case HCLGE_MAC_TO_DEL: - case HCLGE_MAC_DEL_FAIL: case HCLGE_MAC_ACTIVE: list_del(&mac_cfg->node); list_add_tail(&mac_cfg->node, &tmp_del_list); @@ -8021,7 +8019,6 @@ static void hclge_uninit_mac_list(struct hclge_vport *vport, list_for_each_entry_safe(mac_node, tmp, list, node) { switch (mac_node->state) { case HCLGE_MAC_TO_DEL: - case HCLGE_MAC_DEL_FAIL: case HCLGE_MAC_ACTIVE: list_del(&mac_node->node); list_add_tail(&mac_node->node, &tmp_del_list); @@ -8221,7 +8218,7 @@ void hclge_replace_mac_node(struct list_head *list, const u8 *old_addr, }
void hclge_modify_mac_node_state(struct list_head *list, const u8 *addr, - enum HCLGE_MAC_ADDR_STATE state) + enum HCLGE_MAC_NODE_STATE state) { struct hclge_vport_mac_addr_cfg *mac_node;
@@ -8989,8 +8986,7 @@ static void hclge_mac_node_convert_for_reset(struct list_head *list) list_for_each_entry_safe(mac_node, tmp, list, node) { if (mac_node->state == HCLGE_MAC_ACTIVE) { mac_node->state = HCLGE_MAC_TO_ADD; - } else if (mac_node->state == HCLGE_MAC_TO_DEL || - mac_node->state == HCLGE_MAC_DEL_FAIL) { + } else if (mac_node->state == HCLGE_MAC_TO_DEL) { list_del(&mac_node->node); kfree(mac_node); } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 5e462cf..a1fa782 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -640,16 +640,15 @@ struct hclge_fd_ad_data { u16 rule_id; };
-enum HCLGE_MAC_ADDR_STATE { +enum HCLGE_MAC_NODE_STATE { HCLGE_MAC_TO_ADD, HCLGE_MAC_TO_DEL, - HCLGE_MAC_DEL_FAIL, HCLGE_MAC_ACTIVE };
struct hclge_vport_mac_addr_cfg { struct list_head node; - enum HCLGE_MAC_ADDR_STATE state; + enum HCLGE_MAC_NODE_STATE state; u8 mac_addr[ETH_ALEN]; };
@@ -1016,13 +1015,13 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, int hclge_notify_client(struct hclge_dev *hdev, enum hnae3_reset_notify_type type); int hclge_update_mac_list(struct hclge_vport *vport, - enum HCLGE_MAC_ADDR_STATE state, + enum HCLGE_MAC_NODE_STATE state, enum HCLGE_MAC_ADDR_TYPE mac_type, const unsigned char *addr); void hclge_replace_mac_node(struct list_head *list, const u8 *old_addr, const u8 *new_addr, bool keep_old); void hclge_modify_mac_node_state(struct list_head *list, const u8 *addr, - enum HCLGE_MAC_ADDR_STATE state); + enum HCLGE_MAC_NODE_STATE state); void hclge_rm_vport_all_mac_table(struct hclge_vport *vport, bool is_del_list, enum HCLGE_MAC_ADDR_TYPE mac_type); void hclge_rm_vport_all_vlan_table(struct hclge_vport *vport, bool is_del_list);
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This adds some cleanups related to VF reset. Firstly, removes a unnecessary print in hclgevf_reset_wait(). Secondly, convert function hclgevf_reset() from int to void.
Signed-off-by: Huazhong Tan tanhuazhong@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 41 ++++++---------------- 1 file changed, 11 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 4a3b79dd..f1b4118 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1613,10 +1613,6 @@ static int hclgevf_reset_wait(struct hclgevf_dev *hdev) u32 val; int ret;
- /* wait to check the hardware reset completion status */ - val = hclgevf_read_dev(&hdev->hw, HCLGEVF_RST_ING); - dev_info(&hdev->pdev->dev, "checking vf resetting status: %x\n", val); - if (hdev->reset_type == HNAE3_VF_RESET) ret = readl_poll_timeout(hdev->hw.io_base + HCLGEVF_VF_RST_ING, val, @@ -1780,13 +1776,14 @@ static int hclgevf_reset_rebuild(struct hclgevf_dev *hdev) { int ret;
+ hdev->rst_stats.hw_rst_done_cnt++; + rtnl_lock(); /* now, re-initialize the nic client and ae device */ ret = hclgevf_reset_stack(hdev); rtnl_unlock(); if (ret) { - dev_err(&hdev->pdev->dev, - "fail to reset VF stack, ret=%d\n", ret); + dev_err(&hdev->pdev->dev, "failed to reset VF stack\n"); return ret; }
@@ -1798,38 +1795,28 @@ static int hclgevf_reset_rebuild(struct hclgevf_dev *hdev) return 0; }
-static int hclgevf_reset(struct hclgevf_dev *hdev) +static void hclgevf_reset(struct hclgevf_dev *hdev) { - int ret; - - ret = hclgevf_reset_prepare(hdev); - if (ret) + if (hclgevf_reset_prepare(hdev)) goto err_reset;
/* check if VF could successfully fetch the hardware reset completion * status from the hardware */ - ret = hclgevf_reset_wait(hdev); - if (ret) { + if (hclgevf_reset_wait(hdev)) { /* can't do much in this situation, will disable VF */ dev_err(&hdev->pdev->dev, - "VF failed(=%d) to fetch H/W reset completion status\n", - ret); + "failed to fetch H/W reset completion status\n"); goto err_reset; }
- hdev->rst_stats.hw_rst_done_cnt++; - - ret = hclgevf_reset_rebuild(hdev); - if (ret) + if (hclgevf_reset_rebuild(hdev)) goto err_reset;
- return ret; + return;
err_reset: hclgevf_reset_err_handle(hdev); - - return ret; }
static enum hnae3_reset_type hclgevf_get_reset_level(struct hclgevf_dev *hdev, @@ -1998,8 +1985,6 @@ static void hclgevf_reset_service_task(struct hclgevf_dev *hdev) { #define HCLGEVF_MAX_RESET_ATTEMPTS_CNT 3
- int ret; - if (!test_and_clear_bit(HCLGEVF_STATE_RST_SERVICE_SCHED, &hdev->state)) return;
@@ -2018,12 +2003,8 @@ static void hclgevf_reset_service_task(struct hclgevf_dev *hdev) hdev->last_reset_time = jiffies; while ((hdev->reset_type = hclgevf_get_reset_level(hdev, &hdev->reset_pending)) - != HNAE3_NONE_RESET) { - ret = hclgevf_reset(hdev); - if (ret) - dev_err(&hdev->pdev->dev, - "VF stack reset failed %d.\n", ret); - } + != HNAE3_NONE_RESET) + hclgevf_reset(hdev); } else if (test_and_clear_bit(HCLGEVF_RESET_REQUESTED, &hdev->reset_state)) { /* we could be here when either of below happens:
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Since the IRQ handler will print out the register info, so this patch removes the redundant printing register info in hclge_reset_err_handle().
Signed-off-by: Huazhong Tan tanhuazhong@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index d985c68..64a6d74 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3614,18 +3614,15 @@ static int hclge_reset_prepare_wait(struct hclge_dev *hdev) static bool hclge_reset_err_handle(struct hclge_dev *hdev) { struct hnae3_handle *handle = &hdev->vport[0].nic; - u32 msix_sts_reg; - - msix_sts_reg = hclge_read_dev(&hdev->hw, HCLGE_MISC_VECTOR_INT_STS);
if (hdev->reset_pending) { dev_info(&hdev->pdev->dev, "Reset pending %lu\n", hdev->reset_pending); return true; - } else if (msix_sts_reg & HCLGE_RESET_INT_M) { + } else if (hclge_read_dev(&hdev->hw, HCLGE_MISC_VECTOR_INT_STS) & + HCLGE_RESET_INT_M) { dev_info(&hdev->pdev->dev, - "fail to reset, new reset interrupt is 0x%x\n", - msix_sts_reg); + "reset failed because new reset interrupt\n"); hclge_clear_reset_cause(hdev); return false; } else if (hdev->rst_stats.reset_fail_cnt < HCLGE_RESET_MAX_FAIL_CNT) {
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This removes an unnecessary variable 'ret' in hclge_misc_err_recovery()
Signed-off-by: Huazhong Tan tanhuazhong@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 64a6d74..74eb3de 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4018,15 +4018,13 @@ static void hclge_misc_err_recovery(struct hclge_dev *hdev) struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev); struct device *dev = &hdev->pdev->dev; u32 msix_sts_reg; - int ret;
msix_sts_reg = hclge_read_dev(&hdev->hw, HCLGE_VECTOR0_PF_OTHER_INT_STS_REG);
if (msix_sts_reg & HCLGE_VECTOR0_REG_MSIX_MASK) { - ret = hclge_handle_hw_msix_error(hdev, - &hdev->default_reset_request); - if (ret) + if (hclge_handle_hw_msix_error(hdev, + &hdev->default_reset_request)) dev_info(dev, "received msix interrupt 0x%x\n", msix_sts_reg);
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch just modifies definition location of struct hclge_vf_vlan_cfg to sync code with linux mainline.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index a1fa782..099dc29 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -689,6 +689,17 @@ struct hclge_mac_tnl_stats { #define HCLGE_RESET_INTERVAL (12 * HZ) #define HCLGE_WAIT_RESET_DONE 100
+#pragma pack(1) +struct hclge_vf_vlan_cfg { + u8 mbx_cmd; + u8 subcode; + u8 is_kill; + u16 vlan; + u16 proto; +}; + +#pragma pack() + /* For each bit of TCAM entry, it uses a pair of 'x' and * 'y' to indicate which value to match, like below: * ---------------------------------- @@ -888,17 +899,6 @@ enum HCLGE_VPORT_STATE { HCLGE_VPORT_STATE_MAX };
-#pragma pack(1) -struct hclge_vf_vlan_cfg { - u8 mbx_cmd; - u8 subcode; - u8 is_kill; - u16 vlan; - u16 proto; -}; - -#pragma pack() - struct hclge_vlan_info { u16 vlan_proto; /* so far support 802.1Q only */ u16 qos;
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
The macro HCLGEVF_MPF_ENBALE is never used, so this patch deletes it.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h index 4b91a6a..99ab787 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -153,8 +153,6 @@ enum hclgevf_states { HCLGEVF_STATE_RST_FAIL, };
-#define HCLGEVF_MPF_ENBALE 1 - struct hclgevf_mac { u8 media_type; u8 module_type;
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch modifies macro HCLGE_MBX_MAX_RESP_DATA_SIZE into unsigned type and its print format from %d into %u.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h index a2af24b..97e60d30 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h @@ -77,7 +77,7 @@ enum hclge_mbx_tbl_cfg_subcode { };
#define HCLGE_MBX_MAX_MSG_SIZE 14 -#define HCLGE_MBX_MAX_RESP_DATA_SIZE 8 +#define HCLGE_MBX_MAX_RESP_DATA_SIZE 8U #define HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM 4
struct hclge_ring_chain_param { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index fe690f3..6bf5133 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -60,7 +60,7 @@ static int hclgevf_get_mbx_resp(struct hclgevf_dev *hdev, u16 code0, u16 code1,
if (resp_len > HCLGE_MBX_MAX_RESP_DATA_SIZE) { dev_err(&hdev->pdev->dev, - "VF mbx response len(=%u) exceeds maximum(=%d)\n", + "VF mbx response len(=%u) exceeds maximum(=%u)\n", resp_len, HCLGE_MBX_MAX_RESP_DATA_SIZE); return -EINVAL;
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch modifies msi-x into misc for comment of macro HNAE3_MIN_VECTOR_NUM.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index e5e4a5c..b73c417 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -32,7 +32,7 @@
#define HNAE3_MOD_VERSION "1.9.37.7"
-#define HNAE3_MIN_VECTOR_NUM 2 /* one for msi-x, another for IO */ +#define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */
/* Device IDs */ #define HNAE3_DEV_ID_GE 0xA220
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch just modifies definition location of struct hclge_mac_ethertype_idx_rd_cmd to sync code with linux mainline.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index 8813a35..cf529cf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -781,21 +781,6 @@ struct hclge_mac_vlan_idx_rd_cmd { __le32 index; };
-struct hclge_mac_ethertype_idx_rd_cmd { - u8 flags; - u8 resp_code; - __le16 vlan_tag; - u8 mac_addr[ETH_ALEN]; - __le16 index; - __le16 ethter_type; - __le16 egress_port; - __le16 egress_queue; - __le16 rev0; - u8 i_port_bitmap; - u8 i_port_direction; - u8 rev1[2]; -}; - #pragma pack()
struct hclge_vlan_filter_ctrl_cmd { @@ -914,6 +899,24 @@ struct hclge_cfg_tx_queue_pointer_cmd { u8 rsv[14]; };
+#pragma pack(1) +struct hclge_mac_ethertype_idx_rd_cmd { + u8 flags; + u8 resp_code; + __le16 vlan_tag; + u8 mac_addr[ETH_ALEN]; + __le16 index; + __le16 ethter_type; + __le16 egress_port; + __le16 egress_queue; + __le16 rev0; + u8 i_port_bitmap; + u8 i_port_direction; + u8 rev1[2]; +}; + +#pragma pack() + #define HCLGE_TSO_MSS_MIN_S 0 #define HCLGE_TSO_MSS_MIN_M GENMASK(13, 0)
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
An enum type parameter is passed to hclge_set_fd_key_config(), so "stage" should be declared as "enum".
Parameter of "tuple_size" is from "key_length", which with type of "u8", so modify "tuple_size" to "u8" would be modre better
This patch also cleanup some unnecessary blank lines, redundant parentheses.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 74eb3de..7052743 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4943,7 +4943,8 @@ static int hclge_get_fd_allocation(struct hclge_dev *hdev, return ret; }
-static int hclge_set_fd_key_config(struct hclge_dev *hdev, int stage_num) +static int hclge_set_fd_key_config(struct hclge_dev *hdev, + enum HCLGE_FD_STAGE stage_num) { struct hclge_set_fd_key_config_cmd *req; struct hclge_fd_key_cfg *stage; @@ -5286,8 +5287,9 @@ static int hclge_config_key(struct hclge_dev *hdev, u8 stage, u8 key_x[MAX_KEY_BYTES], key_y[MAX_KEY_BYTES]; u8 *cur_key_x, *cur_key_y; unsigned int i; - int ret, tuple_size; + int ret; u8 meta_data_region; + u8 tuple_size;
memset(key_x, 0, sizeof(key_x)); memset(key_y, 0, sizeof(key_y)); @@ -5505,7 +5507,7 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, struct ethtool_rx_flow_spec *fs, u32 *unused_tuple) { - if ((fs->flow_type & FLOW_EXT)) { + if (fs->flow_type & FLOW_EXT) { if (fs->h_ext.vlan_etype) return -EOPNOTSUPP; if (!fs->h_ext.vlan_tci) @@ -5526,7 +5528,7 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, if (is_zero_ether_addr(fs->h_ext.h_dest)) *unused_tuple |= BIT(INNER_DST_MAC); else - *unused_tuple &= ~(BIT(INNER_DST_MAC)); + *unused_tuple &= ~BIT(INNER_DST_MAC); }
return 0; @@ -5797,7 +5799,7 @@ static int hclge_fd_get_tuple(struct hclge_dev *hdev, break; }
- if ((fs->flow_type & FLOW_EXT)) { + if (fs->flow_type & FLOW_EXT) { rule->tuples.vlan_tag1 = be16_to_cpu(fs->h_ext.vlan_tci); rule->tuples_mask.vlan_tag1 = be16_to_cpu(fs->m_ext.vlan_tci); } @@ -5908,7 +5910,6 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, }
rule->flow_type = fs->flow_type; - rule->location = fs->location; rule->unused_tuple = unused; rule->vf_id = dst_vport_id; @@ -6407,14 +6408,12 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id, bit_id = find_first_zero_bit(hdev->fd_bmap, MAX_FD_FILTER_NUM); if (bit_id >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) { spin_unlock_bh(&hdev->fd_rule_lock); - return -ENOSPC; }
rule = kzalloc(sizeof(*rule), GFP_ATOMIC); if (!rule) { spin_unlock_bh(&hdev->fd_rule_lock); - return -ENOMEM; }
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
When checks tuple in hclge_fd_check_ext_tuple(), two nested "if" is used as a logic judgment. It can be spliced as one,using "&&", which make code more readability.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 7052743..a620b20 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5513,10 +5513,9 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, if (!fs->h_ext.vlan_tci) *unused_tuple |= BIT(INNER_VLAN_TAG_FST);
- if (fs->m_ext.vlan_tci) { - if (be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) - return -EINVAL; - } + if (fs->m_ext.vlan_tci && + be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) + return -EINVAL; } else { *unused_tuple |= BIT(INNER_VLAN_TAG_FST); }
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
When restores rules failed in flow table list, PF driver should delete this rule in list and go on restore the rest rules. It means that it would never return other value except "0" in hclge_restore_fd_entries. So this patch modify the return type to "void".
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index b73c417..e2fa3b3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -526,7 +526,7 @@ struct hnae3_ae_ops { struct ethtool_rxnfc *cmd); int (*get_fd_all_rules)(struct hnae3_handle *handle, struct ethtool_rxnfc *cmd, u32 *rule_locs); - int (*restore_fd_rules)(struct hnae3_handle *handle); + void (*restore_fd_rules)(struct hnae3_handle *handle); void (*enable_fd)(struct hnae3_handle *handle, bool enable); int (*add_arfs_entry)(struct hnae3_handle *handle, u16 queue_id, u16 flow_id, struct flow_keys *fkeys); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index a620b20..61d4362 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -68,7 +68,7 @@ static int hclge_set_default_loopback(struct hclge_dev *hdev);
static void hclge_sync_mac_table(struct hclge_dev *hdev); -static int hclge_restore_hw_table(struct hclge_dev *hdev); +static void hclge_restore_hw_table(struct hclge_dev *hdev); static void hclge_sync_promisc_mode(struct hclge_dev *hdev); static int hclge_vf_vlan_filter_switch(struct hclge_vport *vport);
@@ -5995,7 +5995,7 @@ static void hclge_del_all_fd_entries(struct hnae3_handle *handle, } }
-static int hclge_restore_fd_entries(struct hnae3_handle *handle) +static void hclge_restore_fd_entries(struct hnae3_handle *handle) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; @@ -6008,11 +6008,11 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle) * fail. */ if (!hnae3_dev_fd_supported(hdev)) - return 0; + return;
/* if fd is disabled, should not restore it when reset */ if (!hdev->fd_en) - return 0; + return;
spin_lock_bh(&hdev->fd_rule_lock); hlist_for_each_entry_safe(rule, node, &hdev->fd_rule_list, rule_node) { @@ -6035,8 +6035,6 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle) hdev->fd_active_type = HCLGE_FD_EP_ACTIVE;
spin_unlock_bh(&hdev->fd_rule_lock); - - return 0; }
static int hclge_get_fd_rule_cnt(struct hnae3_handle *handle, @@ -8996,7 +8994,7 @@ void hclge_restore_mac_table_common(struct hclge_vport *vport) spin_unlock_bh(&vport->mac_list_lock); }
-static int hclge_restore_hw_table(struct hclge_dev *hdev) +static void hclge_restore_hw_table(struct hclge_dev *hdev) { struct hclge_vport *vport = &hdev->vport[0]; struct hnae3_handle *handle = &vport->nic; @@ -9006,7 +9004,7 @@ static int hclge_restore_hw_table(struct hclge_dev *hdev) hclge_restore_vport_vlan_table(vport); set_bit(HCLGE_STATE_PROMISC_CHANGED, &hdev->state);
- return hclge_restore_fd_entries(handle); + hclge_restore_fd_entries(handle); }
int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Add some debug information for processing flow table if failed.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 46 +++++++++++++++------- 1 file changed, 31 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 61d4362..1fef35f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5508,21 +5508,29 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, u32 *unused_tuple) { if (fs->flow_type & FLOW_EXT) { - if (fs->h_ext.vlan_etype) + if (fs->h_ext.vlan_etype) { + dev_err(&hdev->pdev->dev, "vlan-etype does not support on this device!\n"); return -EOPNOTSUPP; + } + if (!fs->h_ext.vlan_tci) *unused_tuple |= BIT(INNER_VLAN_TAG_FST);
if (fs->m_ext.vlan_tci && - be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) + be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) { + dev_err(&hdev->pdev->dev, "failed to config vlan_tci, invalid vlan_tci: %u, max is %u.\n", + ntohs(fs->h_ext.vlan_tci), VLAN_N_VID - 1); return -EINVAL; + } } else { *unused_tuple |= BIT(INNER_VLAN_TAG_FST); }
if (fs->flow_type & FLOW_MAC_EXT) { - if (!(hdev->fd_cfg.proto_support & BIT(ETHER_FLOW))) + if (!(hdev->fd_cfg.proto_support & BIT(ETHER_FLOW))) { + dev_err(&hdev->pdev->dev, "unsupported protocol of ETHER_FLOW on this device.\n"); return -EOPNOTSUPP; + }
if (is_zero_ether_addr(fs->h_ext.h_dest)) *unused_tuple |= BIT(INNER_DST_MAC); @@ -5540,12 +5548,19 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, u32 flow_type; int ret = 0;
- if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) + if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) { + dev_err(&hdev->pdev->dev, "failed to config fd rules, invalid rule location: %u, max is %u\n.", + fs->location, + hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1] - 1); return -EINVAL; + }
flow_type = fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT); - if (!(BIT(flow_type) & hdev->fd_cfg.proto_support)) + if (!(BIT(flow_type) & hdev->fd_cfg.proto_support)) { + dev_err(&hdev->pdev->dev, "unsupported protocol type, protocol type = 0x%x\n", + flow_type); return -EOPNOTSUPP; + }
if ((fs->flow_type & FLOW_EXT) && (fs->h_ext.data[0] != 0 || fs->h_ext.data[1] != 0)) { @@ -5582,12 +5597,13 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, return -EOPNOTSUPP; }
- if (ret) + if (ret) { + dev_err(&hdev->pdev->dev, "failed to check flow tuple, ret = %d\n", + ret); return ret; + }
- ret = hclge_fd_check_ext_tuple(hdev, fs, unused_tuple); - - return ret; + return hclge_fd_check_ext_tuple(hdev, fs, unused_tuple); }
static bool hclge_fd_rule_exist(struct hclge_dev *hdev, u16 location) @@ -5853,22 +5869,22 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, u8 action; int ret;
- if (!hnae3_dev_fd_supported(hdev)) + if (!hnae3_dev_fd_supported(hdev)) { + dev_err(&hdev->pdev->dev, "Flow Table Director is unsupported\n"); return -EOPNOTSUPP; + }
if (!hdev->fd_en) { - dev_warn(&hdev->pdev->dev, - "Please enable flow director first\n"); + dev_err(&hdev->pdev->dev, + "Please enable flow director first\n"); return -EOPNOTSUPP; }
fs = (struct ethtool_rx_flow_spec *)&cmd->fs;
ret = hclge_fd_check_spec(hdev, fs, &unused); - if (ret) { - dev_err(&hdev->pdev->dev, "Check fd spec failed\n"); + if (ret) return ret; - }
if (fs->ring_cookie == RX_CLS_FLOW_DISC) { action = HCLGE_FD_ACTION_DROP_PACKET;
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch modifies one failed print message for using uniform format.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index de3d37c3..7d0c003 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3719,7 +3719,7 @@ static void hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv) * the remaining options. */ if (hns3_get_vector_ring_chain(tqp_vector, &vector_ring_chain)) - dev_warn(priv->dev, "get ring chain fail\n"); + dev_warn(priv->dev, "failed to get ring chain\n");
h->ae_algo->ops->unmap_ring_from_vector(h, tqp_vector->vector_irq, &vector_ring_chain);
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch fixes the following two points: 1. Net device can not change mtu with stream. So if 'net stop' failed, mtu setting should abort. this patch fixes this. 2. Fixes some coding style with the location of parameter.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 1fef35f..eb2c6ef 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5286,10 +5286,10 @@ static int hclge_config_key(struct hclge_dev *hdev, u8 stage, struct hclge_fd_key_cfg *key_cfg = &hdev->fd_cfg.key_cfg[stage]; u8 key_x[MAX_KEY_BYTES], key_y[MAX_KEY_BYTES]; u8 *cur_key_x, *cur_key_y; - unsigned int i; - int ret; u8 meta_data_region; u8 tuple_size; + int ret; + u32 i;
memset(key_x, 0, sizeof(key_x)); memset(key_y, 0, sizeof(key_y)); @@ -9431,7 +9431,11 @@ int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu) return -EINVAL; }
- hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); + ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); + if (ret) { + mutex_unlock(&hdev->vport_lock); + return ret; + }
ret = hclge_set_mac_mtu(hdev, max_frm_size); if (ret) {
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Since kernel already has logs after kzalloc fails, it's unnecessary to print duplicate logs. So this patch deletes these logs.
Signed-off-by: Yufeng Mo moyufeng@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index 2b85d08..f66b1fd 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -143,12 +143,10 @@ static void hclge_dbg_dump_reg_common(struct hclge_dev *hdev, return; }
- buf_len = sizeof(struct hclge_desc) * bd_num; + buf_len = sizeof(struct hclge_desc) * bd_num; desc_src = kzalloc(buf_len, GFP_KERNEL); - if (!desc_src) { - dev_err(&hdev->pdev->dev, "call kzalloc failed\n"); + if (!desc_src) return; - }
desc = desc_src; ret = hclge_dbg_cmd_send(hdev, desc, index, bd_num, reg_msg->cmd); @@ -845,10 +843,8 @@ static void hclge_dbg_dump_mac_table(struct hclge_dev *hdev)
len = sizeof(struct hclge_mac_vlan_idx_rd_mc) * HCLGE_DBG_MAC_TBL_MAX; mc_mac_tbl = kzalloc(len, GFP_KERNEL); - if (!mc_mac_tbl) { - dev_err(&hdev->pdev->dev, "mc_mac_tbl alloc memory failed\n"); + if (!mc_mac_tbl) return; - }
memset(printf_buf, 0, HCLGE_DBG_BUF_LEN); dev_info(&hdev->pdev->dev, "Unicast tab:\n");
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Function hns3_nic_net_xmit() and functioin hns3_nic_maybe_stop_tx() both get ring pointer from priv->ring[]. According to opinion of community to reduce this kind of operation, this patch adds parameter ring for function hns3_nic_maybe_stop_tx().
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 7d0c003..09ed7045 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1296,15 +1296,14 @@ void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size) size[i] = skb_frag_size(&shinfo->frags[i]); }
-static int hns3_nic_maybe_stop_tx(struct net_device *netdev, +static int hns3_nic_maybe_stop_tx(struct hns3_enet_ring *ring, + struct net_device *netdev, struct sk_buff *skb) { struct hns3_nic_priv *priv = netdev_priv(netdev); unsigned int bd_size[HNS3_MAX_TSO_BD_NUM + 1U]; - struct hns3_enet_ring *ring; unsigned int bd_num;
- ring = &priv->ring[skb->queue_mapping]; bd_num = hns3_tx_bd_num(skb, bd_size); if (unlikely(bd_num > HNS3_MAX_NON_TSO_BD_NUM)) {
@@ -1430,7 +1429,7 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev) /* Prefetch the data used later */ prefetch(skb->data);
- ret = hns3_nic_maybe_stop_tx(netdev, skb); + ret = hns3_nic_maybe_stop_tx(ring, netdev, skb); if (unlikely(ret <= 0)) { if (ret == -EBUSY) { u64_stats_update_begin(&ring->syncp);
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Currently, we change the device address directly in the path f hns3_set_mac_address(). There is a race with calling hclge_sync_vport_mac_table(), both them can add/delete mac address without vport->mac_list_lock protection. This patch fixes it by only updating mac list, then adding/deleting the mac address by hclge_sync_vport_mac_table().
Signed-off-by: Jian Shen shenjian15@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 131 ++++++++------------- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 6 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 58 ++------- 3 files changed, 64 insertions(+), 131 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index eb2c6ef..65c77448 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -7469,8 +7469,6 @@ int hclge_update_mac_list(struct hclge_vport *vport, list = (mac_type == HCLGE_MAC_ADDR_UC) ? &vport->uc_mac_list : &vport->mc_mac_list;
- set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, &vport->state); - spin_lock_bh(&vport->mac_list_lock);
/* if the mac addr is already in the mac list, no need to add a new @@ -7481,6 +7479,7 @@ int hclge_update_mac_list(struct hclge_vport *vport, if (mac_node) { hclge_update_mac_node(mac_node, state); spin_unlock_bh(&vport->mac_list_lock); + set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, &vport->state); return 0; }
@@ -7496,6 +7495,8 @@ int hclge_update_mac_list(struct hclge_vport *vport, return -ENOMEM; }
+ set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, &vport->state); + mac_node->state = state; ether_addr_copy(mac_node->mac_addr, addr); list_add_tail(&mac_node->node, list); @@ -8193,45 +8194,47 @@ static void hclge_get_mac_addr(struct hnae3_handle *handle, u8 *p) ether_addr_copy(p, hdev->hw.mac.mac_addr); }
-/* use new node to replace old node in the list, if old address is still in - * mac table, add it to list tail, and try to remove in service task - */ -void hclge_replace_mac_node(struct list_head *list, const u8 *old_addr, - const u8 *new_addr, bool keep_old) +int hclge_update_mac_node_for_dev_addr(struct hclge_vport *vport, + const u8 *old_addr, const u8 *new_addr) { - struct hclge_vport_mac_addr_cfg *mac_node, *new_node; + struct hclge_vport_mac_addr_cfg *old_node, *new_node; + struct list_head *list = &vport->uc_mac_list;
- mac_node = hclge_find_mac_node(list, old_addr); - if (!mac_node) { + new_node = hclge_find_mac_node(list, new_addr); + if (!new_node) { new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC); if (!new_node) - return; - new_node->state = HCLGE_MAC_ACTIVE; + return -ENOMEM; + new_node->state = HCLGE_MAC_TO_ADD; ether_addr_copy(new_node->mac_addr, new_addr); - list_add_tail(&new_node->node, list); - return; + list_add(&new_node->node, list); + } else { + if (new_node->state == HCLGE_MAC_TO_DEL) + new_node->state = HCLGE_MAC_ACTIVE; + + /* make sure the new addr is in the list head, avoid dev + * addr may be not re-added into mac table for the umv space + * limitation after global/imp reset which will clear mac + * table by hardware. + */ + list_move(&new_node->node, list); }
- mac_node->state = HCLGE_MAC_ACTIVE; - ether_addr_copy(mac_node->mac_addr, new_addr); - if (keep_old) { - new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC); - if (!new_node) - return; - new_node->state = HCLGE_MAC_TO_DEL; - ether_addr_copy(new_node->mac_addr, old_addr); - list_add_tail(&new_node->node, list); + if (old_addr && !ether_addr_equal(old_addr, new_addr)) { + old_node = hclge_find_mac_node(list, old_addr); + if (old_node) { + if (old_node->state == HCLGE_MAC_TO_ADD) { + list_del(&old_node->node); + kfree(old_node); + } else { + old_node->state = HCLGE_MAC_TO_DEL; + } + } } -}
-void hclge_modify_mac_node_state(struct list_head *list, const u8 *addr, - enum HCLGE_MAC_NODE_STATE state) -{ - struct hclge_vport_mac_addr_cfg *mac_node; + set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, &vport->state);
- mac_node = hclge_find_mac_node(list, addr); - if (mac_node) - mac_node->state = state; + return 0; }
static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p, @@ -8240,7 +8243,7 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p, const unsigned char *new_addr = (const unsigned char *)p; struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - bool old_mac_removed = true; + unsigned char *old_addr = NULL; int ret;
/* mac addr check */ @@ -8253,63 +8256,33 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p, return -EINVAL; }
- if ((!is_first || is_kdump_kernel()) && - hclge_rm_uc_addr_common(vport, hdev->hw.mac.mac_addr)) { - dev_warn(&hdev->pdev->dev, - "remove old uc mac address fail.\n"); - old_mac_removed = false; - } - - ret = hclge_add_uc_addr_common(vport, new_addr); + ret = hclge_pause_addr_cfg(hdev, new_addr); if (ret) { dev_err(&hdev->pdev->dev, - "add uc mac address fail, ret =%d.\n", + "Failed to configure mac pause address, ret=%d\n", ret); - - if (!is_first) { - ret = hclge_add_uc_addr_common(vport, - hdev->hw.mac.mac_addr); - if (ret) { - old_mac_removed = true; - dev_err(&hdev->pdev->dev, - "restore uc mac address fail.\n"); - } else { - old_mac_removed = false; - } - } - - /* if old dev addr restore failed, add to the uc mac list, - * and try to restore it in service task - */ - if (old_mac_removed) { - spin_lock_bh(&vport->mac_list_lock); - hclge_modify_mac_node_state(&vport->uc_mac_list, - hdev->hw.mac.mac_addr, - HCLGE_MAC_TO_ADD); - spin_unlock_bh(&vport->mac_list_lock); - } - - return -EIO; + return ret; }
- /* new dev addr add success, replace the old dev addr in uc mac list. - * if old dev addr delete fail, keep it in the mac list, and try to del - * it in service task. - */ - spin_lock_bh(&vport->mac_list_lock); - hclge_replace_mac_node(&vport->uc_mac_list, hdev->hw.mac.mac_addr, - new_addr, !old_mac_removed); - spin_unlock_bh(&vport->mac_list_lock); + if (!is_first) + old_addr = hdev->hw.mac.mac_addr;
- ret = hclge_pause_addr_cfg(hdev, new_addr); + spin_lock_bh(&vport->mac_list_lock); + ret = hclge_update_mac_node_for_dev_addr(vport, old_addr, new_addr); if (ret) { dev_err(&hdev->pdev->dev, - "configure mac pause address fail, ret =%d.\n", - ret); - return -EIO; + "Failed to change the mac addr:%pM, ret =%d\n", + new_addr, ret); + spin_unlock_bh(&vport->mac_list_lock); + return ret; } - + /* we must update dev addr with spin lock protect, preventing dev addr + * being removed by set_rx_mode path. + */ ether_addr_copy(hdev->hw.mac.mac_addr, new_addr); + spin_unlock_bh(&vport->mac_list_lock); + + hclge_task_schedule(hdev, 0);
return 0; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 099dc29..457ba1c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -1018,10 +1018,8 @@ int hclge_update_mac_list(struct hclge_vport *vport, enum HCLGE_MAC_NODE_STATE state, enum HCLGE_MAC_ADDR_TYPE mac_type, const unsigned char *addr); -void hclge_replace_mac_node(struct list_head *list, const u8 *old_addr, - const u8 *new_addr, bool keep_old); -void hclge_modify_mac_node_state(struct list_head *list, const u8 *addr, - enum HCLGE_MAC_NODE_STATE state); +int hclge_update_mac_node_for_dev_addr(struct hclge_vport *vport, + const u8 *old_addr, const u8 *new_addr); void hclge_rm_vport_all_mac_table(struct hclge_vport *vport, bool is_del_list, enum HCLGE_MAC_ADDR_TYPE mac_type); void hclge_rm_vport_all_vlan_table(struct hclge_vport *vport, bool is_del_list); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index e650719..362ebf8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -344,36 +344,6 @@ void hclge_inform_vf_promisc_info(struct hclge_vport *vport) HCLGE_MBX_PUSH_PROMISC_INFO, dest_vfid); }
-static int hclge_modify_vf_mac_addr(struct hclge_vport *vport, - const u8 *old_addr, const u8 *new_addr) -{ - bool old_mac_removed = true; - int ret; - - ret = hclge_rm_uc_addr_common(vport, old_addr); - if (ret) - old_mac_removed = false; - - ret = hclge_add_uc_addr_common(vport, new_addr); - if (ret) { - ret = hclge_add_uc_addr_common(vport, old_addr); - if (ret) { - spin_lock_bh(&vport->mac_list_lock); - hclge_modify_mac_node_state(&vport->uc_mac_list, - old_addr, HCLGE_MAC_TO_ADD); - spin_unlock_bh(&vport->mac_list_lock); - } - return -EIO; - - } else { - spin_lock_bh(&vport->mac_list_lock); - hclge_replace_mac_node(&vport->uc_mac_list, old_addr, new_addr, - !old_mac_removed); - spin_unlock_bh(&vport->mac_list_lock); - } - return ret; -} - static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport, struct hclge_mbx_vf_to_pf_cmd *mbx_req) { @@ -381,7 +351,7 @@ static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport,
const u8 *mac_addr = (const u8 *)(mbx_req->msg.data); struct hclge_dev *hdev = vport->back; - int status = 0; + int status;
if (mbx_req->msg.subcode == HCLGE_MBX_MAC_VLAN_UC_MODIFY) { const u8 *old_addr = (const u8 *) @@ -397,25 +367,17 @@ static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport, if (!is_valid_ether_addr(mac_addr)) return -EINVAL;
- if (is_zero_ether_addr(old_addr)) { - status = hclge_add_uc_addr_common(vport, mac_addr); - if (!status) - hclge_update_mac_list(vport, HCLGE_MAC_ACTIVE, - HCLGE_MAC_ADDR_UC, - mac_addr); - else - hclge_update_mac_list(vport, HCLGE_MAC_TO_ADD, - HCLGE_MAC_ADDR_UC, - mac_addr); - } else { - hclge_modify_vf_mac_addr(vport, old_addr, mac_addr); - } + spin_lock_bh(&vport->mac_list_lock); + status = hclge_update_mac_node_for_dev_addr(vport, old_addr, + mac_addr); + spin_unlock_bh(&vport->mac_list_lock); + hclge_task_schedule(hdev, 0); } else if (mbx_req->msg.subcode == HCLGE_MBX_MAC_VLAN_UC_ADD) { - hclge_update_mac_list(vport, HCLGE_MAC_TO_ADD, - HCLGE_MAC_ADDR_UC, mac_addr); + status = hclge_update_mac_list(vport, HCLGE_MAC_TO_ADD, + HCLGE_MAC_ADDR_UC, mac_addr); } else if (mbx_req->msg.subcode == HCLGE_MBX_MAC_VLAN_UC_REMOVE) { - hclge_update_mac_list(vport, HCLGE_MAC_TO_DEL, - HCLGE_MAC_ADDR_UC, mac_addr); + status = hclge_update_mac_list(vport, HCLGE_MAC_TO_DEL, + HCLGE_MAC_ADDR_UC, mac_addr); } else { dev_err(&hdev->pdev->dev, "failed to set unicast mac addr, unknown subcode %u\n",
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Currently, when traversing the mac list, and allocating memory fail for mac node, it will stop traversing, and rollback the tmp_add_list and tmp_del_list. It's unnecessary, we can continue the configuration with the tmp_add_list and tmp_del_list, which may free some memory after delete node.
Signed-off-by: Jian Shen shenjian15@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 31 ++-------------------- 1 file changed, 2 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 65c77448..0b2c5d6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -7798,27 +7798,6 @@ static void hclge_sync_from_del_list(struct list_head *del_list, } }
-static void hclge_rollback_add_list(struct list_head *add_list) -{ - struct hclge_vport_mac_addr_cfg *mac_node, *tmp; - - list_for_each_entry_safe(mac_node, tmp, add_list, node) { - list_del(&mac_node->node); - kfree(mac_node); - } -} - -static void hclge_rollback_del_list(struct list_head *del_list, - struct list_head *mac_list) -{ - struct hclge_vport_mac_addr_cfg *mac_node, *tmp; - - list_for_each_entry_safe(mac_node, tmp, del_list, node) { - list_del(&mac_node->node); - list_add_tail(&mac_node->node, mac_list); - } -} - static void hclge_update_overflow_flags(struct hclge_vport *vport, enum HCLGE_MAC_ADDR_TYPE mac_type, bool is_all_added) @@ -7864,7 +7843,7 @@ static void hclge_sync_vport_mac_table(struct hclge_vport *vport, case HCLGE_MAC_TO_ADD: new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC); if (!new_node) - goto clear_tmp_list; + goto stop_traverse; ether_addr_copy(new_node->mac_addr, mac_node->mac_addr); new_node->state = mac_node->state; list_add_tail(&new_node->node, &tmp_add_list); @@ -7873,7 +7852,7 @@ static void hclge_sync_vport_mac_table(struct hclge_vport *vport, break; } } - +stop_traverse: spin_unlock_bh(&vport->mac_list_lock);
/* delete first, in order to get max mac table space for adding */ @@ -7902,12 +7881,6 @@ static void hclge_sync_vport_mac_table(struct hclge_vport *vport, hclge_update_overflow_flags(vport, mac_type, all_added);
return; - -clear_tmp_list: - hclge_rollback_del_list(&tmp_del_list, list); - hclge_rollback_add_list(&tmp_add_list); - - spin_unlock_bh(&vport->mac_list_lock); }
static bool hclge_need_sync_mac_table(struct hclge_vport *vport)
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
This patch modifies a magic number in hclge_dbg_dump_ncl_config, which can improve the readability of the code.
Signed-off-by: Yufeng Mo moyufeng@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index f66b1fd..314286c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -1270,6 +1270,7 @@ static void hclge_dbg_dump_ncl_config(struct hclge_dev *hdev, { #define HCLGE_MAX_NCL_CONFIG_OFFSET 16384 #define HCLGE_NCL_CONFIG_LENGTH_IN_EACH_CMD (20 + 24 * 4) +#define HCLGE_NCL_CONFIG_PARAM_NUM 2
struct hclge_desc desc[HCLGE_CMD_NCL_CONFIG_BD_NUM]; int bd_num = HCLGE_CMD_NCL_CONFIG_BD_NUM; @@ -1279,7 +1280,7 @@ static void hclge_dbg_dump_ncl_config(struct hclge_dev *hdev, int ret;
ret = sscanf(cmd_buf, "%x %x", &offset, &length); - if (ret != 2) { + if (ret != HCLGE_NCL_CONFIG_PARAM_NUM) { dev_err(&hdev->pdev->dev, "Too few parameters, num = %d.\n", ret); return;
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Currently, VF doesn't hold the mac address list which has been added or deleted, it just sends the mac address configure request to PF. It's better to handle it on the same way as PF does, which can be more clearly.
Signed-off-by: Jian Shen shenjian15@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 152 +++++++++++++++++---- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 3 +- 2 files changed, 124 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index f1b4118..8d962cc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1287,6 +1287,34 @@ static int hclgevf_set_mac_addr(struct hnae3_handle *handle, void *p, return NULL; }
+static void hclgevf_mac_node_convert(struct hclgevf_mac_addr_node *mac_node, + enum HCLGEVF_MAC_ADDR_STATE state) +{ + switch (state) { + /* from set_rx_mode or tmp_add_list */ + case HCLGEVF_MAC_TO_ADD: + if (mac_node->state == HCLGEVF_MAC_TO_DEL) + mac_node->state = HCLGEVF_MAC_ACTIVE; + break; + /* only from set_rx_mode */ + case HCLGEVF_MAC_TO_DEL: + if (mac_node->state == HCLGEVF_MAC_TO_ADD) { + list_del(&mac_node->node); + kfree(mac_node); + } else { + mac_node->state = HCLGEVF_MAC_TO_DEL; + } + break; + /* only from tmp_add_list, the mac_node->state won't be + * HCLGEVF_MAC_ACTIVE + */ + case HCLGEVF_MAC_ACTIVE: + if (mac_node->state == HCLGEVF_MAC_TO_ADD) + mac_node->state = HCLGEVF_MAC_ACTIVE; + break; + } +} + static int hclgevf_update_mac_list(struct hnae3_handle *handle, enum HCLGEVF_MAC_ADDR_STATE state, enum HCLGEVF_MAC_ADDR_TYPE mac_type, @@ -1301,6 +1329,22 @@ static int hclgevf_update_mac_list(struct hnae3_handle *handle,
spin_lock_bh(&hdev->mac_table.mac_list_lock);
+ /* if the mac addr is already in the mac list, no need to add a new + * one into it, just check the mac addr state, convert it to a new + * new state, or just remove it, or do nothing. + */ + mac_node = hclgevf_find_mac_node(list, addr); + if (mac_node) { + hclgevf_mac_node_convert(mac_node, state); + spin_unlock_bh(&hdev->mac_table.mac_list_lock); + return 0; + } + /* if this address is never added, unnecessary to delete */ + if (state == HCLGEVF_MAC_TO_DEL) { + spin_unlock_bh(&hdev->mac_table.mac_list_lock); + return -ENOENT; + } + mac_node = kzalloc(sizeof(*mac_node), GFP_ATOMIC); if (!mac_node) { spin_unlock_bh(&hdev->mac_table.mac_list_lock); @@ -1382,28 +1426,66 @@ static void hclgevf_config_mac_list(struct hclgevf_dev *hdev, dev_err(&hdev->pdev->dev, "request configure mac %pM failed, state=%d, ret=%d\n", mac_node->mac_addr, mac_node->state, ret); - mac_node->state = HCLGEVF_MAC_REQ_FAIL; return; } - mac_node->state = HCLGEVF_MAC_REQ_SUC; + if (mac_node->state == HCLGEVF_MAC_TO_ADD) { + mac_node->state = HCLGEVF_MAC_ACTIVE; + } else { + list_del(&mac_node->node); + kfree(mac_node); + } + } +} + +static void hclgevf_sync_from_add_list(struct list_head *add_list, + struct list_head *mac_list) +{ + struct hclgevf_mac_addr_node *mac_node, *tmp, *new_node; + + list_for_each_entry_safe(mac_node, tmp, add_list, node) { + /* if the mac address from tmp_add_list is not in the + * uc/mc_mac_list, it means have received a TO_DEL request + * during the time window of sending mac config request to PF + * If mac_node state is ACTIVE, then change its state to TO_DEL, + * then it will be removed at next time. If is TO_ADD, it means + * send TO_ADD request failed, so just remove the mac node. + */ + new_node = hclgevf_find_mac_node(mac_list, mac_node->mac_addr); + if (new_node) { + hclgevf_mac_node_convert(new_node, mac_node->state); + list_del(&mac_node->node); + kfree(mac_node); + } else if (mac_node->state == HCLGEVF_MAC_ACTIVE) { + mac_node->state = HCLGEVF_MAC_TO_DEL; + list_del(&mac_node->node); + list_add_tail(&mac_node->node, mac_list); + } else { + list_del(&mac_node->node); + kfree(mac_node); + } } }
-static void hclgevf_sync_from_tmp_list(struct list_head *tmp_list, +static void hclgevf_sync_from_del_list(struct list_head *del_list, struct list_head *mac_list) { struct hclgevf_mac_addr_node *mac_node, *tmp, *new_node;
- list_for_each_entry_safe(mac_node, tmp, tmp_list, node) { + list_for_each_entry_safe(mac_node, tmp, del_list, node) { new_node = hclgevf_find_mac_node(mac_list, mac_node->mac_addr); if (new_node) { - if (mac_node->state == HCLGEVF_MAC_REQ_SUC) { - list_del(&new_node->node); - kfree(new_node); - } + /* If the mac addr is exist in the mac list, it means + * received a new request TO_ADD during the time window + * of sending mac addr configurrequest to PF, so just + * change the mac state to ACTIVE. + */ + new_node->state = HCLGEVF_MAC_ACTIVE; + list_del(&mac_node->node); + kfree(mac_node); + } else { + list_del(&mac_node->node); + list_add_tail(&mac_node->node, mac_list); } - list_del(&mac_node->node); - kfree(mac_node); } }
@@ -1417,44 +1499,56 @@ static void hclgevf_clear_list(struct list_head *list) } }
-/* For PF handle VF's the mac configure request asynchronously, so VF - * is unware that whether the mac address is exist in the mac table. - * VF has to record the mac address from set_rx_mode, and send request - * one by one. After finish all request, then update the mac address - * state in mac list. - */ static void hclgevf_sync_mac_list(struct hclgevf_dev *hdev, enum HCLGEVF_MAC_ADDR_TYPE mac_type) { struct hclgevf_mac_addr_node *mac_node, *tmp, *new_node; - struct list_head tmp_list, *list; + struct list_head tmp_add_list, tmp_del_list; + struct list_head *list;
- INIT_LIST_HEAD(&tmp_list); + INIT_LIST_HEAD(&tmp_add_list); + INIT_LIST_HEAD(&tmp_del_list);
+ /* move the mac addr to the tmp_add_list and tmp_del_list, then + * we can add/delete these mac addr outside the spin lock + */ list = (mac_type == HCLGEVF_MAC_ADDR_UC) ? &hdev->mac_table.uc_mac_list : &hdev->mac_table.mc_mac_list;
spin_lock_bh(&hdev->mac_table.mac_list_lock);
list_for_each_entry_safe(mac_node, tmp, list, node) { - new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC); - if (!new_node) { - hclgevf_clear_list(&tmp_list); - spin_unlock_bh(&hdev->mac_table.mac_list_lock); - return; + switch (mac_node->state) { + case HCLGEVF_MAC_TO_DEL: + list_del(&mac_node->node); + list_add_tail(&mac_node->node, &tmp_del_list); + break; + case HCLGEVF_MAC_TO_ADD: + new_node = kzalloc(sizeof(*new_node), GFP_ATOMIC); + if (!new_node) + goto stop_traverse; + ether_addr_copy(new_node->mac_addr, mac_node->mac_addr); + new_node->state = mac_node->state; + list_add_tail(&new_node->node, &tmp_add_list); + break; + default: + break; } - ether_addr_copy(new_node->mac_addr, mac_node->mac_addr); - new_node->state = mac_node->state; - list_add_tail(&new_node->node, &tmp_list); } - +stop_traverse: spin_unlock_bh(&hdev->mac_table.mac_list_lock);
- hclgevf_config_mac_list(hdev, &tmp_list, mac_type); + /* delete first, in order to get max mac table space for adding */ + hclgevf_config_mac_list(hdev, &tmp_del_list, mac_type); + hclgevf_config_mac_list(hdev, &tmp_add_list, mac_type);
+ /* if some mac addresses were added/deleted fail, move back to the + * mac_list, and retry at next time. + */ spin_lock_bh(&hdev->mac_table.mac_list_lock);
- hclgevf_sync_from_tmp_list(&tmp_list, list); + hclgevf_sync_from_del_list(&tmp_del_list, list); + hclgevf_sync_from_add_list(&tmp_add_list, list);
spin_unlock_bh(&hdev->mac_table.mac_list_lock); } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h index 99ab787..5829f63 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -244,8 +244,7 @@ enum HCLGEVF_MAC_ADDR_TYPE { enum HCLGEVF_MAC_ADDR_STATE { HCLGEVF_MAC_TO_ADD, HCLGEVF_MAC_TO_DEL, - HCLGEVF_MAC_REQ_SUC, /* send request mbx success */ - HCLGEVF_MAC_REQ_FAIL, /* send request mbx fail */ + HCLGEVF_MAC_ACTIVE };
struct hclgevf_mac_addr_node {
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
The 802.3 specification does not specify the behavior of auto-negotiation off with 1000M in phy. Therefore, some phy compatibility issues occur. This patch forbids the setting of this unreasonable mode by ethtool in driver.
Signed-off-by: Yufeng Mo moyufeng@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 3c25c11..69bf22c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -776,8 +776,13 @@ static int hns3_set_link_ksettings(struct net_device *netdev, cmd->base.duplex);
/* Only support ksettings_set for netdev with phy attached for now */ - if (netdev->phydev) + if (netdev->phydev) { + if (cmd->base.speed == SPEED_1000 && + cmd->base.autoneg == AUTONEG_DISABLE) + return -EINVAL; + return phy_ethtool_ksettings_set(netdev->phydev, cmd); + }
if (handle->pdev->revision == 0x20) return -EOPNOTSUPP;
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
For revision 0x20, rss_tuple_set field does not support in VF, so this patch fixes this case.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 8d962cc..fb97ac8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2409,25 +2409,27 @@ static int hclgevf_config_gro(struct hclgevf_dev *hdev, bool en) static void hclgevf_rss_init_cfg(struct hclgevf_dev *hdev) { struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; + struct hclgevf_rss_tuple_cfg *tuple_sets; u32 i;
+ rss_cfg->hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; rss_cfg->rss_size = hdev->nic.kinfo.rss_size;
- rss_cfg->rss_tuple_sets.ipv4_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv4_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv4_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; - rss_cfg->rss_tuple_sets.ipv4_fragment_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv6_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv6_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; - rss_cfg->rss_tuple_sets.ipv6_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; - rss_cfg->rss_tuple_sets.ipv6_fragment_en = - HCLGEVF_RSS_INPUT_TUPLE_OTHER; - - rss_cfg->hash_algo = hdev->pdev->revision >= 0x21 ? - HCLGEVF_RSS_HASH_ALGO_SIMPLE : HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; - - memcpy(rss_cfg->rss_hash_key, hclgevf_hash_key, HCLGEVF_RSS_KEY_SIZE); + tuple_sets = &rss_cfg->rss_tuple_sets; + if (hdev->pdev->revision >= 0x21) { + rss_cfg->hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; + memcpy(rss_cfg->rss_hash_key, hclgevf_hash_key, + HCLGEVF_RSS_KEY_SIZE); + + tuple_sets->ipv4_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv4_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv4_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; + tuple_sets->ipv4_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv6_tcp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv6_udp_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + tuple_sets->ipv6_sctp_en = HCLGEVF_RSS_INPUT_TUPLE_SCTP; + tuple_sets->ipv6_fragment_en = HCLGEVF_RSS_INPUT_TUPLE_OTHER; + }
/* Initialize RSS indirect table */ for (i = 0; i < HCLGEVF_RSS_IND_TBL_SIZE; i++)
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------------------
Currently, proto_support indicates that what kind of flow type does this device support, with value of BIT(x). Due to 'x' may be extended to more than 32 even 64, it's not a good way to deal with it. So this patch eliminates proto_support.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 37 +++++++++++----------- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 1 - 2 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 0b2c5d6..e90145a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4998,10 +4998,6 @@ static int hclge_init_fd_config(struct hclge_dev *hdev) return -EOPNOTSUPP; }
- hdev->fd_cfg.proto_support = - BIT(TCP_V4_FLOW) | BIT(UDP_V4_FLOW) | BIT(SCTP_V4_FLOW) | - BIT(TCP_V6_FLOW) | BIT(UDP_V6_FLOW) | BIT(SCTP_V6_FLOW) | - BIT(IPV4_USER_FLOW) | BIT(IPV6_USER_FLOW); key_cfg = &hdev->fd_cfg.key_cfg[HCLGE_FD_STAGE_1]; key_cfg->key_sel = HCLGE_FD_KEY_BASE_ON_TUPLE, key_cfg->inner_sipv6_word_en = LOW_2_WORDS; @@ -5015,11 +5011,9 @@ static int hclge_init_fd_config(struct hclge_dev *hdev) BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
/* If use max 400bit key, we can support tuples for ether type */ - if (hdev->fd_cfg.max_key_length == MAX_KEY_LENGTH) { - hdev->fd_cfg.proto_support |= BIT(ETHER_FLOW); + if (hdev->fd_cfg.fd_mode == HCLGE_FD_MODE_DEPTH_2K_WIDTH_400B_STAGE_1) key_cfg->tuple_active |= BIT(INNER_DST_MAC) | BIT(INNER_SRC_MAC); - }
/* roce_type is used to filter roce frames * dst_vport is used to specify the rule @@ -5509,7 +5503,7 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, { if (fs->flow_type & FLOW_EXT) { if (fs->h_ext.vlan_etype) { - dev_err(&hdev->pdev->dev, "vlan-etype does not support on this device!\n"); + dev_err(&hdev->pdev->dev, "vlan-etype does not support!\n"); return -EOPNOTSUPP; }
@@ -5527,8 +5521,10 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, }
if (fs->flow_type & FLOW_MAC_EXT) { - if (!(hdev->fd_cfg.proto_support & BIT(ETHER_FLOW))) { - dev_err(&hdev->pdev->dev, "unsupported protocol of ETHER_FLOW on this device.\n"); + if (hdev->fd_cfg.fd_mode != + HCLGE_FD_MODE_DEPTH_2K_WIDTH_400B_STAGE_1) { + dev_err(&hdev->pdev->dev, + "FLOW_MAC_EXT does not support in current FD mode!\n"); return -EOPNOTSUPP; }
@@ -5546,7 +5542,7 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, u32 *unused_tuple) { u32 flow_type; - int ret = 0; + int ret;
if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) { dev_err(&hdev->pdev->dev, "failed to config fd rules, invalid rule location: %u, max is %u\n.", @@ -5555,19 +5551,13 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, return -EINVAL; }
- flow_type = fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT); - if (!(BIT(flow_type) & hdev->fd_cfg.proto_support)) { - dev_err(&hdev->pdev->dev, "unsupported protocol type, protocol type = 0x%x\n", - flow_type); - return -EOPNOTSUPP; - } - if ((fs->flow_type & FLOW_EXT) && (fs->h_ext.data[0] != 0 || fs->h_ext.data[1] != 0)) { dev_err(&hdev->pdev->dev, "user-def bytes are not supported\n"); return -EOPNOTSUPP; }
+ flow_type = fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT); switch (flow_type) { case SCTP_V4_FLOW: case TCP_V4_FLOW: @@ -5590,15 +5580,24 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, unused_tuple); break; case ETHER_FLOW: + if (hdev->fd_cfg.fd_mode != + HCLGE_FD_MODE_DEPTH_2K_WIDTH_400B_STAGE_1) { + dev_err(&hdev->pdev->dev, + "ETHER_FLOW does not support in current FD mode!\n"); + return -EOPNOTSUPP; + } + ret = hclge_fd_check_ether_tuple(&fs->h_u.ether_spec, unused_tuple); break; default: + dev_err(&hdev->pdev->dev, "unsupported protocol type, protocol type = 0x%x\n", + flow_type); return -EOPNOTSUPP; }
if (ret) { - dev_err(&hdev->pdev->dev, "failed to check flow tuple, ret = %d\n", + dev_err(&hdev->pdev->dev, "failed to check flow union tuple, ret = %d\n", ret); return ret; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 457ba1c..058cac2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -589,7 +589,6 @@ struct hclge_fd_key_cfg { struct hclge_fd_cfg { u8 fd_mode; u16 max_key_length; /* use bit as unit */ - u64 proto_support; u32 rule_num[MAX_STAGE_NUM]; /* rule entry number */ u16 cnt_num[MAX_STAGE_NUM]; /* rule hit counter number */ struct hclge_fd_key_cfg key_cfg[MAX_STAGE_NUM];
From: shenhao shenhao21@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------
This patch is used to modify the hns3 driver version to 1.9.37.8
Signed-off-by: shenhao shenhao21@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index e2fa3b3..5253374 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -30,7 +30,7 @@ #include <linux/pci.h> #include <linux/types.h>
-#define HNAE3_MOD_VERSION "1.9.37.7" +#define HNAE3_MOD_VERSION "1.9.37.8"
#define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h index a661cb2..34ff097 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h @@ -4,7 +4,7 @@ #ifndef __HNS3_CAE_VERSION_H__ #define __HNS3_CAE_VERSION_H__
-#define HNS3_CAE_MOD_VERSION "1.9.37.7" +#define HNS3_CAE_MOD_VERSION "1.9.37.8"
#define CMT_ID_LEN 8 #define RESV_LEN 3 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index bc52f11..4567c2c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -8,7 +8,7 @@
#include "hnae3.h"
-#define HNS3_MOD_VERSION "1.9.37.7" +#define HNS3_MOD_VERSION "1.9.37.8"
extern char hns3_driver_version[];
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 058cac2..80270e4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -12,7 +12,7 @@ #include "hclge_cmd.h" #include "hnae3.h"
-#define HCLGE_MOD_VERSION "1.9.37.7" +#define HCLGE_MOD_VERSION "1.9.37.8" #define HCLGE_DRIVER_NAME "hclge"
#define HCLGE_MAX_PF_NUM 8 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h index 5829f63..bd24595 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -10,7 +10,7 @@ #include "hclgevf_cmd.h" #include "hnae3.h"
-#define HCLGEVF_MOD_VERSION "1.9.37.7" +#define HCLGEVF_MOD_VERSION "1.9.37.8" #define HCLGEVF_DRIVER_NAME "hclgevf"
#define HCLGEVF_MAX_VLAN_ID 4095