From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 83A83A0C4B
	for <public@inbox.dpdk.org>; Thu, 11 Nov 2021 09:59:15 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 757EB41147;
	Thu, 11 Nov 2021 09:59:15 +0100 (CET)
Received: from NAM02-BN1-obe.outbound.protection.outlook.com
 (mail-bn1nam07on2045.outbound.protection.outlook.com [40.107.212.45])
 by mails.dpdk.org (Postfix) with ESMTP id 9809640E03;
 Thu, 11 Nov 2021 09:59:13 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=m50WgXrngXZk4o7R1p4cp503eegy7EN3iVQd/aflwgxQhXRjUjMi/Q5Z63h4EkKgq7HIYdMtGG4hEHHgWxsvOSoJXWH6BWYXUsn5vCrXCtDjiVaQCyP/rk2dv1a9VyEBZTzVSM/rUbu/tPyL2yy6ZeV4rhyRAVqWq9QQ868IJp9qB61rxgNbkxQF6/QmzDknI3+/4rDuLWUog2i9kcJv9hJmsQ6cZaN57P3FOHg30pbU493AxXqUcJzvKCzoPMHADhs77UwWA/8LvC2EitJIO8SUqSNSdz5BSLJtbWPapZ3M2kjnQqwnhveoHEEJsPNUmvDX1pHgGqEg61RMvAPJrg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=+cKVK7+e8RV/hFea1po7MSXGs1gKUbbxWYQdzKm8mWo=;
 b=lY2+4nXc24Iu4riJIemV1jqQ92vZ1F4L6KtREVRYAcmgabNv12QZa8TQUw9AHrs67ayyLCmlSGk65tjN59rXenLxoqFGdeuTAIexr+W/KCbeTwKO4ezYMAElpVRK8XsnAgueNnTKQGkvz7ByouupTZoc17uLm2W2O138jwRScSaHLREdRSxq1ms4xgiHUHni7gelB3jH7Oxd3qBbTqoX4CRu6fXUJC3tTJEc9J4gGEaq9aWvRZ/PcC4MJmF7tYCeLuEidNeM04J4No9knRYfRN8Zt2ysuqt1PLH6qVDNtFI7Su+YUq7/RA7qqVT9C6uoIvNq11DOzVFvssUyd29+wg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
 dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=+cKVK7+e8RV/hFea1po7MSXGs1gKUbbxWYQdzKm8mWo=;
 b=MwFSKpsTVISE8ZQ0XyvQyH+tkmgA052ZTVVUK8O4VG0KJH5gjZBmkmEkcX2o7ZMuZbbsUteLWvxze6bx7WANywK4WTg8a2Cwo9IHoeMEX843qFe/6kQGHmJTflC0mtJCPnow4fXUIhrOxuZUDYiV0k4j3fjB1SdQH7+rl618y1RVDmCusnRGRHhTwm3H2QthKxO6o4gSa4KJcPvTH1EF4pKiLpz161qdWJzeyDciOGdo4ISMnmjYqD8CNsXvopYp0hIuPLigYRSV5Z4GLdRmKYataavOr4r8mwiRS+msbTGzE1VleI6jkXLZWsRE3r/j+1r6UBD0ddoAHXb+pLrl7Q==
Received: from DM6PR12MB3753.namprd12.prod.outlook.com (2603:10b6:5:1c7::18)
 by DM6PR12MB4762.namprd12.prod.outlook.com (2603:10b6:5:7b::17) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Thu, 11 Nov
 2021 08:59:11 +0000
Received: from DM6PR12MB3753.namprd12.prod.outlook.com
 ([fe80::e550:35a2:96e5:657f]) by DM6PR12MB3753.namprd12.prod.outlook.com
 ([fe80::e550:35a2:96e5:657f%4]) with mapi id 15.20.4669.016; Thu, 11 Nov 2021
 08:59:11 +0000
From: Slava Ovsiienko <viacheslavo@nvidia.com>
To: Slava Ovsiienko <viacheslavo@nvidia.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>, Raslan Darawsheh
 <rasland@nvidia.com>, Matan Azrad <matan@nvidia.com>, "stable@dpdk.org"
 <stable@dpdk.org>
Subject: RE: [PATCH] net/mlx5: remove redundant "set used"
Thread-Topic: [PATCH] net/mlx5: remove redundant "set used"
Thread-Index: AQHX1tjfs+lNzlBS506dGdKP2oGSqav+BdSQ
Date: Thu, 11 Nov 2021 08:59:11 +0000
Message-ID: <DM6PR12MB3753A4E679FBBF6414DBB3BADF949@DM6PR12MB3753.namprd12.prod.outlook.com>
References: <DM6PR12MB37538F39D11C26EFA9F5F486DF949@DM6PR12MB3753.namprd12.prod.outlook.com>
 <20211111084751.26721-1-viacheslavo@nvidia.com>
In-Reply-To: <20211111084751.26721-1-viacheslavo@nvidia.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: nvidia.com; dkim=none (message not signed)
 header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: c9dbc530-a0a4-4834-a2a8-08d9a4f18773
