From: Bruce Richardson Date: Wed, 27 May 2015 13:47:49 +0000 (+0100) Subject: kni: query the name of an instance X-Git-Tag: spdx-start~9065 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fdaff83d1ee1519662c74e9b4e2b51d55007a659;p=dpdk.git kni: query the name of an instance When a KNI object is created, a name is assigned to it which is stored internally. There is also an API function to look up a KNI object by name, but there is no API to query the current name of an existing KNI object. This patch adds just such an API. Signed-off-by: Bruce Richardson Acked-by: Helin Zhang --- diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 4e70fa0872..c5a008996f 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -674,6 +674,12 @@ rte_kni_get(const char *name) return NULL; } +const char * +rte_kni_get_name(const struct rte_kni *kni) +{ + return kni->name; +} + /* * It is deprecated and just for backward compatibility. */ diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 603e2cd099..fd2b78f59f 100644 --- a/lib/librte_kni/rte_kni.h +++ b/lib/librte_kni/rte_kni.h @@ -247,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. * diff --git a/lib/librte_kni/rte_kni_version.map b/lib/librte_kni/rte_kni_version.map index b0bbf4df61..a987d31f31 100644 --- a/lib/librte_kni/rte_kni_version.map +++ b/lib/librte_kni/rte_kni_version.map @@ -5,6 +5,7 @@ DPDK_2.0 { rte_kni_close; rte_kni_create; rte_kni_get; + rte_kni_get_name; rte_kni_get_port_id; rte_kni_handle_request; rte_kni_info_get;