All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] Add nic link up/down emulation to e1000
@ 2008-12-09 10:55 Mark McLoughlin
  2008-12-09 10:55 ` [Qemu-devel] [PATCH 1/4] Add 'set_link' monitor command Mark McLoughlin
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Mark McLoughlin @ 2008-12-09 10:55 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Rusty Russell, qemu-devel

Hi,
        Here's a small patch set which adds link up/down
emulation to e1000 via a "set_link" monitor command. This is
useful for people who want to e.g. test how applications
and/or the guest OS handles this condition.

        The command itself takes a VLAN ID and device index
in order to identify which device to modify. That's a bit
lame and could clearly by improved if the overall idea was
thought to be sound.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [PATCH 2/3] kvm: qemu: handle link status in qemu_sendv_packet()
@ 2009-01-08 18:37 Mark McLoughlin
  2009-01-08 18:37 ` [Qemu-devel] [PATCH 1/4] Add 'set_link' monitor command Mark McLoughlin
  0 siblings, 1 reply; 27+ messages in thread
From: Mark McLoughlin @ 2009-01-08 18:37 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Avi Kivity, kvm, Rusty Russell

On Tue, 2008-12-09 at 08:57 -0600, Anthony Liguori wrote:
> Mark McLoughlin wrote:
> > Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> > ---
> >  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.


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2009-01-08 19:46 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 10:55 [Qemu-devel] [PATCH 0/4] Add nic link up/down emulation to e1000 Mark McLoughlin
2008-12-09 10:55 ` [Qemu-devel] [PATCH 1/4] Add 'set_link' monitor command Mark McLoughlin
2008-12-09 10:55   ` [Qemu-devel] [PATCH 2/4] Add device index to 'info network' output Mark McLoughlin
2008-12-09 10:55     ` [Qemu-devel] [PATCH 3/4] Allow devices be notified of link status change Mark McLoughlin
2008-12-09 10:55       ` [Qemu-devel] [PATCH 4/4] Implement e1000 link status Mark McLoughlin
2008-12-09 15:04     ` [Qemu-devel] Re: [PATCH 2/4] Add device index to 'info network' output Anthony Liguori
2008-12-09 15:01   ` [Qemu-devel] Re: [PATCH 1/4] Add 'set_link' monitor command Anthony Liguori
2008-12-12 14:45     ` Mark McLoughlin
2008-12-12 14:46       ` [Qemu-devel] [PATCH 1/5] Add a model string to VLANClientState Mark McLoughlin
2008-12-12 14:46         ` [Qemu-devel] [PATCH 2/5] Assign a name to each VLAN client Mark McLoughlin
2008-12-12 14:46           ` [Qemu-devel] [PATCH 3/5] Fixup info_str formatting Mark McLoughlin
2008-12-12 14:46             ` [Qemu-devel] [PATCH 4/5] Add qemu_format_nic_info_str() Mark McLoughlin
2008-12-12 14:46               ` [Qemu-devel] [PATCH 5/5] Add a -net name=foo parameter Mark McLoughlin
2008-12-14 23:48                 ` Aurelien Jarno
2009-01-06 14:59       ` [Qemu-devel] Re: [PATCH 1/4] Add 'set_link' monitor command Mark McLoughlin
2009-01-06 15:00         ` [Qemu-devel] [PATCH 1/6] Add a model string to VLANClientState Mark McLoughlin
2009-01-06 15:00           ` [Qemu-devel] [PATCH 2/6] Assign a name to each VLAN client Mark McLoughlin
2009-01-06 15:00             ` [Qemu-devel] [PATCH 3/6] Fixup info_str formatting Mark McLoughlin
2009-01-06 15:00               ` [Qemu-devel] [PATCH 4/6] Add qemu_format_nic_info_str() Mark McLoughlin
2009-01-06 15:00                 ` [Qemu-devel] [PATCH 5/6] add missing MAC address to info_str for some NICs Mark McLoughlin
2009-01-06 15:00                   ` [Qemu-devel] [PATCH 6/6] Add a -net name=foo parameter Mark McLoughlin
2009-01-07 17:49           ` [Qemu-devel] Re: [PATCH 1/6] Add a model string to VLANClientState Anthony Liguori
2008-12-09 11:23 ` [Qemu-devel] [PATCH 0/4] Add nic link up/down emulation to e1000 Daniel P. Berrange
2008-12-09 13:57   ` Dor Laor
2008-12-09 15:06 ` [Qemu-devel] " Anthony Liguori
2008-12-10  8:53   ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2009-01-08 18:37 [PATCH 2/3] kvm: qemu: handle link status in qemu_sendv_packet() Mark McLoughlin
2009-01-08 18:37 ` [Qemu-devel] [PATCH 1/4] Add 'set_link' monitor command Mark McLoughlin
2009-01-08 19:46   ` [Qemu-devel] " Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.