x-ms-traffictypediagnostic: DM6PR12MB4762:
x-microsoft-antispam-prvs: <DM6PR12MB4762F3B69C21E92EEE709D5EDF949@DM6PR12MB4762.namprd12.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:7691;
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: TNW4vt4plI8t1jdGFDY6SWR9qL64BL8/VCb5uxZ+hiiLQPX2WNMNTaMPt26smn2fWd5+ZA2mRwOk3vaziabx6FRn6i2J4U07eDJY4Lvh8uOWhOX/YXYIBrjXAO94ARYqAqmN9Z7YEMDdK1DD1OvUxQzWFlguBVs2iUN7YkSG8V7fkyJBjVspPi5SSF/R0KspOrDHvZtd7JJmYIQVjOtsqXTgmIxy+pWm79/egHUgoovUhjPG+6cnmg+wLeVS/HCKytR0+kTQf4AVtEcWs5zetbK6YkTilghyZN5a02k1XN7zrN6zrJ5+h0WNqa+Ot4PTFzoKSD5YEPdNWHES+fSO+X0aNMpzsH+sQpv+Uj0Ywne8GepR52SBXaE4uhMKScDWCU95AQMkPiYOXUP7vaqMKC2nV6W/lh5SjYjoL5x+8P3rXcJnCYzpUrxHQs+qHLV1JFTfi0iB6fChhNp43eRQEjgf+oA4P4v+dmQF/RsfyH1NHrj+MElUX5K7F2iZETWWYENjIE1RJF+Enh7NrqWpWxj2U4fGiuExAyFhbFPNhjhWo/7T/nOhMCOoM5dFg3ViOXPrhktY8okScHYpVnvMYvGf2kF80mNqZmYBel9kL5fBVGlz2mgrNcpq3eD9P+GPIe26O4mrSBwjFN1C8WkYMtdGiYi0vHIwWKusu2M+Y9ftGfPVBXPs1+9DNPe0zaUa1+FCyU3leyWsdRjhqMlZuQPuKebbEUO50nyys8FrPT0FfWM3tzRJDgDU1oOA4T9LvUrW0GQNng9iYjkO8C1KnxCj8lCraFx5L9dIaEgRkUU=
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:DM6PR12MB3753.namprd12.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(366004)(508600001)(966005)(4326008)(52536014)(54906003)(86362001)(53546011)(64756008)(38070700005)(66476007)(33656002)(5660300002)(66556008)(66946007)(9686003)(110136005)(316002)(76116006)(55016002)(38100700002)(122000001)(26005)(7696005)(8936002)(71200400001)(6506007)(8676002)(83380400001)(2906002)(186003)(66446008);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cxHqnbvu0lFWBaykLmOeEc452LkbJ8laxvGZbrombVf64Y3jtiukeg+y8AgD?=
 =?us-ascii?Q?xVLu2KoDa3Yi/PEDTCXxK2ASGtc9t9EkzE7a+gpQszuQSchX5OCSQjhSMgJ7?=
 =?us-ascii?Q?bSXHwSdrUm+XuIohUnkSP/2Gpj/UaamPXJLjZqcOKIuWtxCxmprjPAEuUItC?=
 =?us-ascii?Q?ApNCeiAZJebnrnBog8RfpqS7sDNhfehckQ7k6HXV/2TR1Ig1Xemm86tB7G8n?=
 =?us-ascii?Q?QiZEFznQU6zu7xyy/PPyaw4pG0bth4q45GFP0z6R0HisO38OZChpeP13XCmp?=
 =?us-ascii?Q?cDXiHH/5DJym7SNSGCuv6FUO8wrmbrMvaC4vey31KZ9yXEyBwl44fmMVk2SA?=
 =?us-ascii?Q?sW8EBQXTq9zpWrLVJWgalRiiDMxlv8hqVECVWCb/pnDs454TDWsQMTVy+ejb?=
 =?us-ascii?Q?kpsFkLLjcHA4Ospm5zjC2kW/2ftUI3PBoDkbI4vM7/nOHFqEf3p96rlUIe9q?=
 =?us-ascii?Q?3FsyEDi1C/a4UPZL829YnLhRf5DZ+AM2ToDKIgV4xzvCAci54lKn4k7vnU/d?=
 =?us-ascii?Q?OHToO0BWrE8P1i/bIqVqXZ9+AzJTcLazix/DdiJ0b8Qe4ZMMDJWAovN8bD0L?=
 =?us-ascii?Q?lJ66scHWGBppOpsUJXG+Q8B1k2W/Vplg5ugU8SdItyL+g7UZfaawDttoZTNP?=
 =?us-ascii?Q?vOOOhrlHq+8GXaZugWNBrEIo7+2v9BupB/ibGNgbu6n0Zf9ccKPLMrKvoeGO?=
 =?us-ascii?Q?sqyDtPPmJ4lANbtqLUL/wedE+t/4phIOQPXQ7h0P+YNM+SWkBQ1NSRw1rrO+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e?=
 =?us-ascii?Q?sA=3D=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3753.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: c9dbc530-a0a4-4834-a2a8-08d9a4f18773
