Signed-off-by: Maxim Uvarov <[email protected]>
---
platform/linux-generic/odp_packet_io.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/platform/linux-generic/odp_packet_io.c
b/platform/linux-generic/odp_packet_io.c
index c523350..501b2e9 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -156,6 +156,33 @@ odp_pktio_t odp_pktio_open(const char *dev,
odp_buffer_pool_t pool)
pktio_entry_t *pktio_entry;
int res;
int fanout = 1;
+ char loop0[IFNAMSIZ] = "eth0"; /* linux-generic loop0 device*/
+ char *loop_hint;
+
+ if (strlen(dev) > IFNAMSIZ) {
+ /* ioctl names limitation */
+ ODP_ERR("pktio name %s is too big, limit is %d bytes\n",
+ dev, IFNAMSIZ);
+ return ODP_PKTIO_INVALID;
+ }
+
+ loop_hint = getenv("ODP_PKTIO_LOOPDEV");
+ if (!strncmp(dev, "loop0", 5)) {
+ if (loop_hint && (strlen(loop_hint) > 0)) {
+ if (strlen(loop_hint) > IFNAMSIZ) {
+ ODP_ERR("pktio name %s is too big, limit is %d
bytes\n",
+ loop_hint, IFNAMSIZ);
+ return ODP_PKTIO_INVALID;
+ }
+
+ memset(loop0, 0, IFNAMSIZ);
+ memcpy(loop0, loop_hint, strlen(loop_hint));
+ ODP_DBG("pktio rename loop0 to %s\n", loop_hint);
+ } else {
+ ODP_DBG("pktio rename loop0 to eth0\n");
+ dev = loop0;
+ }
+ }
id = alloc_lock_pktio_entry();
if (id == ODP_PKTIO_INVALID) {
--
1.8.5.1.163.gd7aced9
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp