From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 7E9708E64 for ; Tue, 24 Nov 2015 15:56:34 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 24 Nov 2015 06:56:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,338,1444719600"; d="scan'208";a="1585191" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.208.62]) by fmsmga004.fm.intel.com with SMTP; 24 Nov 2015 06:56:31 -0800 Received: by (sSMTP sendmail emulation); Tue, 24 Nov 2015 14:56:31 +0025 Date: Tue, 24 Nov 2015 14:56:31 +0000 From: Bruce Richardson To: Stephen Hemminger Message-ID: <20151124145630.GA19796@bricha3-MOBL3> References: <1446552059-5446-1-git-send-email-bruce.richardson@intel.com> <1447762867-32124-1-git-send-email-bruce.richardson@intel.com> <1447762867-32124-3-git-send-email-bruce.richardson@intel.com> <20151117075309.7f05dc3a@samsung9> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151117075309.7f05dc3a@samsung9> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: add sanity checks to functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 14:56:34 -0000 On Tue, Nov 17, 2015 at 07:53:09AM -0800, Stephen Hemminger wrote: > On Tue, 17 Nov 2015 12:21:07 +0000 > Bruce Richardson wrote: > > > The functions rte_eth_rx_queue_count and rte_eth_descriptor_done are > > supported by very few PMDs. Therefore, it is best to check for support > > for the functions in the ethdev library, so as to avoid run-time crashes > > at run-time if the application goes to use those APIs. Similarly, the > > port parameter should also be checked for validity. > > > > Signed-off-by: Bruce Richardson > > > > --- > > lib/librte_ether/rte_ethdev.h | 15 +++++++-------- > > 1 file changed, 7 insertions(+), 8 deletions(-) > > > > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > > index a00cd46..028be59 100644 > > --- a/lib/librte_ether/rte_ethdev.h > > +++ b/lib/librte_ether/rte_ethdev.h > > @@ -2533,16 +2533,16 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, > > * @param queue_id > > * The queue id on the specific port. > > * @return > > - * The number of used descriptors in the specific queue. > > + * The number of used descriptors in the specific queue, or: > > + * (-EINVAL) if *port_id* is invalid > > + * (-ENOTSUP) if the device does not support this function > > */ > > -static inline uint32_t > > +static inline int > > rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id) > > { > > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > > -#ifdef RTE_LIBRTE_ETHDEV_DEBUG > > - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); > > - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0); > > -#endif > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); > > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP); > > return (*dev->dev_ops->rx_queue_count)(dev, queue_id); > > } > > > > @@ -2559,15 +2559,14 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id) > > * - (1) if the specific DD bit is set. > > * - (0) if the specific DD bit is not set. > > * - (-ENODEV) if *port_id* invalid. > > + * - (-ENOTSUP) if the device does not support this function > > */ > > static inline int > > rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset) > > { > > struct rte_eth_dev *dev = &rte_eth_devices[port_id]; > > -#ifdef RTE_LIBRTE_ETHDEV_DEBUG > > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP); > > -#endif > > return (*dev->dev_ops->rx_descriptor_done)( \ > > dev->data->rx_queues[queue_id], offset); > > } > > This breaks ABI since older application built with debug will try > and find the shared library entry for the routine. Ok, so assuming we care about the ABI for debug builds, is it enough to just push a patch with a deprecation notice for this for 2.2, or do I need to see about doing a new patchset with the NEXT_ABI macros included in it? My preference is obviously for the former. /Bruce