From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 719462C22 for ; Thu, 3 Mar 2016 15:28:07 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id l68so133752971wml.0 for ; Thu, 03 Mar 2016 06:28:07 -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=12FRTiuRFMM5P02+2zJDr5lYpcOJvP3UdWRJsvc82gT+iUzCqfoBHu17DdMHlB+Bq+ WWkhzfgek8yZzoKX0g1Xcd4MxCeYHGexPtRBtBU9NvAn6t6beA1izUHgN4j4LdSKbRgi 9F4nwK3Kq4RNolAXD2UG7nEMeZ2yU/sz3aaqOlUPwknDzkWd0R1u5X/5UXKqeD9vNf/0 FBYnyrUDfTdXF54Vkp6HYW9x0FLXnQuqZFa8g4iWOfNVXRkIM/DWoUBZdrHbgkbVKGRO eqF/WW2Dhjz0MiJ8j9t0yAkKCdWsTgGa2i9Rz1ColDggjG5pHimBx5S/AFuB5rb51QSb A4OA== 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=K/e07f1Bt3DtVMIR+u1WJaK2rjw3vVumq7GgL+KDpHfYOJT0Tt1RRQqXTkKf5qjZEF Cu56KeHsJ/ZQRGOTyBWZwvWIEB3ljV1LwWywuZer8QnB0BmbjnabNTpTuJMYNZtxvAkW xCOh6LXUX8TW9mcvo9zyC/llV4rQDSUaA7B1R7sBB+qv75XnwL/RIYUSmuiq6Yvx/ZY8 m+J2p/aLVR/0QGPkU8a0+yNvM2pXVcMBN3ECTZcgRxX+qABg/QPDee9ovNF23+PPNPjs aAhNkPhycOtZ9JdlF/qQhVWGNHQCellto+Si1ZPnOmAFGLfCCUHbLXtgrX6S1wxmzrlf hrEg== X-Gm-Message-State: AD7BkJJyxU+de/vILfaggiylJ20x8Adqgix9I6C6UNJATDLgA/0hqZ+YEnVNrVDVG7n6uJ2v X-Received: by 10.194.63.242 with SMTP id j18mr3836623wjs.114.1457015287263; Thu, 03 Mar 2016 06:28:07 -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 i2sm40910610wje.22.2016.03.03.06.28.06 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2016 06:28:06 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 3 Mar 2016 15:27:40 +0100 Message-Id: <1457015260-3041-8-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH v2 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: Thu, 03 Mar 2016 14:28:07 -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