[v2,06/20] drivers: inherit lock annotations for Intel drivers
Checks
Commit Message
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 <david.marchand@redhat.com>
---
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(-)
@@ -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_ */
@@ -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);
@@ -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;
@@ -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)
@@ -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,
@@ -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.
@@ -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;