X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_kni%2Frte_kni.c;h=9dd5ebe0ec9ce5f9bce690c8e2d5610e6108691d;hb=fb3ae0951abd05ff0dc9616a650d81b89c5ac33b;hp=e29d0cc7df3cc4a67070e6a400f911f1fce1bc19;hpb=ee3cac929ede469522461af1bae220bf440e726f;p=dpdk.git diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index e29d0cc7df..9dd5ebe0ec 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -97,6 +97,11 @@ static volatile int kni_fd = -1; int rte_kni_init(unsigned int max_kni_ifaces __rte_unused) { + if (rte_eal_iova_mode() != RTE_IOVA_PA) { + RTE_LOG(ERR, KNI, "KNI requires IOVA as PA\n"); + return -1; + } + /* Check FD and open */ if (kni_fd < 0) { kni_fd = open("/dev/" KNI_DEVICE, O_RDWR); @@ -214,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) { @@ -304,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); @@ -318,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; } @@ -381,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) @@ -399,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 */ @@ -423,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; } @@ -640,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; } @@ -709,7 +714,7 @@ rte_kni_unregister_handlers(struct rte_kni *kni) return 0; } -int __rte_experimental +int rte_kni_update_link(struct rte_kni *kni, unsigned int linkup) { char path[64];