On Fri, May 25, 2012 at 7:05 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > Il 25/05/2012 12:52, zwu.kernel@xxxxxxxxx ha scritto: >> From: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx> >> >> 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 <wuzhy@xxxxxxxxxxxxxxxxxx> >> --- >> 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html