Netdev List
 help / color / mirror / Atom feed
* Re: [RFC PATCH 2/2] macvtap: TX zero copy between guest and host kernel
From: Michael S. Tsirkin @ 2010-09-29  8:28 UTC (permalink / raw)
  To: Shirley Ma
  Cc: Arnd Bergmann, Avi Kivity, Xin, Xiaohui, David Miller, netdev,
	kvm, linux-kernel
In-Reply-To: <20100929081645.GA21195@redhat.com>

On Wed, Sep 29, 2010 at 10:16:45AM +0200, Michael S. Tsirkin wrote:
> On Tue, Sep 28, 2010 at 08:24:29PM -0700, Shirley Ma wrote:
> > Hello Michael,
> > 
> > On Wed, 2010-09-15 at 07:52 -0700, Shirley Ma wrote:
> > > > >  Don't you think once I address vhost_add_used_and_signal update
> > > > > issue, it is a simple and complete patch for macvtap TX zero copy?
> > > > > 
> > > > > Thanks
> > > > > Shirley
> > > > 
> > > > I like the fact that the patch is simple. Unfortunately
> > > > I suspect it'll stop being simple by the time it's complete :) 
> > > 
> > > I can make a try. :)
> > 
> > I compared several approaches for addressing the issue being raised here
> > on how/when to update vhost_add_used_and_signal. The simple approach I
> > have found is:
> > 
> > 1. Adding completion field in struct virtqueue;
> > 2. when it is a zero copy packet, put vhost thread wait for completion
> > to update vhost_add_used_and_signal;
> > 3. passing vq from vhost to macvtap as skb destruct_arg;
> > 4. when skb is freed for the last reference, signal vq completion
> > The test results show same performance as the original patch. How do you
> > think? If it sounds good to you. I will resubmit this reversion patch.
> > The patch still keeps as simple as it was before. :)
> > 
> > Thanks
> > Shirley
> 
> If you look at dev_hard_start_xmit you will see a call
> to skb_orphan_try which often calls the skb destructor.
> So I suspect this is almost equivalent to your original patch,
> and has the same correctness issue.

So you could try doing skb_tx(skb)->prevent_sk_orphan = 1
just to see what will happen. Might be interesting - just
make sure the device doesn't orphan the skb first thing.
I suspect lack of parallelism will result in bad throughput
esp for small messages.

Note this still won't make it correct (this has module unloading
issue, and devices might still orphan skb, clone it, or hang on to
paged data in some other way) but at least closer.

I think you should try testing with guest to external communication,
this will uncover some of these correctness issues for you.
I think netperf also has some flag to check data, might
be a good idea to use it for testing.

> -- 
> MST

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: Eric Dumazet @ 2010-09-29  8:22 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David Miller, netdev, kaber
In-Reply-To: <20100929080303.GA5318@gondor.apana.org.au>

Le mercredi 29 septembre 2010 à 17:03 +0900, Herbert Xu a écrit :
> On Wed, Sep 29, 2010 at 01:00:56AM -0700, David Miller wrote:
> .
> > > 	options ipv6 disable=1
> > > 
> > > If so then that's what should be used in this case.
> > 
> > That's what one should use "always" :-)
> > 
> > Bonding has the same issue, and it's why we added the
> > disable module option, so that the /bin/true stupidity
> > could stop.
> 
> Right, that settles it :)

OK guys, you convinced me ;)



^ permalink raw reply

* Re: [PATCH net-next-2.6] ip_gre: lockless xmit
From: David Miller @ 2010-09-29  8:21 UTC (permalink / raw)
  To: eric.dumazet; +Cc: nicolas.dichtel, netdev
In-Reply-To: <1285748288.2615.15.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 29 Sep 2010 10:18:08 +0200

> What is deprecated is to assert NETIF_F_LLTX and yet, use a lock in the
> ndo_xmit() driver method.

Also we've discussed recently to do away with the NETIF_F_LLTX
flag entirely for queue-less devices such as loopback and
sw tunnels.

Then all will be left are the truly "deprecated" cases Eric
mentions.

^ permalink raw reply

* Re: [PATCH net-next-2.6] ip_gre: lockless xmit
From: Eric Dumazet @ 2010-09-29  8:18 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: David Miller, netdev
In-Reply-To: <4CA2F46B.1070607@6wind.com>

Le mercredi 29 septembre 2010 à 10:10 +0200, Nicolas Dichtel a écrit :
> NETIF_F_LLTX is marked as deprecated:
> 
> include/linux/netdevice.h:
> #define NETIF_F_LLTX            4096    /* LockLess TX - deprecated. 
> Please */
>                                          /* do not use LLTX in new 
> drivers */
> 
> Is it right to use it?
> 

In this particular case (and drivers/net/loopback.c), yes.

This is the only way to avoid the locking in core network
(net/core/dev.c)

What is deprecated is to assert NETIF_F_LLTX and yet, use a lock in the
ndo_xmit() driver method.




^ permalink raw reply

* Re: [RFC PATCH 2/2] macvtap: TX zero copy between guest and host kernel
From: Michael S. Tsirkin @ 2010-09-29  8:16 UTC (permalink / raw)
  To: Shirley Ma
  Cc: Arnd Bergmann, Avi Kivity, Xin, Xiaohui, David Miller, netdev,
	kvm, linux-kernel
In-Reply-To: <1285730669.31343.7.camel@localhost.localdomain>

On Tue, Sep 28, 2010 at 08:24:29PM -0700, Shirley Ma wrote:
> Hello Michael,
> 
> On Wed, 2010-09-15 at 07:52 -0700, Shirley Ma wrote:
> > > >  Don't you think once I address vhost_add_used_and_signal update
> > > > issue, it is a simple and complete patch for macvtap TX zero copy?
> > > > 
> > > > Thanks
> > > > Shirley
> > > 
> > > I like the fact that the patch is simple. Unfortunately
> > > I suspect it'll stop being simple by the time it's complete :) 
> > 
> > I can make a try. :)
> 
> I compared several approaches for addressing the issue being raised here
> on how/when to update vhost_add_used_and_signal. The simple approach I
> have found is:
> 
> 1. Adding completion field in struct virtqueue;
> 2. when it is a zero copy packet, put vhost thread wait for completion
> to update vhost_add_used_and_signal;
> 3. passing vq from vhost to macvtap as skb destruct_arg;
> 4. when skb is freed for the last reference, signal vq completion
> The test results show same performance as the original patch. How do you
> think? If it sounds good to you. I will resubmit this reversion patch.
> The patch still keeps as simple as it was before. :)
> 
> Thanks
> Shirley

If you look at dev_hard_start_xmit you will see a call
to skb_orphan_try which often calls the skb destructor.
So I suspect this is almost equivalent to your original patch,
and has the same correctness issue.

-- 
MST

^ permalink raw reply

* Re: [PATCH net-next-2.6] ip_gre: lockless xmit
From: Nicolas Dichtel @ 2010-09-29  8:10 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev
In-Reply-To: <1285664747.2607.48.camel@edumazet-laptop>

