On Mon, Aug 11, 2014 at 9:56 PM, Alex Wang <al...@nicira.com> wrote:
> Signed-off-by: Alex Wang <al...@nicira.com>
> ---
>  lib/netdev-dpdk.c |   14 ++++++++++++++
>  lib/netdev-dpdk.h |    8 ++++++++
>  2 files changed, 22 insertions(+)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 6ee9803..7298334 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -1442,6 +1442,20 @@ netdev_dpdk_register(void)
>      }
>  }
>
> +/* 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;
> +    }
> +}
This should be part of netdev_class api rather than dpdk specific API.
we should try to minimize dpdk specific call in dpif-netdev layer.

One more issue I noticed in this series is that socket and numa is
used interchangeably, can we use just one?

> +
>  int
>  pmd_thread_setaffinity_cpu(int cpu)
>  {
> diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h
> index e4ba6fc..75f6a0b 100644
> --- a/lib/netdev-dpdk.h
> +++ b/lib/netdev-dpdk.h
> @@ -4,6 +4,7 @@
>  #include <config.h>
>
>  struct dpif_packet;
> +struct netdev;
>
>  #ifdef DPDK_NETDEV
>
> @@ -22,6 +23,7 @@ struct dpif_packet;
>
>  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);
>  void thread_set_nonpmd(void);
> @@ -40,6 +42,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
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to