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 8341DA0521; Tue, 3 Nov 2020 15:12:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8EFC7CB35; Tue, 3 Nov 2020 15:09:58 +0100 (CET) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by dpdk.org (Postfix) with ESMTP id CB52CCB19; Tue, 3 Nov 2020 15:09:55 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 44974580A4B; Tue, 3 Nov 2020 09:09:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 09:09:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=N5XVBGmRr4nw6 +7oDevfRN3r39vrlkp7xLtpl8ya5Kk=; b=F2NT0MEylcAIpFZYEs6o8Ww60jJld 7lBx36+IN+wDrGCsXQAnBv+V1FXK9oHLziRw0UnPWrc7+bsfCQkeES4nYc/uii4w 1uIGg682vX1CqQYyPyZgXXjOUZj761gi7NwpHSk+ZMBZJRQBrxDKKucxp7dhq61l mMJb9Px+DXhQ0HvLj6R/8NGDII4cxNSZJUr2qFW02zZhqY0q+sl0NfhD+unnceta uQL1nXPAYRHK+quOEMemjhnvIHQjwEG1v/4lT+c70LkcDFs0QoBnq0qCZh7HskBO fcPggsA9LPrUm+NHjVnYIL51DM3JI8nmkUAfkP7rPP+0UkFkhdR/a24/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=N5XVBGmRr4nw6+7oDevfRN3r39vrlkp7xLtpl8ya5Kk=; b=Otn+kg0h 6LJIsBJ/67HjsPph9LJUag/wznGuUZfO4wPZlRgCL/vZfTCAOtAFZRJM7AYss8FY dcu0DcwUxYaFtKx6vq9+yVg2Dkt6PqclAOe4a/FoQjmOG9k7L/T9yz/j8CLs/hu0 mTQr+1BW7SbJkd1A3miaoPcV3Web1Z/G2ybRXHKNKOPRzkgmrwqsldbuQHzJrbyW I/UqXWEZkQ+2OQ8hrx16zz/rPYJbA0A92PJDlJIkxUn658OsMntWArwke5Zny21L CB6KqxlKzEbdRkCIzbodzX1Tdg0T4bA81kymF/34gqJtRbaRrCfMLcpqjVR7dQOO dHO7bokwUbv4Wg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght 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 D259E3280060; Tue, 3 Nov 2020 09:09:52 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, viacheslavo@nvidia.com, stable@dpdk.org, Matan Azrad , Shahaf Shuler , Ori Kam Date: Tue, 3 Nov 2020 15:09:21 +0100 Message-Id: <20201103140931.488700-7-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103140931.488700-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103140931.488700-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 06/16] net/mlx5: fix dynamic mbuf offset lookup check 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" The functions rte_mbuf_dynfield_lookup() and rte_mbuf_dynflag_lookup() can return an offset starting with 0 or a negative error code. In reality the first offsets are probably reserved forever, but for the sake of strict API compliance, the checks which considered 0 as an error are fixed. Fixes: efa79e68c8cd ("net/mlx5: support fine grain dynamic flag") Fixes: 3172c471b86f ("net/mlx5: prepare Tx queue structures to support timestamp") Fixes: 0febfcce3693 ("net/mlx5: prepare Tx to support scheduling") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Acked-by: Viacheslav Ovsiienko Acked-by: David Marchand --- drivers/net/mlx5/mlx5_rxtx.c | 4 ++-- drivers/net/mlx5/mlx5_trigger.c | 2 +- drivers/net/mlx5/mlx5_txq.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index b530ff421f..e86468b67a 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -5661,9 +5661,9 @@ mlx5_select_tx_function(struct rte_eth_dev *dev) } if (tx_offloads & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP && rte_mbuf_dynflag_lookup - (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL) > 0 && + (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL) >= 0 && rte_mbuf_dynfield_lookup - (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL) > 0) { + (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL) >= 0) { /* Offload configured, dynamic entities registered. */ olx |= MLX5_TXOFF_CONFIG_TXPP; } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 7735f022a3..917b433c4a 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -302,7 +302,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) DRV_LOG(DEBUG, "port %u starting device", dev->data->port_id); fine_inline = rte_mbuf_dynflag_lookup (RTE_PMD_MLX5_FINE_GRANULARITY_INLINE, NULL); - if (fine_inline > 0) + if (fine_inline >= 0) rte_net_mlx5_dynf_inline_mask = 1UL << fine_inline; else rte_net_mlx5_dynf_inline_mask = 0; diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index af84f5f72b..8ed2bcff7b 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -1305,7 +1305,7 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev) (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); off = rte_mbuf_dynfield_lookup (RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); - if (nbit > 0 && off >= 0 && sh->txpp.refcnt) + if (nbit >= 0 && off >= 0 && sh->txpp.refcnt) mask = 1ULL << nbit; for (i = 0; i != priv->txqs_n; ++i) { data = (*priv->txqs)[i]; -- 2.28.0