NETIF_F_LLTX is marked as deprecated:

include/linux/netdevice.h:
#define NETIF_F_LLTX            4096    /* LockLess TX - deprecated. 
Please */
                                         /* do not use LLTX in new 
drivers */

Is it right to use it?

Regards,
Nicolas

Eric Dumazet wrote:
> GRE tunnels can benefit from lockless xmits, using NETIF_F_LLTX
> 
> Note: If tunnels are created with the "oseq" option, LLTX is not
> enabled :
> 
> Even using an atomic_t o_seq, we would increase chance for packets being
> out of order at receiver.
> 
> Bench on a 16 cpus machine (dual E5540 cpus), 16 threads sending
> 10000000 UDP frames via one gre tunnel (size:200 bytes per frame)
> 
> Before patch : 
> real	3m0.094s
> user	0m9.365s
> sys	47m50.103s
> 
> After patch:
> real	0m29.756s
> user	0m11.097s
> sys	7m33.012s
> 
> Last problem to solve is the contention on dst :
> 
> 
> 38660.00 21.4% __ip_route_output_key          vmlinux             
> 20786.00 11.5% dst_release                    vmlinux             
> 14191.00  7.8% __xfrm_lookup                  vmlinux             
> 12410.00  6.9% ip_finish_output               vmlinux             
>  4540.00  2.5% ip_push_pending_frames         vmlinux             
>  4427.00  2.4% ip_append_data                 vmlinux             
>  4265.00  2.4% __alloc_skb                    vmlinux             
>  4140.00  2.3% __ip_local_out                 vmlinux             
>  3991.00  2.2% dev_queue_xmit                 vmlinux     
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
>  net/ipv4/ip_gre.c |    4 ++++
>  1 files changed, 4 insertions(+)
> 
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index a1b5d5e..035db63 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -1557,6 +1557,10 @@ static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nla
>  	if (!tb[IFLA_MTU])
>  		dev->mtu = mtu;
>  
> +	/* Can use a lockless transmit, unless we generate output sequences */
> +	if (!(nt->parms.o_flags & GRE_SEQ))
> +		dev->features |= NETIF_F_LLTX;
> +
>  	err = register_netdevice(dev);
>  	if (err)
>  		goto out;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: Herbert Xu @ 2010-09-29  8:03 UTC (permalink / raw)
  To: David Miller; +Cc: eric.dumazet, netdev, kaber
In-Reply-To: <20100929.010056.115931816.davem@davemloft.net>

On Wed, Sep 29, 2010 at 01:00:56AM -0700, David Miller wrote:
.
> > 	options ipv6 disable=1
> > 
> > If so then that's what should be used in this case.
> 
> That's what one should use "always" :-)
> 
> Bonding has the same issue, and it's why we added the
> disable module option, so that the /bin/true stupidity
> could stop.

Right, that settles it :)
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH] net: Implement Any-IP support for IPv6.
From: David Miller @ 2010-09-29  8:02 UTC (permalink / raw)
  To: zenczykowski; +Cc: netdev, maze
In-Reply-To: <1285582022-30787-1-git-send-email-zenczykowski@gmail.com>

From: Maciej Żenczykowski <zenczykowski@gmail.com>
Date: Mon, 27 Sep 2010 03:07:02 -0700

> From: Maciej Żenczykowski <maze@google.com>
> 
> AnyIP is the capability to receive packets and establish incoming
> connections on IPs we have not explicitly configured on the machine.
> 
> An example use case is to configure a machine to accept all incoming
> traffic on eth0, and leave the policy of whether traffic for a given IP
> should be delivered to the machine up to the load balancer.
> 
> Can be setup as follows:
>   ip -6 rule from all iif eth0 lookup 200
>   ip -6 route add local default dev lo table 200
> (in this case for all IPv6 addresses)
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Ok, I applied this and Tom's ipv4-side patch and pushed it all
out to net-next-2.6

Thanks!

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: David Miller @ 2010-09-29  8:00 UTC (permalink / raw)
  To: herbert; +Cc: eric.dumazet, netdev, kaber
In-Reply-To: <20100929075758.GA5188@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 29 Sep 2010 16:57:58 +0900

> On Wed, Sep 29, 2010 at 09:45:52AM +0200, Eric Dumazet wrote:
> .
>> > > install ipv6 /bin/true
>> > > 
>> > > or
>> > > 
>> > > options ipv6 disable=1
>> > 
>> > If you set the disable option, it should do the right thing.  Since
>> > the ipv6 symbols will be available, yet the ipv6 stack won't by
>> > default bring up ipv6 addresses onto interfaces etc.
>> 
>> I must miss something obvious.
>> 
>> David, with your patch, I cant :
>> 
>> install ipv6 /bin/true
>> modprobe ip_gre
> 
> Does it work if you use
> 
> 	options ipv6 disable=1
> 
> If so then that's what should be used in this case.

That's what one should use "always" :-)

Bonding has the same issue, and it's why we added the
disable module option, so that the /bin/true stupidity
could stop.

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: David Miller @ 2010-09-29  7:59 UTC (permalink / raw)
  To: eric.dumazet; +Cc: herbert, netdev, kaber
In-Reply-To: <1285746352.2615.11.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 29 Sep 2010 09:45:52 +0200

> I must miss something obvious.
> 
> David, with your patch, I cant :
> 
> install ipv6 /bin/true
> modprobe ip_gre
> 
> FATAL: Error inserting ip_gre
> (/lib/modules/2.6.36-rc6-dirty/kernel/net/ipv4/ip_gre.ko): Unknown
> symbol in module, or unknown parameter (see dmesg)
> 
> [  223.150774] ip_gre: Unknown symbol icmpv6_send (err 0)
> 

Try the options disable=1, that works.

We already prevent the "/bin/true" stupidity from working in
the bonding driver, that's why we added the disable
module option to ipv6.

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: Herbert Xu @ 2010-09-29  7:57 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, kaber
In-Reply-To: <1285746352.2615.11.camel@edumazet-laptop>

On Wed, Sep 29, 2010 at 09:45:52AM +0200, Eric Dumazet wrote:
.
> > > install ipv6 /bin/true
> > > 
> > > or
> > > 
> > > options ipv6 disable=1
> > 
> > If you set the disable option, it should do the right thing.  Since
> > the ipv6 symbols will be available, yet the ipv6 stack won't by
> > default bring up ipv6 addresses onto interfaces etc.
> 
> I must miss something obvious.
> 
> David, with your patch, I cant :
> 
> install ipv6 /bin/true
> modprobe ip_gre

Does it work if you use

	options ipv6 disable=1

If so then that's what should be used in this case.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH] ipv4: remove all rt cache entries on UNREGISTER event
From: Nicolas Dichtel @ 2010-09-29  7:49 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, Octavian Purdila
In-Reply-To: <1285692969.3154.86.camel@edumazet-laptop>

