Once Alin confirms we didn't break anything with Linux we are ready to go. Thanks, Eitan
-----Original Message----- From: Ben Pfaff [mailto:b...@nicira.com] Sent: Wednesday, September 17, 2014 1:38 PM To: Eitan Eliahu Cc: Alin Serdean; Nithin Raju; dev@openvswitch.org Subject: Re: [ovs-dev] [PATCH] Changes needed for dpif-linux to compile under MSVC I'm happy to do that. I don't care whether it happens before or after or simultaneously with the change under consideration. Did you review the change? On Wed, Sep 17, 2014 at 08:30:57PM +0000, Eitan Eliahu wrote: > Hi Alin, should we change the file name to dpif_netlink? > Thanks, > Eitan > > -----Original Message----- > From: Alin Serdean [mailto:aserd...@cloudbasesolutions.com] > Sent: Wednesday, September 17, 2014 1:11 PM > To: Eitan Eliahu; Nithin Raju; 'Ben Pfaff'; dev@openvswitch.org > Subject: [ovs-dev] [PATCH] Changes needed for dpif-linux to compile under 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 <aserd...@cloudbasesolutions.com> > --- > lib/automake.mk | 2 + > lib/dpif-linux.c | 563 > ++++++++++++++++++++++++++++------------------------ > lib/dpif-linux.h | 2 +- > lib/dpif-provider.h | 2 +- > lib/dpif.c | 4 +- > 5 files changed, 311 insertions(+), 262 deletions(-) > > diff --git a/lib/automake.mk b/lib/automake.mk > index b14a510..fb97130 100644 > --- a/lib/automake.mk > +++ b/lib/automake.mk > @@ -332,6 +332,8 @@ endif > > if WIN32 > lib_libopenvswitch_la_SOURCES += \ > + lib/dpif-linux.c \ > + lib/dpif-linux.h \ > lib/netlink-notifier.c \ > lib/netlink-notifier.h \ > lib/netlink-protocol.h \ > diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c > index 2c387ed..a5d0fb5 100644 > --- a/lib/dpif-linux.c > +++ b/lib/dpif-linux.c > @@ -62,7 +62,7 @@ enum { MAX_PORTS = USHRT_MAX }; > * missing if we have old headers. */ > #define ETH_FLAG_LRO (1 << 15) /* LRO is enabled */ > > -struct dpif_linux_dp { > +struct dpif_netlink_dp { > /* Generic Netlink header. */ > uint8_t cmd; > > @@ -78,17 +78,17 @@ struct dpif_linux_dp { > /* OVS_DP_ATTR_MEGAFLOW_STATS.*/ > }; > > -static void dpif_linux_dp_init(struct dpif_linux_dp *); > -static int dpif_linux_dp_from_ofpbuf(struct dpif_linux_dp *, > +static void dpif_netlink_dp_init(struct dpif_netlink_dp *); > +static int dpif_netlink_dp_from_ofpbuf(struct dpif_netlink_dp *, > const struct ofpbuf *); > -static void dpif_linux_dp_dump_start(struct nl_dump *); > -static int dpif_linux_dp_transact(const struct dpif_linux_dp *request, > - struct dpif_linux_dp *reply, > +static void dpif_netlink_dp_dump_start(struct nl_dump *); > +static int dpif_netlink_dp_transact(const struct dpif_netlink_dp *request, > + struct dpif_netlink_dp *reply, > struct ofpbuf **bufp); > -static int dpif_linux_dp_get(const struct dpif *, struct dpif_linux_dp > *reply, > +static int dpif_netlink_dp_get(const struct dpif *, struct dpif_netlink_dp > *reply, > struct ofpbuf **bufp); > > -struct dpif_linux_flow { > +struct dpif_netlink_flow { > /* Generic Netlink header. */ > uint8_t cmd; > > @@ -116,18 +116,18 @@ struct dpif_linux_flow { > bool clear; /* OVS_FLOW_ATTR_CLEAR. */ > }; > > -static void dpif_linux_flow_init(struct dpif_linux_flow *); > -static int dpif_linux_flow_from_ofpbuf(struct dpif_linux_flow *, > +static void dpif_netlink_flow_init(struct dpif_netlink_flow *); > +static int dpif_netlink_flow_from_ofpbuf(struct dpif_netlink_flow *, > const struct ofpbuf *); > -static void dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow *, > +static void dpif_netlink_flow_to_ofpbuf(const struct dpif_netlink_flow *, > struct ofpbuf *); > -static int dpif_linux_flow_transact(struct dpif_linux_flow *request, > - struct dpif_linux_flow *reply, > +static int dpif_netlink_flow_transact(struct dpif_netlink_flow *request, > + struct dpif_netlink_flow *reply, > struct ofpbuf **bufp); > -static void dpif_linux_flow_get_stats(const struct dpif_linux_flow *, > +static void dpif_netlink_flow_get_stats(const struct dpif_netlink_flow *, > struct dpif_flow_stats *); > -static void dpif_linux_flow_to_dpif_flow(struct dpif_flow *, > - const struct dpif_linux_flow *); > +static void dpif_netlink_flow_to_dpif_flow(struct dpif_flow *, > + const struct dpif_netlink_flow *); > > /* One of the dpif channels between the kernel and userspace. */ > struct dpif_channel { > @@ -144,7 +144,7 @@ struct dpif_handler { > }; > > /* Datapath interface for the openvswitch Linux kernel module. */ > -struct dpif_linux { > +struct dpif_netlink { > struct dpif dpif; > int dp_ifindex; > > @@ -160,14 +160,14 @@ struct dpif_linux { > bool refresh_channels; > }; > > -static void report_loss(struct dpif_linux *, struct dpif_channel *, > +static void report_loss(struct dpif_netlink *, struct dpif_channel *, > uint32_t ch_idx, uint32_t handler_id); > > static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5); > > /* Generic Netlink family numbers for OVS. > * > - * Initialized by dpif_linux_init(). */ > + * Initialized by dpif_netlink_init(). */ > static int ovs_datapath_family; > static int ovs_vport_family; > static int ovs_flow_family; > @@ -175,29 +175,29 @@ static int ovs_packet_family; > > /* Generic Netlink multicast groups for OVS. > * > - * Initialized by dpif_linux_init(). */ > + * Initialized by dpif_netlink_init(). */ > static unsigned int ovs_vport_mcgroup; > > -static int dpif_linux_init(void); > -static int open_dpif(const struct dpif_linux_dp *, struct dpif **); > -static uint32_t dpif_linux_port_get_pid(const struct dpif *, > +static int dpif_netlink_init(void); > +static int open_dpif(const struct dpif_netlink_dp *, struct dpif **); > +static uint32_t dpif_netlink_port_get_pid(const struct dpif *, > odp_port_t port_no, uint32_t hash); > -static int dpif_linux_refresh_channels(struct dpif_linux *, > +static int dpif_netlink_refresh_channels(struct dpif_netlink *, > uint32_t n_handlers); > static void dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *, > struct ofpbuf *); > static int dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *, > const struct ofpbuf *); > > -static struct dpif_linux * > -dpif_linux_cast(const struct dpif *dpif) > +static struct dpif_netlink * > +dpif_netlink_cast(const struct dpif *dpif) > { > - dpif_assert_class(dpif, &dpif_linux_class); > - return CONTAINER_OF(dpif, struct dpif_linux, dpif); > + dpif_assert_class(dpif, &dpif_netlink_class); > + return CONTAINER_OF(dpif, struct dpif_netlink, dpif); > } > > static int > -dpif_linux_enumerate(struct sset *all_dps, > +dpif_netlink_enumerate(struct sset *all_dps, > const struct dpif_class *dpif_class OVS_UNUSED) > { > struct nl_dump dump; > @@ -205,17 +205,17 @@ dpif_linux_enumerate(struct sset *all_dps, > struct ofpbuf msg, buf; > int error; > > - error = dpif_linux_init(); > + error = dpif_netlink_init(); > if (error) { > return error; > } > > ofpbuf_use_stub(&buf, reply_stub, sizeof reply_stub); > - dpif_linux_dp_dump_start(&dump); > + dpif_netlink_dp_dump_start(&dump); > while (nl_dump_next(&dump, &msg, &buf)) { > - struct dpif_linux_dp dp; > + struct dpif_netlink_dp dp; > > - if (!dpif_linux_dp_from_ofpbuf(&dp, &msg)) { > + if (!dpif_netlink_dp_from_ofpbuf(&dp, &msg)) { > sset_add(all_dps, dp.name); > } > } > @@ -224,21 +224,21 @@ dpif_linux_enumerate(struct sset *all_dps, > } > > static int > -dpif_linux_open(const struct dpif_class *class OVS_UNUSED, const char *name, > +dpif_netlink_open(const struct dpif_class *class OVS_UNUSED, const char > *name, > bool create, struct dpif **dpifp) > { > - struct dpif_linux_dp dp_request, dp; > + struct dpif_netlink_dp dp_request, dp; > struct ofpbuf *buf; > uint32_t upcall_pid; > int error; > > - error = dpif_linux_init(); > + error = dpif_netlink_init(); > if (error) { > return error; > } > > /* Create or look up datapath. */ > - dpif_linux_dp_init(&dp_request); > + dpif_netlink_dp_init(&dp_request); > if (create) { > dp_request.cmd = OVS_DP_CMD_NEW; > upcall_pid = 0; > @@ -250,7 +250,7 @@ dpif_linux_open(const struct dpif_class *class > OVS_UNUSED, const char *name, > dp_request.name = name; > dp_request.user_features |= OVS_DP_F_UNALIGNED; > dp_request.user_features |= OVS_DP_F_VPORT_PIDS; > - error = dpif_linux_dp_transact(&dp_request, &dp, &buf); > + error = dpif_netlink_dp_transact(&dp_request, &dp, &buf); > if (error) { > return error; > } > @@ -261,15 +261,15 @@ dpif_linux_open(const struct dpif_class *class > OVS_UNUSED, const char *name, > } > > static int > -open_dpif(const struct dpif_linux_dp *dp, struct dpif **dpifp) > +open_dpif(const struct dpif_netlink_dp *dp, struct dpif **dpifp) > { > - struct dpif_linux *dpif; > + struct dpif_netlink *dpif; > > dpif = xzalloc(sizeof *dpif); > dpif->port_notifier = NULL; > fat_rwlock_init(&dpif->upcall_lock); > > - dpif_init(&dpif->dpif, &dpif_linux_class, dp->name, > + dpif_init(&dpif->dpif, &dpif_netlink_class, dp->name, > dp->dp_ifindex, dp->dp_ifindex); > > dpif->dp_ifindex = dp->dp_ifindex; > @@ -340,7 +340,7 @@ vport_socksp_to_pids(struct nl_sock **socksp, uint32_t > n_socks) > /* Given the port number 'port_idx', extracts the pids of netlink sockets > * associated to the port and assigns it to 'upcall_pids'. */ > static bool > -vport_get_pids(struct dpif_linux *dpif, uint32_t port_idx, > +vport_get_pids(struct dpif_netlink *dpif, uint32_t port_idx, > uint32_t **upcall_pids) > { > uint32_t *pids; > @@ -365,7 +365,7 @@ vport_get_pids(struct dpif_linux *dpif, uint32_t port_idx, > } > > static int > -vport_add_channels(struct dpif_linux *dpif, odp_port_t port_no, > +vport_add_channels(struct dpif_netlink *dpif, odp_port_t port_no, > struct nl_sock **socksp) > { > struct epoll_event event; > @@ -413,11 +413,17 @@ vport_add_channels(struct dpif_linux *dpif, odp_port_t > port_no, > for (i = 0; i < dpif->n_handlers; i++) { > struct dpif_handler *handler = &dpif->handlers[i]; > > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > if (epoll_ctl(handler->epoll_fd, EPOLL_CTL_ADD, > nl_sock_fd(socksp[i]), > &event) < 0) { > error = errno; > goto error; > } > +#endif > dpif->handlers[i].channels[port_idx].sock = socksp[i]; > dpif->handlers[i].channels[port_idx].last_poll = LLONG_MIN; > } > @@ -426,8 +432,14 @@ vport_add_channels(struct dpif_linux *dpif, odp_port_t > port_no, > > error: > for (j = 0; j < i; j++) { > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > epoll_ctl(dpif->handlers[j].epoll_fd, EPOLL_CTL_DEL, > nl_sock_fd(socksp[j]), NULL); > +#endif > dpif->handlers[j].channels[port_idx].sock = NULL; > } > > @@ -435,7 +447,7 @@ error: > } > > static void > -vport_del_channels(struct dpif_linux *dpif, odp_port_t port_no) > +vport_del_channels(struct dpif_netlink *dpif, odp_port_t port_no) > { > uint32_t port_idx = odp_to_u32(port_no); > size_t i; > @@ -454,8 +466,14 @@ vport_del_channels(struct dpif_linux *dpif, odp_port_t > port_no) > for (i = 0; i < dpif->n_handlers; i++) { > struct dpif_handler *handler = &dpif->handlers[i]; > > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > epoll_ctl(handler->epoll_fd, EPOLL_CTL_DEL, > nl_sock_fd(handler->channels[port_idx].sock), NULL); > +#endif > nl_sock_destroy(handler->channels[port_idx].sock); > handler->channels[port_idx].sock = NULL; > handler->event_offset = handler->n_events = 0; > @@ -463,7 +481,7 @@ vport_del_channels(struct dpif_linux *dpif, odp_port_t > port_no) > } > > static void > -destroy_all_channels(struct dpif_linux *dpif) > OVS_REQ_WRLOCK(dpif->upcall_lock) > +destroy_all_channels(struct dpif_netlink *dpif) > OVS_REQ_WRLOCK(dpif->upcall_lock) > { > unsigned int i; > > @@ -496,7 +514,13 @@ destroy_all_channels(struct dpif_linux *dpif) > OVS_REQ_WRLOCK(dpif->upcall_lock) > for (i = 0; i < dpif->n_handlers; i++) { > struct dpif_handler *handler = &dpif->handlers[i]; > > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > close(handler->epoll_fd); > +#endif > free(handler->epoll_events); > free(handler->channels); > } > @@ -508,9 +532,9 @@ destroy_all_channels(struct dpif_linux *dpif) > OVS_REQ_WRLOCK(dpif->upcall_lock) > } > > static void > -dpif_linux_close(struct dpif *dpif_) > +dpif_netlink_close(struct dpif *dpif_) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > nl_sock_destroy(dpif->port_notifier); > > @@ -523,38 +547,38 @@ dpif_linux_close(struct dpif *dpif_) > } > > static int > -dpif_linux_destroy(struct dpif *dpif_) > +dpif_netlink_destroy(struct dpif *dpif_) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > - struct dpif_linux_dp dp; > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > + struct dpif_netlink_dp dp; > > - dpif_linux_dp_init(&dp); > + dpif_netlink_dp_init(&dp); > dp.cmd = OVS_DP_CMD_DEL; > dp.dp_ifindex = dpif->dp_ifindex; > - return dpif_linux_dp_transact(&dp, NULL, NULL); > + return dpif_netlink_dp_transact(&dp, NULL, NULL); > } > > static void > -dpif_linux_run(struct dpif *dpif_) > +dpif_netlink_run(struct dpif *dpif_) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > if (dpif->refresh_channels) { > dpif->refresh_channels = false; > fat_rwlock_wrlock(&dpif->upcall_lock); > - dpif_linux_refresh_channels(dpif, dpif->n_handlers); > + dpif_netlink_refresh_channels(dpif, dpif->n_handlers); > fat_rwlock_unlock(&dpif->upcall_lock); > } > } > > static int > -dpif_linux_get_stats(const struct dpif *dpif_, struct dpif_dp_stats *stats) > +dpif_netlink_get_stats(const struct dpif *dpif_, struct dpif_dp_stats *stats) > { > - struct dpif_linux_dp dp; > + struct dpif_netlink_dp dp; > struct ofpbuf *buf; > int error; > > - error = dpif_linux_dp_get(dpif_, &dp, &buf); > + error = dpif_netlink_dp_get(dpif_, &dp, &buf); > if (!error) { > memset(stats, 0, sizeof *stats); > > @@ -643,7 +667,7 @@ netdev_to_ovs_vport_type(const struct netdev *netdev) > } > > static int > -dpif_linux_port_add__(struct dpif_linux *dpif, struct netdev *netdev, > +dpif_netlink_port_add__(struct dpif_netlink *dpif, struct netdev *netdev, > odp_port_t *port_nop) > OVS_REQ_WRLOCK(dpif->upcall_lock) > { > @@ -681,7 +705,13 @@ dpif_linux_port_add__(struct dpif_linux *dpif, struct > netdev *netdev, > request.name = name; > > if (request.type == OVS_VPORT_TYPE_NETDEV) { > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > netdev_linux_ethtool_set_flag(netdev, ETH_FLAG_LRO, "LRO", false); > +#endif > } > > tnl_cfg = netdev_get_tunnel_config(netdev); > @@ -737,21 +767,21 @@ exit: > } > > static int > -dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev, > +dpif_netlink_port_add(struct dpif *dpif_, struct netdev *netdev, > odp_port_t *port_nop) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > int error; > > fat_rwlock_wrlock(&dpif->upcall_lock); > - error = dpif_linux_port_add__(dpif, netdev, port_nop); > + error = dpif_netlink_port_add__(dpif, netdev, port_nop); > fat_rwlock_unlock(&dpif->upcall_lock); > > return error; > } > > static int > -dpif_linux_port_del__(struct dpif_linux *dpif, odp_port_t port_no) > +dpif_netlink_port_del__(struct dpif_netlink *dpif, odp_port_t port_no) > OVS_REQ_WRLOCK(dpif->upcall_lock) > { > struct dpif_linux_vport vport; > @@ -769,20 +799,20 @@ dpif_linux_port_del__(struct dpif_linux *dpif, > odp_port_t port_no) > } > > static int > -dpif_linux_port_del(struct dpif *dpif_, odp_port_t port_no) > +dpif_netlink_port_del(struct dpif *dpif_, odp_port_t port_no) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > int error; > > fat_rwlock_wrlock(&dpif->upcall_lock); > - error = dpif_linux_port_del__(dpif, port_no); > + error = dpif_netlink_port_del__(dpif, port_no); > fat_rwlock_unlock(&dpif->upcall_lock); > > return error; > } > > static int > -dpif_linux_port_query__(const struct dpif_linux *dpif, odp_port_t port_no, > +dpif_netlink_port_query__(const struct dpif_netlink *dpif, odp_port_t > port_no, > const char *port_name, struct dpif_port *dpif_port) > { > struct dpif_linux_vport request; > @@ -813,25 +843,25 @@ dpif_linux_port_query__(const struct dpif_linux *dpif, > odp_port_t port_no, > } > > static int > -dpif_linux_port_query_by_number(const struct dpif *dpif_, odp_port_t port_no, > +dpif_netlink_port_query_by_number(const struct dpif *dpif_, odp_port_t > port_no, > struct dpif_port *dpif_port) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > - return dpif_linux_port_query__(dpif, port_no, NULL, dpif_port); > + return dpif_netlink_port_query__(dpif, port_no, NULL, dpif_port); > } > > static int > -dpif_linux_port_query_by_name(const struct dpif *dpif_, const char *devname, > +dpif_netlink_port_query_by_name(const struct dpif *dpif_, const char > *devname, > struct dpif_port *dpif_port) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > - return dpif_linux_port_query__(dpif, 0, devname, dpif_port); > + return dpif_netlink_port_query__(dpif, 0, devname, dpif_port); > } > > static uint32_t > -dpif_linux_port_get_pid__(const struct dpif_linux *dpif, odp_port_t port_no, > +dpif_netlink_port_get_pid__(const struct dpif_netlink *dpif, odp_port_t > port_no, > uint32_t hash) > OVS_REQ_RDLOCK(dpif->upcall_lock) > { > @@ -857,38 +887,38 @@ dpif_linux_port_get_pid__(const struct dpif_linux > *dpif, odp_port_t port_no, > } > > static uint32_t > -dpif_linux_port_get_pid(const struct dpif *dpif_, odp_port_t port_no, > +dpif_netlink_port_get_pid(const struct dpif *dpif_, odp_port_t port_no, > uint32_t hash) > { > - const struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + const struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > uint32_t ret; > > fat_rwlock_rdlock(&dpif->upcall_lock); > - ret = dpif_linux_port_get_pid__(dpif, port_no, hash); > + ret = dpif_netlink_port_get_pid__(dpif, port_no, hash); > fat_rwlock_unlock(&dpif->upcall_lock); > > return ret; > } > > static int > -dpif_linux_flow_flush(struct dpif *dpif_) > +dpif_netlink_flow_flush(struct dpif *dpif_) > { > - const struct dpif_linux *dpif = dpif_linux_cast(dpif_); > - struct dpif_linux_flow flow; > + const struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > + struct dpif_netlink_flow flow; > > - dpif_linux_flow_init(&flow); > + dpif_netlink_flow_init(&flow); > flow.cmd = OVS_FLOW_CMD_DEL; > flow.dp_ifindex = dpif->dp_ifindex; > - return dpif_linux_flow_transact(&flow, NULL, NULL); > + return dpif_netlink_flow_transact(&flow, NULL, NULL); > } > > -struct dpif_linux_port_state { > +struct dpif_netlink_port_state { > struct nl_dump dump; > struct ofpbuf buf; > }; > > static void > -dpif_linux_port_dump_start__(const struct dpif_linux *dpif, > +dpif_netlink_port_dump_start__(const struct dpif_netlink *dpif, > struct nl_dump *dump) > { > struct dpif_linux_vport request; > @@ -905,20 +935,20 @@ dpif_linux_port_dump_start__(const struct dpif_linux > *dpif, > } > > static int > -dpif_linux_port_dump_start(const struct dpif *dpif_, void **statep) > +dpif_netlink_port_dump_start(const struct dpif *dpif_, void **statep) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > - struct dpif_linux_port_state *state; > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > + struct dpif_netlink_port_state *state; > > *statep = state = xmalloc(sizeof *state); > - dpif_linux_port_dump_start__(dpif, &state->dump); > + dpif_netlink_port_dump_start__(dpif, &state->dump); > > ofpbuf_init(&state->buf, NL_DUMP_BUFSIZE); > return 0; > } > > static int > -dpif_linux_port_dump_next__(const struct dpif_linux *dpif, struct nl_dump > *dump, > +dpif_netlink_port_dump_next__(const struct dpif_netlink *dpif, struct > nl_dump *dump, > struct dpif_linux_vport *vport, > struct ofpbuf *buffer) > { > @@ -938,15 +968,15 @@ dpif_linux_port_dump_next__(const struct dpif_linux > *dpif, struct nl_dump *dump, > } > > static int > -dpif_linux_port_dump_next(const struct dpif *dpif_, void *state_, > +dpif_netlink_port_dump_next(const struct dpif *dpif_, void *state_, > struct dpif_port *dpif_port) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > - struct dpif_linux_port_state *state = state_; > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > + struct dpif_netlink_port_state *state = state_; > struct dpif_linux_vport vport; > int error; > > - error = dpif_linux_port_dump_next__(dpif, &state->dump, &vport, > + error = dpif_netlink_port_dump_next__(dpif, &state->dump, &vport, > &state->buf); > if (error) { > return error; > @@ -958,9 +988,9 @@ dpif_linux_port_dump_next(const struct dpif *dpif_, void > *state_, > } > > static int > -dpif_linux_port_dump_done(const struct dpif *dpif_ OVS_UNUSED, void *state_) > +dpif_netlink_port_dump_done(const struct dpif *dpif_ OVS_UNUSED, void > *state_) > { > - struct dpif_linux_port_state *state = state_; > + struct dpif_netlink_port_state *state = state_; > int error = nl_dump_done(&state->dump); > > ofpbuf_uninit(&state->buf); > @@ -969,9 +999,9 @@ dpif_linux_port_dump_done(const struct dpif *dpif_ > OVS_UNUSED, void *state_) > } > > static int > -dpif_linux_port_poll(const struct dpif *dpif_, char **devnamep) > +dpif_netlink_port_poll(const struct dpif *dpif_, char **devnamep) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > /* Lazily create the Netlink socket to listen for notifications. */ > if (!dpif->port_notifier) { > @@ -1037,9 +1067,9 @@ dpif_linux_port_poll(const struct dpif *dpif_, char > **devnamep) > } > > static void > -dpif_linux_port_poll_wait(const struct dpif *dpif_) > +dpif_netlink_port_poll_wait(const struct dpif *dpif_) > { > - const struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + const struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > if (dpif->port_notifier) { > nl_sock_wait(dpif->port_notifier, POLLIN); > @@ -1049,11 +1079,11 @@ dpif_linux_port_poll_wait(const struct dpif *dpif_) > } > > static void > -dpif_linux_init_flow_get(const struct dpif_linux *dpif, > +dpif_netlink_init_flow_get(const struct dpif_netlink *dpif, > const struct nlattr *key, size_t key_len, > - struct dpif_linux_flow *request) > + struct dpif_netlink_flow *request) > { > - dpif_linux_flow_init(request); > + dpif_netlink_flow_init(request); > request->cmd = OVS_FLOW_CMD_GET; > request->dp_ifindex = dpif->dp_ifindex; > request->key = key; > @@ -1061,23 +1091,23 @@ dpif_linux_init_flow_get(const struct dpif_linux > *dpif, > } > > static int > -dpif_linux_flow_get(const struct dpif_linux *dpif, > +dpif_netlink_flow_get(const struct dpif_netlink *dpif, > const struct nlattr *key, size_t key_len, > - struct dpif_linux_flow *reply, struct ofpbuf **bufp) > + struct dpif_netlink_flow *reply, struct ofpbuf **bufp) > { > - struct dpif_linux_flow request; > + struct dpif_netlink_flow request; > > - dpif_linux_init_flow_get(dpif, key, key_len, &request); > - return dpif_linux_flow_transact(&request, reply, bufp); > + dpif_netlink_init_flow_get(dpif, key, key_len, &request); > + return dpif_netlink_flow_transact(&request, reply, bufp); > } > > static void > -dpif_linux_init_flow_put(struct dpif_linux *dpif, const struct dpif_flow_put > *put, > - struct dpif_linux_flow *request) > +dpif_netlink_init_flow_put(struct dpif_netlink *dpif, const struct > dpif_flow_put *put, > + struct dpif_netlink_flow *request) > { > static const struct nlattr dummy_action; > > - dpif_linux_flow_init(request); > + dpif_netlink_flow_init(request); > request->cmd = (put->flags & DPIF_FP_CREATE > ? OVS_FLOW_CMD_NEW : OVS_FLOW_CMD_SET); > request->dp_ifindex = dpif->dp_ifindex; > @@ -1097,45 +1127,45 @@ dpif_linux_init_flow_put(struct dpif_linux *dpif, > const struct dpif_flow_put *pu > } > > static void > -dpif_linux_init_flow_del(struct dpif_linux *dpif, const struct dpif_flow_del > *del, > - struct dpif_linux_flow *request) > +dpif_netlink_init_flow_del(struct dpif_netlink *dpif, const struct > dpif_flow_del *del, > + struct dpif_netlink_flow *request) > { > - dpif_linux_flow_init(request); > + dpif_netlink_flow_init(request); > request->cmd = OVS_FLOW_CMD_DEL; > request->dp_ifindex = dpif->dp_ifindex; > request->key = del->key; > request->key_len = del->key_len; > } > > -struct dpif_linux_flow_dump { > +struct dpif_netlink_flow_dump { > struct dpif_flow_dump up; > struct nl_dump nl_dump; > atomic_int status; > }; > > -static struct dpif_linux_flow_dump * > -dpif_linux_flow_dump_cast(struct dpif_flow_dump *dump) > +static struct dpif_netlink_flow_dump * > +dpif_netlink_flow_dump_cast(struct dpif_flow_dump *dump) > { > - return CONTAINER_OF(dump, struct dpif_linux_flow_dump, up); > + return CONTAINER_OF(dump, struct dpif_netlink_flow_dump, up); > } > > static struct dpif_flow_dump * > -dpif_linux_flow_dump_create(const struct dpif *dpif_) > +dpif_netlink_flow_dump_create(const struct dpif *dpif_) > { > - const struct dpif_linux *dpif = dpif_linux_cast(dpif_); > - struct dpif_linux_flow_dump *dump; > - struct dpif_linux_flow request; > + const struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > + struct dpif_netlink_flow_dump *dump; > + struct dpif_netlink_flow request; > struct ofpbuf *buf; > > dump = xmalloc(sizeof *dump); > dpif_flow_dump_init(&dump->up, dpif_); > > - dpif_linux_flow_init(&request); > + dpif_netlink_flow_init(&request); > request.cmd = OVS_FLOW_CMD_GET; > request.dp_ifindex = dpif->dp_ifindex; > > buf = ofpbuf_new(1024); > - dpif_linux_flow_to_ofpbuf(&request, buf); > + dpif_netlink_flow_to_ofpbuf(&request, buf); > nl_dump_start(&dump->nl_dump, NETLINK_GENERIC, buf); > ofpbuf_delete(buf); > atomic_init(&dump->status, 0); > @@ -1144,9 +1174,9 @@ dpif_linux_flow_dump_create(const struct dpif *dpif_) > } > > static int > -dpif_linux_flow_dump_destroy(struct dpif_flow_dump *dump_) > +dpif_netlink_flow_dump_destroy(struct dpif_flow_dump *dump_) > { > - struct dpif_linux_flow_dump *dump = dpif_linux_flow_dump_cast(dump_); > + struct dpif_netlink_flow_dump *dump = dpif_netlink_flow_dump_cast(dump_); > unsigned int nl_status = nl_dump_done(&dump->nl_dump); > int dump_status; > > @@ -1156,26 +1186,26 @@ dpif_linux_flow_dump_destroy(struct dpif_flow_dump > *dump_) > return dump_status ? dump_status : nl_status; > } > > -struct dpif_linux_flow_dump_thread { > +struct dpif_netlink_flow_dump_thread { > struct dpif_flow_dump_thread up; > - struct dpif_linux_flow_dump *dump; > - struct dpif_linux_flow flow; > + struct dpif_netlink_flow_dump *dump; > + struct dpif_netlink_flow flow; > struct dpif_flow_stats stats; > struct ofpbuf nl_flows; /* Always used to store flows. */ > struct ofpbuf *nl_actions; /* Used if kernel does not supply actions. */ > }; > > -static struct dpif_linux_flow_dump_thread * > -dpif_linux_flow_dump_thread_cast(struct dpif_flow_dump_thread *thread) > +static struct dpif_netlink_flow_dump_thread * > +dpif_netlink_flow_dump_thread_cast(struct dpif_flow_dump_thread *thread) > { > - return CONTAINER_OF(thread, struct dpif_linux_flow_dump_thread, up); > + return CONTAINER_OF(thread, struct dpif_netlink_flow_dump_thread, up); > } > > static struct dpif_flow_dump_thread * > -dpif_linux_flow_dump_thread_create(struct dpif_flow_dump *dump_) > +dpif_netlink_flow_dump_thread_create(struct dpif_flow_dump *dump_) > { > - struct dpif_linux_flow_dump *dump = dpif_linux_flow_dump_cast(dump_); > - struct dpif_linux_flow_dump_thread *thread; > + struct dpif_netlink_flow_dump *dump = dpif_netlink_flow_dump_cast(dump_); > + struct dpif_netlink_flow_dump_thread *thread; > > thread = xmalloc(sizeof *thread); > dpif_flow_dump_thread_init(&thread->up, &dump->up); > @@ -1187,10 +1217,10 @@ dpif_linux_flow_dump_thread_create(struct > dpif_flow_dump *dump_) > } > > static void > -dpif_linux_flow_dump_thread_destroy(struct dpif_flow_dump_thread *thread_) > +dpif_netlink_flow_dump_thread_destroy(struct dpif_flow_dump_thread *thread_) > { > - struct dpif_linux_flow_dump_thread *thread > - = dpif_linux_flow_dump_thread_cast(thread_); > + struct dpif_netlink_flow_dump_thread *thread > + = dpif_netlink_flow_dump_thread_cast(thread_); > > ofpbuf_uninit(&thread->nl_flows); > ofpbuf_delete(thread->nl_actions); > @@ -1198,8 +1228,8 @@ dpif_linux_flow_dump_thread_destroy(struct > dpif_flow_dump_thread *thread_) > } > > static void > -dpif_linux_flow_to_dpif_flow(struct dpif_flow *dpif_flow, > - const struct dpif_linux_flow *linux_flow) > +dpif_netlink_flow_to_dpif_flow(struct dpif_flow *dpif_flow, > + const struct dpif_netlink_flow *linux_flow) > { > dpif_flow->key = linux_flow->key; > dpif_flow->key_len = linux_flow->key_len; > @@ -1207,17 +1237,17 @@ dpif_linux_flow_to_dpif_flow(struct dpif_flow > *dpif_flow, > dpif_flow->mask_len = linux_flow->mask_len; > dpif_flow->actions = linux_flow->actions; > dpif_flow->actions_len = linux_flow->actions_len; > - dpif_linux_flow_get_stats(linux_flow, &dpif_flow->stats); > + dpif_netlink_flow_get_stats(linux_flow, &dpif_flow->stats); > } > > static int > -dpif_linux_flow_dump_next(struct dpif_flow_dump_thread *thread_, > +dpif_netlink_flow_dump_next(struct dpif_flow_dump_thread *thread_, > struct dpif_flow *flows, int max_flows) > { > - struct dpif_linux_flow_dump_thread *thread > - = dpif_linux_flow_dump_thread_cast(thread_); > - struct dpif_linux_flow_dump *dump = thread->dump; > - struct dpif_linux *dpif = dpif_linux_cast(thread->up.dpif); > + struct dpif_netlink_flow_dump_thread *thread > + = dpif_netlink_flow_dump_thread_cast(thread_); > + struct dpif_netlink_flow_dump *dump = thread->dump; > + struct dpif_netlink *dpif = dpif_netlink_cast(thread->up.dpif); > int n_flows; > > ofpbuf_delete(thread->nl_actions); > @@ -1226,7 +1256,7 @@ dpif_linux_flow_dump_next(struct dpif_flow_dump_thread > *thread_, > n_flows = 0; > while (!n_flows > || (n_flows < max_flows && ofpbuf_size(&thread->nl_flows))) { > - struct dpif_linux_flow linux_flow; > + struct dpif_netlink_flow linux_flow; > struct ofpbuf nl_flow; > int error; > > @@ -1236,7 +1266,7 @@ dpif_linux_flow_dump_next(struct dpif_flow_dump_thread > *thread_, > } > > /* Convert the flow to our output format. */ > - error = dpif_linux_flow_from_ofpbuf(&linux_flow, &nl_flow); > + error = dpif_netlink_flow_from_ofpbuf(&linux_flow, &nl_flow); > if (error) { > atomic_store_relaxed(&dump->status, error); > break; > @@ -1244,11 +1274,11 @@ dpif_linux_flow_dump_next(struct > dpif_flow_dump_thread *thread_, > > if (linux_flow.actions) { > /* Common case: the flow includes actions. */ > - dpif_linux_flow_to_dpif_flow(&flows[n_flows++], &linux_flow); > + dpif_netlink_flow_to_dpif_flow(&flows[n_flows++], &linux_flow); > } else { > /* Rare case: the flow does not include actions. Retrieve this > * individual flow again to get the actions. */ > - error = dpif_linux_flow_get(dpif, linux_flow.key, > + error = dpif_netlink_flow_get(dpif, linux_flow.key, > linux_flow.key_len, &linux_flow, > &thread->nl_actions); > if (error == ENOENT) { > @@ -1263,7 +1293,7 @@ dpif_linux_flow_dump_next(struct dpif_flow_dump_thread > *thread_, > > /* Save this flow. Then exit, because we only have one buffer to > * handle this case. */ > - dpif_linux_flow_to_dpif_flow(&flows[n_flows++], &linux_flow); > + dpif_netlink_flow_to_dpif_flow(&flows[n_flows++], &linux_flow); > break; > } > } > @@ -1271,7 +1301,7 @@ dpif_linux_flow_dump_next(struct dpif_flow_dump_thread > *thread_, > } > > static void > -dpif_linux_encode_execute(int dp_ifindex, const struct dpif_execute *d_exec, > +dpif_netlink_encode_execute(int dp_ifindex, const struct dpif_execute > *d_exec, > struct ofpbuf *buf) > { > struct ovs_header *k_exec; > @@ -1303,7 +1333,7 @@ dpif_linux_encode_execute(int dp_ifindex, const struct > dpif_execute *d_exec, > #define MAX_OPS 50 > > static void > -dpif_linux_operate__(struct dpif_linux *dpif, > +dpif_netlink_operate__(struct dpif_netlink *dpif, > struct dpif_op **ops, size_t n_ops) > { > struct op_auxdata { > @@ -1327,7 +1357,7 @@ dpif_linux_operate__(struct dpif_linux *dpif, > struct dpif_flow_del *del; > struct dpif_execute *execute; > struct dpif_flow_get *get; > - struct dpif_linux_flow flow; > + struct dpif_netlink_flow flow; > > ofpbuf_use_stub(&aux->request, > aux->request_stub, sizeof aux->request_stub); > @@ -1339,35 +1369,35 @@ dpif_linux_operate__(struct dpif_linux *dpif, > switch (op->type) { > case DPIF_OP_FLOW_PUT: > put = &op->u.flow_put; > - dpif_linux_init_flow_put(dpif, put, &flow); > + dpif_netlink_init_flow_put(dpif, put, &flow); > if (put->stats) { > flow.nlmsg_flags |= NLM_F_ECHO; > aux->txn.reply = &aux->reply; > } > - dpif_linux_flow_to_ofpbuf(&flow, &aux->request); > + dpif_netlink_flow_to_ofpbuf(&flow, &aux->request); > break; > > case DPIF_OP_FLOW_DEL: > del = &op->u.flow_del; > - dpif_linux_init_flow_del(dpif, del, &flow); > + dpif_netlink_init_flow_del(dpif, del, &flow); > if (del->stats) { > flow.nlmsg_flags |= NLM_F_ECHO; > aux->txn.reply = &aux->reply; > } > - dpif_linux_flow_to_ofpbuf(&flow, &aux->request); > + dpif_netlink_flow_to_ofpbuf(&flow, &aux->request); > break; > > case DPIF_OP_EXECUTE: > execute = &op->u.execute; > - dpif_linux_encode_execute(dpif->dp_ifindex, execute, > + dpif_netlink_encode_execute(dpif->dp_ifindex, execute, > &aux->request); > break; > > case DPIF_OP_FLOW_GET: > get = &op->u.flow_get; > - dpif_linux_init_flow_get(dpif, get->key, get->key_len, &flow); > + dpif_netlink_init_flow_get(dpif, get->key, get->key_len, &flow); > aux->txn.reply = get->buffer; > - dpif_linux_flow_to_ofpbuf(&flow, &aux->request); > + dpif_netlink_flow_to_ofpbuf(&flow, &aux->request); > break; > > default: > @@ -1395,12 +1425,12 @@ dpif_linux_operate__(struct dpif_linux *dpif, > put = &op->u.flow_put; > if (put->stats) { > if (!op->error) { > - struct dpif_linux_flow reply; > + struct dpif_netlink_flow reply; > > - op->error = dpif_linux_flow_from_ofpbuf(&reply, > + op->error = dpif_netlink_flow_from_ofpbuf(&reply, > txn->reply); > if (!op->error) { > - dpif_linux_flow_get_stats(&reply, put->stats); > + dpif_netlink_flow_get_stats(&reply, put->stats); > } > } > } > @@ -1410,12 +1440,12 @@ dpif_linux_operate__(struct dpif_linux *dpif, > del = &op->u.flow_del; > if (del->stats) { > if (!op->error) { > - struct dpif_linux_flow reply; > + struct dpif_netlink_flow reply; > > - op->error = dpif_linux_flow_from_ofpbuf(&reply, > + op->error = dpif_netlink_flow_from_ofpbuf(&reply, > txn->reply); > if (!op->error) { > - dpif_linux_flow_get_stats(&reply, del->stats); > + dpif_netlink_flow_get_stats(&reply, del->stats); > } > } > } > @@ -1427,11 +1457,11 @@ dpif_linux_operate__(struct dpif_linux *dpif, > case DPIF_OP_FLOW_GET: > get = &op->u.flow_get; > if (!op->error) { > - struct dpif_linux_flow reply; > + struct dpif_netlink_flow reply; > > - op->error = dpif_linux_flow_from_ofpbuf(&reply, txn->reply); > + op->error = dpif_netlink_flow_from_ofpbuf(&reply, > txn->reply); > if (!op->error) { > - dpif_linux_flow_to_dpif_flow(get->flow, &reply); > + dpif_netlink_flow_to_dpif_flow(get->flow, &reply); > } > } > break; > @@ -1446,13 +1476,13 @@ dpif_linux_operate__(struct dpif_linux *dpif, > } > > static void > -dpif_linux_operate(struct dpif *dpif_, struct dpif_op **ops, size_t n_ops) > +dpif_netlink_operate(struct dpif *dpif_, struct dpif_op **ops, size_t n_ops) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > while (n_ops > 0) { > size_t chunk = MIN(n_ops, MAX_OPS); > - dpif_linux_operate__(dpif, ops, chunk); > + dpif_netlink_operate__(dpif, ops, chunk); > ops += chunk; > n_ops -= chunk; > } > @@ -1463,7 +1493,7 @@ dpif_linux_operate(struct dpif *dpif_, struct dpif_op > **ops, size_t n_ops) > * any kernel vport that lacks one and deleting any channels that have no > * backing kernel vports. */ > static int > -dpif_linux_refresh_channels(struct dpif_linux *dpif, uint32_t n_handlers) > +dpif_netlink_refresh_channels(struct dpif_netlink *dpif, uint32_t n_handlers) > OVS_REQ_WRLOCK(dpif->upcall_lock) > { > unsigned long int *keep_channels; > @@ -1481,6 +1511,11 @@ dpif_linux_refresh_channels(struct dpif_linux *dpif, > uint32_t n_handlers) > for (i = 0; i < n_handlers; i++) { > struct dpif_handler *handler = &dpif->handlers[i]; > > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > handler->epoll_fd = epoll_create(10); > if (handler->epoll_fd < 0) { > size_t j; > @@ -1493,6 +1528,7 @@ dpif_linux_refresh_channels(struct dpif_linux *dpif, > uint32_t n_handlers) > > return errno; > } > +#endif > } > dpif->n_handlers = n_handlers; > } > @@ -1507,8 +1543,8 @@ dpif_linux_refresh_channels(struct dpif_linux *dpif, > uint32_t n_handlers) > keep_channels = bitmap_allocate(keep_channels_nbits); > > ofpbuf_use_stub(&buf, reply_stub, sizeof reply_stub); > - dpif_linux_port_dump_start__(dpif, &dump); > - while (!dpif_linux_port_dump_next__(dpif, &dump, &vport, &buf)) { > + dpif_netlink_port_dump_start__(dpif, &dump); > + while (!dpif_netlink_port_dump_next__(dpif, &dump, &vport, &buf)) { > uint32_t port_no = odp_to_u32(vport.port_no); > uint32_t *upcall_pids = NULL; > int error; > @@ -1589,7 +1625,7 @@ dpif_linux_refresh_channels(struct dpif_linux *dpif, > uint32_t n_handlers) > } > > static int > -dpif_linux_recv_set__(struct dpif_linux *dpif, bool enable) > +dpif_netlink_recv_set__(struct dpif_netlink *dpif, bool enable) > OVS_REQ_WRLOCK(dpif->upcall_lock) > { > if ((dpif->handlers != NULL) == enable) { > @@ -1598,32 +1634,32 @@ dpif_linux_recv_set__(struct dpif_linux *dpif, bool > enable) > destroy_all_channels(dpif); > return 0; > } else { > - return dpif_linux_refresh_channels(dpif, 1); > + return dpif_netlink_refresh_channels(dpif, 1); > } > } > > static int > -dpif_linux_recv_set(struct dpif *dpif_, bool enable) > +dpif_netlink_recv_set(struct dpif *dpif_, bool enable) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > int error; > > fat_rwlock_wrlock(&dpif->upcall_lock); > - error = dpif_linux_recv_set__(dpif, enable); > + error = dpif_netlink_recv_set__(dpif, enable); > fat_rwlock_unlock(&dpif->upcall_lock); > > return error; > } > > static int > -dpif_linux_handlers_set(struct dpif *dpif_, uint32_t n_handlers) > +dpif_netlink_handlers_set(struct dpif *dpif_, uint32_t n_handlers) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > int error = 0; > > fat_rwlock_wrlock(&dpif->upcall_lock); > if (dpif->handlers) { > - error = dpif_linux_refresh_channels(dpif, n_handlers); > + error = dpif_netlink_refresh_channels(dpif, n_handlers); > } > fat_rwlock_unlock(&dpif->upcall_lock); > > @@ -1631,7 +1667,7 @@ dpif_linux_handlers_set(struct dpif *dpif_, uint32_t > n_handlers) > } > > static int > -dpif_linux_queue_to_priority(const struct dpif *dpif OVS_UNUSED, > +dpif_netlink_queue_to_priority(const struct dpif *dpif OVS_UNUSED, > uint32_t queue_id, uint32_t *priority) > { > if (queue_id < 0xf000) { > @@ -1707,7 +1743,7 @@ parse_odp_packet(struct ofpbuf *buf, struct dpif_upcall > *upcall, > } > > static int > -dpif_linux_recv__(struct dpif_linux *dpif, uint32_t handler_id, > +dpif_netlink_recv__(struct dpif_netlink *dpif, uint32_t handler_id, > struct dpif_upcall *upcall, struct ofpbuf *buf) > OVS_REQ_RDLOCK(dpif->upcall_lock) > { > @@ -1724,10 +1760,15 @@ dpif_linux_recv__(struct dpif_linux *dpif, uint32_t > handler_id, > > handler->event_offset = handler->n_events = 0; > > +#ifdef _WIN32 > + retval = dpif->uc_array_size; > + handler->event_offset = 0; > +#else > do { > retval = epoll_wait(handler->epoll_fd, handler->epoll_events, > dpif->uc_array_size, 0); > } while (retval < 0 && errno == EINTR); > +#endif > if (retval < 0) { > static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1); > VLOG_WARN_RL(&rl, "epoll_wait failed (%s)", ovs_strerror(errno)); > @@ -1781,42 +1822,48 @@ dpif_linux_recv__(struct dpif_linux *dpif, uint32_t > handler_id, > } > > static int > -dpif_linux_recv(struct dpif *dpif_, uint32_t handler_id, > +dpif_netlink_recv(struct dpif *dpif_, uint32_t handler_id, > struct dpif_upcall *upcall, struct ofpbuf *buf) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > int error; > > fat_rwlock_rdlock(&dpif->upcall_lock); > - error = dpif_linux_recv__(dpif, handler_id, upcall, buf); > + error = dpif_netlink_recv__(dpif, handler_id, upcall, buf); > fat_rwlock_unlock(&dpif->upcall_lock); > > return error; > } > > static void > -dpif_linux_recv_wait__(struct dpif_linux *dpif, uint32_t handler_id) > +dpif_netlink_recv_wait__(struct dpif_netlink *dpif, uint32_t handler_id) > OVS_REQ_RDLOCK(dpif->upcall_lock) > { > +#ifdef _WIN32 > + /* > + * XXX : Map appropiate Windows handle > + */ > +#else > if (dpif->handlers && handler_id < dpif->n_handlers) { > struct dpif_handler *handler = &dpif->handlers[handler_id]; > > poll_fd_wait(handler->epoll_fd, POLLIN); > } > +#endif > } > > static void > -dpif_linux_recv_wait(struct dpif *dpif_, uint32_t handler_id) > +dpif_netlink_recv_wait(struct dpif *dpif_, uint32_t handler_id) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > fat_rwlock_rdlock(&dpif->upcall_lock); > - dpif_linux_recv_wait__(dpif, handler_id); > + dpif_netlink_recv_wait__(dpif, handler_id); > fat_rwlock_unlock(&dpif->upcall_lock); > } > > static void > -dpif_linux_recv_purge__(struct dpif_linux *dpif) > +dpif_netlink_recv_purge__(struct dpif_netlink *dpif) > OVS_REQ_WRLOCK(dpif->upcall_lock) > { > if (dpif->handlers) { > @@ -1835,55 +1882,55 @@ dpif_linux_recv_purge__(struct dpif_linux *dpif) > } > > static void > -dpif_linux_recv_purge(struct dpif *dpif_) > +dpif_netlink_recv_purge(struct dpif *dpif_) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > > fat_rwlock_wrlock(&dpif->upcall_lock); > - dpif_linux_recv_purge__(dpif); > + dpif_netlink_recv_purge__(dpif); > fat_rwlock_unlock(&dpif->upcall_lock); > } > > -const struct dpif_class dpif_linux_class = { > +const struct dpif_class dpif_netlink_class = { > "system", > - dpif_linux_enumerate, > + dpif_netlink_enumerate, > NULL, > - dpif_linux_open, > - dpif_linux_close, > - dpif_linux_destroy, > - dpif_linux_run, > + dpif_netlink_open, > + dpif_netlink_close, > + dpif_netlink_destroy, > + dpif_netlink_run, > NULL, /* wait */ > - dpif_linux_get_stats, > - dpif_linux_port_add, > - dpif_linux_port_del, > - dpif_linux_port_query_by_number, > - dpif_linux_port_query_by_name, > - dpif_linux_port_get_pid, > - dpif_linux_port_dump_start, > - dpif_linux_port_dump_next, > - dpif_linux_port_dump_done, > - dpif_linux_port_poll, > - dpif_linux_port_poll_wait, > - dpif_linux_flow_flush, > - dpif_linux_flow_dump_create, > - dpif_linux_flow_dump_destroy, > - dpif_linux_flow_dump_thread_create, > - dpif_linux_flow_dump_thread_destroy, > - dpif_linux_flow_dump_next, > - dpif_linux_operate, > - dpif_linux_recv_set, > - dpif_linux_handlers_set, > - dpif_linux_queue_to_priority, > - dpif_linux_recv, > - dpif_linux_recv_wait, > - dpif_linux_recv_purge, > + dpif_netlink_get_stats, > + dpif_netlink_port_add, > + dpif_netlink_port_del, > + dpif_netlink_port_query_by_number, > + dpif_netlink_port_query_by_name, > + dpif_netlink_port_get_pid, > + dpif_netlink_port_dump_start, > + dpif_netlink_port_dump_next, > + dpif_netlink_port_dump_done, > + dpif_netlink_port_poll, > + dpif_netlink_port_poll_wait, > + dpif_netlink_flow_flush, > + dpif_netlink_flow_dump_create, > + dpif_netlink_flow_dump_destroy, > + dpif_netlink_flow_dump_thread_create, > + dpif_netlink_flow_dump_thread_destroy, > + dpif_netlink_flow_dump_next, > + dpif_netlink_operate, > + dpif_netlink_recv_set, > + dpif_netlink_handlers_set, > + dpif_netlink_queue_to_priority, > + dpif_netlink_recv, > + dpif_netlink_recv_wait, > + dpif_netlink_recv_purge, > NULL, /* register_upcall_cb */ > NULL, /* enable_upcall */ > NULL, /* disable_upcall */ > }; > > > static int > -dpif_linux_init(void) > +dpif_netlink_init(void) > { > static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; > static int error; > @@ -1918,7 +1965,7 @@ dpif_linux_init(void) > } > > bool > -dpif_linux_is_internal_device(const char *name) > +dpif_netlink_is_internal_device(const char *name) > { > struct dpif_linux_vport reply; > struct ofpbuf *buf; > @@ -2062,7 +2109,7 @@ dpif_linux_vport_transact(const struct dpif_linux_vport > *request, > > ovs_assert((reply != NULL) == (bufp != NULL)); > > - error = dpif_linux_init(); > + error = dpif_netlink_init(); > if (error) { > if (reply) { > *bufp = NULL; > @@ -2112,7 +2159,7 @@ dpif_linux_vport_get(const char *name, struct > dpif_linux_vport *reply, > * 'dp' will contain pointers into 'buf', so the caller should not free 'buf' > * while 'dp' is still in use. */ > static int > -dpif_linux_dp_from_ofpbuf(struct dpif_linux_dp *dp, const struct ofpbuf *buf) > +dpif_netlink_dp_from_ofpbuf(struct dpif_netlink_dp *dp, const struct ofpbuf > *buf) > { > static const struct nl_policy ovs_datapath_policy[] = { > [OVS_DP_ATTR_NAME] = { .type = NL_A_STRING, .max_len = IFNAMSIZ }, > @@ -2129,7 +2176,7 @@ dpif_linux_dp_from_ofpbuf(struct dpif_linux_dp *dp, > const struct ofpbuf *buf) > struct genlmsghdr *genl; > struct ofpbuf b; > > - dpif_linux_dp_init(dp); > + dpif_netlink_dp_init(dp); > > ofpbuf_use_const(&b, ofpbuf_data(buf), ofpbuf_size(buf)); > nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg); > @@ -2158,7 +2205,7 @@ dpif_linux_dp_from_ofpbuf(struct dpif_linux_dp *dp, > const struct ofpbuf *buf) > > /* Appends to 'buf' the Generic Netlink message described by 'dp'. */ > static void > -dpif_linux_dp_to_ofpbuf(const struct dpif_linux_dp *dp, struct ofpbuf *buf) > +dpif_netlink_dp_to_ofpbuf(const struct dpif_netlink_dp *dp, struct ofpbuf > *buf) > { > struct ovs_header *ovs_header; > > @@ -2186,22 +2233,22 @@ dpif_linux_dp_to_ofpbuf(const struct dpif_linux_dp > *dp, struct ofpbuf *buf) > > /* Clears 'dp' to "empty" values. */ > static void > -dpif_linux_dp_init(struct dpif_linux_dp *dp) > +dpif_netlink_dp_init(struct dpif_netlink_dp *dp) > { > memset(dp, 0, sizeof *dp); > } > > static void > -dpif_linux_dp_dump_start(struct nl_dump *dump) > +dpif_netlink_dp_dump_start(struct nl_dump *dump) > { > - struct dpif_linux_dp request; > + struct dpif_netlink_dp request; > struct ofpbuf *buf; > > - dpif_linux_dp_init(&request); > + dpif_netlink_dp_init(&request); > request.cmd = OVS_DP_CMD_GET; > > buf = ofpbuf_new(1024); > - dpif_linux_dp_to_ofpbuf(&request, buf); > + dpif_netlink_dp_to_ofpbuf(&request, buf); > nl_dump_start(dump, NETLINK_GENERIC, buf); > ofpbuf_delete(buf); > } > @@ -2213,8 +2260,8 @@ dpif_linux_dp_dump_start(struct nl_dump *dump) > * and stored in '*reply' and '*bufp'. The caller must free '*bufp' when the > * reply is no longer needed ('reply' will contain pointers into '*bufp'). */ > static int > -dpif_linux_dp_transact(const struct dpif_linux_dp *request, > - struct dpif_linux_dp *reply, struct ofpbuf **bufp) > +dpif_netlink_dp_transact(const struct dpif_netlink_dp *request, > + struct dpif_netlink_dp *reply, struct ofpbuf **bufp) > { > struct ofpbuf *request_buf; > int error; > @@ -2222,14 +2269,14 @@ dpif_linux_dp_transact(const struct dpif_linux_dp > *request, > ovs_assert((reply != NULL) == (bufp != NULL)); > > request_buf = ofpbuf_new(1024); > - dpif_linux_dp_to_ofpbuf(request, request_buf); > + dpif_netlink_dp_to_ofpbuf(request, request_buf); > error = nl_transact(NETLINK_GENERIC, request_buf, bufp); > ofpbuf_delete(request_buf); > > if (reply) { > - dpif_linux_dp_init(reply); > + dpif_netlink_dp_init(reply); > if (!error) { > - error = dpif_linux_dp_from_ofpbuf(reply, *bufp); > + error = dpif_netlink_dp_from_ofpbuf(reply, *bufp); > } > if (error) { > ofpbuf_delete(*bufp); > @@ -2243,17 +2290,17 @@ dpif_linux_dp_transact(const struct dpif_linux_dp > *request, > * The caller must free '*bufp' when the reply is no longer needed ('reply' > * will contain pointers into '*bufp'). */ > static int > -dpif_linux_dp_get(const struct dpif *dpif_, struct dpif_linux_dp *reply, > +dpif_netlink_dp_get(const struct dpif *dpif_, struct dpif_netlink_dp *reply, > struct ofpbuf **bufp) > { > - struct dpif_linux *dpif = dpif_linux_cast(dpif_); > - struct dpif_linux_dp request; > + struct dpif_netlink *dpif = dpif_netlink_cast(dpif_); > + struct dpif_netlink_dp request; > > - dpif_linux_dp_init(&request); > + dpif_netlink_dp_init(&request); > request.cmd = OVS_DP_CMD_GET; > request.dp_ifindex = dpif->dp_ifindex; > > - return dpif_linux_dp_transact(&request, reply, bufp); > + return dpif_netlink_dp_transact(&request, reply, bufp); > } > > > /* Parses the contents of 'buf', which contains a "struct ovs_header" > followed > @@ -2263,7 +2310,7 @@ dpif_linux_dp_get(const struct dpif *dpif_, struct > dpif_linux_dp *reply, > * 'flow' will contain pointers into 'buf', so the caller should not free > 'buf' > * while 'flow' is still in use. */ > static int > -dpif_linux_flow_from_ofpbuf(struct dpif_linux_flow *flow, > +dpif_netlink_flow_from_ofpbuf(struct dpif_netlink_flow *flow, > const struct ofpbuf *buf) > { > static const struct nl_policy ovs_flow_policy[] = { > @@ -2283,7 +2330,7 @@ dpif_linux_flow_from_ofpbuf(struct dpif_linux_flow > *flow, > struct genlmsghdr *genl; > struct ofpbuf b; > > - dpif_linux_flow_init(flow); > + dpif_netlink_flow_init(flow); > > ofpbuf_use_const(&b, ofpbuf_data(buf), ofpbuf_size(buf)); > nlmsg = ofpbuf_try_pull(&b, sizeof *nlmsg); > @@ -2324,7 +2371,7 @@ dpif_linux_flow_from_ofpbuf(struct dpif_linux_flow > *flow, > /* Appends to 'buf' (which must initially be empty) a "struct ovs_header" > * followed by Netlink attributes corresponding to 'flow'. */ > static void > -dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow *flow, > +dpif_netlink_flow_to_ofpbuf(const struct dpif_netlink_flow *flow, > struct ofpbuf *buf) > { > struct ovs_header *ovs_header; > @@ -2361,7 +2408,7 @@ dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow > *flow, > > /* Clears 'flow' to "empty" values. */ > static void > -dpif_linux_flow_init(struct dpif_linux_flow *flow) > +dpif_netlink_flow_init(struct dpif_netlink_flow *flow) > { > memset(flow, 0, sizeof *flow); > } > @@ -2373,8 +2420,8 @@ dpif_linux_flow_init(struct dpif_linux_flow *flow) > * stored in '*reply' and '*bufp'. The caller must free '*bufp' when the > reply > * is no longer needed ('reply' will contain pointers into '*bufp'). */ > static int > -dpif_linux_flow_transact(struct dpif_linux_flow *request, > - struct dpif_linux_flow *reply, struct ofpbuf **bufp) > +dpif_netlink_flow_transact(struct dpif_netlink_flow *request, > + struct dpif_netlink_flow *reply, struct ofpbuf > **bufp) > { > struct ofpbuf *request_buf; > int error; > @@ -2386,16 +2433,16 @@ dpif_linux_flow_transact(struct dpif_linux_flow > *request, > } > > request_buf = ofpbuf_new(1024); > - dpif_linux_flow_to_ofpbuf(request, request_buf); > + dpif_netlink_flow_to_ofpbuf(request, request_buf); > error = nl_transact(NETLINK_GENERIC, request_buf, bufp); > ofpbuf_delete(request_buf); > > if (reply) { > if (!error) { > - error = dpif_linux_flow_from_ofpbuf(reply, *bufp); > + error = dpif_netlink_flow_from_ofpbuf(reply, *bufp); > } > if (error) { > - dpif_linux_flow_init(reply); > + dpif_netlink_flow_init(reply); > ofpbuf_delete(*bufp); > *bufp = NULL; > } > @@ -2404,7 +2451,7 @@ dpif_linux_flow_transact(struct dpif_linux_flow > *request, > } > > static void > -dpif_linux_flow_get_stats(const struct dpif_linux_flow *flow, > +dpif_netlink_flow_get_stats(const struct dpif_netlink_flow *flow, > struct dpif_flow_stats *stats) > { > if (flow->stats) { > @@ -2421,7 +2468,7 @@ dpif_linux_flow_get_stats(const struct dpif_linux_flow > *flow, > /* Logs information about a packet that was recently lost in 'ch' (in > * 'dpif_'). */ > static void > -report_loss(struct dpif_linux *dpif, struct dpif_channel *ch, uint32_t > ch_idx, > +report_loss(struct dpif_netlink *dpif, struct dpif_channel *ch, uint32_t > ch_idx, > uint32_t handler_id) > { > static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5); > diff --git a/lib/dpif-linux.h b/lib/dpif-linux.h > index a35826c..4f85e44 100644 > --- a/lib/dpif-linux.h > +++ b/lib/dpif-linux.h > @@ -56,6 +56,6 @@ int dpif_linux_vport_transact(const struct dpif_linux_vport > *request, > int dpif_linux_vport_get(const char *name, struct dpif_linux_vport *reply, > 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 */ > diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h > index 89b32dd..3f57049 100644 > --- a/lib/dpif-provider.h > +++ b/lib/dpif-provider.h > @@ -358,7 +358,7 @@ struct dpif_class { > 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; > > #ifdef __cplusplus > diff --git a/lib/dpif.c b/lib/dpif.c > index bf2c5f9..51b0166 100644 > --- a/lib/dpif.c > +++ b/lib/dpif.c > @@ -59,8 +59,8 @@ COVERAGE_DEFINE(dpif_purge); > COVERAGE_DEFINE(dpif_execute_with_help); > > static const struct dpif_class *base_dpif_classes[] = { > -#ifdef __linux__ > - &dpif_linux_class, > +#if defined(__linux__) || defined(_WIN32) > + &dpif_netlink_class, > #endif > &dpif_netdev_class, > }; > -- > 1.9.0.msysgit.0 > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev