Skip to content

Commit 330baff

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: add ETS TC weight setting in SSU module
This patch sets the TC weight in SSU module according to info in tm_info. Also, zero weight of TC weight in SSU ETS module means enabling strict priority, so do not allow zero weight when in ETS mode. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 44e59e3 commit 330baff

File tree

1 file changed

+43
-0
lines changed
  • drivers/net/ethernet/hisilicon/hns3/hns3pf

1 file changed

+43
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,36 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge_dev *hdev)
947947
return 0;
948948
}
949949

950+
static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev)
951+
{
952+
#define DEFAULT_TC_WEIGHT 1
953+
#define DEFAULT_TC_OFFSET 14
954+
955+
struct hclge_ets_tc_weight_cmd *ets_weight;
956+
struct hclge_desc desc;
957+
int i;
958+
959+
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_ETS_TC_WEIGHT, false);
960+
ets_weight = (struct hclge_ets_tc_weight_cmd *)desc.data;
961+
962+
for (i = 0; i < HNAE3_MAX_TC; i++) {
963+
struct hclge_pg_info *pg_info;
964+
965+
ets_weight->tc_weight[i] = DEFAULT_TC_WEIGHT;
966+
967+
if (!(hdev->hw_tc_map & BIT(i)))
968+
continue;
969+
970+
pg_info =
971+
&hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid];
972+
ets_weight->tc_weight[i] = pg_info->tc_dwrr[i];
973+
}
974+
975+
ets_weight->weight_offset = DEFAULT_TC_OFFSET;
976+
977+
return hclge_cmd_send(&hdev->hw, &desc, 1);
978+
}
979+
950980
static int hclge_tm_pri_vnet_base_dwrr_pri_cfg(struct hclge_vport *vport)
951981
{
952982
struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
@@ -996,6 +1026,19 @@ static int hclge_tm_pri_dwrr_cfg(struct hclge_dev *hdev)
9961026
ret = hclge_tm_pri_tc_base_dwrr_cfg(hdev);
9971027
if (ret)
9981028
return ret;
1029+
1030+
if (!hnae3_dev_dcb_supported(hdev))
1031+
return 0;
1032+
1033+
ret = hclge_tm_ets_tc_dwrr_cfg(hdev);
1034+
if (ret == -EOPNOTSUPP) {
1035+
dev_warn(&hdev->pdev->dev,
1036+
"fw %08x does't support ets tc weight cmd\n",
1037+
hdev->fw_version);
1038+
ret = 0;
1039+
}
1040+
1041+
return ret;
9991042
} else {
10001043
ret = hclge_tm_pri_vnet_base_dwrr_cfg(hdev);
10011044
if (ret)

0 commit comments

Comments
 (0)