get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/87663/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 87663,
    "url": "http://patches.dpdk.org/api/patches/87663/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1612338382-3253-10-git-send-email-oulijun@huawei.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1612338382-3253-10-git-send-email-oulijun@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1612338382-3253-10-git-send-email-oulijun@huawei.com",
    "date": "2021-02-03T07:46:14",
    "name": "[09/17] net/hns3: fix RSS indirection table size",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c76b2edcb6a3a533b88d6df84e19e45e05e4b1e2",
    "submitter": {
        "id": 1675,
        "url": "http://patches.dpdk.org/api/people/1675/?format=api",
        "name": "Lijun Ou",
        "email": "oulijun@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1612338382-3253-10-git-send-email-oulijun@huawei.com/mbox/",
    "series": [
        {
            "id": 15115,
            "url": "http://patches.dpdk.org/api/series/15115/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15115",
            "date": "2021-02-03T07:46:05",
            "name": "bugfixes and small functionality for hns3",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/15115/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/87663/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/87663/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 1B8F9A0A0E;\n\tWed,  3 Feb 2021 08:48:39 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D933924049C;\n\tWed,  3 Feb 2021 08:47:07 +0100 (CET)",
            "from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32])\n by mails.dpdk.org (Postfix) with ESMTP id 45E76240454\n for <dev@dpdk.org>; Wed,  3 Feb 2021 08:46:57 +0100 (CET)",
            "from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59])\n by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DVtym0mbdzjHbQ;\n Wed,  3 Feb 2021 15:45:52 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id\n 14.3.498.0; Wed, 3 Feb 2021 15:46:50 +0800"
        ],
        "From": "Lijun Ou <oulijun@huawei.com>",
        "To": "<ferruh.yigit@intel.com>",
        "CC": "<dev@dpdk.org>, <linuxarm@openeuler.org>",
        "Date": "Wed, 3 Feb 2021 15:46:14 +0800",
        "Message-ID": "<1612338382-3253-10-git-send-email-oulijun@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1612338382-3253-1-git-send-email-oulijun@huawei.com>",
        "References": "<1612338382-3253-1-git-send-email-oulijun@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH 09/17] net/hns3: fix RSS indirection table size",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "the driver should not use the fixed value as the validity check of\nRSS indirection table size with HW supported. As a result, it will\ncause misjudgment when the RSS reta size with HW supported have\nchanged.\n\nFixes: c37ca66f2b27 (\"net/hns3: support RSS\")\nCc: stable@dpdk.org\n\nSigned-off-by: Lijun Ou <oulijun@huawei.com>\n---\n drivers/net/hns3/hns3_cmd.c       | 11 +++++++++++\n drivers/net/hns3/hns3_cmd.h       |  7 ++++++-\n drivers/net/hns3/hns3_dcb.c       |  2 +-\n drivers/net/hns3/hns3_ethdev.c    | 18 ++++++++++++++++--\n drivers/net/hns3/hns3_ethdev_vf.c | 18 ++++++++++++++++--\n drivers/net/hns3/hns3_flow.c      |  6 +++---\n drivers/net/hns3/hns3_rss.c       | 28 ++++++++++++++--------------\n drivers/net/hns3/hns3_rss.h       |  5 ++---\n 8 files changed, 69 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c\nindex 9ed8161..b750022 100644\n--- a/drivers/net/hns3/hns3_cmd.c\n+++ b/drivers/net/hns3/hns3_cmd.c\n@@ -430,6 +430,16 @@ static void hns3_parse_capability(struct hns3_hw *hw,\n \t\thns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_STASH_B, 1);\n }\n \n+static uint32_t\n+hns3_build_api_caps(void)\n+{\n+\tuint32_t api_caps = 0;\n+\n+\thns3_set_bit(api_caps, HNS3_API_CAP_FLEX_RSS_TBL_B, 1);\n+\n+\treturn rte_cpu_to_le_32(api_caps);\n+}\n+\n static enum hns3_cmd_status\n hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw)\n {\n@@ -439,6 +449,7 @@ hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw)\n \n \thns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_FW_VER, 1);\n \tresp = (struct hns3_query_version_cmd *)desc.data;\n+\tresp->api_caps = hns3_build_api_caps();\n \n \t/* Initialize the cmd function */\n \tret = hns3_cmd_send(hw, &desc, 1);\ndiff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h\nindex e5ca74e..c6c4093 100644\n--- a/drivers/net/hns3/hns3_cmd.h\n+++ b/drivers/net/hns3/hns3_cmd.h\n@@ -312,11 +312,16 @@ enum HNS3_CAPS_BITS {\n \tHNS3_CAPS_HW_PAD_B,\n \tHNS3_CAPS_STASH_B,\n };\n+\n+enum HNS3_API_CAP_BITS {\n+\tHNS3_API_CAP_FLEX_RSS_TBL_B,\n+};\n+\n #define HNS3_QUERY_CAP_LENGTH\t\t3\n struct hns3_query_version_cmd {\n \tuint32_t firmware;\n \tuint32_t hardware;\n-\tuint32_t rsv;\n+\tuint32_t api_caps;\n \tuint32_t caps[HNS3_QUERY_CAP_LENGTH]; /* capabilities of device */\n };\n \ndiff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c\nindex 4fe5956..ebfc240 100644\n--- a/drivers/net/hns3/hns3_dcb.c\n+++ b/drivers/net/hns3/hns3_dcb.c\n@@ -656,7 +656,7 @@ hns3_set_rss_size(struct hns3_hw *hw, uint16_t nb_rx_q)\n \t * stage of the reset process.\n \t */\n \tif (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {\n-\t\tfor (i = 0; i < HNS3_RSS_IND_TBL_SIZE; i++)\n+\t\tfor (i = 0; i < hw->rss_ind_tbl_size; i++)\n \t\t\trss_cfg->rss_indirection_tbl[i] =\n \t\t\t\t\t\t\ti % hw->alloc_rss_size;\n \t}\ndiff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex a92399f..9d2e4d2 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -2593,7 +2593,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)\n \n \tinfo->vmdq_queue_num = 0;\n \n-\tinfo->reta_size = HNS3_RSS_IND_TBL_SIZE;\n+\tinfo->reta_size = hw->rss_ind_tbl_size;\n \tinfo->hash_key_size = HNS3_RSS_KEY_SIZE;\n \tinfo->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT;\n \n@@ -2984,6 +2984,20 @@ hns3_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc)\n }\n \n static int\n+hns3_check_dev_specifications(struct hns3_hw *hw)\n+{\n+\tif (hw->rss_ind_tbl_size == 0 ||\n+\t    hw->rss_ind_tbl_size > HNS3_RSS_IND_TBL_SIZE_MAX) {\n+\t\thns3_err(hw, \"the size of hash lookup table configured (%u)\"\n+\t\t\t      \" exceeds the maximum(%u)\", hw->rss_ind_tbl_size,\n+\t\t\t      HNS3_RSS_IND_TBL_SIZE_MAX);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n hns3_query_dev_specifications(struct hns3_hw *hw)\n {\n \tstruct hns3_cmd_desc desc[HNS3_QUERY_DEV_SPECS_BD_NUM];\n@@ -3003,7 +3017,7 @@ hns3_query_dev_specifications(struct hns3_hw *hw)\n \n \thns3_parse_dev_specifications(hw, desc);\n \n-\treturn 0;\n+\treturn hns3_check_dev_specifications(hw);\n }\n \n static int\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex 11cab37..b3dd40a 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -1016,7 +1016,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)\n \n \tinfo->vmdq_queue_num = 0;\n \n-\tinfo->reta_size = HNS3_RSS_IND_TBL_SIZE;\n+\tinfo->reta_size = hw->rss_ind_tbl_size;\n \tinfo->hash_key_size = HNS3_RSS_KEY_SIZE;\n \tinfo->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT;\n \tinfo->default_rxportconf.ring_size = HNS3_DEFAULT_RING_DESC;\n@@ -1149,6 +1149,20 @@ hns3vf_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc)\n }\n \n static int\n+hns3vf_check_dev_specifications(struct hns3_hw *hw)\n+{\n+\tif (hw->rss_ind_tbl_size == 0 ||\n+\t    hw->rss_ind_tbl_size > HNS3_RSS_IND_TBL_SIZE_MAX) {\n+\t\thns3_warn(hw, \"the size of hash lookup table configured (%u)\"\n+\t\t\t      \" exceeds the maximum(%u)\", hw->rss_ind_tbl_size,\n+\t\t\t      HNS3_RSS_IND_TBL_SIZE_MAX);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n hns3vf_query_dev_specifications(struct hns3_hw *hw)\n {\n \tstruct hns3_cmd_desc desc[HNS3_QUERY_DEV_SPECS_BD_NUM];\n@@ -1168,7 +1182,7 @@ hns3vf_query_dev_specifications(struct hns3_hw *hw)\n \n \thns3vf_parse_dev_specifications(hw, desc);\n \n-\treturn 0;\n+\treturn hns3vf_check_dev_specifications(hw);\n }\n \n static int\ndiff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c\nindex 3e387ac..a601124 100644\n--- a/drivers/net/hns3/hns3_flow.c\n+++ b/drivers/net/hns3/hns3_flow.c\n@@ -1489,14 +1489,14 @@ hns3_update_indir_table(struct rte_eth_dev *dev,\n {\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n-\tuint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE];\n+\tuint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE_MAX];\n \tuint16_t j;\n \tuint32_t i;\n \n \t/* Fill in redirection table */\n \tmemcpy(indir_tbl, hw->rss_info.rss_indirection_tbl,\n \t       sizeof(hw->rss_info.rss_indirection_tbl));\n-\tfor (i = 0, j = 0; i < HNS3_RSS_IND_TBL_SIZE; i++, j++) {\n+\tfor (i = 0, j = 0; i < hw->rss_ind_tbl_size; i++, j++) {\n \t\tj %= num;\n \t\tif (conf->queue[j] >= hw->alloc_rss_size) {\n \t\t\thns3_err(hw, \"queue id(%u) set to redirection table \"\n@@ -1507,7 +1507,7 @@ hns3_update_indir_table(struct rte_eth_dev *dev,\n \t\tindir_tbl[i] = conf->queue[j];\n \t}\n \n-\treturn hns3_set_rss_indir_table(hw, indir_tbl, HNS3_RSS_IND_TBL_SIZE);\n+\treturn hns3_set_rss_indir_table(hw, indir_tbl, hw->rss_ind_tbl_size);\n }\n \n static int\ndiff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c\nindex 7d1a297..858e31a 100644\n--- a/drivers/net/hns3/hns3_rss.c\n+++ b/drivers/net/hns3/hns3_rss.c\n@@ -312,7 +312,7 @@ hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, uint16_t size)\n \n \t/* Update redirection table of hw */\n \tmemcpy(hw->rss_info.rss_indirection_tbl, indir,\n-\t       sizeof(hw->rss_info.rss_indirection_tbl));\n+\t       sizeof(uint16_t) * size);\n \n \treturn 0;\n }\n@@ -324,13 +324,13 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw)\n \tint ret;\n \n \tlut = rte_zmalloc(\"hns3_rss_lut\",\n-\t\t\t  HNS3_RSS_IND_TBL_SIZE * sizeof(uint16_t), 0);\n+\t\t\t  hw->rss_ind_tbl_size * sizeof(uint16_t), 0);\n \tif (lut == NULL) {\n \t\thns3_err(hw, \"No hns3_rss_lut memory can be allocated\");\n \t\treturn -ENOMEM;\n \t}\n \n-\tret = hns3_set_rss_indir_table(hw, lut, HNS3_RSS_IND_TBL_SIZE);\n+\tret = hns3_set_rss_indir_table(hw, lut, hw->rss_ind_tbl_size);\n \tif (ret)\n \t\thns3_err(hw, \"RSS uninit indir table failed: %d\", ret);\n \trte_free(lut);\n@@ -428,7 +428,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,\n \t} else if (rss_hf && rss_cfg->conf.types == 0) {\n \t\t/* Enable RSS, restore indirection table by hw's config */\n \t\tret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,\n-\t\t\t\t\t       HNS3_RSS_IND_TBL_SIZE);\n+\t\t\t\t\t       hw->rss_ind_tbl_size);\n \t\tif (ret)\n \t\t\tgoto conf_err;\n \t}\n@@ -505,15 +505,15 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev,\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n \tstruct hns3_rss_conf *rss_cfg = &hw->rss_info;\n-\tuint16_t i, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */\n-\tuint16_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE];\n+\tuint16_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX];\n \tuint16_t idx, shift;\n+\tuint16_t i;\n \tint ret;\n \n-\tif (reta_size != indir_size || reta_size > ETH_RSS_RETA_SIZE_512) {\n+\tif (reta_size != hw->rss_ind_tbl_size) {\n \t\thns3_err(hw, \"The size of hash lookup table configured (%u)\"\n \t\t\t \"doesn't match the number hardware can supported\"\n-\t\t\t \"(%u)\", reta_size, indir_size);\n+\t\t\t \"(%u)\", reta_size, hw->rss_ind_tbl_size);\n \t\treturn -EINVAL;\n \t}\n \trte_spinlock_lock(&hw->lock);\n@@ -536,7 +536,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev,\n \t}\n \n \tret = hns3_set_rss_indir_table(hw, indirection_tbl,\n-\t\t\t\t       HNS3_RSS_IND_TBL_SIZE);\n+\t\t\t\t       hw->rss_ind_tbl_size);\n \n \trte_spinlock_unlock(&hw->lock);\n \treturn ret;\n@@ -561,13 +561,13 @@ hns3_dev_rss_reta_query(struct rte_eth_dev *dev,\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tstruct hns3_hw *hw = &hns->hw;\n \tstruct hns3_rss_conf *rss_cfg = &hw->rss_info;\n-\tuint16_t i, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */\n \tuint16_t idx, shift;\n+\tuint16_t i;\n \n-\tif (reta_size != indir_size || reta_size > ETH_RSS_RETA_SIZE_512) {\n+\tif (reta_size != hw->rss_ind_tbl_size) {\n \t\thns3_err(hw, \"The size of hash lookup table configured (%u)\"\n \t\t\t \" doesn't match the number hardware can supported\"\n-\t\t\t \"(%u)\", reta_size, indir_size);\n+\t\t\t \"(%u)\", reta_size, hw->rss_ind_tbl_size);\n \t\treturn -EINVAL;\n \t}\n \trte_spinlock_lock(&hw->lock);\n@@ -662,7 +662,7 @@ hns3_rss_set_default_args(struct hns3_hw *hw)\n \tmemcpy(rss_cfg->key, hns3_hash_key, HNS3_RSS_KEY_SIZE);\n \n \t/* Initialize RSS indirection table */\n-\tfor (i = 0; i < HNS3_RSS_IND_TBL_SIZE; i++)\n+\tfor (i = 0; i < hw->rss_ind_tbl_size; i++)\n \t\trss_cfg->rss_indirection_tbl[i] = i % queue_num;\n }\n \n@@ -711,7 +711,7 @@ hns3_config_rss(struct hns3_adapter *hns)\n \t */\n \tif (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG)) {\n \t\tret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl,\n-\t\t\t\t\t       HNS3_RSS_IND_TBL_SIZE);\n+\t\t\t\t\t       hw->rss_ind_tbl_size);\n \t\tif (ret)\n \t\t\tgoto rss_tuple_uninit;\n \t}\ndiff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h\nindex 05d5c26..94668ed 100644\n--- a/drivers/net/hns3/hns3_rss.h\n+++ b/drivers/net/hns3/hns3_rss.h\n@@ -24,9 +24,8 @@\n \tETH_RSS_L4_DST_ONLY)\n \n #define HNS3_RSS_IND_TBL_SIZE\t512 /* The size of hash lookup table */\n+#define HNS3_RSS_IND_TBL_SIZE_MAX 2048\n #define HNS3_RSS_KEY_SIZE\t40\n-#define HNS3_RSS_CFG_TBL_NUM \\\n-\t(HNS3_RSS_IND_TBL_SIZE / HNS3_RSS_CFG_TBL_SIZE)\n #define HNS3_RSS_SET_BITMAP_MSK\t0xffff\n \n #define HNS3_RSS_HASH_ALGO_TOEPLITZ\t0\n@@ -45,7 +44,7 @@ struct hns3_rss_conf {\n \tuint8_t hash_algo; /* hash function type definited by hardware */\n \tuint8_t key[HNS3_RSS_KEY_SIZE];  /* Hash key */\n \tstruct hns3_rss_tuple_cfg rss_tuple_sets;\n-\tuint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE]; /* Shadow table */\n+\tuint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX];\n \tuint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */\n \tbool valid; /* check if RSS rule is valid */\n \t/*\n",
    "prefixes": [
        "09/17"
    ]
}