get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 28746,
    "url": "https://patches.dpdk.org/api/patches/28746/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1505405343-18234-2-git-send-email-harry.van.haaren@intel.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": "<1505405343-18234-2-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1505405343-18234-2-git-send-email-harry.van.haaren@intel.com",
    "date": "2017-09-14T16:09:00",
    "name": "[dpdk-dev,v4,1/4] eventdev: add port attribute function",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "af0d69f0be4d93f89cf27d020408a96193565afc",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.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/1505405343-18234-2-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/28746/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/28746/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 BB398199B5;\n\tThu, 14 Sep 2017 18:08:53 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 64C22374E\n\tfor <dev@dpdk.org>; Thu, 14 Sep 2017 18:08:49 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga105.jf.intel.com with ESMTP; 14 Sep 2017 09:08:48 -0700",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga004.fm.intel.com with ESMTP; 14 Sep 2017 09:08:47 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.42,393,1500966000\"; d=\"scan'208\";a=\"311710623\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jerin.jacob@caviumnetworks.com,\n\tHarry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Thu, 14 Sep 2017 17:09:00 +0100",
        "Message-Id": "<1505405343-18234-2-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1505405343-18234-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1504885015-44642-1-git-send-email-harry.van.haaren@intel.com>\n\t<1505405343-18234-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 1/4] eventdev: add port attribute 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": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This commit reworks the port functions to retrieve information\nabout the port, like the enq or deq depths. Note that \"port count\"\nis a device attribute, and is added in a later patch for dev attributes.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n\n---\n\nv4: feedback from http://dpdk.org/dev/patchwork/patch/28520/\n- Added default: case into switch, returns -EINVAL as per header file (Jerin)\n- Reworked .map file, removed old functions (Jerin)\n- Renamed EXPERIMENTAL section of map file to 17.11 (Jerin)\n- Removed /* out */ comments in .h and .c (Jerin)\n---\n lib/librte_eventdev/rte_eventdev.c           | 35 ++++++++++++--------\n lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++++++----------------\n lib/librte_eventdev/rte_eventdev_version.map |  9 +++--\n test/test/test_eventdev.c                    | 16 ++++++---\n 4 files changed, 61 insertions(+), 48 deletions(-)",
    "diff": "diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c\nindex bbb3805..9eacc73 100644\n--- a/lib/librte_eventdev/rte_eventdev.c\n+++ b/lib/librte_eventdev/rte_eventdev.c\n@@ -744,30 +744,37 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,\n }\n \n uint8_t\n-rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)\n+rte_event_port_count(uint8_t dev_id)\n {\n \tstruct rte_eventdev *dev;\n \n \tdev = &rte_eventdevs[dev_id];\n-\treturn dev->data->ports_dequeue_depth[port_id];\n+\treturn dev->data->nb_ports;\n }\n \n-uint8_t\n-rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)\n+int\n+rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,\n+\t\t\tuint32_t *attr_value)\n {\n \tstruct rte_eventdev *dev;\n-\n+\tRTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);\n \tdev = &rte_eventdevs[dev_id];\n-\treturn dev->data->ports_enqueue_depth[port_id];\n-}\n-\n-uint8_t\n-rte_event_port_count(uint8_t dev_id)\n-{\n-\tstruct rte_eventdev *dev;\n+\tif (!is_valid_port(dev, port_id)) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid port_id=%\" PRIu8, port_id);\n+\t\treturn -EINVAL;\n+\t}\n \n-\tdev = &rte_eventdevs[dev_id];\n-\treturn dev->data->nb_ports;\n+\tswitch (attr_id) {\n+\tcase RTE_EVENT_PORT_ATTR_ENQ_DEPTH:\n+\t\t*attr_value = dev->data->ports_enqueue_depth[port_id];\n+\t\tbreak;\n+\tcase RTE_EVENT_PORT_ATTR_DEQ_DEPTH:\n+\t\t*attr_value = dev->data->ports_dequeue_depth[port_id];\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t};\n+\treturn 0;\n }\n \n int\ndiff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h\nindex 128bc52..e1febfa 100644\n--- a/lib/librte_eventdev/rte_eventdev.h\n+++ b/lib/librte_eventdev/rte_eventdev.h\n@@ -715,47 +715,40 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,\n \t\t     const struct rte_event_port_conf *port_conf);\n \n /**\n- * Get the number of dequeue queue depth configured for event port designated\n- * by its *port_id* on a specific event device\n+ * Get the number of ports on a specific event device\n  *\n  * @param dev_id\n  *   Event device identifier.\n- * @param port_id\n- *   Event port identifier.\n  * @return\n- *   - The number of configured dequeue queue depth\n- *\n- * @see rte_event_dequeue_burst()\n+ *   - The number of configured ports\n  */\n uint8_t\n-rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id);\n+rte_event_port_count(uint8_t dev_id);\n \n /**\n- * Get the number of enqueue queue depth configured for event port designated\n- * by its *port_id* on a specific event device\n- *\n- * @param dev_id\n- *   Event device identifier.\n- * @param port_id\n- *   Event port identifier.\n- * @return\n- *   - The number of configured enqueue queue depth\n- *\n- * @see rte_event_enqueue_burst()\n+ * The queue depth of the port on the enqueue side\n  */\n-uint8_t\n-rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id);\n+#define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0\n+/**\n+ * The queue depth of the port on the dequeue side\n+ */\n+#define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1\n \n /**\n- * Get the number of ports on a specific event device\n+ * Get an attribute from a port.\n  *\n- * @param dev_id\n- *   Event device identifier.\n- * @return\n- *   - The number of configured ports\n+ * @param dev_id Eventdev id\n+ * @param port_id Eventdev port id\n+ * @param attr_id The attribute ID to retrieve\n+ * @param[out] attr_value A pointer that will be filled in with the attribute\n+ *             value if successful\n+ *\n+ * @retval 0 Successfully returned value\n+ *         -EINVAL Invalid device, port or attr_id, or attr_value was NULL\n  */\n-uint8_t\n-rte_event_port_count(uint8_t dev_id);\n+int\n+rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,\n+\t\t\tuint32_t *attr_value);\n \n /**\n  * Start an event device.\ndiff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map\nindex 4c48e5f..57d0b72 100644\n--- a/lib/librte_eventdev/rte_eventdev_version.map\n+++ b/lib/librte_eventdev/rte_eventdev_version.map\n@@ -19,8 +19,6 @@ DPDK_17.05 {\n \n \trte_event_port_default_conf_get;\n \trte_event_port_setup;\n-\trte_event_port_dequeue_depth;\n-\trte_event_port_enqueue_depth;\n \trte_event_port_count;\n \trte_event_port_link;\n \trte_event_port_unlink;\n@@ -51,3 +49,10 @@ DPDK_17.08 {\n \trte_event_ring_init;\n \trte_event_ring_lookup;\n } DPDK_17.05;\n+\n+DPDK_17.11 {\n+\tglobal:\n+\n+\trte_event_port_attr_get;\n+\n+} DPDK_17.08;\ndiff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c\nindex f766191..f3ec470 100644\n--- a/test/test/test_eventdev.c\n+++ b/test/test/test_eventdev.c\n@@ -460,8 +460,12 @@ test_eventdev_dequeue_depth(void)\n \tret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);\n \tTEST_ASSERT_SUCCESS(ret, \"Failed to setup port0\");\n \n-\tTEST_ASSERT_EQUAL(rte_event_port_dequeue_depth(TEST_DEV_ID, 0),\n-\t\t pconf.dequeue_depth, \"Wrong port dequeue depth\");\n+\tuint32_t value;\n+\tTEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,\n+\t\t\tRTE_EVENT_PORT_ATTR_DEQ_DEPTH, &value),\n+\t\t\t0, \"Call to port dequeue depth failed\");\n+\tTEST_ASSERT_EQUAL(value, pconf.dequeue_depth,\n+\t\t\t\"Wrong port dequeue depth\");\n \n \treturn TEST_SUCCESS;\n }\n@@ -481,8 +485,12 @@ test_eventdev_enqueue_depth(void)\n \tret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);\n \tTEST_ASSERT_SUCCESS(ret, \"Failed to setup port0\");\n \n-\tTEST_ASSERT_EQUAL(rte_event_port_enqueue_depth(TEST_DEV_ID, 0),\n-\t\t pconf.enqueue_depth, \"Wrong port enqueue depth\");\n+\tuint32_t value;\n+\tTEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,\n+\t\t\tRTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value),\n+\t\t\t0, \"Call to port enqueue depth failed\");\n+\tTEST_ASSERT_EQUAL(value, pconf.dequeue_depth,\n+\t\t\t\"Wrong port enqueue depth\");\n \n \treturn TEST_SUCCESS;\n }\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "1/4"
    ]
}