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 32BF12C60; Mon, 18 Mar 2019 19:20:49 +0100 (CET) Received: by ubuntu64.mapleworks.com (Postfix, from userid 1001) id 7AFAA3A00CA; Mon, 18 Mar 2019 14:20:48 -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 14:20:47 -0400 Message-Id: <20190318182047.5210-1-olegp123@walla.co.il> X-Mailer: git-send-email 2.14.1 Subject: [dpdk-dev] [PATCH v7] 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: Mon, 18 Mar 2019 18:20:49 -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. This should never happen except for redhat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1504165 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..9aae4c77f 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", + 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7D53FA05FE for ; Mon, 18 Mar 2019 19:20:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0E20A4C95; Mon, 18 Mar 2019 19:20:51 +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 32BF12C60; Mon, 18 Mar 2019 19:20:49 +0100 (CET) Received: by ubuntu64.mapleworks.com (Postfix, from userid 1001) id 7AFAA3A00CA; Mon, 18 Mar 2019 14:20:48 -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 14:20:47 -0400 Message-Id: <20190318182047.5210-1-olegp123@walla.co.il> X-Mailer: git-send-email 2.14.1 Subject: [dpdk-dev] [PATCH v7] 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190318182047.LKMV9U3YnXmZNU_jv0sHd__xjl1qpLR4Jn8m93_B1rA@z> If the value _SC_IOV_MAX is missing, sysconf returns -1. In this case, iov_max is set to a default value of 1024. This should never happen except for redhat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1504165 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..9aae4c77f 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", + 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