get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94707,
    "url": "https://patches.dpdk.org/api/patches/94707/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210623044702.4240-12-ndabilpuram@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20210623044702.4240-12-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210623044702.4240-12-ndabilpuram@marvell.com",
    "date": "2021-06-23T04:46:11",
    "name": "[v4,11/62] net/cnxk: add common devargs parsing function",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5d369320ccaf65c8eb636869eaa8a4f6c17fb788",
    "submitter": {
        "id": 1202,
        "url": "https://patches.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210623044702.4240-12-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 17449,
            "url": "https://patches.dpdk.org/api/series/17449/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17449",
            "date": "2021-06-23T04:46:00",
            "name": "Marvell CNXK Ethdev Driver",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/17449/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94707/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/94707/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 39188A0C41;\n\tWed, 23 Jun 2021 06:48:39 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B61B24067A;\n\tWed, 23 Jun 2021 06:47:56 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id C209341140\n for <dev@dpdk.org>; Wed, 23 Jun 2021 06:47:55 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 15N4k9oe025587 for <dev@dpdk.org>; Tue, 22 Jun 2021 21:47:55 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 39bptj1gje-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 22 Jun 2021 21:47:55 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Tue, 22 Jun 2021 21:47:53 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend\n Transport; Tue, 22 Jun 2021 21:47:52 -0700",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 104A55B6936;\n Tue, 22 Jun 2021 21:47:49 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0220; bh=j4EmyLXJhknzC52U+TBQfeQ4qM8jY22WFhLBLseDaNQ=;\n b=i/5gGZpJrIXHqTACyevBGrkxL5QMhg5qkQG4MmPtPbh6LCzmKUcI1ePrr9VanSBWUjKb\n pcBpOqQ+zDWjfa7AqXyxFIP7KFSC6S5bpuoeUoWIoWwLWSXd9Bcbf2w+4rV1xn1Xj0DM\n LTpr6lQcshMVU4X0wRrEBzSGZ4BmP8hTzHSDSXuqq+AFtE/PJPKrNmzFk8I08RIDCiU6\n i4JUvnKY2vPAdeiVn803DQ8MIpaktU1Csze24qBElbgOaxhAkNMepmvWqsu+Pd6xHYku\n GlGpnpjcRFua4qB/BgIhsEW7iKc9KrZj4o7u1oKdUscHfcVIeo26V00j0Ehqu8BVgoaN 5Q==",
        "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<jerinj@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>,\n <pbhagavatula@marvell.com>, <kirankumark@marvell.com>,\n <psatheesh@marvell.com>, <asekhar@marvell.com>, <hkalra@marvell.com>,\n \"Nithin Dabilpuram\" <ndabilpuram@marvell.com>",
        "Date": "Wed, 23 Jun 2021 10:16:11 +0530",
        "Message-ID": "<20210623044702.4240-12-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210623044702.4240-1-ndabilpuram@marvell.com>",
        "References": "<20210306153404.10781-1-ndabilpuram@marvell.com>\n <20210623044702.4240-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "afgt3saXbvh6ifFQK7VjLc5717ETsMbc",
        "X-Proofpoint-GUID": "afgt3saXbvh6ifFQK7VjLc5717ETsMbc",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790\n definitions=2021-06-23_01:2021-06-22,\n 2021-06-23 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4 11/62] net/cnxk: add common devargs parsing\n function",
        "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": "Add various devargs parsing command line arguments\nparsing functions supported by CN9K and CN10K.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n doc/guides/nics/cnxk.rst               |  94 +++++++++++++++++++\n drivers/net/cnxk/cnxk_ethdev.c         |   7 ++\n drivers/net/cnxk/cnxk_ethdev.h         |   9 ++\n drivers/net/cnxk/cnxk_ethdev_devargs.c | 166 +++++++++++++++++++++++++++++++++\n drivers/net/cnxk/meson.build           |   3 +-\n 5 files changed, 278 insertions(+), 1 deletion(-)\n create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c",
    "diff": "diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst\nindex ca21842..6652e17 100644\n--- a/doc/guides/nics/cnxk.rst\n+++ b/doc/guides/nics/cnxk.rst\n@@ -27,3 +27,97 @@ Driver compilation and testing\n \n Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`\n for details.\n+\n+Runtime Config Options\n+----------------------\n+\n+- ``Rx&Tx scalar mode enable`` (default ``0``)\n+\n+   PMD supports both scalar and vector mode, it may be selected at runtime\n+   using ``scalar_enable`` ``devargs`` parameter.\n+\n+- ``RSS reta size`` (default ``64``)\n+\n+   RSS redirection table size may be configured during runtime using ``reta_size``\n+   ``devargs`` parameter.\n+\n+   For example::\n+\n+      -a 0002:02:00.0,reta_size=256\n+\n+   With the above configuration, reta table of size 256 is populated.\n+\n+- ``Flow priority levels`` (default ``3``)\n+\n+   RTE Flow priority levels can be configured during runtime using\n+   ``flow_max_priority`` ``devargs`` parameter.\n+\n+   For example::\n+\n+      -a 0002:02:00.0,flow_max_priority=10\n+\n+   With the above configuration, priority level was set to 10 (0-9). Max\n+   priority level supported is 32.\n+\n+- ``Reserve Flow entries`` (default ``8``)\n+\n+   RTE flow entries can be pre allocated and the size of pre allocation can be\n+   selected runtime using ``flow_prealloc_size`` ``devargs`` parameter.\n+\n+   For example::\n+\n+      -a 0002:02:00.0,flow_prealloc_size=4\n+\n+   With the above configuration, pre alloc size was set to 4. Max pre alloc\n+   size supported is 32.\n+\n+- ``Max SQB buffer count`` (default ``512``)\n+\n+   Send queue descriptor buffer count may be limited during runtime using\n+   ``max_sqb_count`` ``devargs`` parameter.\n+\n+   For example::\n+\n+      -a 0002:02:00.0,max_sqb_count=64\n+\n+   With the above configuration, each send queue's descriptor buffer count is\n+   limited to a maximum of 64 buffers.\n+\n+- ``Switch header enable`` (default ``none``)\n+\n+   A port can be configured to a specific switch header type by using\n+   ``switch_header`` ``devargs`` parameter.\n+\n+   For example::\n+\n+      -a 0002:02:00.0,switch_header=\"higig2\"\n+\n+   With the above configuration, higig2 will be enabled on that port and the\n+   traffic on this port should be higig2 traffic only. Supported switch header\n+   types are \"higig2\", \"dsa\", \"chlen90b\" and \"chlen24b\".\n+\n+- ``RSS tag as XOR`` (default ``0``)\n+\n+   The HW gives two options to configure the RSS adder i.e\n+\n+   * ``rss_adder<7:0> = flow_tag<7:0> ^ flow_tag<15:8> ^ flow_tag<23:16> ^ flow_tag<31:24>``\n+\n+   * ``rss_adder<7:0> = flow_tag<7:0>``\n+\n+   Latter one aligns with standard NIC behavior vs former one is a legacy\n+   RSS adder scheme used in OCTEON TX2 products.\n+\n+   By default, the driver runs in the latter mode.\n+   Setting this flag to 1 to select the legacy mode.\n+\n+   For example to select the legacy mode(RSS tag adder as XOR)::\n+\n+      -a 0002:02:00.0,tag_as_xor=1\n+\n+\n+\n+.. note::\n+\n+   Above devarg parameters are configurable per device, user needs to pass the\n+   parameters to all the PCIe devices if application requires to configure on\n+   all the ethdev ports.\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c\nindex 526c19b..109fd35 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.c\n+++ b/drivers/net/cnxk/cnxk_ethdev.c\n@@ -57,6 +57,13 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)\n \tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n \trte_eth_copy_pci_info(eth_dev, pci_dev);\n \n+\t/* Parse devargs string */\n+\trc = cnxk_ethdev_parse_devargs(eth_dev->device->devargs, dev);\n+\tif (rc) {\n+\t\tplt_err(\"Failed to parse devargs rc=%d\", rc);\n+\t\tgoto error;\n+\t}\n+\n \t/* Initialize base roc nix */\n \tnix->pci_dev = pci_dev;\n \trc = roc_nix_dev_init(nix);\ndiff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h\nindex ba2bfcd..97e3a15 100644\n--- a/drivers/net/cnxk/cnxk_ethdev.h\n+++ b/drivers/net/cnxk/cnxk_ethdev.h\n@@ -9,11 +9,15 @@\n \n #include <ethdev_driver.h>\n #include <ethdev_pci.h>\n+#include <rte_kvargs.h>\n \n #include \"roc_api.h\"\n \n #define CNXK_ETH_DEV_PMD_VERSION \"1.0\"\n \n+/* Max supported SQB count */\n+#define CNXK_NIX_TX_MAX_SQB 512\n+\n #define CNXK_NIX_TX_OFFLOAD_CAPA                                               \\\n \t(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \\\n \t DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \\\n@@ -38,6 +42,7 @@ struct cnxk_eth_dev {\n \tuint8_t max_mac_entries;\n \n \tuint16_t flags;\n+\tbool scalar_ena;\n \n \t/* Pointer back to rte */\n \tstruct rte_eth_dev *eth_dev;\n@@ -73,4 +78,8 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,\n \t\t   struct rte_pci_device *pci_dev);\n int cnxk_nix_remove(struct rte_pci_device *pci_dev);\n \n+/* Devargs */\n+int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,\n+\t\t\t      struct cnxk_eth_dev *dev);\n+\n #endif /* __CNXK_ETHDEV_H__ */\ndiff --git a/drivers/net/cnxk/cnxk_ethdev_devargs.c b/drivers/net/cnxk/cnxk_ethdev_devargs.c\nnew file mode 100644\nindex 0000000..4af2803\n--- /dev/null\n+++ b/drivers/net/cnxk/cnxk_ethdev_devargs.c\n@@ -0,0 +1,166 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2021 Marvell.\n+ */\n+\n+#include <inttypes.h>\n+#include <math.h>\n+\n+#include \"cnxk_ethdev.h\"\n+\n+static int\n+parse_flow_max_priority(const char *key, const char *value, void *extra_args)\n+{\n+\tRTE_SET_USED(key);\n+\tuint16_t val;\n+\n+\tval = atoi(value);\n+\n+\t/* Limit the max priority to 32 */\n+\tif (val < 1 || val > 32)\n+\t\treturn -EINVAL;\n+\n+\t*(uint16_t *)extra_args = val;\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_flow_prealloc_size(const char *key, const char *value, void *extra_args)\n+{\n+\tRTE_SET_USED(key);\n+\tuint16_t val;\n+\n+\tval = atoi(value);\n+\n+\t/* Limit the prealloc size to 32 */\n+\tif (val < 1 || val > 32)\n+\t\treturn -EINVAL;\n+\n+\t*(uint16_t *)extra_args = val;\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_reta_size(const char *key, const char *value, void *extra_args)\n+{\n+\tRTE_SET_USED(key);\n+\tuint32_t val;\n+\n+\tval = atoi(value);\n+\n+\tif (val <= ETH_RSS_RETA_SIZE_64)\n+\t\tval = ROC_NIX_RSS_RETA_SZ_64;\n+\telse if (val > ETH_RSS_RETA_SIZE_64 && val <= ETH_RSS_RETA_SIZE_128)\n+\t\tval = ROC_NIX_RSS_RETA_SZ_128;\n+\telse if (val > ETH_RSS_RETA_SIZE_128 && val <= ETH_RSS_RETA_SIZE_256)\n+\t\tval = ROC_NIX_RSS_RETA_SZ_256;\n+\telse\n+\t\tval = ROC_NIX_RSS_RETA_SZ_64;\n+\n+\t*(uint16_t *)extra_args = val;\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_flag(const char *key, const char *value, void *extra_args)\n+{\n+\tRTE_SET_USED(key);\n+\n+\t*(uint16_t *)extra_args = atoi(value);\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_sqb_count(const char *key, const char *value, void *extra_args)\n+{\n+\tRTE_SET_USED(key);\n+\tuint32_t val;\n+\n+\tval = atoi(value);\n+\n+\t*(uint16_t *)extra_args = val;\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_switch_header_type(const char *key, const char *value, void *extra_args)\n+{\n+\tRTE_SET_USED(key);\n+\n+\tif (strcmp(value, \"higig2\") == 0)\n+\t\t*(uint16_t *)extra_args = ROC_PRIV_FLAGS_HIGIG;\n+\n+\tif (strcmp(value, \"dsa\") == 0)\n+\t\t*(uint16_t *)extra_args = ROC_PRIV_FLAGS_EDSA;\n+\n+\tif (strcmp(value, \"chlen90b\") == 0)\n+\t\t*(uint16_t *)extra_args = ROC_PRIV_FLAGS_LEN_90B;\n+\treturn 0;\n+}\n+\n+#define CNXK_RSS_RETA_SIZE\t\"reta_size\"\n+#define CNXK_SCL_ENABLE\t\t\"scalar_enable\"\n+#define CNXK_MAX_SQB_COUNT\t\"max_sqb_count\"\n+#define CNXK_FLOW_PREALLOC_SIZE \"flow_prealloc_size\"\n+#define CNXK_FLOW_MAX_PRIORITY\t\"flow_max_priority\"\n+#define CNXK_SWITCH_HEADER_TYPE \"switch_header\"\n+#define CNXK_RSS_TAG_AS_XOR\t\"tag_as_xor\"\n+\n+int\n+cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)\n+{\n+\tuint16_t reta_sz = ROC_NIX_RSS_RETA_SZ_64;\n+\tuint16_t sqb_count = CNXK_NIX_TX_MAX_SQB;\n+\tuint16_t flow_prealloc_size = 8;\n+\tuint16_t switch_header_type = 0;\n+\tuint16_t flow_max_priority = 3;\n+\tuint16_t rss_tag_as_xor = 0;\n+\tuint16_t scalar_enable = 0;\n+\tstruct rte_kvargs *kvlist;\n+\n+\tif (devargs == NULL)\n+\t\tgoto null_devargs;\n+\n+\tkvlist = rte_kvargs_parse(devargs->args, NULL);\n+\tif (kvlist == NULL)\n+\t\tgoto exit;\n+\n+\trte_kvargs_process(kvlist, CNXK_RSS_RETA_SIZE, &parse_reta_size,\n+\t\t\t   &reta_sz);\n+\trte_kvargs_process(kvlist, CNXK_SCL_ENABLE, &parse_flag,\n+\t\t\t   &scalar_enable);\n+\trte_kvargs_process(kvlist, CNXK_MAX_SQB_COUNT, &parse_sqb_count,\n+\t\t\t   &sqb_count);\n+\trte_kvargs_process(kvlist, CNXK_FLOW_PREALLOC_SIZE,\n+\t\t\t   &parse_flow_prealloc_size, &flow_prealloc_size);\n+\trte_kvargs_process(kvlist, CNXK_FLOW_MAX_PRIORITY,\n+\t\t\t   &parse_flow_max_priority, &flow_max_priority);\n+\trte_kvargs_process(kvlist, CNXK_SWITCH_HEADER_TYPE,\n+\t\t\t   &parse_switch_header_type, &switch_header_type);\n+\trte_kvargs_process(kvlist, CNXK_RSS_TAG_AS_XOR, &parse_flag,\n+\t\t\t   &rss_tag_as_xor);\n+\trte_kvargs_free(kvlist);\n+\n+null_devargs:\n+\tdev->scalar_ena = !!scalar_enable;\n+\tdev->nix.rss_tag_as_xor = !!rss_tag_as_xor;\n+\tdev->nix.max_sqb_count = sqb_count;\n+\tdev->nix.reta_sz = reta_sz;\n+\treturn 0;\n+\n+exit:\n+\treturn -EINVAL;\n+}\n+\n+RTE_PMD_REGISTER_PARAM_STRING(net_cnxk,\n+\t\t\t      CNXK_RSS_RETA_SIZE \"=<64|128|256>\"\n+\t\t\t      CNXK_SCL_ENABLE \"=1\"\n+\t\t\t      CNXK_MAX_SQB_COUNT \"=<8-512>\"\n+\t\t\t      CNXK_FLOW_PREALLOC_SIZE \"=<1-32>\"\n+\t\t\t      CNXK_FLOW_MAX_PRIORITY \"=<1-32>\"\n+\t\t\t      CNXK_SWITCH_HEADER_TYPE \"=<higig2|dsa|chlen90b>\"\n+\t\t\t      CNXK_RSS_TAG_AS_XOR \"=1\");\ndiff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build\nindex 089e4fc..e7e43f0 100644\n--- a/drivers/net/cnxk/meson.build\n+++ b/drivers/net/cnxk/meson.build\n@@ -8,7 +8,8 @@ if not dpdk_conf.get('RTE_ARCH_64')\n \tsubdir_done()\n endif\n \n-sources = files('cnxk_ethdev.c')\n+sources = files('cnxk_ethdev.c',\n+\t\t'cnxk_ethdev_devargs.c')\n \n # CN9K\n sources += files('cn9k_ethdev.c')\n",
    "prefixes": [
        "v4",
        "11/62"
    ]
}