get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60590,
    "url": "http://patchwork.dpdk.org/api/patches/60590/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20191007065155.1756-2-pbhagavatula@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20191007065155.1756-2-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191007065155.1756-2-pbhagavatula@marvell.com",
    "date": "2019-10-07T06:51:48",
    "name": "[v9,1/7] ethdev: add set ptype function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c9114ff74d4a882740a16124302fba52e3e665e3",
    "submitter": {
        "id": 1183,
        "url": "http://patchwork.dpdk.org/api/people/1183/?format=api",
        "name": "Pavan Nikhilesh Bhagavatula",
        "email": "pbhagavatula@marvell.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20191007065155.1756-2-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 6715,
            "url": "http://patchwork.dpdk.org/api/series/6715/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=6715",
            "date": "2019-10-07T06:51:47",
            "name": "ethdev: add new Rx offload flags",
            "version": 9,
            "mbox": "http://patchwork.dpdk.org/series/6715/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/60590/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/60590/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D3B141BFAF;\n\tMon,  7 Oct 2019 08:52:06 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n\t[67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 3F3561BFA4\n\tfor <dev@dpdk.org>; Mon,  7 Oct 2019 08:52:04 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n\tby mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n\tx976oCpK019413; Sun, 6 Oct 2019 23:52:03 -0700",
            "from sc-exch01.marvell.com ([199.233.58.181])\n\tby mx0b-0016f401.pphosted.com with ESMTP id 2vetpmvr39-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tSun, 06 Oct 2019 23:52:03 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com\n\t(10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tSun, 6 Oct 2019 23:52:01 -0700",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com\n\t(10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Sun, 6 Oct 2019 23:52:01 -0700",
            "from BG-LT7430.marvell.com (unknown [10.28.17.68])\n\tby maili.marvell.com (Postfix) with ESMTP id 16AE73F7040;\n\tSun,  6 Oct 2019 23:51:58 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-type : content-transfer-encoding; s=pfpt0818;\n\tbh=Tc4FRIjUtM4FSixWQPA+uP0C6Po3R3jxLxKSIj0nVTU=;\n\tb=N0vpzHEUm5YOu7XwpJex42iGcCdF4mkjZJa+2xU016brN8BMLakXLwbmpjNt+aS3/Bs5\n\tJdE/eAPmEIAdKRty32G+7NZM2i0ivdhA3DAzsfMukLGXHgnEW392ppIuo5hkDVweYOmI\n\tiLBY+uHl/GcdSIs0OavaYDNiY+QiMt/c2nDhceQMLaDEFPy+dUzBDWn6/L/I1S3mXsIH\n\tscAAmv5E3qdrSb1SreleBoAFclaioOqBVMPg3bY62EUN8gUANleeoqYarucCHH5WO1kx\n\tmggbVjV/XPQ+gdPE1x8w0rF19JkqghNZc3ADMu/DuhNQ4VMj0rQVBT8CflVZDZqcj1Ed\n\tLQ== ",
        "From": "<pbhagavatula@marvell.com>",
        "To": "<arybchenko@solarflare.com>, <jerinj@marvell.com>, John McNamara\n\t<john.mcnamara@intel.com>, Marko Kovacevic <marko.kovacevic@intel.com>,\n\tThomas Monjalon <thomas@monjalon.net>,\n\tFerruh Yigit <ferruh.yigit@intel.com>",
        "CC": "<dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>",
        "Date": "Mon, 7 Oct 2019 12:21:48 +0530",
        "Message-ID": "<20191007065155.1756-2-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191007065155.1756-1-pbhagavatula@marvell.com>",
        "References": "<20191002213612.14207-1-pbhagavatula@marvell.com>\n\t<20191007065155.1756-1-pbhagavatula@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Content-Transfer-Encoding": "8bit",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.95,1.0.8\n\tdefinitions=2019-10-07_01:2019-10-03,2019-10-07 signatures=0",
        "Subject": "[dpdk-dev]  [PATCH v9 1/7] ethdev: add set ptype function",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Pavan Nikhilesh <pbhagavatula@marvell.com>\n\nAdd `rte_eth_dev_set_supported_ptypes` function that will allow the\napplication to inform the PMD the packet types it is interested in.\nBased on the ptypes set PMDs can optimize their Rx path.\n\n-If application doesn’t want any ptype information it can call\n`rte_eth_dev_set_supported_ptypes(ethdev_id, RTE_PTYPE_UNKNOWN, NULL, 0)`\nand PMD may skip packet type processing and set rte_mbuf::packet_type to\nRTE_PTYPE_UNKNOWN.\n\n-If application doesn’t call `rte_eth_dev_set_supported_ptypes` PMD can\nreturn `rte_mbuf::packet_type` with `rte_eth_dev_get_supported_ptypes`.\n\n-If application is interested only in L2/L3 layer, it can inform the PMD\nto update `rte_mbuf::packet_type` with L2/L3 ptype by calling\n`rte_eth_dev_set_supported_ptypes(ethdev_id,\n\t\tRTE_PTYPE_L2_MASK | RTE_PTYPE_L3_MASK, NULL, 0)`.\n\nSuggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\nReviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n doc/guides/nics/features.rst             |  8 ++-\n doc/guides/rel_notes/release_19_11.rst   |  8 +++\n lib/librte_ethdev/rte_ethdev.c           | 73 ++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev.h           | 37 ++++++++++++\n lib/librte_ethdev/rte_ethdev_core.h      | 19 ++++++\n lib/librte_ethdev/rte_ethdev_version.map |  3 +\n 6 files changed, 146 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst\nindex c4e128d2f..1756fa73a 100644\n--- a/doc/guides/nics/features.rst\n+++ b/doc/guides/nics/features.rst\n@@ -583,9 +583,13 @@ Packet type parsing\n -------------------\n \n Supports packet type parsing and returns a list of supported types.\n+Allows application to set ptypes it is interested in.\n \n-* **[implements] eth_dev_ops**: ``dev_supported_ptypes_get``.\n-* **[related]    API**: ``rte_eth_dev_get_supported_ptypes()``.\n+* **[implements] eth_dev_ops**: ``dev_supported_ptypes_get``,\n+  ``dev_supported_ptypes_set``.\n+* **[related]    API**: ``rte_eth_dev_get_supported_ptypes()``,\n+  ``rte_eth_dev_set_supported_ptypes()``.\n+* **[provides]   mbuf**: ``mbuf.packet_type``.\n \n \n .. _nic_features_timesync:\ndiff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst\nindex 27cfbd9e3..abb7b6529 100644\n--- a/doc/guides/rel_notes/release_19_11.rst\n+++ b/doc/guides/rel_notes/release_19_11.rst\n@@ -56,6 +56,14 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =========================================================\n \n+* **Added ethdev API to set supported packet types**\n+\n+  *  Added new API ``rte_eth_dev_set_supported_ptypes`` that allows an\n+     application to inform PMD about packet types classification the application\n+     is interested in\n+  *  This scheme will allow PMDs to avoid lookup to internal ptype table on Rx\n+     and thereby improve Rx performance if application wishes do so.\n+\n \n Removed Items\n -------------\ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex 17d183e1f..d2561272c 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -2602,6 +2602,79 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,\n \treturn j;\n }\n \n+int\n+rte_eth_dev_set_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,\n+\t\t\t\t uint32_t *set_ptypes, unsigned int num)\n+{\n+\tconst uint32_t *all_ptypes;\n+\tuint32_t test_ptype_mask;\n+\tstruct rte_eth_dev *dev;\n+\tunsigned int i, j;\n+\tint ret;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\tdev = &rte_eth_devices[port_id];\n+\n+\tif (num > 0 && set_ptypes == NULL)\n+\t\treturn -EINVAL;\n+\n+\tif (*dev->dev_ops->dev_supported_ptypes_get == NULL ||\n+\t\t\t*dev->dev_ops->dev_supported_ptypes_set == NULL) {\n+\t\tret = 0;\n+\t\tgoto ptype_unknown;\n+\t}\n+\n+\tif (ptype_mask == 0) {\n+\t\tret = (*dev->dev_ops->dev_supported_ptypes_set)(dev,\n+\t\t\t\tptype_mask);\n+\t\tgoto ptype_unknown;\n+\t}\n+\n+\ttest_ptype_mask = ptype_mask;\n+\twhile (test_ptype_mask) {\n+\t\tuint8_t mask = test_ptype_mask & RTE_PTYPE_L2_MASK;\n+\n+\t\tif (mask && (mask != RTE_PTYPE_L2_MASK)) {\n+\t\t\tret = -EINVAL;\n+\t\t\tgoto ptype_unknown;\n+\t\t}\n+\t\ttest_ptype_mask >>= __builtin_popcount(RTE_PTYPE_L2_MASK);\n+\t}\n+\n+\tall_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);\n+\tif (all_ptypes == NULL) {\n+\t\tret = 0;\n+\t\tgoto ptype_unknown;\n+\t}\n+\n+\t/*\n+\t * Accodommodate as many set_ptypes as possible. If the supplied\n+\t * set_ptypes array is insufficient fill it partially.\n+\t */\n+\tfor (i = 0, j = 0; set_ptypes != NULL &&\n+\t\t\t\t(all_ptypes[i] != RTE_PTYPE_UNKNOWN); ++i) {\n+\t\tif (ptype_mask & all_ptypes[i]) {\n+\t\t\tif (j < num - 1) {\n+\t\t\t\tset_ptypes[j] = all_ptypes[i];\n+\t\t\t\tj++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (set_ptypes != NULL && j < num)\n+\t\tset_ptypes[j] = RTE_PTYPE_UNKNOWN;\n+\n+\treturn (*dev->dev_ops->dev_supported_ptypes_set)(dev, ptype_mask);\n+\n+ptype_unknown:\n+\tif (num > 0)\n+\t\tset_ptypes[0] = RTE_PTYPE_UNKNOWN;\n+\n+\treturn ret;\n+}\n+\n void\n rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr)\n {\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex d9871782e..35e171e3c 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -2431,6 +2431,43 @@ int rte_eth_dev_fw_version_get(uint16_t port_id,\n  */\n int rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,\n \t\t\t\t     uint32_t *ptypes, int num);\n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice.\n+ *\n+ * Inform Ethernet device of the packet types classification the recipient is\n+ * interested in.\n+ *\n+ * Application can use this function to set only specific ptypes that it's\n+ * interested. This information can be used by the PMD to optimize Rx path.\n+ *\n+ * The function accepts an array `set_ptypes` allocated by the caller to\n+ * store the packet types set by the driver, the last element of the array\n+ * is set to RTE_PTYPE_UNKNOWN. The size of the `set_ptype` array should be\n+ * `rte_eth_dev_get_supported_ptypes() + 1` else it might only be filled\n+ * partially.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param ptype_mask\n+ *   The ptype family that application is interested in should be bitwise OR of\n+ *   RTE_PTYPE_*_MASK or 0.\n+ * @param set_ptypes\n+ *   An array pointer to store set packet types, allocated by caller. The\n+ *   function marks the end of array with RTE_PTYPE_UNKNOWN.\n+ * @param num\n+ *   Size of the array pointed by param ptypes.\n+ *   Should be rte_eth_dev_get_supported_ptypes() + 1 to accommodate the\n+ *   set ptypes.\n+ * @return\n+ *   - (0) if Success.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if *ptype_mask* is invalid (or) set_ptypes is NULL and\n+ *     num > 0.\n+ */\n+__rte_experimental\n+int rte_eth_dev_set_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,\n+\t\t\t\t     uint32_t *set_ptypes, unsigned int num);\n \n /**\n  * Retrieve the MTU of an Ethernet device.\ndiff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h\nindex 2922d5b7c..7202a216d 100644\n--- a/lib/librte_ethdev/rte_ethdev_core.h\n+++ b/lib/librte_ethdev/rte_ethdev_core.h\n@@ -110,6 +110,23 @@ typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,\n typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);\n /**< @internal Get supported ptypes of an Ethernet device. */\n \n+/**\n+ * @internal\n+ * Inform an Ethernet device about packet types classifications the recipient\n+ * is interested in.\n+ *\n+ * @param dev\n+ *   The Ethernet device identifier.\n+ * @param ptype_mask\n+ *   The ptype family that application is interested in should be bitwise OR of\n+ *   RTE_PTYPE_*_MASK or 0.\n+ * @return\n+ *   - (0) if Success.\n+ *   - (-EINVAL) if *ptype_mask* is invalid.\n+ */\n+typedef int (*eth_dev_supported_ptypes_set_t)(struct rte_eth_dev *dev,\n+\t\t\t\t\t      uint32_t ptype_mask);\n+\n typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,\n \t\t\t\t    uint16_t queue_id);\n /**< @internal Start rx and tx of a queue of an Ethernet device. */\n@@ -421,6 +438,8 @@ struct eth_dev_ops {\n \teth_fw_version_get_t       fw_version_get; /**< Get firmware version. */\n \teth_dev_supported_ptypes_get_t dev_supported_ptypes_get;\n \t/**< Get packet types supported and identified by device. */\n+\teth_dev_supported_ptypes_set_t dev_supported_ptypes_set;\n+\t/**< Inform Ethernet device about packet types the recipient is interested in. */\n \n \tvlan_filter_set_t          vlan_filter_set; /**< Filter VLAN Setup. */\n \tvlan_tpid_set_t            vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */\ndiff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map\nindex 6df42a47b..e14745b9c 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -283,4 +283,7 @@ EXPERIMENTAL {\n \n \t# added in 19.08\n \trte_eth_read_clock;\n+\n+\t# added in 19.11\n+\trte_eth_dev_set_supported_ptypes;\n };\n",
    "prefixes": [
        "v9",
        "1/7"
    ]
}