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 85C36A04A4 for ; Tue, 1 Mar 2022 15:44:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A87942704; Tue, 1 Mar 2022 15:44:25 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 220C9426DE for ; Tue, 1 Mar 2022 15:44:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646145863; x=1677681863; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qc/3elsjB2A3qZ0+in0AsEfDLCwlgDobZfxxtC9Jwmg=; b=m2QAS6HAxLo/mYTxb+JPU8jwQlIZ/t2rY7caVkjwJCAu++Xg0Z3J1BkM A+UelVNrvhuK0FuQz1jNbndVZvB4hPFxltlbvrgyzQm9h30Q/OBhPSg4k 4ujf+wfbRS0oK79AXmRkl9wRWBvN6ETqMBnqknjhKfI+xVt/9+9NhDgja CicRXXgedQqYm5T8Dq0PlDNFac+3E9k+SBP8UJSxV8+zhTjc+rUnQuvXz Y/lxCLqQhqArPdLK8ROJj3MaAPdm3nSQD6WCFsnjY7lkEildwD2o55nNE Mum1JtocL41Rdbv/DupSbu51vG68bgYsDDBLHEjbQK5p/ftBJ9wZMgsU6 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="233760082" X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="233760082" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 06:44:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="641284243" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga004.jf.intel.com with ESMTP; 01 Mar 2022 06:44:10 -0800 From: Bruce Richardson To: stable@dpdk.org Cc: christian.ehrhardt@canonical.com, Bruce Richardson Subject: [PATCH 19.11 v2 2/5] eal: fix C++ include Date: Tue, 1 Mar 2022 14:44:00 +0000 Message-Id: <20220301144403.411190-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220301144403.411190-1-bruce.richardson@intel.com> References: <20220301140838.406891-1-bruce.richardson@intel.com> <20220301144403.411190-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org C++ files could not include some headers because "new" is a keyword in C++, so can't be a variable name Fixes: 184104fc6121 ("ticketlock: introduce fair ticket based locking") Cc: stable@dpdk.org (This is a backport of patch 59144f6edd from mainline) Signed-off-by: Bruce Richardson --- .../common/include/generic/rte_ticketlock.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/common/include/generic/rte_ticketlock.h b/lib/librte_eal/common/include/generic/rte_ticketlock.h index d9bec87692..5f432cfbe8 100644 --- a/lib/librte_eal/common/include/generic/rte_ticketlock.h +++ b/lib/librte_eal/common/include/generic/rte_ticketlock.h @@ -96,13 +96,13 @@ __rte_experimental static inline int rte_ticketlock_trylock(rte_ticketlock_t *tl) { - rte_ticketlock_t old, new; - old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED); - new.tickets = old.tickets; - new.s.next++; - if (old.s.next == old.s.current) { - if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets, - new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) + rte_ticketlock_t oldl, newl; + oldl.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED); + newl.tickets = oldl.tickets; + newl.s.next++; + if (oldl.s.next == oldl.s.current) { + if (__atomic_compare_exchange_n(&tl->tickets, &oldl.tickets, + newl.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) return 1; } -- 2.32.0