Add a one-parameter function to take an existing rte_ring and wrap it as
an ethdev, returning the port id of the new ethdev instance.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
+#include <rte_memzone.h>
#include <rte_string_fns.h>
#include <rte_dev.h>
#include <rte_kvargs.h>
return -1;
}
+int
+rte_eth_from_ring(struct rte_ring *r)
+{
+ return rte_eth_from_rings(r->name, &r, 1, &r, 1,
+ r->memzone ? r->memzone->socket_id : SOCKET_ID_ANY);
+}
+
enum dev_action{
DEV_CREATE,
DEV_ATTACH
const unsigned nb_tx_queues,
const unsigned numa_node);
+/**
+ * Create a new ethdev port from a ring
+ *
+ * This function is a shortcut call for rte_eth_from_rings for the
+ * case where one wants to take a single rte_ring and use it as though
+ * it were an ethdev
+ *
+ * @param ring
+ * the ring to be used as an ethdev
+ * @return
+ * the port number of the newly created ethdev, or -1 on error
+ */
+int rte_eth_from_ring(struct rte_ring *r);
+
#ifdef __cplusplus
}
#endif
local: *;
};
+
+DPDK_2.2 {
+ global:
+
+ rte_eth_from_ring;
+
+} DPDK_2.0;