On Tue, 2008-12-09 at 08:57 -0600, Anthony Liguori wrote:
> Mark McLoughlin wrote:
> > Signed-off-by: Mark McLoughlin <[email protected]>
> > ---
> >  qemu/net.c |   18 +++++++++++++++++-
> >  1 files changed, 17 insertions(+), 1 deletions(-)
> >
> > diff --git a/qemu/net.c b/qemu/net.c
> > index 16a0990..f23a17f 100644
> > --- a/qemu/net.c
> > +++ b/qemu/net.c
> > @@ -400,6 +400,17 @@ static ssize_t vc_sendv_compat(VLANClientState *vc, 
> > const struct iovec *iov,
> >      return offset;
> >  }
> >  
> > +static ssize_t calc_iov_length(const struct iovec *iov, int iovcnt)
> > +{
> > +    size_t offset = 0;
> > +    int i;
> > +
> > +    for (i = 0; i < iovcnt; i++)
> > +   offset += iov[i].iov_len;
> > +
> > +    return offset;
> > +}
> > +
> >  ssize_t qemu_sendv_packet(VLANClientState *vc1, const struct iovec *iov,
> >                       int iovcnt)
> >  {
> > @@ -407,13 +418,18 @@ ssize_t qemu_sendv_packet(VLANClientState *vc1, const 
> > struct iovec *iov,
> >      VLANClientState *vc;
> >      ssize_t max_len = 0;
> >  
> > +    if (vc1->link_down)
> > +   return calc_iov_length(iov, iovcnt);
> > +
> >      for (vc = vlan->first_client; vc != NULL; vc = vc->next) {
> >     ssize_t len = 0;
> >  
> >     if (vc == vc1)
> >         continue;
> >  
> > -   if (vc->fd_readv)
> > +   if (vc->link_down)
> > +       len = calc_iov_length(iov, iovcnt);
> >   
> 
> Instead of returning a success and silently dropping the packet, maybe 
> it would be better to return an error and let the card deal with 
> dropping the packet.
> 
> In real hardware, the link down would mean the TX queue would fill up 
> because packets aren't able to be sent.

I failed to figure out for real what typical hardware would do, e.g. by
reading the e1000 spec, but I figure the current behaviour is good
enough for now?

Re-based patches follow.

Cheers,
Mark.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to