Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/8568/?format=api
https://patches.dpdk.org/api/patches/8568/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1446552059-5446-5-git-send-email-bruce.richardson@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": "<1446552059-5446-5-git-send-email-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1446552059-5446-5-git-send-email-bruce.richardson@intel.com", "date": "2015-11-03T12:00:59", "name": "[dpdk-dev,v3,4/4] ethdev: check driver support for functions", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "b0317de158821d5e722742d41944bfc656ac0af9", "submitter": { "id": 20, "url": "https://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1446552059-5446-5-git-send-email-bruce.richardson@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/8568/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/8568/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 7C44A8E9D;\n\tTue, 3 Nov 2015 13:01:05 +0100 (CET)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 3DC8A8E91\n\tfor <dev@dpdk.org>; Tue, 3 Nov 2015 13:01:03 +0100 (CET)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga103.jf.intel.com with ESMTP; 03 Nov 2015 04:01:01 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga001.jf.intel.com with ESMTP; 03 Nov 2015 04:01:00 -0800", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\ttA3C0xxi020576; Tue, 3 Nov 2015 12:01:00 GMT", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id tA3C0xDL005508;\n\tTue, 3 Nov 2015 12:00:59 GMT", "(from bricha3@localhost)\n\tby sivswdev01.ir.intel.com with id tA3C0xvJ005504;\n\tTue, 3 Nov 2015 12:00:59 GMT" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,238,1444719600\"; d=\"scan'208\";a=\"810573244\"", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Date": "Tue, 3 Nov 2015 12:00:59 +0000", "Message-Id": "<1446552059-5446-5-git-send-email-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1446552059-5446-1-git-send-email-bruce.richardson@intel.com>", "References": "<1441811374-28984-1-git-send-email-bruce.richardson@intel.com>\n\t<1446552059-5446-1-git-send-email-bruce.richardson@intel.com>", "Subject": "[dpdk-dev] [PATCH v3 4/4] ethdev: check driver support for functions", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <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": "The functions rte_eth_rx_queue_count and rte_eth_descriptor_done are\nsupported by very few PMDs. Therefore, it is best to check for support\nfor the functions in the ethdev library, so as to avoid run-time crashes\nat run-time if the application goes to use those APIs. The performance\nimpact of this change should be very small as this is a predictable\nbranch in the function.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_ether/rte_ethdev.h | 13 ++++++++-----\n 1 file changed, 8 insertions(+), 5 deletions(-)", "diff": "diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 2b702c6..78267b0 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -2525,16 +2525,18 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,\n * @param queue_id\n * The queue id on the specific port.\n * @return\n- * The number of used descriptors in the specific queue.\n+ * The number of used descriptors in the specific queue, or:\n+ * (-EINVAL) if *port_id* is invalid\n+ * (-ENOTSUP) if the device does not support this function\n */\n-static inline uint32_t\n+static inline int\n rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)\n {\n \tstruct rte_eth_dev *dev = &rte_eth_devices[port_id];\n #ifdef RTE_LIBRTE_ETHDEV_DEBUG\n-\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);\n-\tRTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);\n #endif\n+\tRTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);\n return (*dev->dev_ops->rx_queue_count)(dev, queue_id);\n }\n \n@@ -2551,6 +2553,7 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)\n * - (1) if the specific DD bit is set.\n * - (0) if the specific DD bit is not set.\n * - (-ENODEV) if *port_id* invalid.\n+ * - (-ENOTSUP) if the device does not support this function\n */\n static inline int\n rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)\n@@ -2558,8 +2561,8 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)\n \tstruct rte_eth_dev *dev = &rte_eth_devices[port_id];\n #ifdef RTE_LIBRTE_ETHDEV_DEBUG\n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n-\tRTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);\n #endif\n+\tRTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);\n \treturn (*dev->dev_ops->rx_descriptor_done)( \\\n \t\tdev->data->rx_queues[queue_id], offset);\n }\n", "prefixes": [ "dpdk-dev", "v3", "4/4" ] }{ "id": 8568, "url": "