Eric Dumazet wrote:
> Le mardi 28 septembre 2010 à 18:45 +0200, Nicolas Dichtel a écrit :
>> Eric Dumazet wrote:
>>> Le mardi 28 septembre 2010 à 17:24 +0200, Nicolas Dichtel a écrit :
>>>> Hi,
>>>>
>>>> I face a problem when I try to remove an interface, 
>>>> netdev_wait_allrefs() complains about refcount.
>>>>
>>>> Here is a trivial scenario to reproduce the problem:
>>>> # ip tunnel add mode ipip remote 10.16.0.164 local 10.16.0.72 dev eth0
>>>> # ./a.out tunl1
>>>> # ip tunnel del tunl1
>>>>
>>>> Note: a.out binary create an IPv4 raw socket, attach it to tunl1 
>>>> (SO_BINDTODEVICE), set it as multicast (IP_MULTICAST_LOOP), set the 
>>>> multicast interface to tunl1 (IP_MULTICAST_IF), build the IP header 
>>>> (IP_HDRINCL) and then send a single packet (192.168.6.1 -> 224.0.0.18).
>>>>
>>>> Note2: when a.out is executed, tunl1 has no ip address and is down.
>>>>
>>> CC Octavian Purdila, the patch author.
>>>
>>> I am just wondering why this route is created in the first place.
The route is created because no function will check interface status (up 
and running or down). Just at the end, the packet will be enqueued in 
the noop qdisc.

>> At first, I asked myself the same question, but it seems that this is 
>> allowed to send a packet through this kind of socket, even if interface 
>> is down. Packet will be destroyed by the noop qdisk.
>> But I agree that it is strange to perform route lookup and everything to 
>>    destroy the packet at the end ...
>> Maybe raw_sendmsg() can delete it directly ;-) ... or maybe 
>> ip_route_output_flow().
>>
>> Any suggestions welcome.
>>
> 
> Hmm...
> 
> One way to track this kind of problem would be to add a WARN_ON() in
> dev_hold()
> 
> -> Check that when a reference on dev is taken, we are in a known state.
> 
> Something like this ?
dev_hold() is done when interface is down, but before unregistering 
process start.

Regards,
Nicolas

> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 83de0eb..54bef78 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1773,6 +1774,7 @@ static inline void dev_put(struct net_device *dev)
>   */
>  static inline void dev_hold(struct net_device *dev)
>  {
> +	WARN_ON(dev->reg_state != NETREG_REGISTERED);
>  	atomic_inc(&dev->refcnt);
>  }
>  
> 
> 

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: Eric Dumazet @ 2010-09-29  7:45 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev, kaber
In-Reply-To: <20100929.002544.183044247.davem@davemloft.net>

Le mercredi 29 septembre 2010 à 00:25 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 29 Sep 2010 08:47:28 +0200
> 
> > Still, this does not solve the problem for people wanting to disable
> > ipv6 module load or disable it ?
> > 
> > install ipv6 /bin/true
> > 
> > or
> > 
> > options ipv6 disable=1
> 
> If you set the disable option, it should do the right thing.  Since
> the ipv6 symbols will be available, yet the ipv6 stack won't by
> default bring up ipv6 addresses onto interfaces etc.

I must miss something obvious.

David, with your patch, I cant :

install ipv6 /bin/true
modprobe ip_gre

FATAL: Error inserting ip_gre
(/lib/modules/2.6.36-rc6-dirty/kernel/net/ipv4/ip_gre.ko): Unknown
symbol in module, or unknown parameter (see dmesg)

[  223.150774] ip_gre: Unknown symbol icmpv6_send (err 0)

Thanks



^ permalink raw reply

* Re: [PATCH 4/7] net: emaclite: Add support for little-endian platforms
From: Michal Simek @ 2010-09-29  7:33 UTC (permalink / raw)
  To: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ
  Cc: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, duyl-gjFFaj9aHVfQT0dZR+AlfA,
	linnj-gjFFaj9aHVfQT0dZR+AlfA,
	edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w,
	john.williams-g5w7nrANp4BDPfheJLI6IQ
In-Reply-To: <20100928.232722.189705899.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>



David Miller wrote:
> From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Date: Wed, 29 Sep 2010 15:11:46 +0900
> 
>> On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote:
>>> Upcomming Microblaze is little endian that's why is necessary
>>> to fix protocol and length loading.
>>>
>>> Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
>>> CC: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
>>> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>>> CC: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>> CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
>> This should go via davem, but it looks correct to me.
>>
>> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> 
> It doesn't need to, the microblaze guys can integrate this directly:
> 
> Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

Thanks for ACKs. I will add them and will take care about it.

Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: David Miller @ 2010-09-29  7:26 UTC (permalink / raw)
  To: herbert; +Cc: eric.dumazet, netdev, kaber
In-Reply-To: <20100929071158.GA4684@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 29 Sep 2010 16:11:58 +0900

> On Wed, Sep 29, 2010 at 08:24:03AM +0200, Eric Dumazet wrote:
> .
>> Well, sometimes people wants to :
>> 
>> /etc/modprobe.conf
>> install ipv6 /bin/true
>> 
>> 
>> Yet, be able to load ip_gre as a module
>> 
>> so IPV6=m, GRE=m,
> 
> I think if we cared about this we should provide ways to disable
> IPv6 (if there aren't any already) even when the module is loaded
> or the code is built-in.

We do provide this functionality already.

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: David Miller @ 2010-09-29  7:25 UTC (permalink / raw)
  To: eric.dumazet; +Cc: herbert, netdev, kaber
In-Reply-To: <1285742848.22570.53.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 29 Sep 2010 08:47:28 +0200

> Still, this does not solve the problem for people wanting to disable
> ipv6 module load or disable it ?
> 
> install ipv6 /bin/true
> 
> or
> 
> options ipv6 disable=1

If you set the disable option, it should do the right thing.  Since
the ipv6 symbols will be available, yet the ipv6 stack won't by
default bring up ipv6 addresses onto interfaces etc.

^ permalink raw reply

* [PATCH] bonding: rejoin multicast groups on VLANs
From: Flavio Leitner @ 2010-09-29  7:12 UTC (permalink / raw)
  To: netdev; +Cc: Flavio Leitner

It fixes bonding to rejoin multicast groups added
to VLAN devices on top of bonding when a failover
happens.

The first packet may be discarded, so the timer
assure that at least 3 Reports are sent.

Signed-off-by: Flavio Leitner <fleitner@redhat.com>
---
 drivers/net/bonding/bond_main.c |   59 +++++++++++++++++++++++++++++++++-----
 drivers/net/bonding/bonding.h   |    2 +
 2 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3b16f62..a23a5fa 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -865,18 +865,14 @@ static void bond_mc_del(struct bonding *bond, void *addr)
 }
 
 
