DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 1/2] net/tap: fix missing _SC_IOV_MAX
@ 2019-03-08 15:55 olegpoly123
  2019-03-08 15:55 ` [dpdk-dev] [PATCH v2 2/2] Define macro for iov_max default value olegpoly123
  2019-03-08 17:29 ` [dpdk-dev] [PATCH v2 1/2] net/tap: fix missing _SC_IOV_MAX Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: olegpoly123 @ 2019-03-08 15:55 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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 15:55 [dpdk-dev] [PATCH v2 1/2] net/tap: fix missing _SC_IOV_MAX olegpoly123
2019-03-08 15:55 ` [dpdk-dev] [PATCH v2 2/2] Define macro for iov_max default value olegpoly123
2019-03-08 16:33   ` Wiles, Keith
2019-03-08 17:29 ` [dpdk-dev] [PATCH v2 1/2] net/tap: fix missing _SC_IOV_MAX 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).