From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <"oleg@opolyakov"@northforgeinc.com> Received: from ubuntu64.mapleworks.com (modemcable226.69-70-69.static.videotron.ca [69.70.69.226]) by dpdk.org (Postfix) with ESMTP id 09DB15F36; Thu, 7 Mar 2019 23:26:06 +0100 (CET) Received: by ubuntu64.mapleworks.com (Postfix, from userid 1001) id D7A9F3A0099; Thu, 7 Mar 2019 17:26:05 -0500 (EST) From: olegpoly123 To: keith.wiles@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, olegpoly123 , stable@dpdk.org, Oeg Polyakov Date: Thu, 7 Mar 2019 17:25:23 -0500 Message-Id: <20190307222523.24620-1-olegp123@walla.co.il> X-Mailer: git-send-email 2.14.1 X-Mailman-Approved-At: Fri, 08 Mar 2019 11:50:56 +0100 Subject: [dpdk-dev] [PATCH] net/tap: fix missing _SC_IOV_MAX X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2019 22:26:07 -0000 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 --- 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