From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 3CE861B1BF for ; Wed, 24 Jan 2018 16:41:40 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D2A1D226D3; Wed, 24 Jan 2018 10:41:39 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:41:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=KhPI5tDQFS/hNVnr0 zs8Arpqh0NgUq1mWUGYKPwQG1g=; b=nhR7l3W1NcyPF/J+sLypz6VU0J4CkuIsA 6iVrvU/F1RKTKNQutEvwqU3XWIURh4LGFpsgQWq05wKkJ3/dS4zrmb8X4N8p0U5w HoZGdD53Y2aZ9NmncPXo8ndMrsAG7VGrrQXPxtZKZqqR/roRk1jkxrRtFipqJTu6 HmezdX0jWH1Uy5w9JQk8dkYa/Aj9F6NKc19BGXOps+DCqSO3RXkt07np2z4ON5K3 a04BkS3USm9GLH1UNRCkjD5TmJYrDLSfhQjfBl/Zy8R49c3g7JKFE8uu+1RMnq8p Zz9uik7eal1ESy/nPt3EOr+nfea6QG4KuMWygLPSAJwjtW/S6JIVQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=KhPI5tDQFS/hNVnr0zs8Arpqh0NgUq1mWUGYKPwQG1g=; b=atSCxfIU kzg/eDWRvAXwDjkFQGTfb8rQImcQd9zG+1VuwOotIR/J+wZbLrjr8YD0VhlST2Qc cA2fnNBX930BbEcyjNj2JfUuk4zq572TKwUeOSvcNyDz4KEPfqIVs5vZHLMern4Y E8Sqh81TIuwTy5Ue/k2VqaNLO8gKdawo5B7maS+szQsBE/1Djhynj+dYAG0fFD/1 8eyMdCGg2tjoAipyMDlIe3aul5H2mAT9x5kmkka/7HCzMl/qaZN04klT6ID4/RTr gXCQjvUTrndbikdH1tHYk3GCZ7WGffkcUoQhp9vPkC8r2bxZ6o8wVWbG3JbbXMMW cpxSVJZVWA4EQw== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 6DC607E1A2; Wed, 24 Jan 2018 10:41:38 -0500 (EST) From: Yuanhan Liu To: Gage Eads Cc: dpdk stable Date: Wed, 24 Jan 2018 23:33:17 +0800 Message-Id: <1516808026-25523-129-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'eventdev: set error code in port link/unlink functions' has been queued to LTS release 17.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 15:41:40 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/26/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 146c3669870b1400c369376872d2e1fe5e60b14e Mon Sep 17 00:00:00 2001 From: Gage Eads Date: Tue, 14 Nov 2017 16:44:10 -0600 Subject: [PATCH] eventdev: set error code in port link/unlink functions [ upstream commit c75f7897ea35aeb5fe8e2937733a071ea9304b99 ] The return value for rte_event_port_{link, unlink}() is defined as the "number of {links, unlinks} actually established." However, the eventdev layer's error checking returns negative error values. This commit aligns the eventdev code with the API definition by having it set rte_errno and return 0 if it detects an error. Fixes: 4f0804bbdfb9 ("eventdev: implement the northbound APIs") Signed-off-by: Gage Eads --- lib/librte_eventdev/rte_eventdev.c | 36 ++++++++++++++++++++++++---------- lib/librte_eventdev/rte_eventdev_pmd.h | 8 ++++++++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index ce6a5dc..e0c2a78 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -832,13 +832,19 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id, uint16_t *links_map; int i, diag; - RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0); dev = &rte_eventdevs[dev_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_link, -ENOTSUP); + + if (*dev->dev_ops->port_link == NULL) { + RTE_PMD_DEBUG_TRACE("Function not supported\n"); + rte_errno = -ENOTSUP; + return 0; + } if (!is_valid_port(dev, port_id)) { RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id); - return -EINVAL; + rte_errno = -EINVAL; + return 0; } if (queues == NULL) { @@ -857,8 +863,10 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id, } for (i = 0; i < nb_links; i++) - if (queues[i] >= dev->data->nb_queues) - return -EINVAL; + if (queues[i] >= dev->data->nb_queues) { + rte_errno = -EINVAL; + return 0; + } diag = (*dev->dev_ops->port_link)(dev, dev->data->ports[port_id], queues, priorities, nb_links); @@ -883,13 +891,19 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, int i, diag; uint16_t *links_map; - RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, -EINVAL, 0); dev = &rte_eventdevs[dev_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_unlink, -ENOTSUP); + + if (*dev->dev_ops->port_unlink == NULL) { + RTE_PMD_DEBUG_TRACE("Function not supported\n"); + rte_errno = -ENOTSUP; + return 0; + } if (!is_valid_port(dev, port_id)) { RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id); - return -EINVAL; + rte_errno = -EINVAL; + return 0; } if (queues == NULL) { @@ -900,8 +914,10 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, } for (i = 0; i < nb_unlinks; i++) - if (queues[i] >= dev->data->nb_queues) - return -EINVAL; + if (queues[i] >= dev->data->nb_queues) { + rte_errno = -EINVAL; + return 0; + } diag = (*dev->dev_ops->port_unlink)(dev, dev->data->ports[port_id], queues, nb_unlinks); diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index b78423d..64535f2 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -77,6 +77,14 @@ extern "C" { } \ } while (0) +#define RTE_EVENTDEV_VALID_DEVID_OR_ERRNO_RET(dev_id, errno, retval) do { \ + if (!rte_event_pmd_is_valid_dev((dev_id))) { \ + RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \ + rte_errno = errno; \ + return retval; \ + } \ +} while (0) + #define RTE_EVENTDEV_VALID_DEVID_OR_RET(dev_id) do { \ if (!rte_event_pmd_is_valid_dev((dev_id))) { \ RTE_EDEV_LOG_ERR("Invalid dev_id=%d\n", dev_id); \ -- 2.7.4