doc: announce removal of LPM memory location
[dpdk.git] / lib / librte_kni / rte_kni.h
index a409f1f..52ffdb7 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
+ *
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -47,7 +47,8 @@
  */
 
 #include <rte_pci.h>
-#include <rte_mbuf.h>
+#include <rte_memory.h>
+#include <rte_mempool.h>
 
 #include <exec-env/rte_kni_common.h>
 
@@ -56,6 +57,7 @@ extern "C" {
 #endif
 
 struct rte_kni;
+struct rte_mbuf;
 
 /**
  * Structure which has the function pointers for KNI interface.
@@ -89,12 +91,28 @@ struct rte_kni_conf {
        uint8_t force_bind : 1; /* Flag to bind kernel thread */
 };
 
+/**
+ * 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,8 +157,10 @@ 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 existant KNI interface.
+ *  The pointer to the context of an existent KNI interface.
  *
  * @return
  *  - 0 indicates success.
@@ -149,15 +169,15 @@ extern struct rte_kni *rte_kni_create(uint8_t port_id,
 extern int rte_kni_release(struct rte_kni *kni);
 
 /**
- * It is used to handle the request mbufs sent from kernel space. 
+ * It is used to handle the request mbufs sent from kernel space.
  * Then analyzes it and calls the specific actions for the specific requests.
  * Finally constructs the response mbuf and puts it back to the resp_q.
  *
  * @param kni
- *  The pointer to the context of an existant KNI interface.
+ *  The pointer to the context of an existent KNI interface.
  *
  * @return
- *  - 0 
+ *  - 0
  *  - negative value indicates failure.
  */
 extern int rte_kni_handle_request(struct rte_kni *kni);
@@ -227,6 +247,16 @@ extern uint8_t rte_kni_get_port_id(struct rte_kni *kni) \
  */
 extern struct rte_kni *rte_kni_get(const char *name);
 
+/**
+ * Get the name given to a KNI device
+ *
+ * @param kni
+ *   The KNI instance to query
+ * @return
+ *   The pointer to the KNI name
+ */
+extern const char *rte_kni_get_name(const struct rte_kni *kni);
+
 /**
  * Get the KNI context of the specific port.
  *
@@ -235,7 +265,7 @@ extern struct rte_kni *rte_kni_get(const char *name);
  * @param port_id
  *  the port id.
  *
- * @return 
+ * @return
  *  On success: Pointer to KNI interface.
  *  On failure: NULL
  */
@@ -246,9 +276,9 @@ extern struct rte_kni *rte_kni_info_get(uint8_t port_id) \
  * Register KNI request handling for a specified port,and it can
  * be called by master process or slave process.
  *
- * @param kni 
- *  pointer to struct rte_kni. 
- * @param ops 
+ * @param kni
+ *  pointer to struct rte_kni.
+ * @param ops
  *  ponter to struct rte_kni_ops.
  *
  * @return
@@ -260,9 +290,9 @@ extern int rte_kni_register_handlers(struct rte_kni *kni,
 
 /**
  *  Unregister KNI request handling for a specified port.
- * 
- *  @param kni 
- *   pointer to struct rte_kni. 
+ *
+ *  @param kni
+ *   pointer to struct rte_kni.
  *
  *  @return
  *   On success: 0
@@ -271,12 +301,7 @@ extern int rte_kni_register_handlers(struct rte_kni *kni,
 extern int rte_kni_unregister_handlers(struct rte_kni *kni);
 
 /**
- *  close KNI device.
- * 
- *  @param void
- *
- *  @return 
- *   void
+ *  Close KNI device.
  */
 extern void rte_kni_close(void);
 
@@ -285,4 +310,3 @@ extern void rte_kni_close(void);
 #endif
 
 #endif /* _RTE_KNI_H_ */
-