From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: [PATCH 7/7] ethdev: use opaque user callback object Date: Fri, 1 Dec 2017 02:29:57 +0000 Message-ID: <20171201022957.64329-7-ferruh.yigit@intel.com> References: <20171201022957.64329-1-ferruh.yigit@intel.com> Cc: dev@dpdk.org, vladz@cloudius-systems.com To: Ferruh Yigit , Thomas Monjalon Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D11B37CEF for ; Fri, 1 Dec 2017 03:31:14 +0100 (CET) In-Reply-To: <20171201022957.64329-1-ferruh.yigit@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" "struct rte_eth_rxtx_callback" is defined as internal data structure but used in public APIs. Checking the API documentation shows that intention was using this object as opaque object. Data structure only used in delete APIs which doesn't require to know the internals of the data structure. Converting callback parameter in API to void pointer should not require any modification in user application because this data structure was already marked as internal and only should be used as pointer in application. Signed-off-by: Ferruh Yigit --- lib/librte_ether/rte_ethdev.c | 10 ++++++---- lib/librte_ether/rte_ethdev.h | 10 ++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 5558db7c4..fca4895a5 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3206,12 +3206,13 @@ 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) +rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, void *_user_cb) { #ifndef RTE_ETHDEV_RXTX_CALLBACKS return -ENOTSUP; #endif + struct rte_eth_rxtx_callback *user_cb = _user_cb; + /* Check input parameters. */ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); if (user_cb == NULL || @@ -3240,12 +3241,13 @@ 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) +rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id, void *_user_cb) { #ifndef RTE_ETHDEV_RXTX_CALLBACKS return -ENOTSUP; #endif + struct rte_eth_rxtx_callback *user_cb = _user_cb; + /* Check input parameters. */ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); if (user_cb == NULL || diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 12b85a263..b94abef5f 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1215,8 +1215,6 @@ typedef uint16_t (*rte_rx_callback_fn)(uint16_t port_id, uint16_t queue, typedef uint16_t (*rte_tx_callback_fn)(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param); -struct rte_eth_rxtx_callback; - /** * A set of values to describe the possible states of an eth device. */ @@ -2960,8 +2958,8 @@ void *rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id, * - -EINVAL: The port_id or the queue_id is out of range, or the 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); +int +rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, void *user_cb); /** * Remove a TX packet callback from a given port and queue. @@ -2993,8 +2991,8 @@ int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, * - -EINVAL: The port_id or the queue_id is out of range, or the callback * 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); +int +rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id, void *user_cb); /** * Retrieve information about given port's RX queue. -- 2.14.3