Add a getter function for using the dpdk port id outside the scope of
netdev-dpdk.c.

Signed-off-by: Eli Britstein <el...@mellanox.com>
Reviewed-by: Oz Shlomo <o...@mellanox.com>
---
 lib/netdev-dpdk.c | 9 +++++++++
 lib/netdev-dpdk.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c509ffad3..ed8d99f1a 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -4422,6 +4422,15 @@ unlock:
     return err;
 }
 
+int
+netdev_dpdk_get_port_id(const struct netdev *netdev)
+{
+    if (!is_dpdk_class(netdev->netdev_class)) {
+        return -1;
+    }
+    return CONTAINER_OF(netdev, struct netdev_dpdk, up)->port_id;
+}
+
 bool
 netdev_dpdk_flow_api_supported(struct netdev *netdev)
 {
diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h
index 8e79bcdf8..54582ed90 100644
--- a/lib/netdev-dpdk.h
+++ b/lib/netdev-dpdk.h
@@ -56,6 +56,8 @@ netdev_dpdk_rte_flow_query(struct netdev *netdev,
                            struct rte_flow *rte_flow,
                            struct rte_flow_query_count *query,
                            struct rte_flow_error *error);
+int
+netdev_dpdk_get_port_id(const struct netdev *netdev);
 
 #else
 
-- 
2.14.5

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to