2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif-linux: Rename dpif-netlink; change to compile with MSVC.

The patch contains the necessary modifications to compile and also to run
under MSVC.

Added the files to the build system and also changed dpif_linux to be under
a more generic name dpif_windows.

Added a TODO under the windows part in case we want to implement another
counterpart for epoll functions.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Alin Gabriel Serdean
2014-09-18 04:17:54 -07:00
committed by Ben Pfaff
parent 1a9bb326d8
commit 93451a0a81
9 changed files with 430 additions and 375 deletions

View File

@@ -232,7 +232,7 @@ requirements are unclear, please report this as a bug.
There are two existing dpif implementations that may serve as There are two existing dpif implementations that may serve as
useful examples during a port: useful examples during a port:
* lib/dpif-linux.c is a Linux-specific dpif implementation that * lib/dpif-netlink.c is a Linux-specific dpif implementation that
talks to an Open vSwitch-specific kernel module (whose sources talks to an Open vSwitch-specific kernel module (whose sources
are in the "datapath" directory). The kernel module performs are in the "datapath" directory). The kernel module performs
all of the switching work, passing packets that do not match any all of the switching work, passing packets that do not match any

View File

@@ -307,8 +307,8 @@ endif
if LINUX if LINUX
lib_libopenvswitch_la_SOURCES += \ lib_libopenvswitch_la_SOURCES += \
lib/dpif-linux.c \ lib/dpif-netlink.c \
lib/dpif-linux.h \ lib/dpif-netlink.h \
lib/netdev-linux.c \ lib/netdev-linux.c \
lib/netdev-linux.h \ lib/netdev-linux.h \
lib/netlink-notifier.c \ lib/netlink-notifier.c \
@@ -332,6 +332,8 @@ endif
if WIN32 if WIN32
lib_libopenvswitch_la_SOURCES += \ lib_libopenvswitch_la_SOURCES += \
lib/dpif-netlink.c \
lib/dpif-netlink.h \
lib/netlink-notifier.c \ lib/netlink-notifier.c \
lib/netlink-notifier.h \ lib/netlink-notifier.h \
lib/netlink-protocol.h \ lib/netlink-protocol.h \

File diff suppressed because it is too large Load Diff

View File

@@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef DPIF_LINUX_H #ifndef DPIF_NETLINK_H
#define DPIF_LINUX_H 1 #define DPIF_NETLINK_H 1
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
@@ -26,7 +26,7 @@
struct ofpbuf; struct ofpbuf;
struct dpif_linux_vport { struct dpif_netlink_vport {
/* Generic Netlink header. */ /* Generic Netlink header. */
uint8_t cmd; uint8_t cmd;
@@ -48,14 +48,14 @@ struct dpif_linux_vport {
size_t options_len; size_t options_len;
}; };
void dpif_linux_vport_init(struct dpif_linux_vport *); void dpif_netlink_vport_init(struct dpif_netlink_vport *);
int dpif_linux_vport_transact(const struct dpif_linux_vport *request, int dpif_netlink_vport_transact(const struct dpif_netlink_vport *request,
struct dpif_linux_vport *reply, struct dpif_netlink_vport *reply,
struct ofpbuf **bufp); struct ofpbuf **bufp);
int dpif_linux_vport_get(const char *name, struct dpif_linux_vport *reply, int dpif_netlink_vport_get(const char *name, struct dpif_netlink_vport *reply,
struct ofpbuf **bufp); struct ofpbuf **bufp);
bool dpif_linux_is_internal_device(const char *name); bool dpif_netlink_is_internal_device(const char *name);
#endif /* dpif-linux.h */ #endif /* dpif-netlink.h */

View File

@@ -358,7 +358,7 @@ struct dpif_class {
void (*disable_upcall)(struct dpif *); void (*disable_upcall)(struct dpif *);
}; };
extern const struct dpif_class dpif_linux_class; extern const struct dpif_class dpif_netlink_class;
extern const struct dpif_class dpif_netdev_class; extern const struct dpif_class dpif_netdev_class;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -59,8 +59,8 @@ COVERAGE_DEFINE(dpif_purge);
COVERAGE_DEFINE(dpif_execute_with_help); COVERAGE_DEFINE(dpif_execute_with_help);
static const struct dpif_class *base_dpif_classes[] = { static const struct dpif_class *base_dpif_classes[] = {
#ifdef __linux__ #if defined(__linux__) || defined(_WIN32)
&dpif_linux_class, &dpif_netlink_class,
#endif #endif
&dpif_netdev_class, &dpif_netdev_class,
}; };
@@ -1524,7 +1524,7 @@ log_flow_del_message(struct dpif *dpif, const struct dpif_flow_del *del,
* called after the dpif_provider's '->execute' function, which is allowed to * called after the dpif_provider's '->execute' function, which is allowed to
* modify execute->packet and execute->md. In practice, though: * modify execute->packet and execute->md. In practice, though:
* *
* - dpif-linux doesn't modify execute->packet or execute->md. * - dpif-netlink doesn't modify execute->packet or execute->md.
* *
* - dpif-netdev does modify them but it is less likely to have problems * - dpif-netdev does modify them but it is less likely to have problems
* because it is built into ovs-vswitchd and cannot have version skew, * because it is built into ovs-vswitchd and cannot have version skew,

View File

@@ -83,8 +83,8 @@ const char *flow_tun_flag_to_string(uint32_t flags);
* *
* The meaning of 'in_port' is context-dependent. In most cases, it is a * The meaning of 'in_port' is context-dependent. In most cases, it is a
* 16-bit OpenFlow 1.0 port number. In the software datapath interface (dpif) * 16-bit OpenFlow 1.0 port number. In the software datapath interface (dpif)
* layer and its implementations (e.g. dpif-linux, dpif-netdev), it is instead * layer and its implementations (e.g. dpif-netlink, dpif-netdev), it is
* a 32-bit datapath port number. * instead a 32-bit datapath port number.
* *
* The fields are organized in four segments to facilitate staged lookup, where * The fields are organized in four segments to facilitate staged lookup, where
* lower layer fields are first used to determine if the later fields need to * lower layer fields are first used to determine if the later fields need to

View File

@@ -48,7 +48,7 @@
#include <unistd.h> #include <unistd.h>
#include "coverage.h" #include "coverage.h"
#include "dpif-linux.h" #include "dpif-netlink.h"
#include "dpif-netdev.h" #include "dpif-netdev.h"
#include "dynamic-string.h" #include "dynamic-string.h"
#include "fatal-signal.h" #include "fatal-signal.h"
@@ -1523,11 +1523,11 @@ netdev_stats_from_ovs_vport_stats(struct netdev_stats *dst,
static int static int
get_stats_via_vport__(const struct netdev *netdev, struct netdev_stats *stats) get_stats_via_vport__(const struct netdev *netdev, struct netdev_stats *stats)
{ {
struct dpif_linux_vport reply; struct dpif_netlink_vport reply;
struct ofpbuf *buf; struct ofpbuf *buf;
int error; int error;
error = dpif_linux_vport_get(netdev_get_name(netdev), &reply, &buf); error = dpif_netlink_vport_get(netdev_get_name(netdev), &reply, &buf);
if (error) { if (error) {
return error; return error;
} else if (!reply.stats) { } else if (!reply.stats) {

View File

@@ -20,7 +20,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
struct dpif_linux_vport; struct dpif_netlink_vport;
struct dpif_flow_stats; struct dpif_flow_stats;
struct netdev; struct netdev;
struct netdev_class; struct netdev_class;