summaryrefslogtreecommitdiff
path: root/lib/librte_kni/rte_kni.h
diff options
context:
space:
mode:
authorIntel <intel.com>2013-09-18 12:00:00 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2013-10-09 16:16:15 +0200
commitfbf895d44cfebf7bd92bb4edf3f7ff15365e57a5 (patch)
treef723b0d22fb5f0dfd5eb4a37204c2d2bb6cf678b /lib/librte_kni/rte_kni.h
parent0b44a857c8b4e3ba4e2f24d5bb4cc52acbafa897 (diff)
downloaddpdk-fbf895d44cfebf7bd92bb4edf3f7ff15365e57a5.zip
dpdk-fbf895d44cfebf7bd92bb4edf3f7ff15365e57a5.tar.gz
dpdk-fbf895d44cfebf7bd92bb4edf3f7ff15365e57a5.tar.xz
kni: identify device by name
Some old API functions based on port_id are deprecated. Signed-off-by: Intel
Diffstat (limited to 'lib/librte_kni/rte_kni.h')
-rw-r--r--lib/librte_kni/rte_kni.h82
1 files changed, 73 insertions, 9 deletions
diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h
index e3a2547..8be6281 100644
--- a/lib/librte_kni/rte_kni.h
+++ b/lib/librte_kni/rte_kni.h
@@ -46,8 +46,11 @@
* and burst transmit packets to KNI interfaces.
*/
+#include <rte_pci.h>
#include <rte_mbuf.h>
+#include <exec-env/rte_kni_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -58,6 +61,8 @@ struct rte_kni;
* Structure which has the function pointers for KNI interface.
*/
struct rte_kni_ops {
+ uint8_t port_id; /* Port ID */
+
/* Pointer to function of changing MTU */
int (*change_mtu)(uint8_t port_id, unsigned new_mtu);
@@ -66,24 +71,65 @@ struct rte_kni_ops {
};
/**
- * Create kni interface according to the port id. It will create a paired KNI
- * interface in the kernel space for each NIC port. The KNI interface created
+ * Structure for configuring KNI device.
+ */
+struct rte_kni_conf {
+ /*
+ * KNI name which will be used in relevant network device.
+ * Let the name as short as possible, as it will be part of
+ * memzone name.
+ */
+ char name[RTE_KNI_NAMESIZE];
+ uint16_t group_id; /* Group ID */
+ unsigned mbuf_size; /* mbuf size */
+ struct rte_pci_addr addr;
+ struct rte_pci_id id;
+};
+
+/**
+ * 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.
*
- * @param port_id
- * The port id.
* @param pktmbuf_pool
* The mempool for allocting mbufs for packets.
+ * @param conf
+ * The pointer to the configurations of the KNI device.
+ * @param ops
+ * The pointer to the callbacks for the KNI kernel requests.
+ *
+ * @return
+ * - The pointer to the context of a KNI interface.
+ * - NULL indicate error.
+ */
+extern struct rte_kni *rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
+ const struct rte_kni_conf *conf,
+ struct rte_kni_ops *ops);
+
+/**
+ * It create a KNI device for specific port.
+ *
+ * Note: It is deprecated and just for backward compatibility.
+ *
+ * @param port_id
+ * Port ID.
* @param mbuf_size
- * The mbuf size to store a packet.
+ * mbuf size.
+ * @param pktmbuf_pool
+ * The mempool for allocting mbufs for packets.
+ * @param ops
+ * The pointer to the callbacks for the KNI kernel requests.
*
* @return
* - The pointer to the context of a KNI interface.
* - NULL indicate error.
*/
-extern struct rte_kni *rte_kni_create(uint8_t port_id, unsigned mbuf_size,
- struct rte_mempool *pktmbuf_pool, struct rte_kni_ops *ops);
+extern struct rte_kni *rte_kni_create(uint8_t port_id,
+ unsigned mbuf_size,
+ struct rte_mempool *pktmbuf_pool,
+ struct rte_kni_ops *ops) \
+ __attribute__ ((deprecated));
/**
* Release KNI interface according to the context. It will also release the
@@ -154,6 +200,8 @@ extern unsigned rte_kni_tx_burst(struct rte_kni *kni,
/**
* Get the port id from KNI interface.
*
+ * Note: It is deprecated and just for backward compatibility.
+ *
* @param kni
* The KNI interface context.
*
@@ -161,11 +209,26 @@ extern unsigned rte_kni_tx_burst(struct rte_kni *kni,
* On success: The port id.
* On failure: ~0x0
*/
-extern uint8_t rte_kni_get_port_id(struct rte_kni *kni);
+extern uint8_t rte_kni_get_port_id(struct rte_kni *kni) \
+ __attribute__ ((deprecated));
+
+/**
+ * Get the KNI context of its name.
+ *
+ * @param name
+ * pointer to the KNI device name.
+ *
+ * @return
+ * On success: Pointer to KNI interface.
+ * On failure: NULL.
+ */
+extern struct rte_kni *rte_kni_get(const char *name);
/**
* Get the KNI context of the specific port.
*
+ * Note: It is deprecated and just for backward compatibility.
+ *
* @param port_id
* the port id.
*
@@ -173,7 +236,8 @@ extern uint8_t rte_kni_get_port_id(struct rte_kni *kni);
* On success: Pointer to KNI interface.
* On failure: NULL
*/
-extern struct rte_kni * rte_kni_info_get(uint8_t port_id);
+extern struct rte_kni *rte_kni_info_get(uint8_t port_id) \
+ __attribute__ ((deprecated));
/**
* Register KNI request handling for a specified port,and it can