X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2021 08:59:11.5392 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: YLXd6YYfEXIiqOWLKbrE3DZP0I72W8CKfDh+5F6yImJrrl63SJ5mhBS2/3S9kq+R6enNDCRcS4J0Uwry8B3T2A==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4762
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi, Ferruh

I've also inspected the mlx5 PMD code for RTE_SET_USED() for the similar
issues related to the MLX5_ASSERT().

The patch http://patches.dpdk.org/project/dpdk/patch/20211111084751.26721-1=
-viacheslavo@nvidia.com/
should refine the few found ones.=20

I do not mind about squashing with "net/mlx5: fix mutex unlock in txpp clea=
nup"
After getting this code in Upstream will care about the version for LTS.

With best regards,
Slava

> -----Original Message-----
> From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> Sent: Thursday, November 11, 2021 10:48
> To: dev@dpdk.org
> Cc: ferruh.yigit@intel.com; Raslan Darawsheh <rasland@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; stable@dpdk.org
> Subject: [PATCH] net/mlx5: remove redundant "set used"
>=20
> The patch just refines the code and replaces the pairs of MLX5_ASSERT() a=
nd
> RTE_SET_USED() with equivalent claim_zero().
>=20
> Cc: stable@dpdk.org
>=20
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_txpp.c | 30 ++++++++++--------------------
>  1 file changed, 10 insertions(+), 20 deletions(-)
>=20
> diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c
> index 73626f0e8f..af77e91e4c 100644
> --- a/drivers/net/mlx5/mlx5_txpp.c
> +++ b/drivers/net/mlx5/mlx5_txpp.c
> @@ -890,7 +890,6 @@ mlx5_txpp_start(struct rte_eth_dev *dev)
>  	struct mlx5_priv *priv =3D dev->data->dev_private;
>  	struct mlx5_dev_ctx_shared *sh =3D priv->sh;
>  	int err =3D 0;
> -	int ret;
>=20
>  	if (!priv->config.tx_pp) {
>  		/* Packet pacing is not requested for the device. */ @@ -
> 903,14 +902,14 @@ mlx5_txpp_start(struct rte_eth_dev *dev)
>  		return 0;
>  	}
>  	if (priv->config.tx_pp > 0) {
> -		ret =3D rte_mbuf_dynflag_lookup
> -
> 	(RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL);
> -		if (ret < 0)
> +		err =3D rte_mbuf_dynflag_lookup
> +			(RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME,
> NULL);
> +		/* No flag registered means no service needed. */
> +		if (err < 0)
>  			return 0;
> +		err =3D 0;
>  	}
> -	ret =3D pthread_mutex_lock(&sh->txpp.mutex);
> -	MLX5_ASSERT(!ret);
> -	RTE_SET_USED(ret);
> +	claim_zero(pthread_mutex_lock(&sh->txpp.mutex));
>  	if (sh->txpp.refcnt) {
>  		priv->txpp_en =3D 1;
>  		++sh->txpp.refcnt;
> @@ -924,9 +923,7 @@ mlx5_txpp_start(struct rte_eth_dev *dev)
>  			rte_errno =3D -err;
>  		}
>  	}
> -	ret =3D pthread_mutex_unlock(&sh->txpp.mutex);
> -	MLX5_ASSERT(!ret);
> -	RTE_SET_USED(ret);
> +	claim_zero(pthread_mutex_unlock(&sh->txpp.mutex));
>  	return err;
>  }
>=20
> @@ -944,28 +941,21 @@ mlx5_txpp_stop(struct rte_eth_dev *dev)  {
>  	struct mlx5_priv *priv =3D dev->data->dev_private;
>  	struct mlx5_dev_ctx_shared *sh =3D priv->sh;
> -	int ret;
>=20
>  	if (!priv->txpp_en) {
>  		/* Packet pacing is already disabled for the device. */
>  		return;
>  	}
>  	priv->txpp_en =3D 0;
> -	ret =3D pthread_mutex_lock(&sh->txpp.mutex);
> -	MLX5_ASSERT(!ret);
> -	RTE_SET_USED(ret);
> +	claim_zero(pthread_mutex_lock(&sh->txpp.mutex));
>  	MLX5_ASSERT(sh->txpp.refcnt);
>  	if (!sh->txpp.refcnt || --sh->txpp.refcnt) {
> -		ret =3D pthread_mutex_unlock(&sh->txpp.mutex);
> -		MLX5_ASSERT(!ret);
> -		RTE_SET_USED(ret);
> +		claim_zero(pthread_mutex_unlock(&sh->txpp.mutex));
>  		return;
>  	}
>  	/* No references any more, do actual destroy. */
>  	mlx5_txpp_destroy(sh);
> -	ret =3D pthread_mutex_unlock(&sh->txpp.mutex);
> -	MLX5_ASSERT(!ret);
> -	RTE_SET_USED(ret);
> +	claim_zero(pthread_mutex_unlock(&sh->txpp.mutex));
>  }
>=20
>  /*
> --
> 2.18.1