On Fri, May 25, 2012 at 7:05 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > Il 25/05/2012 12:52, zwu.ker...@gmail.com ha scritto: >> From: Zhi Yong Wu <wu...@linux.vnet.ibm.com> >> >> 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 <wu...@linux.vnet.ibm.com> >> --- >> 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. Great. thanks. any comments for other patches?
> > Paolo -- Regards, Zhi Yong Wu