-/*
- * Retrieve the list of registered multicast addresses for the bonding
- * device and retransmit an IGMP JOIN request to the current active
- * slave.
- */
-static void bond_resend_igmp_join_requests(struct bonding *bond)
+static void __bond_resend_igmp_join_requests(struct net_device *dev)
 {
 	struct in_device *in_dev;
 	struct ip_mc_list *im;
 
 	rcu_read_lock();
-	in_dev = __in_dev_get_rcu(bond->dev);
+
+	in_dev = __in_dev_get_rcu(dev);
 	if (in_dev) {
 		for (im = in_dev->mc_list; im; im = im->next)
 			ip_mc_rejoin_group(im);
@@ -885,6 +881,42 @@ static void bond_resend_igmp_join_requests(struct bonding *bond)
 	rcu_read_unlock();
 }
 
+
+/*
+ * Retrieve the list of registered multicast addresses for the bonding
+ * device and retransmit an IGMP JOIN request to the current active
+ * slave.
+ */
+static void bond_resend_igmp_join_requests(struct bonding *bond)
+{
+	struct net_device *vlan_dev;
+	struct vlan_entry *vlan;
+
+	read_lock(&bond->lock);
+	if (bond->kill_timers)
+		goto out;
+
+	/* rejoin all groups on bond device */
+	__bond_resend_igmp_join_requests(bond->dev);
+
+	if (!bond->vlgrp)
+		goto reschedule;
+
+	/* rejoin all groups on vlan devices */
+	list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
+		vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
+		if (vlan_dev)
+			__bond_resend_igmp_join_requests(vlan_dev);
+	}
+
+reschedule:
+	if (--bond->resend_igmp > 0)
+		mod_timer(&bond->mc_timer, jiffies + HZ/5);
+
+out:
+	read_unlock(&bond->lock);
+}
+
 /*
  * flush all members of flush->mc_list from device dev->mc_list
  */
@@ -944,7 +976,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
 
 		netdev_for_each_mc_addr(ha, bond->dev)
 			dev_mc_add(new_active->dev, ha->addr);
-		bond_resend_igmp_join_requests(bond);
+
+		/* rejoin multicast groups */
+		bond->resend_igmp = 3;
+		mod_timer(&bond->mc_timer, jiffies + 1);
 	}
 }
 
@@ -3741,9 +3776,15 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
 static int bond_open(struct net_device *bond_dev)
 {
 	struct bonding *bond = netdev_priv(bond_dev);
+	struct timer_list *mc_timer = &bond->mc_timer;
 
 	bond->kill_timers = 0;
 
+	/* multicast */
+	init_timer(mc_timer);
+	mc_timer->data = (unsigned long)bond;
+	mc_timer->function = (void *)&bond_resend_igmp_join_requests;
+
 	if (bond_is_lb(bond)) {
 		/* bond_alb_initialize must be called before the timer
 		 * is started.
@@ -3808,6 +3849,8 @@ static int bond_close(struct net_device *bond_dev)
 
 	write_unlock_bh(&bond->lock);
 
+	del_timer_sync(&bond->mc_timer);
+
 	if (bond->params.miimon) {  /* link check interval, in milliseconds. */
 		cancel_delayed_work(&bond->mii_work);
 	}
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index c6fdd85..5fd4164 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -198,6 +198,8 @@ struct bonding {
 	s32      slave_cnt; /* never change this value outside the attach/detach wrappers */
 	rwlock_t lock;
 	rwlock_t curr_slave_lock;
+	struct   timer_list mc_timer;
+	s8       resend_igmp;
 	s8       kill_timers;
 	s8	 send_grat_arp;
 	s8	 send_unsol_na;
-- 
1.7.2.3


^ permalink raw reply related

* [PATCH] bonding: fix to rejoin multicast groups immediately
From: Flavio Leitner @ 2010-09-29  7:12 UTC (permalink / raw)
  To: netdev; +Cc: Flavio Leitner

It should rejoin multicast groups immediately when
the failover happens to restore the multicast traffic.

Signed-off-by: Flavio Leitner <fleitner@redhat.com>
---
 net/ipv4/igmp.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 1fdcacd..b81d674 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1257,14 +1257,14 @@ void ip_mc_rejoin_group(struct ip_mc_list *im)
 	if (im->multiaddr == IGMP_ALL_HOSTS)
 		return;
 
-	if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) {
-		igmp_mod_timer(im, IGMP_Initial_Report_Delay);
-		return;
-	}
-	/* else, v3 */
-	im->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-		IGMP_Unsolicited_Report_Count;
-	igmp_ifc_event(in_dev);
+	/* a failover is happening and switches
+	 * must be notified immediately */
+	if (IGMP_V1_SEEN(in_dev))
+		igmp_send_report(in_dev, im, IGMP_HOST_MEMBERSHIP_REPORT);
+	else if (IGMP_V2_SEEN(in_dev))
+		igmp_send_report(in_dev, im, IGMPV2_HOST_MEMBERSHIP_REPORT);
+	else
+		igmp_send_report(in_dev, im, IGMPV3_HOST_MEMBERSHIP_REPORT);
 #endif
 }
 EXPORT_SYMBOL(ip_mc_rejoin_group);
-- 
1.7.2.3


^ permalink raw reply related

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: Herbert Xu @ 2010-09-29  7:11 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, netdev, Patrick McHardy
In-Reply-To: <1285741443.22570.27.camel@edumazet-laptop>

On Wed, Sep 29, 2010 at 08:24:03AM +0200, Eric Dumazet wrote:
.
> Well, sometimes people wants to :
> 
> /etc/modprobe.conf
> install ipv6 /bin/true
> 
> 
> Yet, be able to load ip_gre as a module
> 
> so IPV6=m, GRE=m,

I think if we cared about this we should provide ways to disable
IPv6 (if there aren't any already) even when the module is loaded
or the code is built-in.

BTW, I think the code isn't 100% safe as is as it tries to access
skb_dst unconditionally in the IPv6 case.  If the packet came via
a remote source (e.g., bridging and virt) it may not have an IPv6
skb_dst at all.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH] ip_gre: CONFIG_IPV6_MODULE support
From: Eric Dumazet @ 2010-09-29  6:47 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev, kaber
In-Reply-To: <20100928.223850.104051485.davem@davemloft.net>

Le mardi 28 septembre 2010 à 22:38 -0700, David Miller a écrit :
> From: David Miller <davem@davemloft.net>
> Date: Tue, 28 Sep 2010 21:41:32 -0700 (PDT)
> 
> > Eric, please cook up a patch which does this, I think the
> > magic Kconfig dependency formula for this is:
> > 
> > 	depends on IPV6 || IPV6=n
> > 
> > Thanks!
> 
> Nevermind, I took care of it :-)
> 
> --------------------
> ip_gre: Fix dependencies wrt. ipv6.
> 
> The GRE tunnel driver needs to invoke icmpv6 helpers in the
> ipv6 stack when ipv6 support is enabled.
> 
> Therefore if IPV6 is enabled, we have to enforce that GRE's
> enabling (modular or static) matches that of ipv6.
> 
> Reported-by: Patrick McHardy <kaber@trash.net>
> Reported-by: Herbert Xu <herbert@gondor.apana.org.au>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/ipv4/Kconfig |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
> index 571f895..72380a3 100644
> --- a/net/ipv4/Kconfig
> +++ b/net/ipv4/Kconfig
> @@ -217,6 +217,7 @@ config NET_IPIP
>  
>  config NET_IPGRE
>  	tristate "IP: GRE tunnels over IP"
> +	depends on IPV6 || IPV6=n
>  	help
>  	  Tunneling means encapsulating data of one protocol type within
>  	  another protocol and sending it over a channel that understands the


