From patchwork Mon Mar 18 16:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: olegpoly123 X-Patchwork-Id: 51293 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 26CED3572; Mon, 18 Mar 2019 17:55:33 +0100 (CET) Received: from ubuntu64.mapleworks.com (modemcable226.69-70-69.static.videotron.ca [69.70.69.226]) by dpdk.org (Postfix) with ESMTP id F1B16324D; Mon, 18 Mar 2019 17:55:30 +0100 (CET) Received: by ubuntu64.mapleworks.com (Postfix, from userid 1001) id 47CE43A00CA; Mon, 18 Mar 2019 12:55:30 -0400 (EDT) From: olegpoly123 To: keith.wiles@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, olegpoly123 , stable@dpdk.org Date: Mon, 18 Mar 2019 12:55:23 -0400 Message-Id: <20190318165523.4086-1-olegp123@walla.co.il> X-Mailer: git-send-email 2.14.1 Subject: [dpdk-dev] [PATCH v6] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Keith Wiles --- 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;