Signed-off-by: Alex Wang <al...@nicira.com> --- lib/netdev-dpdk.c | 14 ++++++++++++++ lib/netdev-dpdk.h | 11 +++++++++++ 2 files changed, 25 insertions(+)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c43049a..0e91b43 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1253,6 +1253,20 @@ netdev_dpdk_register(void) netdev_register_provider(&netdev_dpdk_class); } +/* Returns the 'socket_id' if 'netdev_' is class dpdk. Otherwise, + * return -1. */ +int +netdev_dpdk_get_socket_id(const struct netdev *netdev_) +{ + if (is_dpdk_class(netdev_->netdev_class)) { + struct netdev_dpdk *netdev = netdev_dpdk_cast(netdev_); + + return netdev->socket_id; + } else { + return -1; + } +} + int pmd_thread_setaffinity_cpu(int cpu) { diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h index f443a21..da507ce 100644 --- a/lib/netdev-dpdk.h +++ b/lib/netdev-dpdk.h @@ -20,13 +20,18 @@ struct dpif_packet; #include <rte_launch.h> #include <rte_malloc.h> +struct netdev; + int dpdk_init(int argc, char **argv); void netdev_dpdk_register(void); +int netdev_dpdk_get_socket_id(const struct netdev *); void free_dpdk_buf(struct dpif_packet *); int pmd_thread_setaffinity_cpu(int cpu); #else +struct netdev; + static inline int dpdk_init(int arg1 OVS_UNUSED, char **arg2 OVS_UNUSED) { @@ -39,6 +44,12 @@ netdev_dpdk_register(void) /* Nothing */ } +static inline int +netdev_dpdk_get_socket_id(const struct netdev *netdev_ OVS_UNUSED) +{ + return -1; +} + static inline void free_dpdk_buf(struct dpif_packet *buf OVS_UNUSED) { -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev