qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 16/16] hub: add the support for hub own flow


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v4 16/16] hub: add the support for hub own flow control
Date: Fri, 25 May 2012 13:05:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Il 25/05/2012 12:52, address@hidden ha scritto:
> From: Zhi Yong Wu <address@hidden>
> 
> Only when all other hub port's *peer* .can_receive() all return 1, the source 
> hub port .can_receive() return 1.
> 
> Signed-off-by: Zhi Yong Wu <address@hidden>
> ---
>  net/hub.c |   27 ++++++++++++++++++++++++---
>  1 files changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/net/hub.c b/net/hub.c
> index 357ca87..478cce1 100644
> --- a/net/hub.c
> +++ b/net/hub.c
> @@ -15,6 +15,7 @@
>  #include "monitor.h"
>  #include "net.h"
>  #include "hub.h"
> +#include "iov.h"
>  
>  /*
>   * A hub broadcasts incoming packets to all its ports except the source port.
> @@ -59,16 +60,16 @@ static ssize_t net_hub_receive_iov(NetHub *hub, 
> NetHubPort *source_port,
>                                     const struct iovec *iov, int iovcnt)
>  {
>      NetHubPort *port;
> -    ssize_t ret = 0;
> +    ssize_t len = iov_size(iov, iovcnt);
>  
>      QLIST_FOREACH(port, &hub->ports, next) {
>          if (port == source_port) {
>              continue;
>          }
>  
> -        ret = qemu_sendv_packet(&port->nc, iov, iovcnt);
> +        qemu_sendv_packet(&port->nc, iov, iovcnt);

I think you still need to apply flow control, otherwise you're cheating.
 But perhaps this is acceptable, I'll leave it to more expert people.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]