summaryrefslogtreecommitdiff
path: root/drivers/net/softnic
diff options
context:
space:
mode:
authorReshma Pattan <reshma.pattan@intel.com>2018-09-11 15:20:36 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-10-12 17:59:01 +0200
commite12b1770900151cd5e5247d7555c14715d153b2c (patch)
tree490d07a68fdafa26097cc8339b045303342abf58 /drivers/net/softnic
parent51442e068453e91897b84cd6c04425119b8481f5 (diff)
downloaddpdk-next-eventdev-e12b1770900151cd5e5247d7555c14715d153b2c.zip
dpdk-next-eventdev-e12b1770900151cd5e5247d7555c14715d153b2c.tar.gz
dpdk-next-eventdev-e12b1770900151cd5e5247d7555c14715d153b2c.tar.xz
net/softnic: get eth device
Add utility function to get the rte_eth_dev from a given softnic. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Diffstat (limited to 'drivers/net/softnic')
-rw-r--r--drivers/net/softnic/rte_eth_softnic_internals.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index 9c587bc..1857ec5 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -18,6 +18,7 @@
#include <rte_table_action.h>
#include <rte_pipeline.h>
+#include <rte_ethdev_core.h>
#include <rte_ethdev_driver.h>
#include <rte_tm_driver.h>
#include <rte_flow_driver.h>
@@ -537,6 +538,22 @@ struct pmd_internals {
struct softnic_thread_data thread_data[RTE_MAX_LCORE];
};
+static inline struct rte_eth_dev *
+ETHDEV(struct pmd_internals *softnic)
+{
+ uint16_t port_id;
+ int status;
+
+ if (softnic == NULL)
+ return NULL;
+
+ status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id);
+ if (status)
+ return NULL;
+
+ return &rte_eth_devices[port_id];
+}
+
/**
* Ethdev Flow API
*/