Skip to content

Commit

Permalink
dpdk: New module with some code from netdev-dpdk.
Browse files Browse the repository at this point in the history
There's a lot of code in netdev-dpdk which is not at all related to the
netdev interface, mostly the library initialization code.

This commit moves it to a new 'dpdk' module, to simplify 'netdev-dpdk'.

Also a new module 'dpdk-stub' is introduced to implement some functions
when DPDK is not available.  This replaces the old 'netdev-nodpdk'
module.

Some redundant includes are removed or reorganized as a consequence.

No functional change.

CC: Aaron Conole <[email protected]>
Signed-off-by: Daniele Di Proietto <[email protected]>
Acked-by: Aaron Conole <[email protected]>
Tested-by: Aaron Conole <[email protected]>
  • Loading branch information
ddiproietto committed Oct 12, 2016
1 parent 05b49df commit 01961bb
Show file tree
Hide file tree
Showing 11 changed files with 528 additions and 455 deletions.
9 changes: 5 additions & 4 deletions lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ lib_libopenvswitch_la_SOURCES = \
lib/dpctl.h \
lib/dp-packet.h \
lib/dp-packet.c \
lib/dpdk.h \
lib/dpif-netdev.c \
lib/dpif-netdev.h \
lib/dpif-provider.h \
Expand Down Expand Up @@ -128,6 +129,7 @@ lib_libopenvswitch_la_SOURCES = \
lib/meta-flow.c \
lib/multipath.c \
lib/multipath.h \
lib/netdev-dpdk.h \
lib/netdev-dummy.c \
lib/netdev-provider.h \
lib/netdev-vport.c \
Expand Down Expand Up @@ -368,12 +370,11 @@ endif

if DPDK_NETDEV
lib_libopenvswitch_la_SOURCES += \
lib/netdev-dpdk.c \
lib/netdev-dpdk.h
lib/dpdk.c \
lib/netdev-dpdk.c
else
lib_libopenvswitch_la_SOURCES += \
lib/netdev-nodpdk.c \
lib/netdev-dpdk.h
lib/dpdk-stub.c
endif

if WIN32
Expand Down
5 changes: 3 additions & 2 deletions lib/dp-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include "openvswitch/dynamic-string.h"
#include "netdev-dpdk.h"

#include "dp-packet.h"
#include "netdev-dpdk.h"
#include "openvswitch/dynamic-string.h"
#include "util.h"

static void
Expand Down
8 changes: 7 additions & 1 deletion lib/dp-packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@

#include <stddef.h>
#include <stdint.h>

#ifdef DPDK_NETDEV
#include <rte_config.h>
#include <rte_mbuf.h>
#endif

#include "netdev-dpdk.h"
#include "openvswitch/list.h"
#include "packets.h"
#include "util.h"
#include "netdev-dpdk.h"

#ifdef __cplusplus
extern "C" {
Expand Down
16 changes: 15 additions & 1 deletion lib/netdev-nodpdk.c → lib/dpdk-stub.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2014, 2015, 2016 Nicira, Inc.
* Copyright (c) 2016 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,7 +16,8 @@
*/

#include <config.h>
#include "netdev-dpdk.h"
#include "dpdk.h"

#include "smap.h"
#include "ovs-thread.h"
#include "openvswitch/vlog.h"
Expand All @@ -34,3 +36,15 @@ dpdk_init(const struct smap *ovs_other_config)
ovsthread_once_done(&once);
}
}

void
dpdk_set_lcore_id(unsigned cpu OVS_UNUSED)
{
/* Nothing */
}

const char *
dpdk_get_vhost_sock_dir(void)
{
return NULL;
}
Loading

0 comments on commit 01961bb

Please sign in to comment.