DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX
@ 2019-03-08 18:00 olegpoly123
  2019-03-08 18:06 ` Wiles, Keith
  2019-03-09  3:02 ` Stephen Hemminger
  0 siblings, 2 replies; 6+ messages in thread
From: olegpoly123 @ 2019-03-08 18:00 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.

Cc: stable@dpdk.org

Signed-off-by: olegpoly123 <olegp123@walla.co.il>
---
 drivers/net/tap/rte_eth_tap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 6f5109fca..2a7e6aa00 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,12 @@ 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] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX
  2019-03-08 18:00 [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX olegpoly123
@ 2019-03-08 18:06 ` Wiles, Keith
  2019-03-08 18:54   ` Thomas Monjalon
  2019-03-09  3:02 ` Stephen Hemminger
  1 sibling, 1 reply; 6+ messages in thread
From: Wiles, Keith @ 2019-03-08 18:06 UTC (permalink / raw)
  To: olegpoly123; +Cc: Thomas Monjalon, dpdk-dev, stable



> On Mar 8, 2019, at 12:00 PM, olegpoly123 <olegp123@walla.co.il> wrote:
> 
> If the value _SC_IOV_MAX is missing, sysconf returns -1.
> In this case, iov_max is set to a default value of 1024.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: olegpoly123 <olegp123@walla.co.il>
> ---
> drivers/net/tap/rte_eth_tap.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 6f5109fca..2a7e6aa00 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,12 @@ 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
> 

Sorry the email subject does not list [PATCH v3], but maybe someone can fix it when it is applied or should another patch be submitted with [PATCH v3]?

In any case I approve the patch.

Acked-by: Keith Wiles <keith.wiles@intel.com>

Regards,
Keith

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

* Re: [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX
  2019-03-08 18:06 ` Wiles, Keith
@ 2019-03-08 18:54   ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2019-03-08 18:54 UTC (permalink / raw)
  To: olegpoly123; +Cc: Wiles, Keith, dpdk-dev, stable

Thanks for contributing.
Please find two comments below.

> > On Mar 8, 2019, at 12:00 PM, olegpoly123 <olegp123@walla.co.il> wrote:
> > 
> > If the value _SC_IOV_MAX is missing, sysconf returns -1.
> > In this case, iov_max is set to a default value of 1024.
> > 
> > Cc: stable@dpdk.org

Is there any specific commit we can reference for backport?
Maybe this one?
Fixes: ec12df9504fe ("net/tap: fix support for large Rx queues")

> > Signed-off-by: olegpoly123 <olegp123@walla.co.il>

Please provide your real name.

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

* Re: [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX
  2019-03-08 18:00 [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX olegpoly123
  2019-03-08 18:06 ` Wiles, Keith
@ 2019-03-09  3:02 ` Stephen Hemminger
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2019-03-09  3:02 UTC (permalink / raw)
  To: olegpoly123; +Cc: keith.wiles, thomas, dev, stable

On Fri,  8 Mar 2019 13:00:16 -0500
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;
> +	}

You haven't listened to my comment about mixing declaration and
code. Why?

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

* Re: [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX
  2019-03-07 22:25 olegpoly123
@ 2019-03-07 22:31 ` Wiles, Keith
  0 siblings, 0 replies; 6+ messages in thread
From: Wiles, Keith @ 2019-03-07 22:31 UTC (permalink / raw)
  To: olegpoly123; +Cc: Thomas Monjalon, dev, stable, Oeg Polyakov



> On Mar 7, 2019, at 4:25 PM, olegpoly123 <olegp123@walla.co.il> wrote:
> 
> If the value _SC_IOV_MAX is missing, sysconf returns -1.
> In this case, iov_max is set to a default value of 1024.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Oeg Polyakov <opolyakov@northforgeinc.com>
> ---
> drivers/net/tap/rte_eth_tap.c | 5 +++++
> 1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index 6f5109fca..cd48b2b2a 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -1326,6 +1326,11 @@ 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 1024 as default\n");
> +		iov_max = 1024;

Can I get you to create a define for the 1024 value e.g. #define TAP_IOV_DEFAULT_MAX 1024 or something of that type.
Also change the TAP_LOG to use the define. 
> +	}
> 	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
> 

Regards,
Keith

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

* [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX
@ 2019-03-07 22:25 olegpoly123
  2019-03-07 22:31 ` Wiles, Keith
  0 siblings, 1 reply; 6+ messages in thread
From: olegpoly123 @ 2019-03-07 22:25 UTC (permalink / raw)
  To: keith.wiles, thomas; +Cc: dev, olegpoly123, stable, Oeg Polyakov

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

Cc: stable@dpdk.org

Signed-off-by: Oeg Polyakov <opolyakov@northforgeinc.com>
---
 drivers/net/tap/rte_eth_tap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 6f5109fca..cd48b2b2a 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1326,6 +1326,11 @@ 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 1024 as default\n");
+		iov_max = 1024;
+	}
 	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] 6+ messages in thread

end of thread, other threads:[~2019-03-09  3:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 18:00 [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX olegpoly123
2019-03-08 18:06 ` Wiles, Keith
2019-03-08 18:54   ` Thomas Monjalon
2019-03-09  3:02 ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2019-03-07 22:25 olegpoly123
2019-03-07 22:31 ` Wiles, Keith

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