[dpdk-dev,1/3] net/avf/base: add spinlock functions

Message ID 1515653557-63430-2-git-send-email-wenzhuo.lu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Wenzhuo Lu Jan. 11, 2018, 6:52 a.m. UTC
  Move the spinlock functions to the base code,
and make them inline.
This patch is for next-net and want to be squashed
to the commit in fixes tag.

Fixes: 8267939627e7 ("net/avf/base: add base code for avf PMD")
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/avf/base/avf_osdep.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
  

Patch

diff --git a/drivers/net/avf/base/avf_osdep.h b/drivers/net/avf/base/avf_osdep.h
index 2f46bb2..9ef4596 100644
--- a/drivers/net/avf/base/avf_osdep.h
+++ b/drivers/net/avf/base/avf_osdep.h
@@ -156,6 +156,29 @@  struct avf_spinlock {
 #define avf_allocate_virt_mem(h, m, s) avf_allocate_virt_mem_d(h, m, s)
 #define avf_free_virt_mem(h, m) avf_free_virt_mem_d(h, m)
 
+static inline void
+avf_init_spinlock_d(struct avf_spinlock *sp)
+{
+	rte_spinlock_init(&sp->spinlock);
+}
+
+static inline void
+avf_acquire_spinlock_d(struct avf_spinlock *sp)
+{
+	rte_spinlock_lock(&sp->spinlock);
+}
+
+static inline void
+avf_release_spinlock_d(struct avf_spinlock *sp)
+{
+	rte_spinlock_unlock(&sp->spinlock);
+}
+
+static inline void
+avf_destroy_spinlock_d(__rte_unused struct avf_spinlock *sp)
+{
+}
+
 #define avf_init_spinlock(_sp) avf_init_spinlock_d(_sp)
 #define avf_acquire_spinlock(_sp) avf_acquire_spinlock_d(_sp)
 #define avf_release_spinlock(_sp) avf_release_spinlock_d(_sp)