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 D6D40A00BE; Sun, 10 Apr 2022 15:53:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 41720410E0; Sun, 10 Apr 2022 15:53:05 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10068.outbound.protection.outlook.com [40.107.1.68]) by mails.dpdk.org (Postfix) with ESMTP id D76F140DDB for ; Sun, 10 Apr 2022 15:53:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UO8cS1WSaWr354swYtUHBGienc+ieKhcsmXHl3or964cRjc0JVLNuvuIDPxfykgL4a16wqS9Q+GdWieaIjj4gEpUzKDmoCkNc/1kb7pLKChbZSLjYOJWczFsWQK3IycfZZdDdSqUww5tqSm1YrON48ktfWBxAmHwHzoShkX1UnlGq4P0Tyfq0cbgqiRMHZIHbDZKZcN1LGdtWLJCa9Wiz39vx7uT5VivRPX9c5Gk+/poiBr2rVUdMaVrF44uLHPZYQv46jNDb+wOieBhojbvUJtTOyyeyw7CoFKuH8zKnjNnoXrkfl7k4DmQU9oCxxj+ulGy9Sf2SedyBFxBsm4eNQ== 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=AktmK6NPwf7ZsqIFtOkJEC3Gqt5HF2QHO71Qn9QmkGA=; b=iESwaRcYv/lvq+fQ4QnpDlvJxlReW7RPSdNYcvbiVcqCKeU98GNTqtazzOiHwGijaY7r+YsbTQkixNcDd0xbxSXYEThrF/Ao4kWfLV0hwt8dwSSbgolN7amNkgdKjLxJRwvOsHzkQ1CIkeEO5+R+Xn+/vQs5kRXT4tTlrGf9mb1s6TDS5rADQ6MLPLaCNF3iUOJ71V4AaSW73ke1dGKdpqZRIx8W5Peojc/6YSIdAs7TCq9zduAMrfavS4q0lNhaOmFv2I4FcgoVLgEWQt6uw96RHSGAJpvDMM5Axn6r72FEPwIm/zd1lCTEbn/W4xomFjrBnAsJW1DTXzWzUHKOSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AktmK6NPwf7ZsqIFtOkJEC3Gqt5HF2QHO71Qn9QmkGA=; b=YgkW/vbvqpVymyjLbAIF2J2g8rzbp/xCMKycckLNVXfKTfxplBCmE+21jo6WJAbDsq3Zzm0446os5KrpIU+ED+qffLrcB+1dDI3v3JQfb0kgNS6NyPzQGmEINsw1xQA/khjWLlCKUuYA3k85LFhgq16MTrxoIU409Vowk9D6Luk= Received: from AM6PR0202CA0050.eurprd02.prod.outlook.com (2603:10a6:20b:3a::27) by DBAPR07MB6712.eurprd07.prod.outlook.com (2603:10a6:10:189::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.16; Sun, 10 Apr 2022 13:53:00 +0000 Received: from VE1EUR02FT043.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::43) by AM6PR0202CA0050.outlook.office365.com (2603:10a6:20b:3a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Sun, 10 Apr 2022 13:53:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT043.mail.protection.outlook.com (10.152.13.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5144.20 via Frontend Transport; Sun, 10 Apr 2022 13:53:00 +0000 Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESBMR502.ericsson.se (153.88.183.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Sun, 10 Apr 2022 15:52:59 +0200 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.184) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Sun, 10 Apr 2022 15:52:59 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 8E3F1601CB; Sun, 10 Apr 2022 15:52:59 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: Thomas Monjalon , David Marchand , , , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Subject: [RFC 3/3] examples/bond: fix invalid use of trylock Date: Sun, 10 Apr 2022 15:51:40 +0200 Message-ID: <20220410135140.161842-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> References: <20220410135140.161842-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58c77d29-92d1-4e35-d8fd-08da1af96ce5 X-MS-TrafficTypeDiagnostic: DBAPR07MB6712:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 79Lwo27fFSYtIxvj9Ygih9HBzanpIxLwljsSxbHeJB4fZHehar8J1aFiL0Od5Vo4lFVTIEz2G5IWQxiFu/y7vfTfNV+OYWoqvrYTpd/0jbLoF+eY48fgbqF6w13eZR7OdbZd6HWORyU788OWbrYIl6ggXsxuWHp/9AtU2EIHWPfeg35O1tyESfTp+MPg+yxAQOSFPJo38izxb0xB6SsGMmoAabJwvNOBZVIs30PI7WMwKRk7LL2LbWgkfCM+qJLQkApw5rMemgysajz339uUakBTiepfq1HrfWOQA9y9SXsVC64muhUqWLt7xMotx8IsYoDKgN2izpS06winmpqUJtmFEzkpCFS25w0K8qZWoId1AvmMZ+Xsg/EonyU0Vr7jbM2hMVGwVQNH4oX3VLuFMPjv1vQlDhVKV8V9/mk3bG8Li/5fslgBHwUPI7nboSrMSIZ0qrFGytD0nzTqClkSYt/UBYLniq+HJMFhhnYam0rPzCXr7M9Toai5Tu8d/REYKHeyH45SHHkoFHk2T4c30DPydRDHXdeudtOLzNBIFXLZ/4+YEvXXfjpwhyH9jpDtp16ttQEj7PACs7FidpVLFjj9OhX5uIAkD+wK57njMlz/ZLg+ez2Lybf+dpTt4j2QlDvMVH3yfj1RBKO7yI9OG2udnmEC1EFIwpM2aAx9hi4Mgk8tPDzylLZRdjME4lTpqVTu0AhA+z62biq3juJgp6u21BuXrjFmUkWw1NUzALQ9leIzLX8eEtGHYBDPa3hwvpodkyLQ56EvE7yRAEoDYQ== X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(82310400005)(34020700004)(40460700003)(47076005)(66574015)(36860700001)(336012)(36756003)(2906002)(82960400001)(186003)(1076003)(6266002)(2616005)(26005)(356005)(7636003)(83380400001)(70586007)(6916009)(70206006)(54906003)(5660300002)(8936002)(508600001)(4326008)(8676002)(86362001)(316002)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2022 13:53:00.1903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58c77d29-92d1-4e35-d8fd-08da1af96ce5 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR02FT043.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6712 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 conditional rte_spinlock_trylock() was used as if it is an unconditional lock operation in a number of places. Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6") Cc: michalx.k.jastrzebski@intel.com Signed-off-by: Mattias Rönnblom --- examples/bond/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index 335bde5c8d..4efebb3902 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -373,7 +373,7 @@ static int lcore_main(__rte_unused void *arg1) bond_ip = BOND_IP_1 | (BOND_IP_2 << 8) | (BOND_IP_3 << 16) | (BOND_IP_4 << 24); - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); while (global_flag_stru_p->LcoreMainIsRunning) { rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -456,7 +456,7 @@ static int lcore_main(__rte_unused void *arg1) if (is_free == 0) rte_pktmbuf_free(pkts[i]); } - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); } rte_spinlock_unlock(&global_flag_stru_p->lock); printf("BYE lcore_main\n"); @@ -571,7 +571,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, { int worker_core_id = rte_lcore_id(); - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) != WAIT) { @@ -591,7 +591,7 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, if ((worker_core_id >= RTE_MAX_LCORE) || (worker_core_id == 0)) return; - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); global_flag_stru_p->LcoreMainIsRunning = 1; rte_spinlock_unlock(&global_flag_stru_p->lock); cmdline_printf(cl, @@ -659,7 +659,7 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data) { - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { cmdline_printf(cl, "lcore_main not running on core:%d\n", @@ -700,7 +700,7 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data) { - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { cmdline_printf(cl, "lcore_main not running on core:%d\n", @@ -762,7 +762,7 @@ static void cmd_show_parsed(__rte_unused void *parsed_result, printf("\n"); } - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); cmdline_printf(cl, "Active_slaves:%d " "packets received:Tot:%d Arp:%d IPv4:%d\n", -- 2.25.1