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 DD8BC41D5F; Fri, 24 Feb 2023 16:12:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46F8E42BD9; Fri, 24 Feb 2023 16:12:14 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4BF0342BD9 for ; Fri, 24 Feb 2023 16:12:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677251532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+tkzNdYdaEMg7nLjjDLlht/iQdXqJxQW6oh+tndfXwk=; b=UqvY97ePgxj+HEVvhKVxsfw4GXxEwoJcvdL0K3chPGwbnZtfb48KmhZ+1oSybw+fYkZxcK Y6oGGoVsMNh9WOsemVMYlVfIM+4MPVApy1WBo032xkmUjCRI4MJ2HtzFgONr5mHWf2MWma A5maq9ls/+hWiO98BtALHSDvy7ikWeM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-ohh5oBEqNRC4kwBdkEEH7A-1; Fri, 24 Feb 2023 10:12:09 -0500 X-MC-Unique: ohh5oBEqNRC4kwBdkEEH7A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B5F395D605; Fri, 24 Feb 2023 15:12:09 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFA39C15BA0; Fri, 24 Feb 2023 15:12:07 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Jingjing Wu , Beilei Xing , Yuying Zhang , Qiming Yang , Qi Zhang Subject: [PATCH v2 06/20] drivers: inherit lock annotations for Intel drivers Date: Fri, 24 Feb 2023 16:11:29 +0100 Message-Id: <20230224151143.3274897-7-david.marchand@redhat.com> In-Reply-To: <20230224151143.3274897-1-david.marchand@redhat.com> References: <20230224081642.2566619-1-david.marchand@redhat.com> <20230224151143.3274897-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Due to clang limitation, inline helpers don't inherit lock annotations from the EAL lock API. Replace them with macros. Signed-off-by: David Marchand --- drivers/common/iavf/iavf_osdep.h | 39 ++++++-------------------- drivers/common/iavf/iavf_prototype.h | 6 ---- drivers/common/idpf/base/idpf_osdep.h | 26 +++-------------- drivers/net/i40e/base/i40e_osdep.h | 8 +++--- drivers/net/i40e/base/i40e_prototype.h | 5 ---- drivers/net/i40e/i40e_ethdev.c | 24 ---------------- drivers/net/ice/base/ice_osdep.h | 26 +++-------------- 7 files changed, 20 insertions(+), 114 deletions(-) diff --git a/drivers/common/iavf/iavf_osdep.h b/drivers/common/iavf/iavf_osdep.h index 31d3d809f9..263d92400c 100644 --- a/drivers/common/iavf/iavf_osdep.h +++ b/drivers/common/iavf/iavf_osdep.h @@ -170,11 +170,6 @@ struct iavf_virt_mem { u32 size; } __rte_packed; -/* SW spinlock */ -struct iavf_spinlock { - rte_spinlock_t spinlock; -}; - #define iavf_allocate_dma_mem(h, m, unused, s, a) \ iavf_allocate_dma_mem_d(h, m, s, a) #define iavf_free_dma_mem(h, m) iavf_free_dma_mem_d(h, m) @@ -182,32 +177,14 @@ struct iavf_spinlock { #define iavf_allocate_virt_mem(h, m, s) iavf_allocate_virt_mem_d(h, m, s) #define iavf_free_virt_mem(h, m) iavf_free_virt_mem_d(h, m) -static inline void -iavf_init_spinlock_d(struct iavf_spinlock *sp) -{ - rte_spinlock_init(&sp->spinlock); -} - -static inline void -iavf_acquire_spinlock_d(struct iavf_spinlock *sp) -{ - rte_spinlock_lock(&sp->spinlock); -} - -static inline void -iavf_release_spinlock_d(struct iavf_spinlock *sp) -{ - rte_spinlock_unlock(&sp->spinlock); -} - -static inline void -iavf_destroy_spinlock_d(__rte_unused struct iavf_spinlock *sp) -{ -} +/* SW spinlock */ +struct iavf_spinlock { + rte_spinlock_t spinlock; +}; -#define iavf_init_spinlock(_sp) iavf_init_spinlock_d(_sp) -#define iavf_acquire_spinlock(_sp) iavf_acquire_spinlock_d(_sp) -#define iavf_release_spinlock(_sp) iavf_release_spinlock_d(_sp) -#define iavf_destroy_spinlock(_sp) iavf_destroy_spinlock_d(_sp) +#define iavf_init_spinlock(sp) rte_spinlock_init(&(sp)->spinlock) +#define iavf_acquire_spinlock(sp) rte_spinlock_lock(&(sp)->spinlock) +#define iavf_release_spinlock(sp) rte_spinlock_unlock(&(sp)->spinlock) +#define iavf_destroy_spinlock(sp) RTE_SET_USED(sp) #endif /* _IAVF_OSDEP_H_ */ diff --git a/drivers/common/iavf/iavf_prototype.h b/drivers/common/iavf/iavf_prototype.h index b5124de5bf..ba78ec5169 100644 --- a/drivers/common/iavf/iavf_prototype.h +++ b/drivers/common/iavf/iavf_prototype.h @@ -76,12 +76,6 @@ STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype) return iavf_ptype_lookup[ptype]; } -/* prototype for functions used for SW spinlocks */ -void iavf_init_spinlock(struct iavf_spinlock *sp); -void iavf_acquire_spinlock(struct iavf_spinlock *sp); -void iavf_release_spinlock(struct iavf_spinlock *sp); -void iavf_destroy_spinlock(struct iavf_spinlock *sp); - __rte_internal void iavf_vf_parse_hw_config(struct iavf_hw *hw, struct virtchnl_vf_resource *msg); diff --git a/drivers/common/idpf/base/idpf_osdep.h b/drivers/common/idpf/base/idpf_osdep.h index 99ae9cf60a..49bd7c4b21 100644 --- a/drivers/common/idpf/base/idpf_osdep.h +++ b/drivers/common/idpf/base/idpf_osdep.h @@ -210,28 +210,10 @@ struct idpf_lock { rte_spinlock_t spinlock; }; -static inline void -idpf_init_lock(struct idpf_lock *sp) -{ - rte_spinlock_init(&sp->spinlock); -} - -static inline void -idpf_acquire_lock(struct idpf_lock *sp) -{ - rte_spinlock_lock(&sp->spinlock); -} - -static inline void -idpf_release_lock(struct idpf_lock *sp) -{ - rte_spinlock_unlock(&sp->spinlock); -} - -static inline void -idpf_destroy_lock(__rte_unused struct idpf_lock *sp) -{ -} +#define idpf_init_lock(sp) rte_spinlock_init(&(sp)->spinlock) +#define idpf_acquire_lock(sp) rte_spinlock_lock(&(sp)->spinlock) +#define idpf_release_lock(sp) rte_spinlock_unlock(&(sp)->spinlock) +#define idpf_destroy_lock(sp) RTE_SET_USED(sp) struct idpf_hw; diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h index 51537c5cf3..aa5dc61841 100644 --- a/drivers/net/i40e/base/i40e_osdep.h +++ b/drivers/net/i40e/base/i40e_osdep.h @@ -215,10 +215,10 @@ struct i40e_spinlock { rte_spinlock_t spinlock; }; -#define i40e_init_spinlock(_sp) i40e_init_spinlock_d(_sp) -#define i40e_acquire_spinlock(_sp) i40e_acquire_spinlock_d(_sp) -#define i40e_release_spinlock(_sp) i40e_release_spinlock_d(_sp) -#define i40e_destroy_spinlock(_sp) i40e_destroy_spinlock_d(_sp) +#define i40e_init_spinlock(sp) rte_spinlock_init(&(sp)->spinlock) +#define i40e_acquire_spinlock(sp) rte_spinlock_lock(&(sp)->spinlock) +#define i40e_release_spinlock(sp) rte_spinlock_unlock(&(sp)->spinlock) +#define i40e_destroy_spinlock(sp) RTE_SET_USED(sp) #define I40E_NTOHS(a) rte_be_to_cpu_16(a) #define I40E_NTOHL(a) rte_be_to_cpu_32(a) diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h index 29c86c7fe8..691c977172 100644 --- a/drivers/net/i40e/base/i40e_prototype.h +++ b/drivers/net/i40e/base/i40e_prototype.h @@ -546,11 +546,6 @@ i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed) } } #endif /* PF_DRIVER */ -/* prototype for functions used for SW spinlocks */ -void i40e_init_spinlock(struct i40e_spinlock *sp); -void i40e_acquire_spinlock(struct i40e_spinlock *sp); -void i40e_release_spinlock(struct i40e_spinlock *sp); -void i40e_destroy_spinlock(struct i40e_spinlock *sp); /* i40e_common for VF drivers*/ void i40e_vf_parse_hw_config(struct i40e_hw *hw, diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7726a89d99..cf2969f6ce 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -4622,30 +4622,6 @@ i40e_free_virt_mem_d(__rte_unused struct i40e_hw *hw, return I40E_SUCCESS; } -void -i40e_init_spinlock_d(struct i40e_spinlock *sp) -{ - rte_spinlock_init(&sp->spinlock); -} - -void -i40e_acquire_spinlock_d(struct i40e_spinlock *sp) -{ - rte_spinlock_lock(&sp->spinlock); -} - -void -i40e_release_spinlock_d(struct i40e_spinlock *sp) -{ - rte_spinlock_unlock(&sp->spinlock); -} - -void -i40e_destroy_spinlock_d(__rte_unused struct i40e_spinlock *sp) -{ - return; -} - /** * Get the hardware capabilities, which will be parsed * and saved into struct i40e_hw. diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h index 4b92057521..0e14b934c8 100644 --- a/drivers/net/ice/base/ice_osdep.h +++ b/drivers/net/ice/base/ice_osdep.h @@ -211,28 +211,10 @@ struct ice_lock { rte_spinlock_t spinlock; }; -static inline void -ice_init_lock(struct ice_lock *sp) -{ - rte_spinlock_init(&sp->spinlock); -} - -static inline void -ice_acquire_lock(struct ice_lock *sp) -{ - rte_spinlock_lock(&sp->spinlock); -} - -static inline void -ice_release_lock(struct ice_lock *sp) -{ - rte_spinlock_unlock(&sp->spinlock); -} - -static inline void -ice_destroy_lock(__rte_unused struct ice_lock *sp) -{ -} +#define ice_init_lock(sp) rte_spinlock_init(&(sp)->spinlock) +#define ice_acquire_lock(sp) rte_spinlock_lock(&(sp)->spinlock) +#define ice_release_lock(sp) rte_spinlock_unlock(&(sp)->spinlock) +#define ice_destroy_lock(sp) RTE_SET_USED(sp) struct ice_hw; -- 2.39.2