Still, this does not solve the problem for people wanting to disable
ipv6 module load or disable it ?

install ipv6 /bin/true

or

options ipv6 disable=1

I tried both ways with my patch and could load ip_gre module. But in
both ways, register_icmpv6_send() was not called so ip_gre could not try
to use icmpv6_send()






^ permalink raw reply

* Re: [PATCH v2 1/2] Phonet: Implement Pipe Controller to support Nokia Slim Modems
From: Kumar SANGHVI @ 2010-09-29  6:32 UTC (permalink / raw)
  To: Rémi Denis-Courmont
  Cc: davem@davemloft.net, netdev@vger.kernel.org,
	STEricsson_nomadik_linux, Sudeep DIVAKARAN, Gulshan KARMANI,
	Linus WALLEIJ
In-Reply-To: <201009290125.07068.remi.denis-courmont@nokia.com>

Hi Rémi Denis-Courmontt

On Wed, Sep 29, 2010 at 00:25:06 +0200, Rémi Denis-Courmont wrote:
 
> As far as I know, you don't need to do that in kernel space. I don't know the 
> internals of the STE modem. Regardless of having or not having a pipe 
> controller, Linux userspace can send pipe messages using a plain Phonet 
> datagram socket. This avoids adding ioctl()'s and protocol stuff in kernel 
> space. Then, as far as kernel is concerned, only small changes to the data 
> path would be required.
>
Agreed partially. In fact, we initially followed the same approach.
However, following this approach, we faced problem situations which I
have described in detail in the mail '[PATCH 0/2] Phonet: Implement Pipe
Controller to support Nokia Slim Modems'.

We can introduce corrections in Phonet stack for the PS path which
would be minor. But then those changes look more like a hack. Further,
this change would be required at several places where PS communication
is happening with modem e.g. pep_reply, pipe_skb_send, pipe_snd_status,
etc.

Further, if a new function tomorrow is introduced for PS path
communication with modem then, that hack will have to be added to that
function also.
 
> Both the Nokia modem plugin for oFono, and the (closed-source) Nokia N900 CSD-
> GPRS service work that way. In other words, the pipe 'signaling' is done in 
> userspace, while the pipe 'data' is done in kernel space for optimal 
> performance.
>
 
I am not much aware of modem used in Nokia N900 but I guess N900 modem
has pipe controller implemented inside it. So, the pipe 'data' works
fine with kernel.

If we use the same approach for Nokia Slim modems, this approach
introduces the problem of PS data traversing two times the phonet stack.
Again I have described this problem in the mail '[PATCH 0/2] Phonet:
Implement Pipe Controller to support Nokia Slim Modems'.

> For some background - Phonet pipes work very much like FTP. There are two 
> endpoints exchaning data, and one client ('owner') deciding which endpoints 
> and when to establish a pipe between. In most case the client is also one of 
> the endpoint, but this is not required. With this patch, the client is tied to 
> being one of the endpoint. Arguably, this is not a problem for most usecases. 
> But I am not sure this belongs in *kernel* space.

Based on problems described above, we thought it would be better to
handle in kernel. Later on, any user-space can establish Pipe connection
with modem using this approach e.g. Video telephony socket can establish
its own pipe with modem, GPRS/3G socket can establish its own pipe with
modem.

Further, the pipe controller implementation allows the flexibility to
user-space of where it is sending the pipe 'data'.
Currently, the phonet stack by default is sending pipe 'data' to
dst_dev:dst_obj = 0x00:0x00 using the variable struct sockaddr_pn
pipe_srv.
Pipe controller implementation however maintains the remote-pep for any
particular user-space socket and always sends pipe data to that correct
destination remote-pep.

