get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 89697,
    "url": "http://patches.dpdk.org/api/patches/89697/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1616498467-37533-2-git-send-email-humin29@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": "<1616498467-37533-2-git-send-email-humin29@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1616498467-37533-2-git-send-email-humin29@huawei.com",
    "date": "2021-03-23T11:21:00",
    "name": "[v6,1/8] net/hns3: support runtime config to select IO burst func",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "c438e54cadecba3196723e59ebb101153829066f",
    "submitter": {
        "id": 1944,
        "url": "http://patches.dpdk.org/api/people/1944/?format=api",
        "name": "humin (Q)",
        "email": "humin29@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/1616498467-37533-2-git-send-email-humin29@huawei.com/mbox/",
    "series": [
        {
            "id": 15830,
            "url": "http://patches.dpdk.org/api/series/15830/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15830",
            "date": "2021-03-23T11:21:07",
            "name": "features and bugfixes for hns3",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/15830/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/89697/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/89697/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 245A6A09E4;\n\tTue, 23 Mar 2021 12:21:49 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B849F140E37;\n\tTue, 23 Mar 2021 12:21:02 +0100 (CET)",
            "from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191])\n by mails.dpdk.org (Postfix) with ESMTP id 2F70C40683\n for <dev@dpdk.org>; Tue, 23 Mar 2021 12:20:48 +0100 (CET)",
            "from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59])\n by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F4TQH1TknzwQ8C\n for <dev@dpdk.org>; Tue, 23 Mar 2021 19:18:47 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id\n 14.3.498.0; Tue, 23 Mar 2021 19:20:40 +0800"
        ],
        "From": "\"Min Hu (Connor)\" <humin29@huawei.com>",
        "To": "<dev@dpdk.org>, <ferruh.yigit@intel.com>",
        "Date": "Tue, 23 Mar 2021 19:21:00 +0800",
        "Message-ID": "<1616498467-37533-2-git-send-email-humin29@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1616498467-37533-1-git-send-email-humin29@huawei.com>",
        "References": "<1615357493-42394-1-git-send-email-humin29@huawei.com>\n <1616498467-37533-1-git-send-email-humin29@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 v6 1/8] net/hns3: support runtime config to\n select IO burst func",
        "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": "From: Chengwen Feng <fengchengwen@huawei.com>\n\nCurrently, the driver support multiple IO burst function and auto\nselection of the most appropriate function based on offload\nconfiguration.\n\nMost applications such as l2fwd/l3fwd don't provide the means to\nchange offload configuration, so it will use the auto selection's io\nburst function.\n\nThis patch support runtime config to select io burst function, which\nadd two config: rx_func_hint and tx_func_hint, both could assign\nvec/sve/simple/common.\n\nThe driver will use the following rules to select io burst func:\na. if hint equal vec and meet the vec Rx/Tx usage condition then use\nthe neon function.\nb. if hint equal sve and meet the sve Rx/Tx usage condition then use\nthe sve function.\nc. if hint equal simple and meet the simple Rx/Tx usage condition then\nuse the simple function.\nd. if hint equal common then use the common function.\ne. if hint not set then:\ne.1. if meet the vec Rx/Tx usage condition then use the neon function.\ne.2. if meet the simple Rx/Tx usage condition then use the simple\nfunction.\ne.3. else use the common function.\n\nNote: the sve Rx/Tx usage condition based on the vec Rx/Tx usage\ncondition and runtime environment (which must support SVE).\n\nIn the previous versions, driver will preferred use the sve function\nwhen meet the sve Rx/Tx usage condition, but in this case driver could\nget better performance if use the neon function.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\nSigned-off-by: Min Hu (Connor) <humin29@huawei.com>\n---\n doc/guides/nics/hns3.rst               | 37 ++++++++++++++++\n doc/guides/rel_notes/release_21_05.rst |  1 +\n drivers/net/hns3/hns3_ethdev.c         | 77 ++++++++++++++++++++++++++++++++++\n drivers/net/hns3/hns3_ethdev.h         | 15 +++++++\n drivers/net/hns3/hns3_ethdev_vf.c      |  4 ++\n drivers/net/hns3/hns3_rxtx.c           | 54 +++++++++++++++++-------\n 6 files changed, 174 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst\nindex 84bd7a3..ccd2f6f 100644\n--- a/doc/guides/nics/hns3.rst\n+++ b/doc/guides/nics/hns3.rst\n@@ -46,6 +46,43 @@ Prerequisites\n - Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.\n \n \n+Runtime Config Options\n+----------------------\n+\n+- ``rx_func_hint`` (default ``none``)\n+\n+  Used to select Rx burst function, supported value are ``vec``, ``sve``,\n+  ``simple``, ``common``.\n+  ``vec``, if supported use the ``vec`` Rx function which indicates the\n+  default vector algorithm, neon for Kunpeng Arm platform.\n+  ``sve``, if supported use the ``sve`` Rx function which indicates the\n+  sve algorithm.\n+  ``simple``, if supported use the ``simple`` Rx function which indicates\n+  the scalar algorithm.\n+  ``common``, if supported use the ``common`` Rx function which indicates\n+  the scalar scattered algorithm.\n+\n+  When provided parameter is not supported, ``vec`` usage condition will\n+  be first checked, if meets, use the ``vec``. Then, ``simple``, at last\n+  ``common``.\n+\n+- ``tx_func_hint`` (default ``none``)\n+\n+  Used to select Tx burst function, supported value are ``vec``, ``sve``,\n+  ``simple``, ``common``.\n+  ``vec``, if supported use the ``vec`` Tx function which indicates the\n+  default vector algorithm, neon for Kunpeng Arm platform.\n+  ``sve``, if supported use the ``sve`` Tx function which indicates the\n+  sve algorithm.\n+  ``simple``, if supported use the ``simple`` Tx function which indicates\n+  the scalar simple algorithm.\n+  ``common``, if supported use the ``common`` Tx function which indicates\n+  the scalar algorithm.\n+\n+  When provided parameter is not supported, ``vec`` usage condition will\n+  be first checked, if meets, use the ``vec``. Then, ``simple``, at last\n+  ``common``.\n+\n Driver compilation and testing\n ------------------------------\n \ndiff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst\nindex dc5399f..1d85942 100644\n--- a/doc/guides/rel_notes/release_21_05.rst\n+++ b/doc/guides/rel_notes/release_21_05.rst\n@@ -60,6 +60,7 @@ New Features\n   * Added support for module EEPROM dumping.\n   * Added support for freeing Tx mbuf on demand.\n   * Added support for copper port in Kunpeng930.\n+  * Added support for runtime config to select IO burst function.\n \n * **Updated NXP DPAA2 driver.**\n \ndiff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex 9cbcc13..28aa27a 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -6,6 +6,7 @@\n #include <rte_bus_pci.h>\n #include <ethdev_pci.h>\n #include <rte_pci.h>\n+#include <rte_kvargs.h>\n \n #include \"hns3_ethdev.h\"\n #include \"hns3_logs.h\"\n@@ -6505,6 +6506,78 @@ hns3_get_module_info(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n+static int\n+hns3_parse_io_hint_func(const char *key, const char *value, void *extra_args)\n+{\n+\tuint32_t hint = HNS3_IO_FUNC_HINT_NONE;\n+\n+\tRTE_SET_USED(key);\n+\n+\tif (strcmp(value, \"vec\") == 0)\n+\t\thint = HNS3_IO_FUNC_HINT_VEC;\n+\telse if (strcmp(value, \"sve\") == 0)\n+\t\thint = HNS3_IO_FUNC_HINT_SVE;\n+\telse if (strcmp(value, \"simple\") == 0)\n+\t\thint = HNS3_IO_FUNC_HINT_SIMPLE;\n+\telse if (strcmp(value, \"common\") == 0)\n+\t\thint = HNS3_IO_FUNC_HINT_COMMON;\n+\n+\t/* If the hint is valid then update output parameters */\n+\tif (hint != HNS3_IO_FUNC_HINT_NONE)\n+\t\t*(uint32_t *)extra_args = hint;\n+\n+\treturn 0;\n+}\n+\n+static const char *\n+hns3_get_io_hint_func_name(uint32_t hint)\n+{\n+\tswitch (hint) {\n+\tcase HNS3_IO_FUNC_HINT_VEC:\n+\t\treturn \"vec\";\n+\tcase HNS3_IO_FUNC_HINT_SVE:\n+\t\treturn \"sve\";\n+\tcase HNS3_IO_FUNC_HINT_SIMPLE:\n+\t\treturn \"simple\";\n+\tcase HNS3_IO_FUNC_HINT_COMMON:\n+\t\treturn \"common\";\n+\tdefault:\n+\t\treturn \"none\";\n+\t}\n+}\n+\n+void\n+hns3_parse_devargs(struct rte_eth_dev *dev)\n+{\n+\tstruct hns3_adapter *hns = dev->data->dev_private;\n+\tuint32_t rx_func_hint = HNS3_IO_FUNC_HINT_NONE;\n+\tuint32_t tx_func_hint = HNS3_IO_FUNC_HINT_NONE;\n+\tstruct hns3_hw *hw = &hns->hw;\n+\tstruct rte_kvargs *kvlist;\n+\n+\tif (dev->device->devargs == NULL)\n+\t\treturn;\n+\n+\tkvlist = rte_kvargs_parse(dev->device->devargs->args, NULL);\n+\tif (!kvlist)\n+\t\treturn;\n+\n+\trte_kvargs_process(kvlist, HNS3_DEVARG_RX_FUNC_HINT,\n+\t\t\t   &hns3_parse_io_hint_func, &rx_func_hint);\n+\trte_kvargs_process(kvlist, HNS3_DEVARG_TX_FUNC_HINT,\n+\t\t\t   &hns3_parse_io_hint_func, &tx_func_hint);\n+\trte_kvargs_free(kvlist);\n+\n+\tif (rx_func_hint != HNS3_IO_FUNC_HINT_NONE)\n+\t\thns3_warn(hw, \"parsed %s = %s.\", HNS3_DEVARG_RX_FUNC_HINT,\n+\t\t\t  hns3_get_io_hint_func_name(rx_func_hint));\n+\thns->rx_func_hint = rx_func_hint;\n+\tif (tx_func_hint != HNS3_IO_FUNC_HINT_NONE)\n+\t\thns3_warn(hw, \"parsed %s = %s.\", HNS3_DEVARG_TX_FUNC_HINT,\n+\t\t\t  hns3_get_io_hint_func_name(tx_func_hint));\n+\thns->tx_func_hint = tx_func_hint;\n+}\n+\n static const struct eth_dev_ops hns3_eth_dev_ops = {\n \t.dev_configure      = hns3_dev_configure,\n \t.dev_start          = hns3_dev_start,\n@@ -6625,6 +6698,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)\n \thw->adapter_state = HNS3_NIC_UNINITIALIZED;\n \thns->is_vf = false;\n \thw->data = eth_dev->data;\n+\thns3_parse_devargs(eth_dev);\n \n \t/*\n \t * Set default max packet size according to the mtu\n@@ -6758,5 +6832,8 @@ static struct rte_pci_driver rte_hns3_pmd = {\n RTE_PMD_REGISTER_PCI(net_hns3, rte_hns3_pmd);\n RTE_PMD_REGISTER_PCI_TABLE(net_hns3, pci_id_hns3_map);\n RTE_PMD_REGISTER_KMOD_DEP(net_hns3, \"* igb_uio | vfio-pci\");\n+RTE_PMD_REGISTER_PARAM_STRING(net_hns3,\n+\t\tHNS3_DEVARG_RX_FUNC_HINT \"=vec|sve|simple|common \"\n+\t\tHNS3_DEVARG_TX_FUNC_HINT \"=vec|sve|simple|common \");\n RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, NOTICE);\n RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, NOTICE);\ndiff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h\nindex 932600d..ec4b475 100644\n--- a/drivers/net/hns3/hns3_ethdev.h\n+++ b/drivers/net/hns3/hns3_ethdev.h\n@@ -772,9 +772,23 @@ struct hns3_adapter {\n \tbool tx_simple_allowed;\n \tbool tx_vec_allowed;\n \n+\tuint32_t rx_func_hint;\n+\tuint32_t tx_func_hint;\n+\n \tstruct hns3_ptype_table ptype_tbl __rte_cache_min_aligned;\n };\n \n+enum {\n+\tHNS3_IO_FUNC_HINT_NONE = 0,\n+\tHNS3_IO_FUNC_HINT_VEC,\n+\tHNS3_IO_FUNC_HINT_SVE,\n+\tHNS3_IO_FUNC_HINT_SIMPLE,\n+\tHNS3_IO_FUNC_HINT_COMMON\n+};\n+\n+#define HNS3_DEVARG_RX_FUNC_HINT\t\"rx_func_hint\"\n+#define HNS3_DEVARG_TX_FUNC_HINT\t\"tx_func_hint\"\n+\n #define HNS3_DEV_SUPPORT_DCB_B\t\t\t0x0\n #define HNS3_DEV_SUPPORT_COPPER_B\t\t0x1\n #define HNS3_DEV_SUPPORT_UDP_GSO_B\t\t0x2\n@@ -975,6 +989,7 @@ int hns3_dev_infos_get(struct rte_eth_dev *eth_dev,\n \t\t       struct rte_eth_dev_info *info);\n void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,\n \t\t\t  uint32_t link_speed, uint8_t link_duplex);\n+void hns3_parse_devargs(struct rte_eth_dev *dev);\n \n static inline bool\n is_reset_pending(struct hns3_adapter *hns)\ndiff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c\nindex fd20c52..f3eaefb 100644\n--- a/drivers/net/hns3/hns3_ethdev_vf.c\n+++ b/drivers/net/hns3/hns3_ethdev_vf.c\n@@ -2834,6 +2834,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)\n \thw->adapter_state = HNS3_NIC_UNINITIALIZED;\n \thns->is_vf = true;\n \thw->data = eth_dev->data;\n+\thns3_parse_devargs(eth_dev);\n \n \tret = hns3_reset_init(hw);\n \tif (ret)\n@@ -2962,3 +2963,6 @@ static struct rte_pci_driver rte_hns3vf_pmd = {\n RTE_PMD_REGISTER_PCI(net_hns3_vf, rte_hns3vf_pmd);\n RTE_PMD_REGISTER_PCI_TABLE(net_hns3_vf, pci_id_hns3vf_map);\n RTE_PMD_REGISTER_KMOD_DEP(net_hns3_vf, \"* igb_uio | vfio-pci\");\n+RTE_PMD_REGISTER_PARAM_STRING(net_hns3_vf,\n+\t\tHNS3_DEVARG_RX_FUNC_HINT \"=vec|sve|simple|common \"\n+\t\tHNS3_DEVARG_TX_FUNC_HINT \"=vec|sve|simple|common \");\ndiff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c\nindex 00167c4..f5c7d71 100644\n--- a/drivers/net/hns3/hns3_rxtx.c\n+++ b/drivers/net/hns3/hns3_rxtx.c\n@@ -2689,13 +2689,26 @@ hns3_get_rx_function(struct rte_eth_dev *dev)\n {\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n \tuint64_t offloads = dev->data->dev_conf.rxmode.offloads;\n+\tbool vec_allowed, sve_allowed, simple_allowed;\n+\n+\tvec_allowed = hns->rx_vec_allowed &&\n+\t\t      hns3_rx_check_vec_support(dev) == 0;\n+\tsve_allowed = vec_allowed && hns3_check_sve_support();\n+\tsimple_allowed = hns->rx_simple_allowed && !dev->data->scattered_rx &&\n+\t\t\t (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0;\n+\n+\tif (hns->rx_func_hint == HNS3_IO_FUNC_HINT_VEC && vec_allowed)\n+\t\treturn hns3_recv_pkts_vec;\n+\tif (hns->rx_func_hint == HNS3_IO_FUNC_HINT_SVE && sve_allowed)\n+\t\treturn hns3_recv_pkts_vec_sve;\n+\tif (hns->rx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed)\n+\t\treturn hns3_recv_pkts;\n+\tif (hns->rx_func_hint == HNS3_IO_FUNC_HINT_COMMON)\n+\t\treturn hns3_recv_scattered_pkts;\n \n-\tif (hns->rx_vec_allowed && hns3_rx_check_vec_support(dev) == 0)\n-\t\treturn hns3_check_sve_support() ? hns3_recv_pkts_vec_sve :\n-\t\t       hns3_recv_pkts_vec;\n-\n-\tif (hns->rx_simple_allowed && !dev->data->scattered_rx &&\n-\t    (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0)\n+\tif (vec_allowed)\n+\t\treturn hns3_recv_pkts_vec;\n+\tif (simple_allowed)\n \t\treturn hns3_recv_pkts;\n \n \treturn hns3_recv_scattered_pkts;\n@@ -3930,19 +3943,32 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)\n {\n \tuint64_t offloads = dev->data->dev_conf.txmode.offloads;\n \tstruct hns3_adapter *hns = dev->data->dev_private;\n+\tbool vec_allowed, sve_allowed, simple_allowed;\n \n-\tif (hns->tx_vec_allowed && hns3_tx_check_vec_support(dev) == 0) {\n-\t\t*prep = NULL;\n-\t\treturn hns3_check_sve_support() ? hns3_xmit_pkts_vec_sve :\n-\t\t\thns3_xmit_pkts_vec;\n-\t}\n+\tvec_allowed = hns->tx_vec_allowed &&\n+\t\t      hns3_tx_check_vec_support(dev) == 0;\n+\tsve_allowed = vec_allowed && hns3_check_sve_support();\n+\tsimple_allowed = hns->tx_simple_allowed &&\n+\t\t\t offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE);\n \n-\tif (hns->tx_simple_allowed &&\n-\t    offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)) {\n-\t\t*prep = NULL;\n+\t*prep = NULL;\n+\n+\tif (hns->tx_func_hint == HNS3_IO_FUNC_HINT_VEC && vec_allowed)\n+\t\treturn hns3_xmit_pkts_vec;\n+\tif (hns->tx_func_hint == HNS3_IO_FUNC_HINT_SVE && sve_allowed)\n+\t\treturn hns3_xmit_pkts_vec_sve;\n+\tif (hns->tx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed)\n \t\treturn hns3_xmit_pkts_simple;\n+\tif (hns->tx_func_hint == HNS3_IO_FUNC_HINT_COMMON) {\n+\t\t*prep = hns3_prep_pkts;\n+\t\treturn hns3_xmit_pkts;\n \t}\n \n+\tif (vec_allowed)\n+\t\treturn hns3_xmit_pkts_vec;\n+\tif (simple_allowed)\n+\t\treturn hns3_xmit_pkts_simple;\n+\n \t*prep = hns3_prep_pkts;\n \treturn hns3_xmit_pkts;\n }\n",
    "prefixes": [
        "v6",
        "1/8"
    ]
}