Commit 693e4415 authored by GuoJia Liao's avatar GuoJia Liao Committed by Jakub Kicinski

net: hns3: optimize the code when update the tc info

When update the TC info for NIC, there are some differences
between PF and VF. Currently, four "vport->vport_id" are
used to distinguish PF or VF. So merge them into one to
improve readability and maintainability of code.
Signed-off-by: default avatarGuoJia Liao <liaoguojia@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 87ce161e
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
#define HCLGE_LINK_STATUS_MS 10 #define HCLGE_LINK_STATUS_MS 10
#define HCLGE_VF_VPORT_START_NUM 1
static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mps); static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mps);
static int hclge_init_vlan_config(struct hclge_dev *hdev); static int hclge_init_vlan_config(struct hclge_dev *hdev);
static void hclge_sync_vlan_filter(struct hclge_dev *hdev); static void hclge_sync_vlan_filter(struct hclge_dev *hdev);
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#define HCLGE_MAX_PF_NUM 8 #define HCLGE_MAX_PF_NUM 8
#define HCLGE_VF_VPORT_START_NUM 1
#define HCLGE_RD_FIRST_STATS_NUM 2 #define HCLGE_RD_FIRST_STATS_NUM 2
#define HCLGE_RD_OTHER_STATS_NUM 4 #define HCLGE_RD_OTHER_STATS_NUM 4
......
...@@ -640,13 +640,18 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) ...@@ -640,13 +640,18 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
/* TC configuration is shared by PF/VF in one port, only allow /* TC configuration is shared by PF/VF in one port, only allow
* one tc for VF for simplicity. VF's vport_id is non zero. * one tc for VF for simplicity. VF's vport_id is non zero.
*/ */
kinfo->tc_info.num_tc = vport->vport_id ? 1 : if (vport->vport_id) {
kinfo->tc_info.num_tc = 1;
vport->qs_offset = HNAE3_MAX_TC +
vport->vport_id - HCLGE_VF_VPORT_START_NUM;
vport_max_rss_size = hdev->vf_rss_size_max;
} else {
kinfo->tc_info.num_tc =
min_t(u16, vport->alloc_tqps, hdev->tm_info.num_tc); min_t(u16, vport->alloc_tqps, hdev->tm_info.num_tc);
vport->qs_offset = (vport->vport_id ? HNAE3_MAX_TC : 0) + vport->qs_offset = 0;
(vport->vport_id ? (vport->vport_id - 1) : 0); vport_max_rss_size = hdev->pf_rss_size_max;
}
vport_max_rss_size = vport->vport_id ? hdev->vf_rss_size_max :
hdev->pf_rss_size_max;
max_rss_size = min_t(u16, vport_max_rss_size, max_rss_size = min_t(u16, vport_max_rss_size,
hclge_vport_get_max_rss_size(vport)); hclge_vport_get_max_rss_size(vport));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment