DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/tap: fix support for large Rx queues
@ 2017-04-27 13:51 Pascal Mazon
  2017-05-01 20:33 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Pascal Mazon @ 2017-04-27 13:51 UTC (permalink / raw)
  To: dev; +Cc: pascal.mazon

Rx queues configured with more than 1023 descriptors cause readv() calls to
fail due to more iovec entries than permitted by the kernel. As a result,
no packets can be received.

Quietly limit internal Rx queue size to the maximum number of iovec entries
to fix this issue.

Fixes: 0781f5762cfe ("net/tap: support segmented mbufs")

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
 drivers/net/tap/rte_eth_tap.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index d9ec14d709ed..e44de027d705 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -875,7 +875,9 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
 	struct pmd_internals *internals = dev->data->dev_private;
 	struct rx_queue *rxq = &internals->rxq[rx_queue_id];
 	struct rte_mbuf **tmp = &rxq->pool;
-	struct iovec (*iovecs)[nb_rx_desc + 1];
+	long iov_max = sysconf(_SC_IOV_MAX);
+	uint16_t nb_desc = RTE_MIN(nb_rx_desc, iov_max - 1);
+	struct iovec (*iovecs)[nb_desc + 1];
 	int data_off = RTE_PKTMBUF_HEADROOM;
 	int ret = 0;
 	int fd;
@@ -891,13 +893,13 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->mp = mp;
 	rxq->trigger_seen = 1; /* force initial burst */
 	rxq->in_port = dev->data->port_id;
-	rxq->nb_rx_desc = nb_rx_desc;
+	rxq->nb_rx_desc = nb_desc;
 	iovecs = rte_zmalloc_socket(dev->data->name, sizeof(*iovecs), 0,
 				    socket_id);
 	if (!iovecs) {
 		RTE_LOG(WARNING, PMD,
 			"%s: Couldn't allocate %d RX descriptors\n",
-			dev->data->name, nb_rx_desc);
+			dev->data->name, nb_desc);
 		return -ENOMEM;
 	}
 	rxq->iovecs = iovecs;
@@ -911,7 +913,7 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
 	(*rxq->iovecs)[0].iov_len = sizeof(struct tun_pi);
 	(*rxq->iovecs)[0].iov_base = &rxq->pi;
 
-	for (i = 1; i <= nb_rx_desc; i++) {
+	for (i = 1; i <= nb_desc; i++) {
 		*tmp = rte_pktmbuf_alloc(rxq->mp);
 		if (!*tmp) {
 			RTE_LOG(WARNING, PMD,
-- 
2.12.0.306.g4a9b9b3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/tap: fix support for large Rx queues
  2017-04-27 13:51 [dpdk-dev] [PATCH] net/tap: fix support for large Rx queues Pascal Mazon
@ 2017-05-01 20:33 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-05-01 20:33 UTC (permalink / raw)
  To: Pascal Mazon; +Cc: dev

27/04/2017 15:51, Pascal Mazon:
> Rx queues configured with more than 1023 descriptors cause readv() calls to
> fail due to more iovec entries than permitted by the kernel. As a result,
> no packets can be received.
> 
> Quietly limit internal Rx queue size to the maximum number of iovec entries
> to fix this issue.
> 
> Fixes: 0781f5762cfe ("net/tap: support segmented mbufs")
> 
> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-01 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 13:51 [dpdk-dev] [PATCH] net/tap: fix support for large Rx queues Pascal Mazon
2017-05-01 20:33 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).