netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Alex Williamson <alex.williamson@hp.com>
Cc: markmc@redhat.com, netdev@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v2 2/4] virtio_net: Add a set_rx_mode interface
Date: Fri, 30 Jan 2009 16:00:57 +1030	[thread overview]
Message-ID: <200901301600.57298.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20090129230512.2672.13107.stgit@debian.lart>

On Friday 30 January 2009 09:35:12 Alex Williamson wrote: 
> +static void virtnet_set_rx_mode(struct net_device *dev)
> +{
> +	struct virtnet_info *vi = netdev_priv(dev);
> +	u8 promisc, allmulti;
> +
> +	if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
> +		return;

Hmm, this check duplicates the one in virtnet_send_command; after
all your patches, is it ever called with !VIRTIO_NET_F_CTRL_RX?  Maybe it should be a BUG_ON in there?

> +	promisc = ((dev->flags & IFF_PROMISC) != 0 || dev->uc_count > 0);
> +	allmulti = ((dev->flags & IFF_ALLMULTI) != 0 || dev->mc_count > 0);
> +
> +	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
> +				  VIRTIO_NET_CTRL_RX_PROMISC,
> +				  &promisc, sizeof(promisc)))
> +		printk(KERN_WARNING "%s: Failed to %sable promisc mode.\n",
> +		       dev->name, promisc ? "en" : "dis");
> +
> +	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
> +				  VIRTIO_NET_CTRL_RX_ALLMULTI,
> +				  &allmulti, sizeof(allmulti)))
> +		printk(KERN_WARNING "%s: Failed to %sable allmulti mode.\n",
> +		       dev->name, allmulti ? "en" : "dis");
> +}

Hmm, we can't do anything with this error.  I'd be very tempted to define the API to say "this can't fail".  Leave this code in as a sanity check, but have a comment to that effect?

> +#define VIRTIO_NET_CTRL_RX    0
> + #define VIRTIO_NET_CTRL_RX_PROMISC      0
> + #define VIRTIO_NET_CTRL_RX_ALLMULTI     1

Comment above/beside these two perhaps?
/* Supported if VIRTIO_NET_F_CTRL_RX */

Cheers,
Rusty.

  reply	other threads:[~2009-01-30  5:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29 23:05 [PATCH v2 0/4] virtio_net: Add MAC and VLAN filtering Alex Williamson
2009-01-29 23:05 ` [PATCH v2 1/4] virtio_net: Add a virtqueue for outbound control commands Alex Williamson
2009-01-30  5:08   ` Rusty Russell
2009-01-29 23:05 ` [PATCH v2 2/4] virtio_net: Add a set_rx_mode interface Alex Williamson
2009-01-30  5:30   ` Rusty Russell [this message]
2009-01-29 23:05 ` [PATCH v2 3/4] virtio_net: Add a MAC filter table Alex Williamson
2009-01-30  5:46   ` Rusty Russell
2009-01-29 23:05 ` [PATCH v2 4/4] virtio_net: Add support for VLAN filtering in the hypervisor Alex Williamson
2009-01-30  6:01   ` Rusty Russell
2009-01-30  1:49 ` [PATCH v2 0/4] virtio_net: Add MAC and VLAN filtering David Miller
2009-01-30  7:05   ` Rusty Russell
2009-01-30  7:12     ` David Miller
2009-01-30  5:03 ` Rusty Russell
2009-02-01 20:05   ` [PATCH v3 " Alex Williamson
2009-02-01 20:05     ` [PATCH v3 1/4] virtio_net: Add a virtqueue for outbound control commands Alex Williamson
2009-02-02  9:40       ` Rusty Russell
2009-02-02 14:10         ` Anthony Liguori
2009-02-01 20:05     ` [PATCH v3 2/4] virtio_net: Add a set_rx_mode interface Alex Williamson
2009-02-02  9:52       ` Rusty Russell
2009-02-02 21:34         ` Alex Williamson
2009-02-03  2:54           ` Rusty Russell
2009-02-01 20:05     ` [PATCH v3 3/4] virtio_net: Add a MAC filter table Alex Williamson
2009-02-02  9:57       ` Rusty Russell
2009-02-01 20:05     ` [PATCH v3 4/4] virtio_net: Add support for VLAN filtering in the hypervisor Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200901301600.57298.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=alex.williamson@hp.com \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).