tap: do not duplicate fd's
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v4 1/1 tap: do not duplicate fd's
The TAP device can use same file descriptopr for both rx and tx queues. This allows up to 8 queues (versus 4).
---
v4 - fix typos reported by check patch
drivers/net/tap/meson.build | 2 +- drivers/net/tap/rte_eth_tap.c | 197 +++++++++++++++------------------- drivers/net/tap/rte_eth_tap.h | 3 +- drivers/net/tap/tap_flow.c | 3 +- drivers/net/tap/tap_intr.c | 7 +- 5 files changed, 92 insertions(+), 120 deletions(-)
drivers/net/tap/meson.build +1 -1
@@ -16,7 +16,7 @@ sources = files( deps = ['bus_vdev', 'gso', 'hash'] -cflags += '-DTAP_MAX_QUEUES=16' +cflags += '-DTAP_MAX_QUEUES=8' # input array for meson symbol search: # [ "MACRO to define if found", "header for the search",
drivers/net/tap/rte_eth_tap.c +84 -113
343 lines not on this page · raw message
drivers/net/tap/rte_eth_tap.h +1 -2
@@ -96,8 +96,7 @@ struct pmd_internals { };struct pmd_process_private { -int rxq_fds[RTE_PMD_TAP_MAX_QUEUES ]; -int txq_fds[RTE_PMD_TAP_MAX_QUEUES ]; +int fds[RTE_PMD_TAP_MAX_QUEUES ]; };/* tap_intr.c */
drivers/net/tap/tap_flow.c +2 -1
@@ -1595,8 +1595,9 @@ tap_flow_isolate(struct rte_eth_dev *dev,* If netdevice is there, setup appropriate flow rules immediately. * Otherwise it will be set when bringing up the netdevice (tun_alloc). */ -if (!process_private->rxq_fds[0 ]) +if (process_private->fds[0 ] ==-1 )return 0 ; +if (set) {struct rte_flow *remote_flow;
drivers/net/tap/tap_intr.c +4 -3
@@ -68,9 +68,11 @@ tap_rx_intr_vec_install(struct rte_eth_dev *dev) }for (i =0 ; i < n; i++) {struct rx_queue *rxq = pmd->dev->data->rx_queues[i]; +int fd = process_private->fds[i];/* Skip queues that cannot request interrupts. */ -if (!rxq || process_private->rxq_fds[i] ==-1 ) { +if (!rxq || fd ==-1 ) { +/* Use invalid intr_vec[] index to disable entry. */ /* Use invalid intr_vec[] index to disable entry. */ if (rte_intr_vec_list_index_set (intr_handle, i,RTE_INTR_VEC_RXTX_OFFSET +RTE_MAX_RXTX_INTR_VEC_ID ))
@@ -80,8 +82,7 @@ tap_rx_intr_vec_install(struct rte_eth_dev *dev)if (rte_intr_vec_list_index_set (intr_handle, i,RTE_INTR_VEC_RXTX_OFFSET + count))return -rte_errno; -if (rte_intr_efds_index_set (intr_handle, count, - process_private->rxq_fds[i])) +if (rte_intr_efds_index_set (intr_handle, count, fd))return -rte_errno; count++; }
Signature · 1 line
2.43.0
Quoted 19 lines · Stephen Hemminger
The TAP device can use same file descriptopr for both rx and tx queues. This allows up to 8 queues (versus 4).
Signed-off-by Stephen Hemminger <[email protected]>---
v4 - fix typos reported by check patchdrivers/net/tap/meson.build | 2 +- drivers/net/tap/rte_eth_tap.c | 197 +++++++++++++++------------------- drivers/net/tap/rte_eth_tap.h | 3 +- drivers/net/tap/tap_flow.c | 3 +- drivers/net/tap/tap_intr.c | 7 +- 5 files changed, 92 insertions(+), 120 deletions(-)drivers/net/tap/meson.build +0
-0
drivers/net/tap/meson.build sources = files( · line 20
Quoted 6 lines
drivers/net/tap/meson.build +1
-1@@ -16,7 +16,7 @@ sources = files( deps = ['bus_vdev', 'gso', 'hash'] -cflags += '-DTAP_MAX_QUEUES=16' +cflags += '-DTAP_MAX_QUEUES=8'
OK to merge file descriptors instead of duplicating them.
But we have this 4 queue limitation only for multi process case, right? If user is planning to use only with primary, this will reduce the supported queue number.
Does it make sense to enforce this limitation for secondary only and keep TAP_MAX_QUEUES same?
So for multi process usecase supported queue number will be 8, for primary only use case it will remain 16.
<...>
Quoted 19 lines
drivers/net/tap/meson.build +3
-7@@ -1482,52 +1480,34 @@ tap_setup_queue(struct rte_eth_dev *dev, uint16_t qid, int is_rx) { - int ret; - int *fd; - int *other_fd; - const char *dir; + int fd, ret; struct pmd_internals *pmd = dev->data->dev_private; struct pmd_process_private *process_private = dev->process_private; struct rx_queue *rx = &internals->rxq[qid]; struct tx_queue *tx = &internals->txq[qid]; - struct rte_gso_ctx *gso_ctx; + struct rte_gso_ctx *gso_ctx = NULL; + const char *dir = is_rx ? "rx" : "tx"; - if (is_rx) { - fd = &process_private->rxq_fds[qid];
drivers/net/tap/meson.build tap_setup_queue(struct rte_eth_dev *dev, · line 1493
Quoted 10 lines
drivers/net/tap/meson.build +1
-7- other_fd = &process_private->txq_fds[qid]; - dir = "rx"; - gso_ctx = NULL; - } else { - fd = &process_private->txq_fds[qid]; - other_fd = &process_private->rxq_fds[qid]; - dir = "tx"; + if (is_rx) gso_ctx = &tx->gso_ctx;
Should this be 'if (!is_rx)' ?
Quoted 6 lines · On Wed, 24 Apr 2024 17:57:46 +0100 Ferruh Yigit <[email protected]> wrote:
OK to merge file descriptors instead of duplicating them.
But we have this 4 queue limitation only for multi process case, right? If user is planning to use only with primary, this will reduce the supported queue number.
Quoted 6 lines
Does it make sense to enforce this limitation for secondary only and keep
TAP_MAX_QUEUESsame?
So for multi process usecase supported queue number will be 8, for primary only use case it will remain 16.<...>
Yes, the lower limit only applies to the secondary process. But any application using secondary processes will have the problem; i.e it is not that primary gets 16 and the secondary only sees 8.
Lets keep MAX_QUEUES at 16 for now, and let users see the warning. For 24.11 up the max passed fd's to what Linux allows.
Quoted 7 lines · Stephen Hemminger
Yes, the lower limit only applies to the secondary process. But any application using secondary processes will have the problem; i.e it is not that primary gets 16 and the secondary only sees 8.
Lets keep
MAX_QUEUESat 16 for now, and let users see the warning. For 24.11 up the max passed fd's to what Linux allows.
+1
Quoted 14 lines · Stephen Hemminger
Quoted 11 lines · On Wed, 24 Apr 2024 17:57:46 +0100 Ferruh Yigit <[email protected]> wrote:
OK to merge file descriptors instead of duplicating them.
But we have this 4 queue limitation only for multi process case, right? If user is planning to use only with primary, this will reduce the supported queue number.
Does it make sense to enforce this limitation for secondary only and keep
TAP_MAX_QUEUESsame?
So for multi process usecase supported queue number will be 8, for primary only use case it will remain 16.
Quoted 9 lines
Quoted 1 line
<...>
Yes, the lower limit only applies to the secondary process. But any application using secondary processes will have the problem; i.e it is not that primary gets 16 and the secondary only sees 8.
Lets keep
MAX_QUEUESat 16 for now, and let users see the warning. For 24.11 up the max passed fd's to what Linux allows.
+1