diff mbox

api: implement odp_pktio_name

Message ID 1421148468-6446-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Jan. 13, 2015, 11:27 a.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-generic/include/api/odp_packet_io.h | 11 +++++++++++
 platform/linux-generic/odp_packet_io.c             | 11 +++++++++++
 2 files changed, 22 insertions(+)
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h
index 0c34f29..7c4c19d 100644
--- a/platform/linux-generic/include/api/odp_packet_io.h
+++ b/platform/linux-generic/include/api/odp_packet_io.h
@@ -168,6 +168,17 @@  int odp_pktio_promisc_mode(odp_pktio_t id);
 size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
 			  size_t addr_size);
 
+/*
+ * Return the interface name from a pktio handle. This is the
+ * name that was passed to the odp_pktio_open() call.
+ *
+ * @param id ODP Packet IO handle.
+ *
+ * @retval Pointer to the interface name.
+ * @retval NULL if packet handle is invalid.
+ */
+const char *odp_pktio_name(odp_pktio_t id);
+
 /**
  * @}
  */
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index cd109d2..7b08edf 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -746,3 +746,14 @@  size_t odp_pktio_mac_addr(odp_pktio_t id, void *mac_addr,
 
 	return ETH_ALEN;
 }
+
+const char *odp_pktio_name(odp_pktio_t id)
+{
+	pktio_entry_t *entry;
+
+	entry = get_pktio_entry(id);
+	if (entry == NULL)
+		return NULL;
+
+	return entry->s.name;
+}