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

2014-08-28 Thread Saurabh Shah
That would be very helpful. Thanks!

Saurabh


>Hi,
>
>Will send the patch until  the end of the day.
>
>Alin.
>
>-Mesaj original-
>De la: Saurabh Shah [mailto:ssaur...@vmware.com]
>Trimis: Thursday, August 28, 2014 9:31 PM
>Către: Alin Serdean; dev@openvswitch.org; Ben Pfaff
>Subiect: Re: [ovs-dev] [PATCH 3/4] Changes needed to compile dpif-linux.c
>with MSVC
>
>Hi Alin,
>
>We are getting to a point where we need this change. Do you plan to send a
>V2 soon?
>
>Thanks!
>Saurabh
>
>
>>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:ssaur...@vmware.com]
>>Trimis: Friday, August 15, 2014 4:21 AM
>>Către: Alin Serdean; dev@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-boun...@openvswitch.org] On Behalf Of Alin
>>> Serdean
>>> Sent: Wednesday, August 13, 2014 8:17 AM
>>> To: dev@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 
>>> ---
>>>  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_NE

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

2014-08-28 Thread Alin Serdean
Hi,

Will send the patch until  the end of the day.

Alin.

-Mesaj original-
De la: Saurabh Shah [mailto:ssaur...@vmware.com] 
Trimis: Thursday, August 28, 2014 9:31 PM
Către: Alin Serdean; dev@openvswitch.org; Ben Pfaff
Subiect: Re: [ovs-dev] [PATCH 3/4] Changes needed to compile dpif-linux.c with 
MSVC

Hi Alin,

We are getting to a point where we need this change. Do you plan to send a
V2 soon?

Thanks!
Saurabh


>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:ssaur...@vmware.com]
>Trimis: Friday, August 15, 2014 4:21 AM
>Către: Alin Serdean; dev@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-boun...@openvswitch.org] On Behalf Of Alin 
>> Serdean
>> Sent: Wednesday, August 13, 2014 8:17 AM
>> To: dev@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 
>> ---
>>  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
&

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

2014-08-28 Thread Saurabh Shah
Hi Alin,

We are getting to a point where we need this change. Do you plan to send a
V2 soon?

Thanks!
Saurabh


>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:ssaur...@vmware.com]
>Trimis: Friday, August 15, 2014 4:21 AM
>Către: Alin Serdean; dev@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-boun...@openvswitch.org] On Behalf Of Alin
>> Serdean
>> Sent: Wednesday, August 13, 2014 8:17 AM
>> To: dev@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 
>> ---
>>  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 h

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

2014-08-15 Thread Nithin Raju
On Aug 13, 2014, at 8:16 AM, Alin Serdean  
wrote:

> 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.

Agree, IOCP is not directly compatible with epoll. Like, it has been discussed 
earlier, there's a way to make the IOCP work with the recv_set, recv_wait, recv 
workflow. We can discuss more on this. But, as you say, we may not be able to 
make it compatible with epoll.

> It also adds a lot of overhead for our particular task.

What overhead are you implying?

> The nl_sock_recv in dpif_linux_recv__ can be flagged to get the
> GetOverlappedResult for that specific handle if needed.

In dpif-windows.c, we actually pass the overlapped structure to the poll 
infrastructure. WaitForMultipleObjects() can be used on the event in the 
overlapped structure. When the IRP is completed by the userspace, the poll 
fires. It might be possible to use GetOverlappedResult() to get the same 
effect, but then you'll have to do busy polling in recv_wait(), and return 0.

> Initialize dpif_linux_class on MSVC as well.

Sounds good. As has been discussed, maybe we should make the linux -> netdev 
changes first, and then the excluding epoll from _WIN32 changes on top of that.

thanks,
Nithin
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


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

2014-08-15 Thread Ben Pfaff
s/linux/netlink/ is fine with me.

On Fri, Aug 15, 2014 at 04:25:49PM +, 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:ssaur...@vmware.com] 
> Trimis: Friday, August 15, 2014 4:21 AM
> C?tre: Alin Serdean; dev@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-boun...@openvswitch.org] On Behalf Of Alin 
> > Serdean
> > Sent: Wednesday, August 13, 2014 8:17 AM
> > To: dev@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 
> > ---
> >  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) {
> >   

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

2014-08-15 Thread Alin Serdean
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:ssaur...@vmware.com] 
Trimis: Friday, August 15, 2014 4:21 AM
Către: Alin Serdean; dev@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-boun...@openvswitch.org] On Behalf Of Alin 
> Serdean
> Sent: Wednesday, August 13, 2014 8:17 AM
> To: dev@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 
> ---
>  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/

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

2014-08-14 Thread Saurabh Shah
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-boun...@openvswitch.org] On Behalf Of Alin
> Serdean
> Sent: Wednesday, August 13, 2014 8:17 AM
> To: dev@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 
> ---
>  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@openvswitch.org
> https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailm
> an/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=pEkjsHfytv
> HEWufeZPpgqSOJMdMjuZPbesVsNhCUc0E%3D%0A&m=ES%2F%2FMdJuqy9
> sEIsECgbZtGgyTPg9t4gHjwHpJbZhJ94%3D%0A&s=af2cea9567a1bbbf220259c5
> 8be18aaf41a60533bfe24dbfe7086b4d9138af82
___
dev mailing list
dev@o