From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id AF87F5690 for ; Mon, 22 Feb 2016 19:19:14 +0100 (CET) Received: by mail-wm0-f44.google.com with SMTP id g62so186571353wme.1 for ; Mon, 22 Feb 2016 10:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v2SoUPncoqkDSyGxe9DRcIvTg7LHsSufD2DZM0vmH1w=; b=oYC1WDlfS05GEowsVPkBcvZHk8RI36IfSrF4tQvsMM8UJZP5DnNhMJxUuizbni5kP4 /8r/bnC/j+ia3gqddWidoghkRsKdxxrN8JJX/je7gaopVyKFmCuKd5oKecHbDjMUL86Z z2ILVo4LHyFRGQX7iYGQN0jMr3t1pPquDtTUZqkCIu2iKo0l4shJhMB3sqvmWY9/PbEZ GvFEHvVk1dQR0MQwt5O3yet8g5lfwUWXblZj+CCZzFJJ6/P6H5+m/JKWoqw3yiCBAnmJ sGW8OLlN6p57KGbQhD7oipRMQdb1N0CW8AYws1AJsYTql/dlxv8n93QlYBIF49Qg8eMq L04A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v2SoUPncoqkDSyGxe9DRcIvTg7LHsSufD2DZM0vmH1w=; b=Pq9aFhbHZ6Y5+0ao61luvnhxaH+P+azXxzQU9nTA5Rk1JpQwmiUchSSPPa5KhCLGU/ RIZzC7BAwUhVMyLdNht8J6ONH+w+8Nq8ceODEWckcJLyBAHbEpTgd72FNORacIljSKkr MRG8aEgO4e3dWfcgv7pDbr6v8PbMGDemAwG4uF9dQ5KzCwxrfV/5AR+Z15MQxGEyKV2E CSst8BdgLoG9YEtwhzMRIUpbCpzpR93xzCw1i2NI6U9OjsycMgRtmNoKUPxK3vakius5 tvVjeHFbK3LMgcfJIMneC0uGZMp/wmCFoi+3T+sYuNdraojONaMphVyCpxglPficfFUU z5gg== X-Gm-Message-State: AG10YOQt9HIDEwwh93S4ku5RXYiqkV5gRriJrB/b9W63Sx9LuucnPfg70o9x1j0xHT9xAYjS X-Received: by 10.28.127.5 with SMTP id a5mr14637452wmd.32.1456165154543; Mon, 22 Feb 2016 10:19:14 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id w17sm22172682wmw.5.2016.02.22.10.19.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Feb 2016 10:19:13 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 22 Feb 2016 19:18:43 +0100 Message-Id: <1456165123-28365-8-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 7/7] mlx4: make sure that number of RX queues is a power of 2 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 18:19:15 -0000 From: Robin Jarry In the documentation it is specified that the hardware only supports a number of RX queues if it is a power of 2. Since ibv_exp_create_qp may not return an error when the number of queues is unsupported by hardware, sanitize the value in dev_configure. Signed-off-by: Robin Jarry --- drivers/net/mlx4/mlx4.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 3c1f4c2..67025c7 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -734,6 +734,12 @@ dev_configure(struct rte_eth_dev *dev) } if (rxqs_n == priv->rxqs_n) return 0; + if ((rxqs_n & (rxqs_n - 1)) != 0) { + ERROR("%p: invalid number of RX queues (%u)," + " must be a power of 2", + (void *)dev, rxqs_n); + return EINVAL; + } INFO("%p: RX queues number update: %u -> %u", (void *)dev, priv->rxqs_n, rxqs_n); /* If RSS is enabled, disable it first. */ -- 2.1.4