> 
> > @@ -791,6 +1171,48 @@ static int pep_setsockopt(struct sock *sk, int level,
> > int optname,
> > 
> >         lock_sock(sk);
> >         switch (optname) {
> > +#ifdef CONFIG_PHONET_PIPECTRLR
> > +       case PNPIPE_CREATE:
> > +               if (val) {
> > +                       if (pn->pipe_state > PIPE_IDLE) {
> > +                               err = -EFAULT;
> 
> Why EFAULT here? I can't see any user-space memory access failure.

Agreed. I think I should rather use -EAGAIN.
I will correct this in all the rest of places where you have indicated
-EFAULT should not be used.
I will send out a correction patch since phonet pipe controller patch is already merged
by David.

> 
> > @@ -877,11 +1313,11 @@ static int pipe_skb_send(struct sock *sk, struct
> > sk_buff *skb) } else
> >                 ph->message_id = PNS_PIPE_DATA;
> >         ph->pipe_handle = pn->pipe_handle;
> > -
> > -       err = pn_skb_send(sk, skb, &pipe_srv);
> > -       if (err && pn_flow_safe(pn->tx_fc))
> > -               atomic_inc(&pn->tx_credits);
> > -       return err;
> > +#ifdef CONFIG_PHONET_PIPECTRLR
> > +       return pn_skb_send(sk, skb, &spn);
> > +#else
> > +       return pn_skb_send(sk, skb, &pipe_srv);
> > +#endif
> >  }
> 
> This reintroduces the bug that I fixed in 
> 1a98214feef2221cd7c24b17cd688a5a9d85b2ea :-(

I apologise here as I accidently lost your commit here.
I will restore your commit here by sending patch.

> 
> -- 
> Rémi Denis-Courmont
> Nokia Devices R&D, Maemo Software, Helsinki

Thanks & regards,
Kumar.

^ permalink raw reply

* Re: [PATCH linux-2.6 v2] IPv6: Temp addresses are immediately deleted.
From: David Miller @ 2010-09-29  6:30 UTC (permalink / raw)
  To: gwurster
  Cc: kuznet, pekkas, jmorris, yoshfuji, kaber, shemminger,
	eric.dumazet, herbert, ebiederm, netdev, linux-kernel
In-Reply-To: <20100927171010.GB7106@adams.ccsl.carleton.ca>

From: Glenn Wurster <gwurster@scs.carleton.ca>
Date: Mon, 27 Sep 2010 13:10:10 -0400

> There is a bug in the interaction between ipv6_create_tempaddr and 
> addrconf_verify.  Because ipv6_create_tempaddr uses the cstamp and tstamp 
> from the public address in creating a private address, if we have not 
> received a router advertisement in a while, tstamp + temp_valid_lft might be 
> < now.  If this happens, the new address is created inside 
> ipv6_create_tempaddr, then the loop within addrconf_verify starts again and 
> the address is immediately deleted.  We are left with no temporary addresses 
> on the interface, and no more will be created until the public IP address is 
> updated.  To avoid this, set the expiry time to be the minimum of the time 
> left on the public address or the config option PLUS the current age of the 
> public interface.
> 
> Version 2, now with 100% fewer line wraps.  Thanks to David Miller for
> pointing out the line wrapping issue.
> 
> Signed-off-by: Glenn Wurster <gwurster@scs.carleton.ca>

This can only happen if we apply your other patch, which I showed
was incorrect as per RFCs.

We only create temporary address when public addresses are created,
and this is the point where we are handling a router advertisement
with non-zero Valid Lifetime.

Therefore I'm not applying this patch either.


^ permalink raw reply

* [PATCH net-next 1/2] enic: remove dead code
From: Stephen Hemminger @ 2010-09-29  6:29 UTC (permalink / raw)
  To: Scott Feldman, Vasanthy Kolluri, Roopa Prabhu, David Miller; +Cc: netdev

This driver seems to have lots of leftover dead code that is defined
globally but never used.

Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/enic/enic_res.c  |   16 -----
 drivers/net/enic/enic_res.h  |    2 
 drivers/net/enic/vnic_dev.c  |  128 -------------------------------------------
 drivers/net/enic/vnic_dev.h  |   10 ---
 drivers/net/enic/vnic_intr.c |    5 -
 5 files changed, 161 deletions(-)

--- a/drivers/net/enic/enic_res.c	2010-09-29 15:21:47.983306313 +0900
+++ b/drivers/net/enic/enic_res.c	2010-09-29 15:26:29.273306571 +0900
@@ -149,22 +149,6 @@ int enic_set_nic_cfg(struct enic *enic, 
 	return vnic_dev_cmd(enic->vdev, CMD_NIC_CFG, &a0, &a1, wait);
 }
 
-int enic_set_rss_key(struct enic *enic, dma_addr_t key_pa, u64 len)
-{
-	u64 a0 = (u64)key_pa, a1 = len;
-	int wait = 1000;
-
-	return vnic_dev_cmd(enic->vdev, CMD_RSS_KEY, &a0, &a1, wait);
-}
-
-int enic_set_rss_cpu(struct enic *enic, dma_addr_t cpu_pa, u64 len)
-{
-	u64 a0 = (u64)cpu_pa, a1 = len;
-	int wait = 1000;
-
-	return vnic_dev_cmd(enic->vdev, CMD_RSS_CPU, &a0, &a1, wait);
-}
-
 void enic_free_vnic_resources(struct enic *enic)
 {
 	unsigned int i;
--- a/drivers/net/enic/enic_res.h	2010-09-29 15:21:47.993306327 +0900
+++ b/drivers/net/enic/enic_res.h	2010-09-29 15:26:29.273306571 +0900
@@ -137,8 +137,6 @@ int enic_del_vlan(struct enic *enic, u16
 int enic_set_nic_cfg(struct enic *enic, u8 rss_default_cpu, u8 rss_hash_type,
 	u8 rss_hash_bits, u8 rss_base_cpu, u8 rss_enable, u8 tso_ipid_split_en,
 	u8 ig_vlan_strip_en);
-int enic_set_rss_key(struct enic *enic, dma_addr_t key_pa, u64 len);
-int enic_set_rss_cpu(struct enic *enic, dma_addr_t cpu_pa, u64 len);
 void enic_get_res_counts(struct enic *enic);
 void enic_init_vnic_resources(struct enic *enic);
 int enic_alloc_vnic_resources(struct enic *);
--- a/drivers/net/enic/vnic_dev.c	2010-09-29 15:21:48.003304595 +0900
+++ b/drivers/net/enic/vnic_dev.c	2010-09-29 15:27:22.315218464 +0900
@@ -186,21 +186,6 @@ void __iomem *vnic_dev_get_res(struct vn
 	}
 }
 
-dma_addr_t vnic_dev_get_res_bus_addr(struct vnic_dev *vdev,
-	enum vnic_res_type type, unsigned int index)
-{
-	switch (type) {
-	case RES_TYPE_WQ:
-	case RES_TYPE_RQ:
-	case RES_TYPE_CQ:
-	case RES_TYPE_INTR_CTRL:
-		return vdev->res[type].bus_addr +
-			index * VNIC_RES_STRIDE;
-	default:
-		return vdev->res[type].bus_addr;
-	}
-}
-
 unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring,
 	unsigned int desc_count, unsigned int desc_size)
 {
@@ -384,18 +369,6 @@ static int vnic_dev_cmd_no_proxy(struct 
 	return err;
 }
 
-void vnic_dev_cmd_proxy_by_bdf_start(struct vnic_dev *vdev, u16 bdf)
-{
-	vdev->proxy = PROXY_BY_BDF;
-	vdev->proxy_index = bdf;
-}
-
-void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev)
-{
-	vdev->proxy = PROXY_NONE;
-	vdev->proxy_index = 0;
-}
-
 int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	u64 *a0, u64 *a1, int wait)
 {
@@ -488,13 +461,6 @@ int vnic_dev_spec(struct vnic_dev *vdev,
 	return err;
 }
 
-int vnic_dev_stats_clear(struct vnic_dev *vdev)
-{
-	u64 a0 = 0, a1 = 0;
-	int wait = 1000;
-	return vnic_dev_cmd(vdev, CMD_STATS_CLEAR, &a0, &a1, wait);
-}
-
 int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats)
 {
 	u64 a0, a1;
@@ -528,19 +494,6 @@ int vnic_dev_enable(struct vnic_dev *vde
 	return vnic_dev_cmd(vdev, CMD_ENABLE, &a0, &a1, wait);
 }
 
-int vnic_dev_enable_wait(struct vnic_dev *vdev)
-{
-	u64 a0 = 0, a1 = 0;
-	int wait = 1000;
-	int err;
-
-	err = vnic_dev_cmd(vdev, CMD_ENABLE_WAIT, &a0, &a1, wait);
-	if (err == ERR_ECMDUNKNOWN)
-		return vnic_dev_cmd(vdev, CMD_ENABLE, &a0, &a1, wait);
-
-	return err;
-}
-
 int vnic_dev_disable(struct vnic_dev *vdev)
 {
 	u64 a0 = 0, a1 = 0;
@@ -572,30 +525,6 @@ int vnic_dev_open_done(struct vnic_dev *
 	return 0;
 }
 
-int vnic_dev_soft_reset(struct vnic_dev *vdev, int arg)
-{
-	u64 a0 = (u32)arg, a1 = 0;
-	int wait = 1000;
-	return vnic_dev_cmd(vdev, CMD_SOFT_RESET, &a0, &a1, wait);
-}
-
-int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done)
-{
-	u64 a0 = 0, a1 = 0;
-	int wait = 1000;
-	int err;
-
-	*done = 0;
-
-	err = vnic_dev_cmd(vdev, CMD_SOFT_RESET_STATUS, &a0, &a1, wait);
-	if (err)
-		return err;
-
-	*done = (a0 == 0);
-
-	return 0;
-}
-
 int vnic_dev_hang_reset(struct vnic_dev *vdev, int arg)
 {
 	u64 a0 = (u32)arg, a1 = 0;
@@ -680,26 +609,6 @@ int vnic_dev_packet_filter(struct vnic_d
 	return err;
 }
 
-int vnic_dev_packet_filter_all(struct vnic_dev *vdev, int directed,
-	int multicast, int broadcast, int promisc, int allmulti)
-{
-	u64 a0, a1 = 0;
-	int wait = 1000;
-	int err;
-
-	a0 = (directed ? CMD_PFILTER_DIRECTED : 0) |
-	     (multicast ? CMD_PFILTER_MULTICAST : 0) |
-	     (broadcast ? CMD_PFILTER_BROADCAST : 0) |
-	     (promisc ? CMD_PFILTER_PROMISCUOUS : 0) |
-	     (allmulti ? CMD_PFILTER_ALL_MULTICAST : 0);
-
-	err = vnic_dev_cmd(vdev, CMD_PACKET_FILTER_ALL, &a0, &a1, wait);
-	if (err)
-		pr_err("Can't set packet filter\n");
-
-	return err;
-}
-
 int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)
 {
 	u64 a0 = 0, a1 = 0;
@@ -748,19 +657,6 @@ int vnic_dev_set_ig_vlan_rewrite_mode(st
 	return err;
 }
 
-int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr)
-{
-	u64 a0 = intr, a1 = 0;
-	int wait = 1000;
-	int err;
-
-	err = vnic_dev_cmd(vdev, CMD_IAR, &a0, &a1, wait);
-	if (err)
-		pr_err("Failed to raise INTR[%d], err %d\n", intr, err);
-
-	return err;
-}
-
 int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
 	void *notify_addr, dma_addr_t notify_pa, u16 intr)
 {
@@ -954,30 +850,6 @@ u32 vnic_dev_mtu(struct vnic_dev *vdev)
 	return vdev->notify_copy.mtu;
 }
 
-u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev)
-{
-	if (!vnic_dev_notify_ready(vdev))
-		return 0;
-
-	return vdev->notify_copy.link_down_cnt;
-}
-
-u32 vnic_dev_notify_status(struct vnic_dev *vdev)
-{
-	if (!vnic_dev_notify_ready(vdev))
-		return 0;
-
-	return vdev->notify_copy.status;
-}
-
-u32 vnic_dev_uif(struct vnic_dev *vdev)
-{
-	if (!vnic_dev_notify_ready(vdev))
-		return 0;
-
-	return vdev->notify_copy.uif;
-}
-
 void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
 	enum vnic_dev_intr_mode intr_mode)
 {
--- a/drivers/net/enic/vnic_dev.h	2010-09-29 15:21:48.013306844 +0900
+++ b/drivers/net/enic/vnic_dev.h	2010-09-29 15:26:29.273306571 +0900
@@ -84,8 +84,6 @@ unsigned int vnic_dev_get_res_count(stru
 	enum vnic_res_type type);
 void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type,
 	unsigned int index);
