From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Nov 2017 18:31:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,343,1508828400"; d="scan'208";a="182654072" Received: from silpixa00372839.ir.intel.com (HELO silpixa00372839.ger.corp.intel.com) ([10.237.222.154]) by fmsmga006.fm.intel.com with ESMTP; 30 Nov 2017 18:31:13 -0800 From: Ferruh Yigit To: Ferruh Yigit , Thomas Monjalon Cc: dev@dpdk.org, vladz@cloudius-systems.com Date: Fri, 1 Dec 2017 02:29:57 +0000 Message-Id: <20171201022957.64329-7-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171201022957.64329-1-ferruh.yigit@intel.com> References: <20171201022957.64329-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH 7/7] ethdev: use opaque user callback object 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: Fri, 01 Dec 2017 02:31:15 -0000 "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