From: Guojia Liao liaoguojia@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
------------------------------
When setting the port base vlan, parameters of qos, vlan tag and vlan protocol are needed. Those three parameters can encapsulated into sturct of vlan_info, which makes the code more readability.
Currently, there is a 8s timewindow for PF to know VF being unalive. in this case, when host changes VF mac or VLAN configuration, PF may fail to send mailbox to VF. For VF will query these configuration from PF when reinitialization, so it needn't return error to stack.
Signed-off-by: Guojia Liao liaoguojia@huawei.com Reviewed-by: Peng Li lipeng321@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Junxin Chen chenjunxin1@huawei.com Signed-off-by: Shengzui You youshengzui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++--- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 4 ++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 41429a8bed56..1ec8954526b5 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -9034,7 +9034,7 @@ static int hclge_vf_vlan_filter_switch(struct hclge_vport *vport) { struct hnae3_handle *nic = &vport->nic; struct hclge_dev *hdev = vport->back; - u8 filter_en; + bool filter_en; int ret;
filter_en = hclge_has_vlan_used(hdev, vport->vport_id) || @@ -9243,8 +9243,7 @@ static int hclge_set_vf_vlan_filter(struct hnae3_handle *handle, int vfid, if (test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) (void)hclge_push_vf_port_base_vlan_info(&hdev->vport[0], vport->vport_id, - state, vlan, qos, - ntohs(proto)); + state, &vlan_info);
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 7259dd99a118..76a102c46dbc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -1032,8 +1032,8 @@ void hclge_restore_vport_vlan_table(struct hclge_vport *vport); int hclge_update_port_base_vlan_cfg(struct hclge_vport *vport, u16 state, struct hclge_vlan_info *vlan_info); int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid, - u16 state, u16 vlan_tag, u16 qos, - u16 vlan_proto); + u16 state, + struct hclge_vlan_info *vlan_info); enum hnae3_reset_type hclge_get_reset_level(struct hnae3_ae_dev *ae_dev, unsigned long *addr); void hclge_task_schedule(struct hclge_dev *hdev, unsigned long delay_time); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index 362ebf8710b2..0c6fc6f65ef2 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -411,17 +411,17 @@ static int hclge_set_vf_mc_mac_addr(struct hclge_vport *vport, }
int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid, - u16 state, u16 vlan_tag, u16 qos, - u16 vlan_proto) + u16 state, + struct hclge_vlan_info *vlan_info) { #define MSG_DATA_SIZE 8
u8 msg_data[MSG_DATA_SIZE];
memcpy(&msg_data[0], &state, sizeof(u16)); - memcpy(&msg_data[2], &vlan_proto, sizeof(u16)); - memcpy(&msg_data[4], &qos, sizeof(u16)); - memcpy(&msg_data[6], &vlan_tag, sizeof(u16)); + memcpy(&msg_data[2], &vlan_info->vlan_proto, sizeof(u16)); + memcpy(&msg_data[4], &vlan_info->qos, sizeof(u16)); + memcpy(&msg_data[6], &vlan_info->vlan_tag, sizeof(u16));
return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data), HCLGE_MBX_PUSH_VLAN_INFO, vfid);