ethdev: call Rx and Tx callbacks in the order they were added
Change the order that user supplied RX and TX callbacks are called to the order that they were added (fifo). The previous calling order was the reverse of this (lifo) and was counter intuitive for users. Suggested-by: Robert Sanford <rsanford@akamai.com> Signed-off-by: John McNamara <john.mcnamara@intel.com>
This commit is contained in:
parent
980995f8cc
commit
073208ebab
@ -3179,8 +3179,20 @@ rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
|
||||
|
||||
cb->fn.rx = fn;
|
||||
cb->param = user_param;
|
||||
cb->next = rte_eth_devices[port_id].post_rx_burst_cbs[queue_id];
|
||||
rte_eth_devices[port_id].post_rx_burst_cbs[queue_id] = cb;
|
||||
|
||||
/* Add the callbacks in fifo order. */
|
||||
struct rte_eth_rxtx_callback *tail =
|
||||
rte_eth_devices[port_id].post_rx_burst_cbs[queue_id];
|
||||
|
||||
if (!tail) {
|
||||
rte_eth_devices[port_id].post_rx_burst_cbs[queue_id] = cb;
|
||||
|
||||
} else {
|
||||
while (tail->next)
|
||||
tail = tail->next;
|
||||
tail->next = cb;
|
||||
}
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
@ -3208,8 +3220,20 @@ rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
|
||||
|
||||
cb->fn.tx = fn;
|
||||
cb->param = user_param;
|
||||
cb->next = rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id];
|
||||
rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id] = cb;
|
||||
|
||||
/* Add the callbacks in fifo order. */
|
||||
struct rte_eth_rxtx_callback *tail =
|
||||
rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id];
|
||||
|
||||
if (!tail) {
|
||||
rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id] = cb;
|
||||
|
||||
} else {
|
||||
while (tail->next)
|
||||
tail = tail->next;
|
||||
tail->next = cb;
|
||||
}
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
|
@ -3542,6 +3542,8 @@ int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
|
||||
* that can be used to later remove the callback using
|
||||
* rte_eth_remove_rx_callback().
|
||||
*
|
||||
* Multiple functions are called in the order that they are added.
|
||||
*
|
||||
* @param port_id
|
||||
* The port identifier of the Ethernet device.
|
||||
* @param queue_id
|
||||
@ -3567,6 +3569,8 @@ void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
|
||||
* that can be used to later remove the callback using
|
||||
* rte_eth_remove_tx_callback().
|
||||
*
|
||||
* Multiple functions are called in the order that they are added.
|
||||
*
|
||||
* @param port_id
|
||||
* The port identifier of the Ethernet device.
|
||||
* @param queue_id
|
||||
|
Loading…
Reference in New Issue
Block a user