-dma_addr_t vnic_dev_get_res_bus_addr(struct vnic_dev *vdev,
-	enum vnic_res_type type, unsigned int index);
 unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring,
 	unsigned int desc_count, unsigned int desc_size);
 void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring);
@@ -95,21 +93,16 @@ void vnic_dev_free_desc_ring(struct vnic
 	struct vnic_dev_ring *ring);
 int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	u64 *a0, u64 *a1, int wait);
-void vnic_dev_cmd_proxy_by_bdf_start(struct vnic_dev *vdev, u16 bdf);
-void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev);
 int vnic_dev_fw_info(struct vnic_dev *vdev,
 	struct vnic_devcmd_fw_info **fw_info);
 int vnic_dev_hw_version(struct vnic_dev *vdev,
 	enum vnic_dev_hw_version *hw_ver);
 int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size,
 	void *value);
-int vnic_dev_stats_clear(struct vnic_dev *vdev);
 int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats);
 int vnic_dev_hang_notify(struct vnic_dev *vdev);
 int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast,
 	int broadcast, int promisc, int allmulti);
-int vnic_dev_packet_filter_all(struct vnic_dev *vdev, int directed,
-	int multicast, int broadcast, int promisc, int allmulti);
 int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr);
 int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr);
 int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
@@ -124,11 +117,8 @@ u32 vnic_dev_port_speed(struct vnic_dev 
 u32 vnic_dev_msg_lvl(struct vnic_dev *vdev);
 u32 vnic_dev_mtu(struct vnic_dev *vdev);
 u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev);
-u32 vnic_dev_notify_status(struct vnic_dev *vdev);
-u32 vnic_dev_uif(struct vnic_dev *vdev);
 int vnic_dev_close(struct vnic_dev *vdev);
 int vnic_dev_enable(struct vnic_dev *vdev);
-int vnic_dev_enable_wait(struct vnic_dev *vdev);
 int vnic_dev_disable(struct vnic_dev *vdev);
 int vnic_dev_open(struct vnic_dev *vdev, int arg);
 int vnic_dev_open_done(struct vnic_dev *vdev, int *done);
--- a/drivers/net/enic/vnic_intr.c	2010-09-29 15:21:48.033303590 +0900
+++ b/drivers/net/enic/vnic_intr.c	2010-09-29 15:26:29.273306571 +0900
@@ -65,8 +65,3 @@ void vnic_intr_clean(struct vnic_intr *i
 {
 	iowrite32(0, &intr->ctrl->int_credits);
 }
-
-void vnic_intr_raise(struct vnic_intr *intr)
-{
-	vnic_dev_raise_intr(intr->vdev, (u16)intr->index);
-}

^ permalink raw reply

* [PATCH net-next 2/2] enic: make local functions static
From: Stephen Hemminger @ 2010-09-29  6:29 UTC (permalink / raw)
  To: Scott Feldman, Vasanthy Kolluri, Roopa Prabhu; +Cc: David Miller, netdev
In-Reply-To: <20100929151959.6a09a269@s6510>

Lots of functions in this driver are only used in one file and should
be static. Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/enic/enic_main.c |    6 +++---
 drivers/net/enic/vnic_dev.c  |    6 +++---
 drivers/net/enic/vnic_dev.h  |    7 -------
 drivers/net/enic/vnic_rq.c   |    2 +-
 drivers/net/enic/vnic_rq.h   |    4 ----
 drivers/net/enic/vnic_wq.c   |    2 +-
 drivers/net/enic/vnic_wq.h   |    4 ----
 7 files changed, 8 insertions(+), 23 deletions(-)

--- a/drivers/net/enic/enic_main.c	2010-09-29 15:21:47.173306644 +0900
+++ b/drivers/net/enic/enic_main.c	2010-09-29 15:27:30.223305739 +0900
@@ -1972,7 +1972,7 @@ static int enic_dev_hang_notify(struct e
 	return err;
 }
 
-int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic)
+static int enic_dev_set_ig_vlan_rewrite_mode(struct enic *enic)
 {
 	int err;
 
@@ -2147,14 +2147,14 @@ static const struct net_device_ops enic_
 #endif
 };
 
