get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 122619,
    "url": "http://patches.dpdk.org/api/patches/122619/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230129105140.29921-4-liudongdong3@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": "<20230129105140.29921-4-liudongdong3@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230129105140.29921-4-liudongdong3@huawei.com",
    "date": "2023-01-29T10:51:33",
    "name": "[03/10] net/hns3: refactor set RSS hash algorithm and key interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "da46e9e69e841e10c1267cd99c44c37cfad81896",
    "submitter": {
        "id": 2718,
        "url": "http://patches.dpdk.org/api/people/2718/?format=api",
        "name": "Dongdong Liu",
        "email": "liudongdong3@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/20230129105140.29921-4-liudongdong3@huawei.com/mbox/",
    "series": [
        {
            "id": 26679,
            "url": "http://patches.dpdk.org/api/series/26679/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=26679",
            "date": "2023-01-29T10:51:32",
            "name": "net/hns3: some bugfixes for rss",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/26679/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/122619/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/122619/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 BA472424B3;\n\tSun, 29 Jan 2023 11:52:34 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E4E6840EDB;\n\tSun, 29 Jan 2023 11:52:16 +0100 (CET)",
            "from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])\n by mails.dpdk.org (Postfix) with ESMTP id AF3B240ED5;\n Sun, 29 Jan 2023 11:52:10 +0100 (CET)",
            "from kwepemi500017.china.huawei.com (unknown [172.30.72.57])\n by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4P4Skp3N7WznVJw;\n Sun, 29 Jan 2023 18:50:10 +0800 (CST)",
            "from localhost.localdomain (10.28.79.22) by\n kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.34; Sun, 29 Jan 2023 18:52:09 +0800"
        ],
        "From": "Dongdong Liu <liudongdong3@huawei.com>",
        "To": "<dev@dpdk.org>, <ferruh.yigit@amd.com>, <thomas@monjalon.net>,\n <andrew.rybchenko@oktetlabs.ru>",
        "CC": "<stable@dpdk.org>, <yisen.zhuang@huawei.com>, <liudongdong3@huawei.com>,\n <lihuisong@huawei.com>",
        "Subject": "[PATCH 03/10] net/hns3: refactor set RSS hash algorithm and key\n interface",
        "Date": "Sun, 29 Jan 2023 18:51:33 +0800",
        "Message-ID": "<20230129105140.29921-4-liudongdong3@huawei.com>",
        "X-Mailer": "git-send-email 2.22.0",
        "In-Reply-To": "<20230129105140.29921-1-liudongdong3@huawei.com>",
        "References": "<20230129105140.29921-1-liudongdong3@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.28.79.22]",
        "X-ClientProxiedBy": "dggems702-chm.china.huawei.com (10.3.19.179) To\n kwepemi500017.china.huawei.com (7.221.188.110)",
        "X-CFilter-Loop": "Reflected",
        "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"
    },
    "content": "From: Huisong Li <lihuisong@huawei.com>\n\nThe hns3_rss_set_algo_key() is used to set RSS hash algorithm and key to\nhardware. The maximum times of command sent to firmware depend on the\nlength of key. However, now this times is fixed, which isn't good for\nkey expansion. In addition, hash algorithm comes from rss_info::hash_algo\nmaintained in driver, which also isn't good for the usage of this function.\nThis patch has to use hash algorithm and key length as the input parameters\nof this interface.\n\nFixes: c37ca66f2b27 (\"net/hns3: support RSS\")\nCc: stable@dpdk.org\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Dongdong Liu <liudongdong3@huawei.com>\n---\n drivers/net/hns3/hns3_flow.c |  3 ++-\n drivers/net/hns3/hns3_rss.c  | 48 ++++++++++++++++--------------------\n drivers/net/hns3/hns3_rss.h  |  4 ++-\n 3 files changed, 26 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c\nindex a2c1589c39..95609f8483 100644\n--- a/drivers/net/hns3/hns3_flow.c\n+++ b/drivers/net/hns3/hns3_flow.c\n@@ -1494,7 +1494,8 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)\n \tif (ret)\n \t\treturn ret;\n \n-\tret = hns3_rss_set_algo_key(hw, rss_config->key);\n+\tret = hns3_rss_set_algo_key(hw, hw->rss_info.hash_algo,\n+\t\t\t\t    rss_config->key, HNS3_RSS_KEY_SIZE);\n \tif (ret)\n \t\treturn ret;\n \ndiff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c\nindex ca5a129234..3db7bf0445 100644\n--- a/drivers/net/hns3/hns3_rss.c\n+++ b/drivers/net/hns3/hns3_rss.c\n@@ -277,45 +277,37 @@ static const struct {\n \n /*\n  * rss_generic_config command function, opcode:0x0D01.\n- * Used to set algorithm, key_offset and hash key of rss.\n+ * Used to set algorithm and hash key of RSS.\n  */\n int\n-hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key)\n+hns3_rss_set_algo_key(struct hns3_hw *hw, uint8_t hash_algo,\n+\t\t      const uint8_t *key, uint8_t key_len)\n {\n-#define HNS3_KEY_OFFSET_MAX\t3\n-#define HNS3_SET_HASH_KEY_BYTE_FOUR\t2\n-\n \tstruct hns3_rss_generic_config_cmd *req;\n \tstruct hns3_cmd_desc desc;\n-\tuint32_t key_offset, key_size;\n-\tconst uint8_t *key_cur;\n-\tuint8_t cur_offset;\n+\tconst uint8_t *cur_key;\n+\tuint16_t cur_key_size;\n+\tuint16_t max_bd_num;\n+\tuint16_t idx;\n \tint ret;\n \n \treq = (struct hns3_rss_generic_config_cmd *)desc.data;\n \n-\t/*\n-\t * key_offset=0, hash key byte0~15 is set to hardware.\n-\t * key_offset=1, hash key byte16~31 is set to hardware.\n-\t * key_offset=2, hash key byte32~39 is set to hardware.\n-\t */\n-\tfor (key_offset = 0; key_offset < HNS3_KEY_OFFSET_MAX; key_offset++) {\n+\tmax_bd_num = DIV_ROUND_UP(key_len, HNS3_RSS_HASH_KEY_NUM);\n+\tfor (idx = 0; idx < max_bd_num; idx++) {\n \t\thns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_GENERIC_CONFIG,\n \t\t\t\t\t  false);\n \n-\t\treq->hash_config |=\n-\t\t\t(hw->rss_info.hash_algo & HNS3_RSS_HASH_ALGO_MASK);\n-\t\treq->hash_config |= (key_offset << HNS3_RSS_HASH_KEY_OFFSET_B);\n+\t\treq->hash_config |= (hash_algo & HNS3_RSS_HASH_ALGO_MASK);\n+\t\treq->hash_config |= (idx << HNS3_RSS_HASH_KEY_OFFSET_B);\n \n-\t\tif (key_offset == HNS3_SET_HASH_KEY_BYTE_FOUR)\n-\t\t\tkey_size = HNS3_RSS_KEY_SIZE - HNS3_RSS_HASH_KEY_NUM *\n-\t\t\tHNS3_SET_HASH_KEY_BYTE_FOUR;\n+\t\tif (idx == max_bd_num - 1)\n+\t\t\tcur_key_size = key_len % HNS3_RSS_HASH_KEY_NUM;\n \t\telse\n-\t\t\tkey_size = HNS3_RSS_HASH_KEY_NUM;\n+\t\t\tcur_key_size = HNS3_RSS_HASH_KEY_NUM;\n \n-\t\tcur_offset = key_offset * HNS3_RSS_HASH_KEY_NUM;\n-\t\tkey_cur = key + cur_offset;\n-\t\tmemcpy(req->hash_key, key_cur, key_size);\n+\t\tcur_key = key + idx * HNS3_RSS_HASH_KEY_NUM;\n+\t\tmemcpy(req->hash_key, cur_key, cur_key_size);\n \n \t\tret = hns3_cmd_send(hw, &desc, 1);\n \t\tif (ret) {\n@@ -518,7 +510,8 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,\n \t\tgoto set_tuple_fail;\n \n \tif (key) {\n-\t\tret = hns3_rss_set_algo_key(hw, key);\n+\t\tret = hns3_rss_set_algo_key(hw, hw->rss_info.hash_algo,\n+\t\t\t\t\t    key, HNS3_RSS_KEY_SIZE);\n \t\tif (ret)\n \t\t\tgoto set_algo_key_fail;\n \t}\n@@ -795,8 +788,9 @@ hns3_config_rss(struct hns3_adapter *hns)\n \t\tbreak;\n \t}\n \n-\t/* Configure RSS hash algorithm and hash key offset */\n-\tret = hns3_rss_set_algo_key(hw, hash_key);\n+\t/* Configure RSS hash algorithm and hash key */\n+\tret = hns3_rss_set_algo_key(hw, hw->rss_info.hash_algo, hash_key,\n+\t\t\t\t    HNS3_RSS_KEY_SIZE);\n \tif (ret)\n \t\treturn ret;\n \ndiff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h\nindex 8e8b056f4e..b7f62ca1ee 100644\n--- a/drivers/net/hns3/hns3_rss.h\n+++ b/drivers/net/hns3/hns3_rss.h\n@@ -109,6 +109,8 @@ int hns3_rss_reset_indir_table(struct hns3_hw *hw);\n int hns3_config_rss(struct hns3_adapter *hns);\n void hns3_rss_uninit(struct hns3_adapter *hns);\n int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf);\n-int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key);\n+int hns3_rss_set_algo_key(struct hns3_hw *hw, uint8_t hash_algo,\n+\t\t\t  const uint8_t *key, uint8_t key_len);\n+\n \n #endif /* HNS3_RSS_H */\n",
    "prefixes": [
        "03/10"
    ]
}