summaryrefslogtreecommitdiff
path: root/lib/librte_kni/rte_kni.h
diff options
context:
space:
mode:
authorMarc Sune <marc.sune@bisdn.de>2014-10-21 12:46:55 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-10-21 17:24:53 +0200
commit0c6bc8ef70ba3f3043d3fbd25cc535a4f1b8098d (patch)
tree61c323c1c2c1fbf757b5193cb79f293849eb544d /lib/librte_kni/rte_kni.h
parent3ead3080aaf77c984044f1e911a276a54a3c625b (diff)
downloaddpdk-0c6bc8ef70ba3f3043d3fbd25cc535a4f1b8098d.zip
dpdk-0c6bc8ef70ba3f3043d3fbd25cc535a4f1b8098d.tar.gz
dpdk-0c6bc8ef70ba3f3043d3fbd25cc535a4f1b8098d.tar.xz
kni: memzone pool for alloc and release
The previous implementation of rte_kni_alloc() was allocating memzones with a name composed of a fixed string and the interface name. When an application was allocating and deallocating multiple interfaces with different names, memzones were quickly exhausted, even though memzones from deallocated interfaces were never used anymore (unless an interface with the same name was re-allocated). As a result, the application was unable to allocate more KNI interfaces with different names. This patch implements the KNI memzone pool in order to prevent memzone exhaustion when allocating/deallocating KNI interfaces. It adds a new API call, rte_kni_init(max_kni_ifaces) that shall be called before any call to rte_kni_alloc() if KNI is used. The memzones are pre-allocated with interface- independent names so that they can be reused. Signed-off-by: Marc Sune <marc.sune@bisdn.de> Acked-by: Helin Zhang <helin.zhang@intel.com>
Diffstat (limited to 'lib/librte_kni/rte_kni.h')
-rw-r--r--lib/librte_kni/rte_kni.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h
index 1a0b004..815b8e2 100644
--- a/lib/librte_kni/rte_kni.h
+++ b/lib/librte_kni/rte_kni.h
@@ -90,11 +90,27 @@ struct rte_kni_conf {
};
/**
+ * Initialize and preallocate KNI subsystem
+ *
+ * This function is to be executed on the MASTER lcore only, after EAL
+ * initialization and before any KNI interface is attempted to be
+ * allocated
+ *
+ * @param max_kni_ifaces
+ * The maximum number of KNI interfaces that can coexist concurrently
+ */
+extern void rte_kni_init(unsigned int max_kni_ifaces);
+
+
+/**
* Allocate KNI interface according to the port id, mbuf size, mbuf pool,
* configurations and callbacks for kernel requests.The KNI interface created
* in the kernel space is the net interface the traditional Linux application
* talking to.
*
+ * The rte_kni_alloc shall not be called before rte_kni_init() has been
+ * called. rte_kni_alloc is thread safe.
+ *
* @param pktmbuf_pool
* The mempool for allocting mbufs for packets.
* @param conf
@@ -139,6 +155,8 @@ extern struct rte_kni *rte_kni_create(uint8_t port_id,
* paired KNI interface in kernel space. All processing on the specific KNI
* context need to be stopped before calling this interface.
*
+ * rte_kni_release is thread safe.
+ *
* @param kni
* The pointer to the context of an existent KNI interface.
*