All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevic@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	netdev@vger.kernel.org
Subject: Re: [RFC] virtio_net: multicast address list never sent to host
Date: Fri, 06 Dec 2013 20:37:01 -0500	[thread overview]
Message-ID: <52A27BBD.7050203@redhat.com> (raw)
In-Reply-To: <20131206145145.29d204f9@nehalam.linuxnetplumber.net>

[fixed alex's address to stop bounces]

On 12/06/2013 05:51 PM, Stephen Hemminger wrote:
> On Fri, 06 Dec 2013 09:38:35 -0500
> Vlad Yasevich <vyasevic@redhat.com> wrote:
> 
>>> -		sgs[out_num++] = out;
>>> -	if (in)
>>> -		sgs[out_num + in_num++] = in;
>>> +	while (out_cnt-- > 0)
>>> +		sgs[out_num++] = out++;  
>>
>> I think we can skip sg_count and just use
>>         while ((sg = sg_next(out)) != NULL)
>>                 sgs[out_num++] = sg;
>>
>> And we can probably do this loop for both 'in' and 'out' pointers.
>>
>> -vlad
> 
> 
> That won't work because callers pass a list with a single element,
> as in:

Ok, then how about:

    for (sg = out; sg; sg = sg_next(sg))
         sgs[out_num++] = sg;

    for (sg = in; sg; sg = sg_next(sg))
         sgs[in_num++] = sg;

since even a list of 1 element can be iterated using sg_next().

This makes it generic and will not require this function to change
if we ever had more then 2 elements to set, or even more then 1 element
to receive.

-vlad

>   
>> static int virtnet_set_mac_address(struct net_device *dev, void *p)
>> {
>> 	struct virtnet_info *vi = netdev_priv(dev);
>> 	struct virtio_device *vdev = vi->vdev;
>> 	int ret;
>> 	struct sockaddr *addr = p;
>> 	struct scatterlist sg;
>>
>> 	ret = eth_prepare_mac_addr_change(dev, p);
>> 	if (ret)
>> 		return ret;
>>
>> 	if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
>> 		sg_init_one(&sg, addr->sa_data, dev->addr_len);
>> 		if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC,
>> 					  VIRTIO_NET_CTRL_MAC_ADDR_SET,
>> 					  &sg, NULL)) {
>> 			dev_warn(&vdev->dev,

  reply	other threads:[~2013-12-07  1:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 23:20 [RFC] virtio_net: multicast address list never sent to host Stephen Hemminger
2013-12-06 14:38 ` Vlad Yasevich
2013-12-06 22:51   ` Stephen Hemminger
2013-12-07  1:37     ` Vlad Yasevich [this message]
2013-12-07  0:42 ` Rusty Russell
2013-12-08 12:35 ` Michael S. Tsirkin
2013-12-08 19:43   ` Stephen Hemminger
2013-12-10  8:22 ` Amos Kong
2013-12-16  7:52   ` Amos Kong

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=52A27BBD.7050203@redhat.com \
    --to=vyasevic@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stephen@networkplumber.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 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.