[dpdk-stable] [PATCH] net/tap: fix missing _SC_IOV_MAX

Wiles, Keith keith.wiles at intel.com
Fri Mar 8 19:06:41 CET 2019



> On Mar 8, 2019, at 12:00 PM, olegpoly123 <olegp123 at 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 at dpdk.org
> 
> Signed-off-by: olegpoly123 <olegp123 at 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 at intel.com>

Regards,
Keith



More information about the stable mailing list