-void enic_dev_deinit(struct enic *enic)
+static void enic_dev_deinit(struct enic *enic)
 {
 	netif_napi_del(&enic->napi);
 	enic_free_vnic_resources(enic);
 	enic_clear_intr_mode(enic);
 }
 
-int enic_dev_init(struct enic *enic)
+static int enic_dev_init(struct enic *enic)
 {
 	struct device *dev = enic_get_dev(enic);
 	struct net_device *netdev = enic->netdev;
--- a/drivers/net/enic/vnic_dev.c	2010-09-29 15:27:22.315218464 +0900
+++ b/drivers/net/enic/vnic_dev.c	2010-09-29 15:27:30.233306032 +0900
@@ -186,7 +186,7 @@ void __iomem *vnic_dev_get_res(struct vn
 	}
 }
 
-unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring,
+static unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring,
 	unsigned int desc_count, unsigned int desc_size)
 {
 	/* The base address of the desc rings must be 512 byte aligned.
@@ -657,7 +657,7 @@ int vnic_dev_set_ig_vlan_rewrite_mode(st
 	return err;
 }
 
-int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
+static int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
 	void *notify_addr, dma_addr_t notify_pa, u16 intr)
 {
 	u64 a0, a1;
@@ -696,7 +696,7 @@ int vnic_dev_notify_set(struct vnic_dev 
 	return vnic_dev_notify_setcmd(vdev, notify_addr, notify_pa, intr);
 }
 
-int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev)
+static int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev)
 {
 	u64 a0, a1;
 	int wait = 1000;
--- a/drivers/net/enic/vnic_rq.c	2010-09-29 15:21:47.203305569 +0900
+++ b/drivers/net/enic/vnic_rq.c	2010-09-29 15:27:30.233306032 +0900
@@ -115,7 +115,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev,
 	return 0;
 }
 
-void vnic_rq_init_start(struct vnic_rq *rq, unsigned int cq_index,
+static void vnic_rq_init_start(struct vnic_rq *rq, unsigned int cq_index,
 	unsigned int fetch_index, unsigned int posted_index,
 	unsigned int error_interrupt_enable,
 	unsigned int error_interrupt_offset)
--- a/drivers/net/enic/vnic_wq.c	2010-09-29 15:21:47.213306002 +0900
+++ b/drivers/net/enic/vnic_wq.c	2010-09-29 15:27:30.233306032 +0900
@@ -115,7 +115,7 @@ int vnic_wq_alloc(struct vnic_dev *vdev,
 	return 0;
 }
 
-void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
+static void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
 	unsigned int fetch_index, unsigned int posted_index,
 	unsigned int error_interrupt_enable,
 	unsigned int error_interrupt_offset)
--- a/drivers/net/enic/vnic_dev.h	2010-09-29 15:26:29.273306571 +0900
+++ b/drivers/net/enic/vnic_dev.h	2010-09-29 15:27:30.233306032 +0900
@@ -84,8 +84,6 @@ unsigned int vnic_dev_get_res_count(stru
 	enum vnic_res_type type);
 void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type,
 	unsigned int index);
-unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring,
-	unsigned int desc_count, unsigned int desc_size);
 void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring);
 int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring,
 	unsigned int desc_count, unsigned int desc_size);
@@ -106,17 +104,12 @@ int vnic_dev_packet_filter(struct vnic_d
 int vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr);
 int vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr);
 int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
-int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr);
-int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
-	void *notify_addr, dma_addr_t notify_pa, u16 intr);
 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr);
-int vnic_dev_notify_unsetcmd(struct vnic_dev *vdev);
 int vnic_dev_notify_unset(struct vnic_dev *vdev);
 int vnic_dev_link_status(struct vnic_dev *vdev);
 u32 vnic_dev_port_speed(struct vnic_dev *vdev);
 u32 vnic_dev_msg_lvl(struct vnic_dev *vdev);
 u32 vnic_dev_mtu(struct vnic_dev *vdev);
-u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev);
 int vnic_dev_close(struct vnic_dev *vdev);
 int vnic_dev_enable(struct vnic_dev *vdev);
 int vnic_dev_disable(struct vnic_dev *vdev);
--- a/drivers/net/enic/vnic_rq.h	2010-09-29 15:21:47.243305555 +0900
+++ b/drivers/net/enic/vnic_rq.h	2010-09-29 15:27:30.233306032 +0900
@@ -202,10 +202,6 @@ static inline int vnic_rq_fill(struct vn
 void vnic_rq_free(struct vnic_rq *rq);
 int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
 	unsigned int desc_count, unsigned int desc_size);
-void vnic_rq_init_start(struct vnic_rq *rq, unsigned int cq_index,
-	unsigned int fetch_index, unsigned int posted_index,
-	unsigned int error_interrupt_enable,
-	unsigned int error_interrupt_offset);
 void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
 	unsigned int error_interrupt_enable,
 	unsigned int error_interrupt_offset);
--- a/drivers/net/enic/vnic_wq.h	2010-09-29 15:21:47.263307399 +0900
+++ b/drivers/net/enic/vnic_wq.h	2010-09-29 15:27:30.233306032 +0900
@@ -153,10 +153,6 @@ static inline void vnic_wq_service(struc
 void vnic_wq_free(struct vnic_wq *wq);
 int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index,
 	unsigned int desc_count, unsigned int desc_size);
-void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
-	unsigned int fetch_index, unsigned int posted_index,
-	unsigned int error_interrupt_enable,
-	unsigned int error_interrupt_offset);
 void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index,
 	unsigned int error_interrupt_enable,
 	unsigned int error_interrupt_offset);

^ permalink raw reply

* Re: [PATCH 4/7] net: emaclite: Add support for little-endian platforms
From: David Miller @ 2010-09-29  6:27 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ
  Cc: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
	microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, duyl-gjFFaj9aHVfQT0dZR+AlfA,
	netdev-u79uwXL29TY76Z2rM5mHXA, linnj-gjFFaj9aHVfQT0dZR+AlfA,
	edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w,
	john.williams-g5w7nrANp4BDPfheJLI6IQ
In-Reply-To: <20100929061146.GA2439-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>

From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Date: Wed, 29 Sep 2010 15:11:46 +0900

> On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote:
>> Upcomming Microblaze is little endian that's why is necessary
>> to fix protocol and length loading.
>> 
>> Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
>> CC: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
>> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>> CC: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> 
> This should go via davem, but it looks correct to me.
> 
> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

It doesn't need to, the microblaze guys can integrate this directly:

Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox