From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD8A9A0548; Thu, 11 Nov 2021 09:48:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3359140E2D; Thu, 11 Nov 2021 09:48:14 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2069.outbound.protection.outlook.com [40.107.220.69]) by mails.dpdk.org (Postfix) with ESMTP id 5E77840E28; Thu, 11 Nov 2021 09:48:12 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UbbX1SSGKWPKlarorboxW9sf/k3nlSt2KnZBlhRZCAbbdVL1O2lPCS24TdqxETeIxfeUT+meRuhaiHYvlwBfixqCxyH3AZ/27OWD2uQvRAr167kDU07pETNZ6+i2C74THh0DCSd8P8EXEli/tsNzRUnUbtVbo/9C9n2WRA/tppvm/CAbIGmu7I39goS3rJDQJganxjvDEMwjohNY4ZayG1b1Oo1w718iQy0u6SNq6cB9Idgce1j1KgBdIZfQgooYqYWfg1bk9iMv6E0X7edovxyYqaixeWCGYSGDTHhf4Xr1wx55qGUz18PQ9A/haM3l0pgWSAffBqd4IGiIFuggZg== 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=tQdG8a98wcqRTi3WoTcMlvSQgAN/W811R3XEMzC/gEk=; b=hs3xFjYVluvbWMgmoeCXoQshMrICdkdytogloz2FjHkH+UJIq/qr0r9Xkfb2otZ2NTnUiTJkbY8hCQffAF+zPvOb1scdWomjwyti5W+6yoBz4B5zcK1zJQX0bsmvu6vkYM5fdhU8mE29SEUI1aF8hQNK2eJa8/MFf/QwTIwKLDyqzZKJ9/VKpYR2K7j62Did71Vb7MWMsWR554d/W6LrMYBXzEa2odhNhZF4HJJNShYUf37FiNsxTwSW3MGSRCZ+r13Rk8NQObsSanmRPV0YadhGzxocsGXzmL8QvK6Q82KNWw+4QHmEUXJTVLmRU6/dRA1tj8pIOPnjmQKheIlaAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=tQdG8a98wcqRTi3WoTcMlvSQgAN/W811R3XEMzC/gEk=; b=Y7Rkj60D5jCUis4FYTiDXIo2CYBZj1r2vgR4rYk8lKXcYbM/IxQ00aZa49rXjuW+ZIhLkX28sDi0D+0d5ldQnJEZ0vmlyIm+64t5msB5Nsvg7q6gPa8sp54ihXtT6xaTuVwKAe40BRvt2AgUiBsdeFwhUWUwfXpmRSNPsVAH5fc/zp71tjaDRn/sC+BWukufl8sMkE7GmCHUJ/J7lUlKlwQw1AHlANgzJI4CYeeQ2uTRlizXmOI1XbnKILzrVBk7bs4IgZGHRD3FW1sb/t/BLO5XgSOvMYmlm50o1MFVMobSF2TSEfONXpYvnXT7pMzSf7PvZfMgIDrDKFOusZsTTg== Received: from DM6PR11CA0033.namprd11.prod.outlook.com (2603:10b6:5:190::46) by DM6PR12MB4745.namprd12.prod.outlook.com (2603:10b6:5:7b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Thu, 11 Nov 2021 08:48:09 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::cf) by DM6PR11CA0033.outlook.office365.com (2603:10b6:5:190::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 08:48:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 08:48:08 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 11 Nov 2021 08:48:06 +0000 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH] net/mlx5: remove redundant "set used" Date: Thu, 11 Nov 2021 10:47:51 +0200 Message-ID: <20211111084751.26721-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa1d53a9-95a1-493d-178e-08d9a4effc77 X-MS-TrafficTypeDiagnostic: DM6PR12MB4745: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: smWMroU1yFbefcq8Tbf6RBghfZaDe7N2WpyRqTQ0apOTo9s8Ggpb+c5VH+BuDNm/tj7ES3BH14KVedjwvYY9rncxuzFAf06ptCU1Pg39bW8zW5AvY2tRyL4evj3b6FB8opbPyWzK8jnfX8CwjyVXUT9B9QMlrLMM/EicTU7TOmfH+57l2KUwtPthVjvVuSYxuWmhmC3qDibe12fswzFdQxTIghd5KdNh23VxeXB7pRuz23UBNwWLHyHn2RSjQqXzbOL9m6vR+Csd3hW7BVtZ0qirSWwS7XsnPSfl/EYu8qmUK4HjchZKOIeWHmoI9iKPDSzFeTysqnlsQe6Ay6KNKH9Eik2z5c6jpTUW36Tmwf53R7WnlpDYTtvhpBSUypaqQ8ZXg+6pN+XZC8DZuYGr0wkgtP+O2e28vbsgG8gkFZBiE7l3haGUxSTkRI//6NVYF2/PqnvFdQphOtgjYbnuVkqz0QSQGX9o1FDfJr8IZGl+1ztQTLkw45MIO3oD2vQseP9mKWMD3YP+icW/yucxevtDci/Nz5ggpstwsgs2hAt7QhXvJWT8Z6vtZ7MkISFBovlQn75yaWDiCoiUnbI3IHNC+UJSiyuqghewudC2/59IBCOuM049VV73VBHqLfn76XfsfBOBQbrqnAl7RGWPq+Rk6H/mzuSicDLRM90Os4h2874ODFSZBsUP2qpnBjrIHXZNAWIPYV4CYN5LCq2VQA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(26005)(426003)(2616005)(70586007)(7636003)(6666004)(186003)(36906005)(8676002)(508600001)(1076003)(83380400001)(16526019)(336012)(55016002)(4326008)(5660300002)(7696005)(356005)(6916009)(70206006)(8936002)(86362001)(36860700001)(82310400003)(2906002)(6286002)(54906003)(316002)(36756003)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2021 08:48:08.8328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa1d53a9-95a1-493d-178e-08d9a4effc77 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4745 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The patch just refines the code and replaces the pairs of MLX5_ASSERT() and RTE_SET_USED() with equivalent claim_zero(). Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_txpp.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) 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 = dev->data->dev_private; struct mlx5_dev_ctx_shared *sh = priv->sh; int err = 0; - int ret; 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 = rte_mbuf_dynflag_lookup - (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); - if (ret < 0) + err = rte_mbuf_dynflag_lookup + (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); + /* No flag registered means no service needed. */ + if (err < 0) return 0; + err = 0; } - ret = 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 = 1; ++sh->txpp.refcnt; @@ -924,9 +923,7 @@ mlx5_txpp_start(struct rte_eth_dev *dev) rte_errno = -err; } } - ret = pthread_mutex_unlock(&sh->txpp.mutex); - MLX5_ASSERT(!ret); - RTE_SET_USED(ret); + claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); return err; } @@ -944,28 +941,21 @@ mlx5_txpp_stop(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_dev_ctx_shared *sh = priv->sh; - int ret; if (!priv->txpp_en) { /* Packet pacing is already disabled for the device. */ return; } priv->txpp_en = 0; - ret = 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 = 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 = pthread_mutex_unlock(&sh->txpp.mutex); - MLX5_ASSERT(!ret); - RTE_SET_USED(ret); + claim_zero(pthread_mutex_unlock(&sh->txpp.mutex)); } /* -- 2.18.1