From: Reshma Pattan Date: Tue, 11 Sep 2018 14:20:36 +0000 (+0100) Subject: net/softnic: get eth device X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e12b1770900151cd5e5247d7555c14715d153b2c;p=dpdk.git net/softnic: get eth device Add utility function to get the rte_eth_dev from a given softnic. Signed-off-by: Cristian Dumitrescu Signed-off-by: Reshma Pattan --- diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index 9c587bc7d9..1857ec50d6 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -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 */