rte_eth_add_rx_callback() and rte_eth_add_tx_callback() refuse
hairpin queues, but rte_eth_add_first_rx_callback() was missed.
A callback installed on a hairpin queue is never invoked.

Fixes: cf5516696d77 ("ethdev: add hairpin queue")
Cc: [email protected]

Signed-off-by: Stephen Hemminger <[email protected]>
---
 lib/ethdev/rte_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index f843e8808a..562a24d559 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6173,6 +6173,11 @@ rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t 
queue_id,
                return NULL;
        }
 
+       if (rte_eth_dev_is_rx_hairpin_queue(&rte_eth_devices[port_id], 
queue_id)) {
+               rte_errno = EINVAL;
+               return NULL;
+       }
+
        struct rte_eth_rxtx_callback *cb = rte_zmalloc(NULL, sizeof(*cb), 0);
 
        if (cb == NULL) {
-- 
2.53.0

Reply via email to