[ovs-dev] [PATCH 3/4] Changes needed to compile dpif-linux.c with MSVC

Ben Pfaff bpfaff at vmware.com
Fri Aug 15 16:31:47 UTC 2014


s/linux/netlink/ is fine with me.

On Fri, Aug 15, 2014 at 04:25:49PM +0000, Alin Serdean wrote:
> Hi Saurabh,
> 
> If Ben is ok with the name change I would be glad to send out a V2
> of the patch.
> 
> Thanks,
> Alin.
> 
> -----Mesaj original-----
> De la: Saurabh Shah [mailto:ssaurabh at vmware.com] 
> Trimis: Friday, August 15, 2014 4:21 AM
> C?tre: Alin Serdean; dev at openvswitch.org
> Subiect: RE: [ovs-dev] [PATCH 3/4] Changes needed to compile dpif-linux.c with MSVC
> 
> We should change the name of the class to dpif_netlink_class and rename dpif-linux to dpif-netlink.
> 
> Saurabh
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces at openvswitch.org] On Behalf Of Alin 
> > Serdean
> > Sent: Wednesday, August 13, 2014 8:17 AM
> > To: dev at openvswitch.org
> > Subject: [ovs-dev] [PATCH 3/4] Changes needed to compile dpif-linux.c 
> > with MSVC
> > 
> > The following changes are just a start to begin a discussion.
> > 
> > Bypass all epoll functionality.
> > 
> > IOCP work the other way around than epoll: you get if the operation 
> > finished for a HANDLE in contrast of getting the number of file 
> > descriptors that are ready for an operation.
> > It also adds a lot of overhead for our particular task.
> > 
> > The nl_sock_recv in dpif_linux_recv__ can be flagged to get the 
> > GetOverlappedResult for that specific handle if needed.
> > 
> > Initialize dpif_linux_class on MSVC as well.
> > 
> > Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
> > ---
> >  lib/dpif-linux.c | 21 +++++++++++++++++++--
> >  lib/dpif.c       |  2 +-
> >  2 files changed, 20 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 
> > 6d461b2..982b5e9 100644
> > --- a/lib/dpif-linux.c
> > +++ b/lib/dpif-linux.c
> > @@ -410,12 +410,15 @@ 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];
> > -
> > +#ifndef _WIN32
> >          if (epoll_ctl(handler->epoll_fd, EPOLL_CTL_ADD, nl_sock_fd(socksp[i]),
> >                        &event) < 0) {
> >              error = errno;
> >              goto error;
> >          }
> > +#else
> > +        memcpy(&dpif->handlers[i].epoll_events[port_idx], &event, 
> > +sizeof(event)); #endif
> >          dpif->handlers[i].channels[port_idx].sock = socksp[i];
> >          dpif->handlers[i].channels[port_idx].last_poll = LLONG_MIN;
> >      }
> > @@ -424,8 +427,10 @@ vport_add_channels(struct dpif_linux *dpif, 
> > odp_port_t port_no,
> > 
> >  error:
> >      for (j = 0; j < i; j++) {
> > +#ifndef _WIN32
> >          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;
> >      }
> > 
> > @@ -451,9 +456,10 @@ 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];
> > -
> > +#ifndef _WIN32
> >          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; @@ -679,7 
> > +685,9 @@ dpif_linux_port_add__(struct dpif_linux *dpif, struct netdev *netdev,
> >      request.name = name;
> > 
> >      if (request.type == OVS_VPORT_TYPE_NETDEV) {
> > +#ifndef _WIN32
> >          netdev_linux_ethtool_set_flag(netdev, ETH_FLAG_LRO, "LRO", 
> > false);
> > +#endif
> >      }
> > 
> >      tnl_cfg = netdev_get_tunnel_config(netdev); @@ -1486,7 +1494,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];
> > 
> > +#ifndef _WIN32
> >              handler->epoll_fd = epoll_create(10);
> > +#else
> > +            handler->epoll_fd = 0;
> > +#endif
> >              if (handler->epoll_fd < 0) {
> >                  size_t j;
> > 
> > @@ -1728,8 +1740,13 @@ dpif_linux_recv__(struct dpif_linux *dpif, 
> > uint32_t handler_id,
> >          handler->event_offset = handler->n_events = 0;
> > 
> >          do {
> > +#ifndef _WIN32
> >              retval = epoll_wait(handler->epoll_fd, handler->epoll_events,
> >                                  dpif->uc_array_size, 0);
> > +#else
> > +            retval = dpif->uc_array_size;
> > +            handler->event_offset = 0; #endif
> >          } while (retval < 0 && errno == EINTR);
> >          if (retval < 0) {
> >              static struct vlog_rate_limit rl = 
> > VLOG_RATE_LIMIT_INIT(1, 1); diff --git a/lib/dpif.c b/lib/dpif.c index 
> > 1f15840..916afaa 100644
> > --- a/lib/dpif.c
> > +++ b/lib/dpif.c
> > @@ -59,7 +59,7 @@ COVERAGE_DEFINE(dpif_purge); 
> > COVERAGE_DEFINE(dpif_execute_with_help);
> > 
> >  static const struct dpif_class *base_dpif_classes[] = { -#ifdef 
> > __linux__
> > +#if defined(__linux__) || defined(_WIN32)
> >      &dpif_linux_class,
> >  #endif
> >      &dpif_netdev_class,
> > --
> > 1.9.0.msysgit.0
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mail
> > m an/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=pEkjsHfytv
> > HEWufeZPpgqSOJMdMjuZPbesVsNhCUc0E%3D%0A&m=ES%2F%2FMdJuqy9
> > sEIsECgbZtGgyTPg9t4gHjwHpJbZhJ94%3D%0A&s=af2cea9567a1bbbf220259c5
> > 8be18aaf41a60533bfe24dbfe7086b4d9138af82



More information about the dev mailing list