]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: hns3: adjust rss indirection table configure command
authorGuojia Liao <liaoguojia@huawei.com>
Thu, 10 Dec 2020 03:42:11 +0000 (11:42 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Dec 2020 04:33:20 +0000 (20:33 -0800)
For the max rss size of PF may be up to 512, so adjust the
command of configuring rss indirection table to support
queue id larger than 255. The width of queue id is extended
from 8 bits to 10 bits. The high 2 bits are stored in filed
rss_qid_h when the queue id is larger than 255.

Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index f5a620c3e66db2d15deff80bb848cf354bb0388c..a6c306b3b9b3d46620e5c7b24b2f8d98125fe2e0 100644 (file)
@@ -560,12 +560,15 @@ struct hclge_rss_input_tuple_cmd {
 };
 
 #define HCLGE_RSS_CFG_TBL_SIZE 16
+#define HCLGE_RSS_CFG_TBL_SIZE_H       4
+#define HCLGE_RSS_CFG_TBL_BW_H         2U
+#define HCLGE_RSS_CFG_TBL_BW_L         8U
 
 struct hclge_rss_indirection_table_cmd {
        __le16 start_table_index;
        __le16 rss_set_bitmap;
-       u8 rsv[4];
-       u8 rss_result[HCLGE_RSS_CFG_TBL_SIZE];
+       u8 rss_qid_h[HCLGE_RSS_CFG_TBL_SIZE_H];
+       u8 rss_qid_l[HCLGE_RSS_CFG_TBL_SIZE];
 };
 
 #define HCLGE_RSS_TC_OFFSET_S          0
index f361226b350077a2504c66df253b2da2d4af2e16..5de45a935e4de90a5a86dd6fc59815567b2b54b6 100644 (file)
@@ -4282,8 +4282,12 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u16 *indir)
 {
        struct hclge_rss_indirection_table_cmd *req;
        struct hclge_desc desc;
-       int i, j;
+       u8 rss_msb_oft;
+       u8 rss_msb_val;
        int ret;
+       u16 qid;
+       int i;
+       u32 j;
 
        req = (struct hclge_rss_indirection_table_cmd *)desc.data;
 
@@ -4294,11 +4298,15 @@ static int hclge_set_rss_indir_table(struct hclge_dev *hdev, const u16 *indir)
                req->start_table_index =
                        cpu_to_le16(i * HCLGE_RSS_CFG_TBL_SIZE);
                req->rss_set_bitmap = cpu_to_le16(HCLGE_RSS_SET_BITMAP_MSK);
-
-               for (j = 0; j < HCLGE_RSS_CFG_TBL_SIZE; j++)
-                       req->rss_result[j] =
-                               indir[i * HCLGE_RSS_CFG_TBL_SIZE + j];
-
+               for (j = 0; j < HCLGE_RSS_CFG_TBL_SIZE; j++) {
+                       qid = indir[i * HCLGE_RSS_CFG_TBL_SIZE + j];
+                       req->rss_qid_l[j] = qid & 0xff;
+                       rss_msb_oft =
+                               j * HCLGE_RSS_CFG_TBL_BW_H / BITS_PER_BYTE;
+                       rss_msb_val = (qid >> HCLGE_RSS_CFG_TBL_BW_L & 0x1) <<
+                               (j * HCLGE_RSS_CFG_TBL_BW_H % BITS_PER_BYTE);
+                       req->rss_qid_h[rss_msb_oft] |= rss_msb_val;
+               }
                ret = hclge_cmd_send(&hdev->hw, &desc, 1);
                if (ret) {
                        dev_err(&hdev->pdev->dev,