get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133775,
    "url": "http://patches.dpdk.org/api/patches/133775/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231102082020.2588392-3-haijie1@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": "<20231102082020.2588392-3-haijie1@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231102082020.2588392-3-haijie1@huawei.com",
    "date": "2023-11-02T08:20:13",
    "name": "[v9,2/9] ethdev: support setting and querying RSS algorithm",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "150403ac1c547ceb8c43aa51e8b3a95a2a697192",
    "submitter": {
        "id": 2935,
        "url": "http://patches.dpdk.org/api/people/2935/?format=api",
        "name": "Jie Hai",
        "email": "haijie1@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/20231102082020.2588392-3-haijie1@huawei.com/mbox/",
    "series": [
        {
            "id": 30113,
            "url": "http://patches.dpdk.org/api/series/30113/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30113",
            "date": "2023-11-02T08:20:14",
            "name": "support setting and querying RSS algorithms",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/30113/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/133775/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/133775/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 86F1A4326B;\n\tThu,  2 Nov 2023 09:24:41 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 062D14161A;\n\tThu,  2 Nov 2023 09:24:05 +0100 (CET)",
            "from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])\n by mails.dpdk.org (Postfix) with ESMTP id 7DD6A40608\n for <dev@dpdk.org>; Thu,  2 Nov 2023 09:23:57 +0100 (CET)",
            "from kwepemi500020.china.huawei.com (unknown [172.30.72.57])\n by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SLcJf5kXfzrTqG;\n Thu,  2 Nov 2023 16:20:50 +0800 (CST)",
            "from localhost.localdomain (10.67.165.2) by\n kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.31; Thu, 2 Nov 2023 16:23:53 +0800"
        ],
        "From": "Jie Hai <haijie1@huawei.com>",
        "To": "<dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit\n <ferruh.yigit@amd.com>, Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, Ori\n Kam <orika@nvidia.com>",
        "CC": "<lihuisong@huawei.com>, <fengchengwen@huawei.com>,\n <liudongdong3@huawei.com>",
        "Subject": "[PATCH v9 2/9] ethdev: support setting and querying RSS algorithm",
        "Date": "Thu, 2 Nov 2023 16:20:13 +0800",
        "Message-ID": "<20231102082020.2588392-3-haijie1@huawei.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "In-Reply-To": "<20231102082020.2588392-1-haijie1@huawei.com>",
        "References": "<20230315110033.30143-1-liudongdong3@huawei.com>\n <20231102082020.2588392-1-haijie1@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.165.2]",
        "X-ClientProxiedBy": "dggems704-chm.china.huawei.com (10.3.19.181) To\n kwepemi500020.china.huawei.com (7.221.188.8)",
        "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": "Currently, rte_eth_rss_conf supports configuring and querying\nRSS hash functions, rss key and it's length, but not RSS hash\nalgorithm.\n\nThe structure ``rte_eth_dev_info`` is extended by adding a new\nfield \"rss_algo_capa\". Drivers are responsible for reporting this\ncapa and configurations of RSS hash algorithm can be verified based\non the capability. The default value of \"rss_algo_capa\" is\nRTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT) if drivers do not report it.\n\nThe structure ``rte_eth_rss_conf`` is extended by adding a new\nfield \"algorithm\". This represents the RSS algorithms to apply.\nIf the value of \"algorithm\" used for configuration is a gibberish\nvalue, drivers should report the error.\n\nTo check whether the drivers report valid \"algorithm\", it is set\nto default value before querying in rte_eth_dev_rss_hash_conf_get().\n\nSigned-off-by: Jie Hai <haijie1@huawei.com>\nSigned-off-by: Dongdong Liu <liudongdong3@huawei.com>\nAcked-by: Huisong Li <lihuisong@huawei.com>\nAcked-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n doc/guides/rel_notes/release_23_11.rst | 13 ++++++++++++\n lib/ethdev/rte_ethdev.c                | 25 ++++++++++++++++++++++\n lib/ethdev/rte_ethdev.h                | 29 ++++++++++++++++++++++++++\n lib/ethdev/rte_flow.c                  |  1 -\n lib/ethdev/rte_flow.h                  | 26 ++---------------------\n 5 files changed, 69 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst\nindex 0b67f31dc385..20556b8a17ce 100644\n--- a/doc/guides/rel_notes/release_23_11.rst\n+++ b/doc/guides/rel_notes/release_23_11.rst\n@@ -122,6 +122,13 @@ New Features\n   a group's miss actions, which are the actions to be performed on packets\n   that didn't match any of the flow rules in the group.\n \n+* **Added support for RSS hash algorithm.**\n+\n+  * Added new field ``rss_algo_capa`` to ``rte_eth_dev_info`` structure for\n+    reporting RSS hash algorithm capability that drivers support.\n+  * Added new field ``algorithm`` to ``rte_eth_rss_conf`` structure for RSS\n+    hash algorithm querying and configuring.\n+\n * **Updated Amazon ena (Elastic Network Adapter) net driver.**\n \n   * Upgraded ENA HAL to latest version.\n@@ -376,6 +383,12 @@ ABI Changes\n * security: struct ``rte_security_ipsec_sa_options`` was updated\n   due to inline out-of-place feature addition.\n \n+* ethdev: Added \"rss_algo_capa\" field to ``rte_eth_dev_info`` structure for\n+* reporting RSS hash algorithm capability.\n+\n+* ethdev: Added \"algorithm\" field to ``rte_eth_rss_conf`` structure for RSS\n+  hash algorithm.\n+\n \n Known Issues\n ------------\ndiff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 6727aca12dce..36d8deef90c5 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -1269,6 +1269,7 @@ int\n rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t\t      const struct rte_eth_conf *dev_conf)\n {\n+\tenum rte_eth_hash_function algorithm;\n \tstruct rte_eth_dev *dev;\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_eth_conf orig_conf;\n@@ -1510,6 +1511,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,\n \t\tgoto rollback;\n \t}\n \n+\talgorithm = dev_conf->rx_adv_conf.rss_conf.algorithm;\n+\tif (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||\n+\t    (dev_info.rss_algo_capa & RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {\n+\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\"Ethdev port_id=%u configured RSS hash algorithm (%u)\"\n+\t\t\t\"is not in the algorithm capability (0x%\" PRIx32 \")\\n\",\n+\t\t\tport_id, algorithm, dev_info.rss_algo_capa);\n+\t\tret = -EINVAL;\n+\t\tgoto rollback;\n+\t}\n+\n \t/*\n \t * Setup new number of Rx/Tx queues and reconfigure device.\n \t */\n@@ -3767,6 +3779,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)\n \tdev_info->min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN -\n \t\tRTE_ETHER_CRC_LEN;\n \tdev_info->max_mtu = UINT16_MAX;\n+\tdev_info->rss_algo_capa = RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT);\n \n \tif (*dev->dev_ops->dev_infos_get == NULL)\n \t\treturn -ENOTSUP;\n@@ -4716,6 +4729,16 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,\n \t\treturn -EINVAL;\n \t}\n \n+\tif (rss_conf->algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||\n+\t    (dev_info.rss_algo_capa &\n+\t     RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {\n+\t\tRTE_ETHDEV_LOG(ERR,\n+\t\t\t\"Ethdev port_id=%u configured RSS hash algorithm (%u)\"\n+\t\t\t\"is not in the algorithm capability (0x%\" PRIx32 \")\\n\",\n+\t\t\tport_id, rss_conf->algorithm, dev_info.rss_algo_capa);\n+\t\treturn -EINVAL;\n+\t}\n+\n \tif (*dev->dev_ops->rss_hash_update == NULL)\n \t\treturn -ENOTSUP;\n \tret = eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,\n@@ -4756,6 +4779,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id,\n \t\treturn -EINVAL;\n \t}\n \n+\trss_conf->algorithm = RTE_ETH_HASH_FUNCTION_DEFAULT;\n+\n \tif (*dev->dev_ops->rss_hash_conf_get == NULL)\n \t\treturn -ENOTSUP;\n \tret = eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,\ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex fb1a1f89c67f..37d8ef694523 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -445,6 +445,33 @@ struct rte_vlan_filter_conf {\n \tuint64_t ids[64];\n };\n \n+/**\n+ * Hash function types.\n+ */\n+enum rte_eth_hash_function {\n+\t/** DEFAULT means driver decides which hash algorithm to pick. */\n+\tRTE_ETH_HASH_FUNCTION_DEFAULT = 0,\n+\tRTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */\n+\tRTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */\n+\t/**\n+\t * Symmetric Toeplitz: src, dst will be replaced by\n+\t * xor(src, dst). For the case with src/dst only,\n+\t * src or dst address will xor with zero pair.\n+\t */\n+\tRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,\n+\t/**\n+\t * Symmetric Toeplitz: L3 and L4 fields are sorted prior to\n+\t * the hash function.\n+\t *  If src_ip > dst_ip, swap src_ip and dst_ip.\n+\t *  If src_port > dst_port, swap src_port and dst_port.\n+\t */\n+\tRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,\n+\tRTE_ETH_HASH_FUNCTION_MAX,\n+};\n+\n+#define RTE_ETH_HASH_ALGO_TO_CAPA(x) RTE_BIT32(x)\n+#define RTE_ETH_HASH_ALGO_CAPA_MASK(x) RTE_BIT32(RTE_ETH_HASH_FUNCTION_ ## x)\n+\n /**\n  * A structure used to configure the Receive Side Scaling (RSS) feature\n  * of an Ethernet port.\n@@ -469,6 +496,7 @@ struct rte_eth_rss_conf {\n \t * which RSS hashing is to be applied.\n \t */\n \tuint64_t rss_hf;\n+\tenum rte_eth_hash_function algorithm;\t/**< Hash algorithm. */\n };\n \n /*\n@@ -1749,6 +1777,7 @@ struct rte_eth_dev_info {\n \t/** Device redirection table size, the total number of entries. */\n \tuint16_t reta_size;\n \tuint8_t hash_key_size; /**< Hash key size in bytes */\n+\tuint32_t rss_algo_capa; /** RSS hash algorithms capabilities */\n \t/** Bit mask of RSS offloads, the bit offset also means flow type */\n \tuint64_t flow_type_rss_offloads;\n \tstruct rte_eth_rxconf default_rxconf; /**< Default Rx configuration */\ndiff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c\nindex 20ee8430eaec..549e3295584c 100644\n--- a/lib/ethdev/rte_flow.c\n+++ b/lib/ethdev/rte_flow.c\n@@ -13,7 +13,6 @@\n #include <rte_branch_prediction.h>\n #include <rte_string_fns.h>\n #include <rte_mbuf_dyn.h>\n-#include \"rte_ethdev.h\"\n #include \"rte_flow_driver.h\"\n #include \"rte_flow.h\"\n \ndiff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h\nindex 751c29a0f3f3..affdc8121b57 100644\n--- a/lib/ethdev/rte_flow.h\n+++ b/lib/ethdev/rte_flow.h\n@@ -40,6 +40,8 @@\n #include <rte_macsec.h>\n #include <rte_ib.h>\n \n+#include \"rte_ethdev.h\"\n+\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n@@ -3222,30 +3224,6 @@ struct rte_flow_query_count {\n \tuint64_t bytes; /**< Number of bytes through this rule [out]. */\n };\n \n-/**\n- * Hash function types.\n- */\n-enum rte_eth_hash_function {\n-\t/** DEFAULT means driver decides which hash algorithm to pick. */\n-\tRTE_ETH_HASH_FUNCTION_DEFAULT = 0,\n-\tRTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */\n-\tRTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */\n-\t/**\n-\t * Symmetric Toeplitz: src, dst will be replaced by\n-\t * xor(src, dst). For the case with src/dst only,\n-\t * src or dst address will xor with zero pair.\n-\t */\n-\tRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,\n-\t/**\n-\t * Symmetric Toeplitz: L3 and L4 fields are sorted prior to\n-\t * the hash function.\n-\t *  If src_ip > dst_ip, swap src_ip and dst_ip.\n-\t *  If src_port > dst_port, swap src_port and dst_port.\n-\t */\n-\tRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,\n-\tRTE_ETH_HASH_FUNCTION_MAX,\n-};\n-\n /**\n  * RTE_FLOW_ACTION_TYPE_RSS\n  *\n",
    "prefixes": [
        "v9",
        "2/9"
    ]
}