get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 62834,
    "url": "http://patches.dpdk.org/api/patches/62834/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191111131914.16559-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": "<20191111131914.16559-2-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191111131914.16559-2-pbhagavatula@marvell.com",
    "date": "2019-11-11T13:19:05",
    "name": "[v17,01/10] ethdev: add set ptype function",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "32a3d05285bf4d8da9c6edd3bf297baec1d5c030",
    "submitter": {
        "id": 1183,
        "url": "http://patches.dpdk.org/api/people/1183/?format=api",
        "name": "Pavan Nikhilesh Bhagavatula",
        "email": "pbhagavatula@marvell.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/20191111131914.16559-2-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 7386,
            "url": "http://patches.dpdk.org/api/series/7386/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7386",
            "date": "2019-11-11T13:19:04",
            "name": "ethdev: add new Rx offload flags",
            "version": 17,
            "mbox": "http://patches.dpdk.org/series/7386/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/62834/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/62834/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 366C2A04B9;\n\tMon, 11 Nov 2019 14:19:31 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 7365F29AC;\n\tMon, 11 Nov 2019 14:19:25 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id CD68A2986\n for <dev@dpdk.org>; Mon, 11 Nov 2019 14:19:24 +0100 (CET)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n xABDFdmD001176; Mon, 11 Nov 2019 05:19:24 -0800",
            "from sc-exch02.marvell.com ([199.233.58.182])\n by mx0a-0016f401.pphosted.com with ESMTP id 2w5upuxv71-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 11 Nov 2019 05:19:23 -0800",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com\n (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 11 Nov\n 2019 05:19:22 -0800",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com\n (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n Transport; Mon, 11 Nov 2019 05:19:22 -0800",
            "from BG-LT7430.marvell.com (unknown [10.28.17.38])\n by maili.marvell.com (Postfix) with ESMTP id D5C0F3F7041;\n Mon, 11 Nov 2019 05:19:19 -0800 (PST)"
        ],
        "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 : content-transfer-encoding; s=pfpt0818;\n bh=Fkde7VaWLFy9NLYIpGNWHK4hwn8D1XYnxuJW50QuM4U=;\n b=lASOm+YPJ83y9SO1j8+aoa/hUUB3MmAxRyHSJJNtdZw+7TPUOJ/ZnzD1SovqCbg1DJII\n zPCEzmnkDEXpDaOU67a4+6cDMyBdhJDUFS7PHkOMCAraEvplj6FdvhcmyAEIjUZ10YAb\n RKbsekuF3/259PLUPUK3uLcgaxGcv/VjiH+9qXPRjPtarDoA4bggXfX3aRBmxK0iyXny\n wH2XuSiMNmqUdXk9Olej8N0K6aVJBDJ4OIX5qHnrj5pUghxCnaR8LThThKAhn2oH8Nr4\n pWKKg8H+gpR7xT85qY/1FnwnW/Vu9S/tYxV+EFS5xYyBq2ggXOjmCQINK/fLYfplDh7L 4w==",
        "From": "<pbhagavatula@marvell.com>",
        "To": "<ferruh.yigit@intel.com>, <arybchenko@solarflare.com>,\n <jerinj@marvell.com>, <thomas@monjalon.net>, John McNamara\n <john.mcnamara@intel.com>, Marko Kovacevic <marko.kovacevic@intel.com>",
        "CC": "<dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>",
        "Date": "Mon, 11 Nov 2019 18:49:05 +0530",
        "Message-ID": "<20191111131914.16559-2-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191111131914.16559-1-pbhagavatula@marvell.com>",
        "References": "<20191106191803.15098-1-pbhagavatula@marvell.com>\n <20191111131914.16559-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,18.0.572\n definitions=2019-11-11_03:2019-11-11,2019-11-11 signatures=0",
        "Subject": "[dpdk-dev]  [PATCH v17 01/10] 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 <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: Pavan Nikhilesh <pbhagavatula@marvell.com>\n\nAdd `rte_eth_dev_set_ptypes` function that will allow the application\nto inform the PMD about reduced range of packet types to handle.\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_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_ptypes` PMD can return\n`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_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             |  7 +-\n doc/guides/rel_notes/release_19_11.rst   |  8 +++\n lib/librte_ethdev/rte_ethdev.c           | 87 +++++++++++++++++++++++-\n lib/librte_ethdev/rte_ethdev.h           | 36 ++++++++++\n lib/librte_ethdev/rte_ethdev_core.h      | 17 +++++\n lib/librte_ethdev/rte_ethdev_version.map |  1 +\n 6 files changed, 153 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst\nindex 7a31cf7c8..f33e8e6d4 100644\n--- a/doc/guides/nics/features.rst\n+++ b/doc/guides/nics/features.rst\n@@ -583,9 +583,12 @@ 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+* **[related]    API**: ``rte_eth_dev_get_supported_ptypes()``,\n+  ``rte_eth_dev_set_ptypes()``, ``dev_ptypes_set``.\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 669e69966..f10acc288 100644\n--- a/doc/guides/rel_notes/release_19_11.rst\n+++ b/doc/guides/rel_notes/release_19_11.rst\n@@ -94,6 +94,13 @@ New Features\n   * Rx metadata is delivered to host via a dynamic field of ``rte_mbuf`` with\n     PKT_RX_DYNF_METADATA.\n \n+* **Added ethdev API to set supported packet types**\n+\n+  * Added new API ``rte_eth_dev_set_ptypes`` that allows an application to\n+    inform PMD about about reduced range of packet types to handle.\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 * **Updated the enic driver.**\n \n   * Added support for Geneve with options offload.\n@@ -280,6 +287,7 @@ New Features\n   See :doc:`../prog_guide/lto` for more information:\n \n \n+\n Removed Items\n -------------\n \ndiff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c\nindex 652c369e5..d5c4865ba 100644\n--- a/lib/librte_ethdev/rte_ethdev.c\n+++ b/lib/librte_ethdev/rte_ethdev.c\n@@ -2879,6 +2879,92 @@ 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_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 valid_ptype_masks[] = {\n+\t\tRTE_PTYPE_L2_MASK,\n+\t\tRTE_PTYPE_L3_MASK,\n+\t\tRTE_PTYPE_L4_MASK,\n+\t\tRTE_PTYPE_TUNNEL_MASK,\n+\t\tRTE_PTYPE_INNER_L2_MASK,\n+\t\tRTE_PTYPE_INNER_L3_MASK,\n+\t\tRTE_PTYPE_INNER_L4_MASK,\n+\t};\n+\tconst uint32_t *all_ptypes;\n+\tstruct rte_eth_dev *dev;\n+\tuint32_t unused_mask;\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_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_ptypes_set)(dev,\n+\t\t\t\tptype_mask);\n+\t\tgoto ptype_unknown;\n+\t}\n+\n+\tunused_mask = ptype_mask;\n+\tfor (i = 0; i < RTE_DIM(valid_ptype_masks); i++) {\n+\t\tuint32_t mask = ptype_mask & valid_ptype_masks[i];\n+\t\tif (mask && mask != valid_ptype_masks[i]) {\n+\t\t\tret = -EINVAL;\n+\t\t\tgoto ptype_unknown;\n+\t\t}\n+\t\tunused_mask &= ~valid_ptype_masks[i];\n+\t}\n+\n+\tif (unused_mask) {\n+\t\tret = -EINVAL;\n+\t\tgoto ptype_unknown;\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 * Accommodate 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_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 int\n rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr)\n {\n@@ -2891,7 +2977,6 @@ rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr)\n \treturn 0;\n }\n \n-\n int\n rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu)\n {\ndiff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h\nindex 44d77b332..a7872819d 100644\n--- a/lib/librte_ethdev/rte_ethdev.h\n+++ b/lib/librte_ethdev/rte_ethdev.h\n@@ -2604,6 +2604,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 about reduced range of packet types to handle.\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_ptypes(uint16_t port_id, uint32_t ptype_mask,\n+\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 f215af7c9..9588fe7d8 100644\n--- a/lib/librte_ethdev/rte_ethdev_core.h\n+++ b/lib/librte_ethdev/rte_ethdev_core.h\n@@ -234,6 +234,21 @@ typedef int (*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 Ethernet device about reduced range of packet types to handle.\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+ */\n+typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev,\n+\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@@ -630,6 +645,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_ptypes_set_t dev_ptypes_set;\n+\t/**< Inform Ethernet device about reduced range of packet types to handle. */\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 ee289ef13..ccfbeae23 100644\n--- a/lib/librte_ethdev/rte_ethdev_version.map\n+++ b/lib/librte_ethdev/rte_ethdev_version.map\n@@ -292,4 +292,5 @@ EXPERIMENTAL {\n \trte_flow_dynf_metadata_offs;\n \trte_flow_dynf_metadata_mask;\n \trte_flow_dynf_metadata_register;\n+\trte_eth_dev_set_ptypes;\n };\n",
    "prefixes": [
        "v17",
        "01/10"
    ]
}