patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v6] net/tap: fix missing _SC_IOV_MAX
@ 2019-03-18 16:55 olegpoly123
  2019-03-18 17:56 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: olegpoly123 @ 2019-03-18 16:55 UTC (permalink / raw)
  To: keith.wiles, thomas; +Cc: dev, olegpoly123, stable

If the value _SC_IOV_MAX is missing, sysconf returns -1.
In this case, iov_max is set to a default value of 1024.

Fixes: ec12df9504fe ("net/tap: fix support for large Rx queues")
Cc: stable@dpdk.org

Signed-off-by: Oleg Polyakov <olegp123@walla.co.il>
Acked-by: Keith Wiles <keith.wiles@intel.com>
---
 drivers/net/tap/rte_eth_tap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 6f5109fca..8f7c552b3 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -68,6 +68,8 @@
 /* IPC key for queue fds sync */
 #define TAP_MP_KEY "tap_mp_sync_queues"
 
+#define TAP_IOV_DEFAULT_MAX 1024
+
 static int tap_devices_count;
 static struct rte_vdev_driver pmd_tap_drv;
 static struct rte_vdev_driver pmd_tun_drv;
@@ -1326,6 +1328,13 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
 	struct rx_queue *rxq = &internals->rxq[rx_queue_id];
 	struct rte_mbuf **tmp = &rxq->pool;
 	long iov_max = sysconf(_SC_IOV_MAX);
+
+	if (iov_max <= 0) {
+		TAP_LOG(WARNING,
+			"_SC_IOV_MAX is not defined. Using %d as default\n",
+			TAP_IOV_DEFAULT_MAX);
+		iov_max = TAP_IOV_DEFAULT_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;
-- 
2.14.1


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v6] net/tap: fix missing _SC_IOV_MAX
  2019-03-18 16:55 [dpdk-stable] [PATCH v6] net/tap: fix missing _SC_IOV_MAX olegpoly123
@ 2019-03-18 17:56 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2019-03-18 17:56 UTC (permalink / raw)
  To: olegpoly123; +Cc: keith.wiles, thomas, dev, stable

On Mon, 18 Mar 2019 12:55:23 -0400
olegpoly123 <olegp123@walla.co.il> wrote:

>  	long iov_max = sysconf(_SC_IOV_MAX);
> +
> +	if (iov_max <= 0) {
> +		TAP_LOG(WARNING,
> +			"_SC_IOV_MAX is not defined. Using %d as default\n",
> +			TAP_IOV_DEFAULT_MAX);
> +		iov_max = TAP_IOV_DEFAULT_MAX;
> +	}
>  	uint16_t nb_desc = RTE_MIN(nb_rx_desc, iov_max - 1);

Looking at this a little more carefully.

1. Trivial: TAP_LOG() already adds a newline.

2. TAP device should not be silently reducing the number of receive descriptors.

3. TAP device be using IOV_MAX to set rx_descriptor limit. (in dev_info)
   The ethdev would rx_queue_setup with any request for too large a value.



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

end of thread, other threads:[~2019-03-18 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-18 16:55 [dpdk-stable] [PATCH v6] net/tap: fix missing _SC_IOV_MAX olegpoly123
2019-03-18 17:56 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger

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).