eal: add API to lock/unlock tailq list
[dpdk.git] / lib / librte_kni / rte_kni.c
index e60de2c..9dd5ebe 100644 (file)
@@ -219,7 +219,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
                return NULL;
        }
 
-       rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_write_lock();
 
        kni = __rte_kni_get(conf->name);
        if (kni != NULL) {
@@ -309,7 +309,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
        kni_list = RTE_TAILQ_CAST(rte_kni_tailq.head, rte_kni_list);
        TAILQ_INSERT_TAIL(kni_list, te, next);
 
-       rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_write_unlock();
 
        /* Allocate mbufs and then put them into alloc_q */
        kni_allocate_mbufs(kni);
@@ -323,7 +323,7 @@ mz_fail:
 kni_fail:
        rte_free(te);
 unlock:
-       rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_write_unlock();
 
        return NULL;
 }
@@ -386,7 +386,7 @@ rte_kni_release(struct rte_kni *kni)
 
        kni_list = RTE_TAILQ_CAST(rte_kni_tailq.head, rte_kni_list);
 
-       rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_write_lock();
 
        TAILQ_FOREACH(te, kni_list, next) {
                if (te->data == kni)
@@ -404,7 +404,7 @@ rte_kni_release(struct rte_kni *kni)
 
        TAILQ_REMOVE(kni_list, te, next);
 
-       rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_write_unlock();
 
        /* mbufs in all fifo should be released, except request/response */
 
@@ -428,7 +428,7 @@ rte_kni_release(struct rte_kni *kni)
        return 0;
 
 unlock:
-       rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_write_unlock();
 
        return -1;
 }
@@ -645,11 +645,11 @@ rte_kni_get(const char *name)
        if (name == NULL || name[0] == '\0')
                return NULL;
 
-       rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_read_lock();
 
        kni = __rte_kni_get(name);
 
-       rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK);
+       rte_mcfg_tailq_read_unlock();
 
        return kni;
 }