[RFC,04/13] net/ring: allow lockfree transmit if ring supports it
Checks
Commit Message
Need to be able have multiple threads all using same
transmit queue when using SPAN.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ring/rte_eth_ring.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
@@ -177,6 +177,19 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
return 0;
}
+static bool
+eth_tx_queue_lockfree(const struct pmd_internals *internals)
+{
+ unsigned int i;
+
+ for (i = 0; i < internals->max_tx_queues; i++) {
+ const struct ring_queue *r = &internals->tx_ring_queues[i];
+
+ if (r->rng->flags & RING_F_SP_ENQ)
+ return false;
+ }
+ return true;
+}
static int
eth_dev_info(struct rte_eth_dev *dev,
@@ -189,6 +202,10 @@ eth_dev_info(struct rte_eth_dev *dev,
dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues;
dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_SCATTER;
dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+
+ if (eth_tx_queue_lockfree(internals))
+ dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_MT_LOCKFREE;
+
dev_info->max_tx_queues = (uint16_t)internals->max_tx_queues;
dev_info->min_rx_bufsize = 0;