From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 6E8425F14 for ; Tue, 20 Mar 2018 17:34:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 09:34:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,336,1517904000"; d="scan'208";a="209850332" Received: from silpixa00399777.ir.intel.com (HELO silpixa00399777.ger.corp.intel.com) ([10.237.222.236]) by orsmga005.jf.intel.com with ESMTP; 20 Mar 2018 09:34:05 -0700 From: Ferruh Yigit To: Neil Horman , John McNamara , Marko Kovacevic , Thomas Monjalon , Reshma Pattan Cc: dev@dpdk.org, Ferruh Yigit Date: Tue, 20 Mar 2018 16:34:04 +0000 Message-Id: <20180320163404.7780-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180309112531.292163-1-ferruh.yigit@intel.com> References: <20180309112531.292163-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v5] ethdev: return named opaque type instead of void pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2018 16:34:11 -0000 "struct rte_eth_rxtx_callback" is defined as internal data structure and used as named opaque type. So the functions that are adding callbacks can return objects in this type instead of void pointer. Also const qualifier added to "struct rte_eth_rxtx_callback *" to protect it better from application modification. Signed-off-by: Ferruh Yigit --- v2: * keep using struct * in parameters, instead add callback functions return struct rte_eth_rxtx_callback pointer. v4: * Remove deprecation notice. LIBABIVER already increased in this release v5: * add const qualifier to rte_eth_rxtx_callback --- doc/guides/rel_notes/deprecation.rst | 7 ------- lib/librte_ether/rte_ethdev.c | 10 +++++----- lib/librte_ether/rte_ethdev.h | 17 ++++++++++------- lib/librte_latencystats/rte_latencystats.c | 2 +- lib/librte_pdump/rte_pdump.c | 2 +- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index ad54de721..0c696f743 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -142,13 +142,6 @@ Deprecation Notices successful. This modification will only impact the PMDs, not the applications. -* ethdev: functions add rx/tx callback will return named opaque type - ``rte_eth_add_rx_callback()``, ``rte_eth_add_first_rx_callback()`` and - ``rte_eth_add_tx_callback()`` functions currently return callback object as - ``void \*`` but APIs to delete callbacks get ``struct rte_eth_rxtx_callback \*`` - as parameter. For consistency functions adding callback will return - ``struct rte_eth_rxtx_callback \*`` instead of ``void \*``. - * i40e: The default flexible payload configuration which extracts the first 16 bytes of the payload for RSS will be deprecated starting from 18.02. If required the previous behavior can be configured using existing flow diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index dd9470099..9304d0440 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3487,7 +3487,7 @@ rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type, filter_op, arg)); } -void * +const struct rte_eth_rxtx_callback * rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param) { @@ -3529,7 +3529,7 @@ rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id, return cb; } -void * +const struct rte_eth_rxtx_callback * rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param) { @@ -3564,7 +3564,7 @@ rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id, return cb; } -void * +const struct rte_eth_rxtx_callback * rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param) { @@ -3609,7 +3609,7 @@ rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id, int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, - struct rte_eth_rxtx_callback *user_cb) + const struct rte_eth_rxtx_callback *user_cb) { #ifndef RTE_ETHDEV_RXTX_CALLBACKS return -ENOTSUP; @@ -3643,7 +3643,7 @@ rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id, - struct rte_eth_rxtx_callback *user_cb) + const struct rte_eth_rxtx_callback *user_cb) { #ifndef RTE_ETHDEV_RXTX_CALLBACKS return -ENOTSUP; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 213fe27e1..d890fa7bc 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -3004,6 +3004,8 @@ int rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type, int rte_eth_dev_get_dcb_info(uint16_t port_id, struct rte_eth_dcb_info *dcb_info); +struct rte_eth_rxtx_callback; + /** * Add a callback to be called on packet RX on a given port and queue. * @@ -3028,7 +3030,8 @@ int rte_eth_dev_get_dcb_info(uint16_t port_id, * NULL on error. * On success, a pointer value which can later be used to remove the callback. */ -void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id, +const struct rte_eth_rxtx_callback * +rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param); /** @@ -3056,7 +3059,8 @@ void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id, * NULL on error. * On success, a pointer value which can later be used to remove the callback. */ -void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id, +const struct rte_eth_rxtx_callback * +rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param); /** @@ -3083,11 +3087,10 @@ void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id, * NULL on error. * On success, a pointer value which can later be used to remove the callback. */ -void *rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id, +const struct rte_eth_rxtx_callback * +rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param); -struct rte_eth_rxtx_callback; - /** * Remove an RX packet callback from a given port and queue. * @@ -3119,7 +3122,7 @@ struct rte_eth_rxtx_callback; * is NULL or not found for the port/queue. */ int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, - struct rte_eth_rxtx_callback *user_cb); + const struct rte_eth_rxtx_callback *user_cb); /** * Remove a TX packet callback from a given port and queue. @@ -3152,7 +3155,7 @@ int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, * is NULL or not found for the port/queue. */ int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id, - struct rte_eth_rxtx_callback *user_cb); + const struct rte_eth_rxtx_callback *user_cb); /** * Retrieve information about given port's RX queue. diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c index 66330203c..fc9497659 100644 --- a/lib/librte_latencystats/rte_latencystats.c +++ b/lib/librte_latencystats/rte_latencystats.c @@ -46,7 +46,7 @@ struct rte_latency_stats { static struct rte_latency_stats *glob_stats; struct rxtx_cbs { - struct rte_eth_rxtx_callback *cb; + const struct rte_eth_rxtx_callback *cb; }; static struct rxtx_cbs rx_cbs[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT]; diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index ec8a5d84c..4fb0b4204 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -75,7 +75,7 @@ struct pdump_response { static struct pdump_rxtx_cbs { struct rte_ring *ring; struct rte_mempool *mp; - struct rte_eth_rxtx_callback *cb; + const struct rte_eth_rxtx_callback *cb; void *filter; } rx_cbs[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT], tx_cbs[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT]; -- 2.13.6