kni: add kni close function
authorBruce Richardson <bruce.richardson@intel.com>
Wed, 12 Feb 2014 16:23:56 +0000 (16:23 +0000)
committerDavid Marchand <david.marchand@6wind.com>
Tue, 25 Feb 2014 20:29:19 +0000 (21:29 +0100)
KNI close function added.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_kni/rte_kni.c
lib/librte_kni/rte_kni.h

index 509ae52..a0daa23 100644 (file)
@@ -523,3 +523,12 @@ rte_kni_unregister_handlers(struct rte_kni *kni)
        kni->ops.config_network_if = NULL;
        return 0;
 }
        kni->ops.config_network_if = NULL;
        return 0;
 }
+void 
+rte_kni_close(void)
+{
+       if (kni_fd < 0)
+               return;
+
+       close(kni_fd);
+       kni_fd = -1;    
+}
index af458ef..a409f1f 100644 (file)
@@ -270,6 +270,16 @@ extern int rte_kni_register_handlers(struct rte_kni *kni,
  */
 extern int rte_kni_unregister_handlers(struct rte_kni *kni);
 
  */
 extern int rte_kni_unregister_handlers(struct rte_kni *kni);
 
+/**
+ *  close KNI device.
+ * 
+ *  @param void
+ *
+ *  @return 
+ *   void
+ */
+extern void rte_kni_close(void);
+
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif