From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 27044A051C; Sun, 9 Feb 2020 22:17:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AB8B31BEE2; Sun, 9 Feb 2020 22:17:43 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id E1F211BEDE for ; Sun, 9 Feb 2020 22:17:41 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 745A521B1B; Sun, 9 Feb 2020 16:17:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 09 Feb 2020 16:17:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=mesmtp; bh=+5q0jBNT72DUaqcV7pukP/n yJSm2SiTdoQYPI1ivBvM=; b=Wtz9Pyu6XQYZQqAWy7xfGyej57KvdvNahev8BOc 5GBxOrOp3Y9IFblSm0cJV4Nu5r4eVp1pFn/gD4aLXSMGMLWmS7WEWbIRaBvcznyF XumddArdj3SECAP3gnPSL3VFAensEmj1I/y+xuEsY+oXndW+HC5YCl+i+twuHSez LQUw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=+5q0jBNT72DUaqcV7 pukP/nyJSm2SiTdoQYPI1ivBvM=; b=cCJAna70FZH/jYNJr6QGAMLGJtghjf3L/ kHvCbh25GgauQ6ZqjT9mVQp+YwiMuUw6Qy9/edUQmw1b1y4Kq9xVYQmpkSJ3cXWO Lx7nNiDhW+X/WIeSRaVb2piF8oqJ/FJvZ+5fQ/HTmwtdd4Q2rHjFmgnC58x9E2RJ oO2Pi95cO2qKlzc2/lInb4udhhYuc2oi5N6W/ul9GecrUILCH9Oo3h+xzXe2NtiA o196V3JYgVAUApNtIjyy93+/ZHprQ80MghvLMHwkdDqMLQ2hhUXxFlH/383nVhcO j4BnR54pq2pwgqXlJeW7j80CG2Pw797jLTuKkmeSnaKdppj9eXm5w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrheelgdduvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgrshcu ofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukfhppe ejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id A4793328005D; Sun, 9 Feb 2020 16:17:40 -0500 (EST) From: Thomas Monjalon To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Cc: dev@dpdk.org Date: Sun, 9 Feb 2020 22:17:25 +0100 Message-Id: <20200209211725.197237-1-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/mlx: replace hardcoded value with macro 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" Replace checking against 65535 limit, with a simpler form using RTE_MIN and UINT16_MAX macros. Signed-off-by: Thomas Monjalon --- drivers/net/mlx4/mlx4_ethdev.c | 5 ++--- drivers/net/mlx5/mlx5_ethdev.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index e500ec422c..9ff05c6738 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -645,9 +645,8 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) */ max = ((priv->device_attr.max_cq > priv->device_attr.max_qp) ? priv->device_attr.max_qp : priv->device_attr.max_cq); - /* If max >= 65535 then max = 0, max_rx_queues is uint16_t. */ - if (max >= 65535) - max = 65535; + /* max_rx_queues is uint16_t. */ + max = RTE_MIN(max, (unsigned int)UINT16_MAX); info->max_rx_queues = max; info->max_tx_queues = max; info->max_mac_addrs = RTE_DIM(priv->mac); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 86923aa7af..d7d3bc73ce 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -619,9 +619,8 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) */ max = RTE_MIN(priv->sh->device_attr.orig_attr.max_cq, priv->sh->device_attr.orig_attr.max_qp); - /* If max >= 65535 then max = 0, max_rx_queues is uint16_t. */ - if (max >= 65535) - max = 65535; + /* max_rx_queues is uint16_t. */ + max = RTE_MIN(max, (unsigned int)UINT16_MAX); info->max_rx_queues = max; info->max_tx_queues = max; info->max_mac_addrs = MLX5_MAX_UC_MAC_ADDRESSES; -- 2.25.0