ethdev: return named opaque type instead of void pointer

"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 <ferruh.yigit@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Ferruh Yigit 2018-03-20 16:34:04 +00:00
parent 462b66d89a
commit 03d8f47100
5 changed files with 17 additions and 21 deletions

View File

@ -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

View File

@ -3493,7 +3493,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)
{
@ -3535,7 +3535,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)
{
@ -3570,7 +3570,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)
{
@ -3615,7 +3615,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;
@ -3649,7 +3649,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;

View File

@ -3002,6 +3002,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.
*
@ -3026,7 +3028,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);
/**
@ -3054,7 +3057,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);
/**
@ -3081,11 +3085,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.
*
@ -3117,7 +3120,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.
@ -3150,7 +3153,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.

View File

@ -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];

View File

@ -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];