get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60456,
    "url": "http://patches.dpdk.org/api/patches/60456/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191002213612.14207-2-pbhagavatula@marvell.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": "<20191002213612.14207-2-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191002213612.14207-2-pbhagavatula@marvell.com",
    "date": "2019-10-02T21:36:06",
    "name": "[v8,1/7] ethdev: add set ptype function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0deaccf36b80db689dae1b44273078c26cf5d5c3",
    "submitter": {
        "id": 1183,
        "url": "http://patches.dpdk.org/api/people/1183/?format=api",
        "name": "Pavan Nikhilesh Bhagavatula",
        "email": "pbhagavatula@marvell.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191002213612.14207-2-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 6677,
            "url": "http://patches.dpdk.org/api/series/6677/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6677",
            "date": "2019-10-02T21:36:05",
            "name": "ethdev: add new Rx offload flags",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/6677/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/60456/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/60456/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 53F4A1BF81;\n\tWed,  2 Oct 2019 23:36:26 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n\t[67.231.156.173]) by dpdk.org (Postfix) with ESMTP id D77DD1BF7F\n\tfor <dev@dpdk.org>; Wed,  2 Oct 2019 23:36:24 +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\tx92LWswu012531; Wed, 2 Oct 2019 14:36:22 -0700",
            "from sc-exch04.marvell.com ([199.233.58.184])\n\tby mx0b-0016f401.pphosted.com with ESMTP id 2vd0ya0rw9-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tWed, 02 Oct 2019 14:36:21 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com\n\t(10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tWed, 2 Oct 2019 14:36:19 -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; Wed, 2 Oct 2019 14:36:19 -0700",
            "from BG-LT7430.marvell.com (unknown [10.28.17.68])\n\tby maili.marvell.com (Postfix) with ESMTP id 1814F3F703F;\n\tWed,  2 Oct 2019 14:36:16 -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=BuZ/bVURh2Z7aiG2K93Iiva72+3TV/Pqi8/hYPEGUQU=;\n\tb=FIjh4UH87GNzRLGw7rxOA1bczc3T6L8i2UG6hzkppdbZ+1nKtRjeZTfKB180J1Md6cwc\n\txgrEvfJjby5jvzv+I+OIiSvS8HQLCJQ+ASVoQmchERe20ORR3DZXQYQ0aCh5AtD61Hih\n\tdYBX/Wny944MzbwieYKkHNbVsMEJLErMTtqkuwoMNDRZsREI/ezP386FeRNs9wGsQ1vA\n\t+cK0DlSNgBZd2wPfg+Mhb0pe39Rmi0cUD78g8kDU55rETH2nP8JE8jTH4dY2dI4KPMx2\n\tO2QEd/P+cm6XZ4aBpWVjPEpldlO8yoLbjwRkNDqUvW40ZoadUoFGPXAK/389BIBZZOPF\n\tiQ== ",
        "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": "Thu, 3 Oct 2019 03:06:06 +0530",
        "Message-ID": "<20191002213612.14207-2-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191002213612.14207-1-pbhagavatula@marvell.com>",
        "References": "<20191002034716.6842-1-pbhagavatula@marvell.com>\n\t<20191002213612.14207-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-02_09:2019-10-01,2019-10-02 signatures=0",
        "Subject": "[dpdk-dev]  [PATCH v8 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>\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           | 59 ++++++++++++++++++++++++\n lib/librte_ethdev/rte_ethdev.h           | 36 +++++++++++++++\n lib/librte_ethdev/rte_ethdev_core.h      | 12 +++++\n lib/librte_ethdev/rte_ethdev_version.map |  3 ++\n 6 files changed, 124 insertions(+), 2 deletions(-)\n\n--\n2.17.1",
    "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..57bc12b56 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -2602,6 +2602,65 @@ 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+\tunsigned int i, j;\n+\tstruct rte_eth_dev *dev;\n+\tconst uint32_t *all_ptypes;\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\tif (num > 0)\n+\t\t\tset_ptypes[0] = RTE_PTYPE_UNKNOWN;\n+\t\treturn 0;\n+\t}\n+\n+\tif (ptype_mask == 0) {\n+\t\tif (num > 0)\n+\t\t\tset_ptypes[0] = RTE_PTYPE_UNKNOWN;\n+\n+\t\treturn (*dev->dev_ops->dev_supported_ptypes_set)(dev,\n+\t\t\t\tptype_mask);\n+\t}\n+\n+\tall_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);\n+\tif (all_ptypes == NULL) {\n+\t\tif (num > 0)\n+\t\t\tset_ptypes[0] = RTE_PTYPE_UNKNOWN;\n+\n+\t\treturn 0;\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)\n+\t\tset_ptypes[j] = RTE_PTYPE_UNKNOWN;\n+\n+\treturn (*dev->dev_ops->dev_supported_ptypes_set)(dev, ptype_mask);\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..c577a9172 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -2431,6 +2431,42 @@ 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 in which\n+ * the recipient is interested.\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.\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..06afd6a3d 100644\n--- a/lib/librte_ethdev/rte_ethdev_core.h\n+++ b/lib/librte_ethdev/rte_ethdev_core.h\n@@ -110,6 +110,16 @@ 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+typedef int (*eth_dev_supported_ptypes_set_t)(struct rte_eth_dev *dev,\n+\t\t\t\t\t      uint32_t ptype_mask);\n+/**< @internal Inform an Ethernet device about packet types in which the\n+ *   recipient is interested.\n+ *   Ptype_mask can have any of the following values RTE_PTYPE_UNKNOWN |\n+ *   RTE_PTYPE_L2_MASK | RTE_PTYPE_L3_MASK | RTE_PTYPE_L4_MASK |\n+ *   RTE_PTYPE_TUNNEL_MASK | RTE_PTYPE_INNER_L2_MASK | RTE_PTYPE_INNER_L3_MASK |\n+ *   RTE_PTYPE_INNER_L4_MASK | RTE_PTYPE_ALL_MASK.\n+ */\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 +431,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 in which the recipient is interested. */\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": [
        "v8",
        "1/7"
    ]
}