提交 b66ae5ce 编写于 作者: J Jian Shen 提交者: Zheng Zengkai

net: hns3: allocate fd counter for queue bonding

driver inclusion
category:feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I62HX2

----------------------------------------------------------------------

For the fd rule of queue bonding is created by hardware
automatically, the driver needs to specify the fd counter
for each function, then it's available to query how many
times the queue bonding fd rules hit.
Signed-off-by: NJian Shen <shenjian15@huawei.com>
Signed-off-by: NJiantao Xiao <xiaojiantao1@h-partners.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Reviewed-by: NJian Shen <shenjian15@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 29ecb19f
...@@ -755,6 +755,18 @@ struct hclge_fd_qb_cfg_cmd { ...@@ -755,6 +755,18 @@ struct hclge_fd_qb_cfg_cmd {
u8 rsv[22]; u8 rsv[22];
}; };
#define HCLGE_FD_QB_AD_RULE_ID_VLD_B 0
#define HCLGE_FD_QB_AD_COUNTER_VLD_B 1
struct hclge_fd_qb_ad_cmd {
u8 vf_id;
u8 rsv1;
u8 ad_sel;
u8 rsv2;
__le16 hit_rule_id;
u8 counter_id;
u8 rsv3[17];
};
#define HCLGE_FD_USER_DEF_OFT_S 0 #define HCLGE_FD_USER_DEF_OFT_S 0
#define HCLGE_FD_USER_DEF_OFT_M GENMASK(14, 0) #define HCLGE_FD_USER_DEF_OFT_M GENMASK(14, 0)
#define HCLGE_FD_USER_DEF_EN_B 15 #define HCLGE_FD_USER_DEF_EN_B 15
......
...@@ -4561,6 +4561,40 @@ static void hclge_update_vport_alive(struct hclge_dev *hdev) ...@@ -4561,6 +4561,40 @@ static void hclge_update_vport_alive(struct hclge_dev *hdev)
} }
} }
static int hclge_set_fd_qb_counter(struct hclge_dev *hdev, u8 vf_id)
{
struct hclge_fd_qb_ad_cmd *req;
struct hclge_desc desc;
int ret;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_FD_QB_AD_OP, false);
req = (struct hclge_fd_qb_ad_cmd *)desc.data;
req->vf_id = vf_id;
hnae3_set_bit(req->ad_sel, HCLGE_FD_QB_AD_COUNTER_VLD_B, 1);
req->counter_id = vf_id % hdev->fd_cfg.cnt_num[HCLGE_FD_STAGE_1];
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret)
dev_warn(&hdev->pdev->dev,
"failed to set qb counter for vport %u, ret = %d.\n",
vf_id, ret);
return ret;
}
static void hclge_init_fd_qb_counter(struct hclge_dev *hdev)
{
int ret;
u16 i;
if (!test_bit(HNAE3_DEV_SUPPORT_QB_B, hdev->ae_dev->caps))
return;
for (i = 0; i < hdev->num_alloc_vport; i++) {
ret = hclge_set_fd_qb_counter(hdev, i);
if (ret)
return;
}
}
static int hclge_set_fd_qb(struct hclge_dev *hdev, u8 vf_id, bool enable) static int hclge_set_fd_qb(struct hclge_dev *hdev, u8 vf_id, bool enable)
{ {
struct hclge_fd_qb_cfg_cmd *req; struct hclge_fd_qb_cfg_cmd *req;
...@@ -5682,6 +5716,11 @@ static int hclge_init_fd_config(struct hclge_dev *hdev) ...@@ -5682,6 +5716,11 @@ static int hclge_init_fd_config(struct hclge_dev *hdev)
if (ret) if (ret)
return ret; return ret;
if (!hdev->fd_cfg.cnt_num[HCLGE_FD_STAGE_1])
hdev->fd_cfg.cnt_num[HCLGE_FD_STAGE_1] = 1;
hclge_init_fd_qb_counter(hdev);
return hclge_set_fd_key_config(hdev, HCLGE_FD_STAGE_1); return hclge_set_fd_key_config(hdev, HCLGE_FD_STAGE_1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册