Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] stmmac: removed not used definitions
From: David Miller @ 2011-05-05 17:43 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev
In-Reply-To: <1304590250-9434-1-git-send-email-peppe.cavallaro@st.com>

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Thu,  5 May 2011 12:10:50 +0200

> Reported-by: Karim Hamiti <karim.hamiti@st.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied to net-next-2.6, thanks.

^ permalink raw reply

* Re: [net-next v3 0/6] bnx2x enhancements and date update
From: David Miller @ 2011-05-05 17:45 UTC (permalink / raw)
  To: dmitry; +Cc: netdev, eilong, vladz, bhutchings
In-Reply-To: <1304589516.17528.11.camel@lb-tlvb-dmitry>

From: "Dmitry Kravkov" <dmitry@broadcom.com>
Date: Thu, 5 May 2011 12:58:36 +0300

> Another re-spin with format fixes as reported by Ben Hutchings
> <bhutchings@solarflare.com>

All applied, thanks for fixing things up.

^ permalink raw reply

* Re: [PATCHv4 2/2] tg3: Allow ethtool to enable/disable loopback.
From: Mahesh Bandewar @ 2011-05-05 17:47 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Matt Carlson, David Miller, netdev, Michael Chan, Tom Herbert
In-Reply-To: <BANLkTi=1Nw6A8cMNyVGnASOA_VF018ooxA@mail.gmail.com>

On Wed, May 4, 2011 at 11:59 PM, Michał Mirosław <mirqus@gmail.com> wrote:
> 2011/5/5 Mahesh Bandewar <maheshb@google.com>:
>> This patch adds tg3_set_features() to handle loopback mode. Currently the
>> capability is added for the devices which support internal MAC loopback mode.
>> So when enabled, it enables internal-MAC loopback.
>>
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>> ---
>> Changes since v3:
>>  (a) Corrected the condition (|| => &&) where loopback capability is added.
>>  (b) set_features() always returns 0.
>>  (c) Clear the loopback bit in ndo_open callback to avoid discrepancy.
>>
>> Changes since v2:
>>  Implemtned Joe Perches's style change.
>>
>> Changes since v1:
>>  Implemented Matt Carlson's suggestions.
>>  (a) Enable this capability on the devices which are capable of MAC-loopback
>>      mode.
>>  (b) check if the device is running before making changes.
>>  (c) check bits before making changes.
>>
>>  drivers/net/tg3.c |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 69 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
>> index 7c7c9a8..7f7a290 100644
>> --- a/drivers/net/tg3.c
>> +++ b/drivers/net/tg3.c
>> @@ -6309,6 +6309,44 @@ dma_error:
>>        return NETDEV_TX_OK;
>>  }
>>
>> +static int tg3_set_loopback(struct net_device *dev, u32 features)
>> +{
>> +       struct tg3 *tp = netdev_priv(dev);
>> +       u32 cur_mode = 0;
>> +       int retval = 0;
>
> void? You always return zero and don't check it in callers.
>
> [...]
>> @@ -9485,6 +9533,15 @@ static int tg3_open(struct net_device *dev)
>>
>>        netif_tx_start_all_queues(dev);
>>
>> +       /*
>> +        * Reset loopback feature if it was turned on while the device was down
>> +        * to avoid and any discrepancy in features reporting.
>> +        */
>> +       if (dev->features & NETIF_F_LOOPBACK) {
>> +               dev->features &= ~NETIF_F_LOOPBACK;
>> +               dev->wanted_features &= ~NETIF_F_LOOPBACK;
>> +       }
>> +
>
> if (dev->features & NETIF_F_LOOPBACK)
>  tg3_set_loopback(dev, dev->features);
>
Unfortunately at this stage device will not be able to set-loopback so
I resorted to clearing the bit(s).

> Whatever you do, don't modify wanted_features in drivers.
>
Since just clearing the 'features' would leave wanted_features in
discrepant state, I thought this will bring it to a sane state. So
what is a preferred way?

> BTW, similar problems (also like in previous versions) are in
> forcedeth implementation.
Yes, whatever we decide about the state of the wanted_features, I'll
implement similarly for forcedeth. Which previous problem you are
referring to? Is it the return value? There is a different kind of
failure (error while writing the register). Since update_features()
cant handle return value, I'm ignoring the return value. As far as the
correct return code is concerned, I wasn't sure what is appropriate
return code here (may be PHY_ERROR would be appropriate there) but
again I could ignore it just the way rest of the code is ignoring.

>
> Best Regards,
> Michał Mirosław
> --
> 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: [PATCHv2 1/2] net: Export dev_queue_xmit_nit for use by macvlan driver
From: David Miller @ 2011-05-05 17:50 UTC (permalink / raw)
  To: david.ward; +Cc: netdev, kaber
In-Reply-To: <1304036552-1589-2-git-send-email-david.ward@ll.mit.edu>

From: David Ward <david.ward@ll.mit.edu>
Date: Thu, 28 Apr 2011 20:22:31 -0400

> @@ -1521,11 +1521,13 @@ static inline int deliver_skb(struct sk_buff *skb,
>  }
>  
>  /*
> - *	Support routine. Sends outgoing frames to any network
> - *	taps currently in use.
> + * dev_queue_xmit_nit - send outgoing frame to AF_PACKET sockets
> + *
> + * @skb: buffer to send
> + * @dev: network device that AF_PACKET sockets are attached to (if any)
>   */

Your change to this comment is inaccurate.

AF_PACKET is only one of several types of entities that register these
kinds of taps.

Also, I really don't like exposing these kinds of internals for what is
largely a macvlan internal issue.  Please find a less intrustive way
to solve this problem.

Thanks.

^ permalink raw reply

* Re: [PATCH 1/2] net: use NETIF_F_ALL_TSO for vlan features
From: David Miller @ 2011-05-05 17:53 UTC (permalink / raw)
  To: shanwei; +Cc: netdev, eilong, dm, leedom, mirqus, bhutchings
In-Reply-To: <4DBA4AB4.5000802@cn.fujitsu.com>

From: Shan Wei <shanwei@cn.fujitsu.com>
Date: Fri, 29 Apr 2011 13:20:52 +0800

> 
> As Dimitris Michailidis suggested, use NETIF_F_ALL_TSO for vlan_features,
> which is a mask, but not hw_features. 
> 
> Compile test.
> 
> 
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>

I do not understand why we want to advertise a set of ->vlan_features
TSO flags that are different from the flags advertised in ->hw_features.

Why do we want to do this?

^ permalink raw reply

* Re: [PATCH 2/2 net-next] net: drivers: set TSO/UFO offload option explicitly
From: David Miller @ 2011-05-05 17:54 UTC (permalink / raw)
  To: shanwei
  Cc: netdev, rusty, mst, eric.dumazet, mirq-linux, mirqus, bhutchings,
	dm
In-Reply-To: <4DBA4DF5.5020101@cn.fujitsu.com>

From: Shan Wei <shanwei@cn.fujitsu.com>
Date: Fri, 29 Apr 2011 13:34:45 +0800

> The device drivers should not use NETIF_F_ALL_TSO mask to set hw_features(or features),
> but have to explicitly set offload option. Because, This would make drivers automatically
> clain to support any new TSO feature an the moment of NETIF_F_ALL_TSO is expanded.
> 
> Some code style tuning. Just compile test. 
> 
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>

But loopback is special.  It can support anything the kernel stack can emit.

So for loopback, using NETIF_F_ALL_TSO is in fact appropriate.

^ permalink raw reply

* Re: [patch net-next-2.6] net: call dev_alloc_name from register_netdevice
From: David Miller @ 2011-05-05 17:58 UTC (permalink / raw)
  To: jpirko; +Cc: netdev, eric.dumazet, mirqus, xemul
In-Reply-To: <1304162492-6606-1-git-send-email-jpirko@redhat.com>

From: Jiri Pirko <jpirko@redhat.com>
Date: Sat, 30 Apr 2011 13:21:32 +0200

> Force dev_alloc_name() to be called from register_netdevice() by
> dev_get_valid_name(). That allows to remove multiple explicit
> dev_alloc_name() calls.
> 
> The possibility to call dev_alloc_name in advance remains.
> 
> This also fixes veth creation regresion caused by
> 84c49d8c3e4abefb0a41a77b25aa37ebe8d6b743
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

I like this change, and if some real legitimate hole is found
in it we can either quickly fix that or revert this simply.

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] Removed unnecessary assignments , gotos and goto labels
From: David Miller @ 2011-05-05 18:00 UTC (permalink / raw)
  To: sasikanth.v19; +Cc: netdev
In-Reply-To: <1304187809-7887-1-git-send-email-sasikanth.v19@gmail.com>

From: Sasikanth V <sasikanth.v19@gmail.com>
Date: Sat, 30 Apr 2011 23:53:29 +0530

> @@ -1779,15 +1770,15 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
>  	sll->sll_ifindex = po->ifindex;
>  	sll->sll_protocol = po->num;
>  	sll->sll_pkttype = 0;
> +	sll->sll_hatype = 0;	
> +	sll->sll_halen = 0;
> +
>  	rcu_read_lock();
>  	dev = dev_get_by_index_rcu(sock_net(sk), po->ifindex);
>  	if (dev) {
>  		sll->sll_hatype = dev->type;
>  		sll->sll_halen = dev->addr_len;
>  		memcpy(sll->sll_addr, dev->dev_addr, dev->addr_len);
> -	} else {
> -		sll->sll_hatype = 0;	/* Bad: we have no ARPHRD_UNSPEC */
> -		sll->sll_halen = 0;
>  	}
>  	rcu_read_unlock();

This is completely bogus.

In the dev != NULL case, we'll now write to sll_hatype and sll_halen
twice, which is less inefficient than making sure we write to these
fields only one.

And outside of this part, I really don't like the cleanups you made
here, and they don't improve the code in any way in my eyes.

Sorry.

^ permalink raw reply

* Re: [PATCH] can: fix SJA1000 dlc for RTR packets
From: David Miller @ 2011-05-05 18:02 UTC (permalink / raw)
  To: kurt.van.dijck; +Cc: socketcan-core, netdev
In-Reply-To: <20110502145048.GF338@e-circ.dyndns.org>

From: Kurt Van Dijck <kurt.van.dijck@eia.be>
Date: Mon, 2 May 2011 16:50:48 +0200

> RTR frames do have a valid data length code on CAN.
> The driver for SJA1000 did not handle that situation properly.
> 
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] net: Add sendmmsg socket system call
From: David Miller @ 2011-05-05 18:06 UTC (permalink / raw)
  To: anton; +Cc: acme, netdev
In-Reply-To: <20110503162135.5e410fcf@kryten>

From: Anton Blanchard <anton@samba.org>
Date: Tue, 3 May 2011 16:21:35 +1000

> This patch adds a multiple message send syscall and is the send
> version of the existing recvmmsg syscall. This is heavily
> based on the patch by Arnaldo that added recvmmsg.
> 
> I wrote a microbenchmark to test the performance gains of using
> this new syscall:
> 
> http://ozlabs.org/~anton/junkcode/sendmmsg_test.c
> 
> The test was run on a ppc64 box with a 10 Gbit network card. The
> benchmark can send both UDP and RAW ethernet packets.
...
> We see a 20% improvement in throughput on UDP send and 30%
> on raw socket send.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Great work, applied, thanks!

^ permalink raw reply

* Re: [PATCH 1/2] net: use NETIF_F_ALL_TSO for vlan features
From: Michał Mirosław @ 2011-05-05 18:19 UTC (permalink / raw)
  To: David Miller; +Cc: shanwei, netdev, eilong, dm, leedom, bhutchings
In-Reply-To: <20110505.105350.183065364.davem@davemloft.net>

2011/5/5 David Miller <davem@davemloft.net>:
> From: Shan Wei <shanwei@cn.fujitsu.com>
> Date: Fri, 29 Apr 2011 13:20:52 +0800
>> As Dimitris Michailidis suggested, use NETIF_F_ALL_TSO for vlan_features,
>> which is a mask, but not hw_features.
> I do not understand why we want to advertise a set of ->vlan_features
> TSO flags that are different from the flags advertised in ->hw_features.
>
> Why do we want to do this?

I remember some posts about hardware that needs HW tag insertion for
TSO on VLAN to work or other additional constraints for offloads on
VLANs. I wonder if vlan_features handling should be converted to
something like ndo_fix_features.

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: [PATCHv4 2/2] tg3: Allow ethtool to enable/disable loopback.
From: Michał Mirosław @ 2011-05-05 18:35 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Matt Carlson, David Miller, netdev, Michael Chan, Tom Herbert
In-Reply-To: <BANLkTin88L+YBrpdaHR57CSx3dg2dMF7Yg@mail.gmail.com>

W dniu 5 maja 2011 19:47 użytkownik Mahesh Bandewar
<maheshb@google.com> napisał:
> On Wed, May 4, 2011 at 11:59 PM, Michał Mirosław <mirqus@gmail.com> wrote:
>> 2011/5/5 Mahesh Bandewar <maheshb@google.com>:
>>> This patch adds tg3_set_features() to handle loopback mode. Currently the
>>> capability is added for the devices which support internal MAC loopback mode.
>>> So when enabled, it enables internal-MAC loopback.
[...]
>>> @@ -9485,6 +9533,15 @@ static int tg3_open(struct net_device *dev)
>>>
>>>        netif_tx_start_all_queues(dev);
>>>
>>> +       /*
>>> +        * Reset loopback feature if it was turned on while the device was down
>>> +        * to avoid and any discrepancy in features reporting.
>>> +        */
>>> +       if (dev->features & NETIF_F_LOOPBACK) {
>>> +               dev->features &= ~NETIF_F_LOOPBACK;
>>> +               dev->wanted_features &= ~NETIF_F_LOOPBACK;
>>> +       }
>>> +
>>
>> if (dev->features & NETIF_F_LOOPBACK)
>>  tg3_set_loopback(dev, dev->features);
>>
> Unfortunately at this stage device will not be able to set-loopback so
> I resorted to clearing the bit(s).

ndo_fix_features+ndo_set_features might be caled before ndo_open - the
first might be just from register_netdev() so even before ndo_open
callback.

>> Whatever you do, don't modify wanted_features in drivers.
> Since just clearing the 'features' would leave wanted_features in
> discrepant state, I thought this will bring it to a sane state. So
> what is a preferred way?

If you really can't do other way, driver should keep additional state
that is checked in ndo_fix_features callback.

>> BTW, similar problems (also like in previous versions) are in
>> forcedeth implementation.
> Yes, whatever we decide about the state of the wanted_features, I'll
> implement similarly for forcedeth. Which previous problem you are
> referring to? Is it the return value? There is a different kind of
> failure (error while writing the register). Since update_features()
> cant handle return value, I'm ignoring the return value. As far as the
> correct return code is concerned, I wasn't sure what is appropriate
> return code here (may be PHY_ERROR would be appropriate there) but
> again I could ignore it just the way rest of the code is ignoring.

Let's wait for this threads points to be resolved. You will probably
change the forcedeth's implementation then anyway. :-)

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb
From: Christoph Lameter @ 2011-05-05 18:40 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: Eric Dumazet, casteyde.christian, Andrew Morton, netdev,
	bugzilla-daemon, bugme-daemon, Vegard Nossum
In-Reply-To: <4DC24239.7050806@cs.helsinki.fi>

On Thu, 5 May 2011, Pekka Enberg wrote:

> > > -#ifdef CONFIG_CMPXCHG_LOCAL
> > > +#ifdef SLUB_USE_CMPXCHG_DOUBLE
> > >   	/*
> > >   	 * Must align to double word boundary for the double cmpxchg
> > > instructions
> > >   	 * to work.
> > >
> >
> >
> > Is anybody taking the patch and sending it upstream ?
>
> Oh, sorry, it got lost in my inbox. I can take care of it.

Combining this one with the patch I sent to remove the #ifdeffery would
make this much simpler.


^ permalink raw reply

* Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb
From: Eric Dumazet @ 2011-05-05 18:48 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Pekka Enberg, casteyde.christian, Andrew Morton, netdev,
	bugzilla-daemon, bugme-daemon, Vegard Nossum
In-Reply-To: <alpine.DEB.2.00.1105051339310.6821@router.home>

Le jeudi 05 mai 2011 à 13:40 -0500, Christoph Lameter a écrit :
> On Thu, 5 May 2011, Pekka Enberg wrote:
> 
> > > > -#ifdef CONFIG_CMPXCHG_LOCAL
> > > > +#ifdef SLUB_USE_CMPXCHG_DOUBLE
> > > >   	/*
> > > >   	 * Must align to double word boundary for the double cmpxchg
> > > > instructions
> > > >   	 * to work.
> > > >
> > >
> > >
> > > Is anybody taking the patch and sending it upstream ?
> >
> > Oh, sorry, it got lost in my inbox. I can take care of it.
> 
> Combining this one with the patch I sent to remove the #ifdeffery would
> make this much simpler.

I must missed it, could you please resend it ?

Thanks



^ permalink raw reply

* Re: [PATCH 0/2] wireless: Make and use const struct ieee80211_channel
From: John W. Linville @ 2011-05-05 18:49 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-wireless, libertas-dev, orinoco-users, orinoco-devel,
	netdev, linux-kernel
In-Reply-To: <cover.1304054543.git.joe@perches.com>

These patches generated a lot of warnings in net/mac80211.  Did you
actually build them?

On Thu, Apr 28, 2011 at 10:25:06PM -0700, Joe Perches wrote:
> Joe Perches (2):
>   wireless: Make struct ieee80211_channel const where possible
>   wireless: Use const struct ieee80211_channel where possible
> 
>  drivers/net/wireless/iwlegacy/iwl-4965-lib.c |    2 +-
>  drivers/net/wireless/iwlegacy/iwl3945-base.c |    2 +-
>  drivers/net/wireless/iwlwifi/iwl-agn-lib.c   |    2 +-
>  drivers/net/wireless/iwmc3200wifi/cfg80211.c |    4 +-
>  drivers/net/wireless/libertas/cfg.c          |    2 +-
>  drivers/net/wireless/mwifiex/cfg80211.c      |    9 ++++---
>  drivers/net/wireless/orinoco/cfg.c           |    2 +-
>  drivers/net/wireless/rndis_wlan.c            |    9 ++++---
>  drivers/net/wireless/wl1251/cmd.c            |    2 +-
>  drivers/net/wireless/wl1251/cmd.h            |    2 +-
>  include/net/cfg80211.h                       |   34 +++++++++++++-------------
>  net/wireless/chan.c                          |   10 ++++----
>  net/wireless/core.h                          |   14 ++++++----
>  net/wireless/debugfs.c                       |    2 +-
>  net/wireless/ibss.c                          |    6 ++--
>  net/wireless/mlme.c                          |   15 ++++++-----
>  net/wireless/nl80211.c                       |   31 ++++++++++++-----------
>  net/wireless/nl80211.h                       |    9 ++++---
>  net/wireless/reg.c                           |   11 ++++----
>  net/wireless/reg.h                           |    4 +-
>  net/wireless/scan.c                          |    6 ++--
>  net/wireless/wext-sme.c                      |    2 +-
>  22 files changed, 94 insertions(+), 86 deletions(-)
> 
> -- 
> 1.7.5.rc3.dirty
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb
From: Christoph Lameter @ 2011-05-05 19:05 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Pekka Enberg, casteyde.christian, Andrew Morton, netdev,
	bugzilla-daemon, bugme-daemon, Vegard Nossum
In-Reply-To: <1304621296.3032.98.camel@edumazet-laptop>

On Thu, 5 May 2011, Eric Dumazet wrote:

> > Combining this one with the patch I sent to remove the #ifdeffery would
> > make this much simpler.
>
> I must missed it, could you please resend it ?


Subject: slub: Remove CONFIG_CMPXCHG_LOCAL ifdeffery

Remove the #ifdefs. This means that the irqsafe_cpu_cmpxchg_double() is used
everywhere.

There may be performance implications since:

A. We now have to manage a transaction ID for all arches

B. The interrupt holdoff for arches not supporting CONFIG_CMPXCHG_LOCAL is reduced
to a very short irqoff section.

There are no multiple irqoff/irqon sequences as a result of this change. Even in the fallback
case we only have to do one disable and enable like before.

Signed-off-by: Christoph Lameter <cl@linux.com>

---
 include/linux/slub_def.h |    2 -
 mm/slub.c                |   56 -----------------------------------------------
 2 files changed, 58 deletions(-)

Index: linux-2.6/include/linux/slub_def.h
===================================================================
--- linux-2.6.orig/include/linux/slub_def.h	2011-05-04 09:33:08.000000000 -0500
+++ linux-2.6/include/linux/slub_def.h	2011-05-04 09:42:05.000000000 -0500
@@ -37,9 +37,7 @@ enum stat_item {

 struct kmem_cache_cpu {
 	void **freelist;	/* Pointer to next available object */
-#ifdef CONFIG_CMPXCHG_LOCAL
 	unsigned long tid;	/* Globally unique transaction id */
-#endif
 	struct page *page;	/* The slab from which we are allocating */
 	int node;		/* The node of the page (or -1 for debug) */
 #ifdef CONFIG_SLUB_STATS
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c	2011-05-04 09:41:59.000000000 -0500
+++ linux-2.6/mm/slub.c	2011-05-04 09:48:11.000000000 -0500
@@ -1540,7 +1540,6 @@ static void unfreeze_slab(struct kmem_ca
 	}
 }

-#ifdef CONFIG_CMPXCHG_LOCAL
 #ifdef CONFIG_PREEMPT
 /*
  * Calculate the next globally unique transaction for disambiguiation
@@ -1600,17 +1599,12 @@ static inline void note_cmpxchg_failure(
 	stat(s, CMPXCHG_DOUBLE_CPU_FAIL);
 }

-#endif
-
 void init_kmem_cache_cpus(struct kmem_cache *s)
 {
-#ifdef CONFIG_CMPXCHG_LOCAL
 	int cpu;

 	for_each_possible_cpu(cpu)
 		per_cpu_ptr(s->cpu_slab, cpu)->tid = init_tid(cpu);
-#endif
-
 }
 /*
  * Remove the cpu slab
@@ -1643,9 +1637,7 @@ static void deactivate_slab(struct kmem_
 		page->inuse--;
 	}
 	c->page = NULL;
-#ifdef CONFIG_CMPXCHG_LOCAL
 	c->tid = next_tid(c->tid);
-#endif
 	unfreeze_slab(s, page, tail);
 }

@@ -1780,7 +1772,6 @@ static void *__slab_alloc(struct kmem_ca
 {
 	void **object;
 	struct page *new;
-#ifdef CONFIG_CMPXCHG_LOCAL
 	unsigned long flags;

 	local_irq_save(flags);
@@ -1792,7 +1783,6 @@ static void *__slab_alloc(struct kmem_ca
 	 */
 	c = this_cpu_ptr(s->cpu_slab);
 #endif
-#endif

 	/* We handle __GFP_ZERO in the caller */
 	gfpflags &= ~__GFP_ZERO;
@@ -1819,10 +1809,8 @@ load_freelist:
 	c->node = page_to_nid(c->page);
 unlock_out:
 	slab_unlock(c->page);
-#ifdef CONFIG_CMPXCHG_LOCAL
 	c->tid = next_tid(c->tid);
 	local_irq_restore(flags);
-#endif
 	stat(s, ALLOC_SLOWPATH);
 	return object;

@@ -1858,9 +1846,7 @@ new_slab:
 	}
 	if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
 		slab_out_of_memory(s, gfpflags, node);
-#ifdef CONFIG_CMPXCHG_LOCAL
 	local_irq_restore(flags);
-#endif
 	return NULL;
 debug:
 	if (!alloc_debug_processing(s, c->page, object, addr))
@@ -1887,20 +1873,12 @@ static __always_inline void *slab_alloc(
 {
 	void **object;
 	struct kmem_cache_cpu *c;
-#ifdef CONFIG_CMPXCHG_LOCAL
 	unsigned long tid;
-#else
-	unsigned long flags;
-#endif

 	if (slab_pre_alloc_hook(s, gfpflags))
 		return NULL;

-#ifndef CONFIG_CMPXCHG_LOCAL
-	local_irq_save(flags);
-#else
 redo:
-#endif

 	/*
 	 * Must read kmem_cache cpu data via this cpu ptr. Preemption is
@@ -1910,7 +1888,6 @@ redo:
 	 */
 	c = __this_cpu_ptr(s->cpu_slab);

-#ifdef CONFIG_CMPXCHG_LOCAL
 	/*
 	 * The transaction ids are globally unique per cpu and per operation on
 	 * a per cpu queue. Thus they can be guarantee that the cmpxchg_double
@@ -1919,7 +1896,6 @@ redo:
 	 */
 	tid = c->tid;
 	barrier();
-#endif

 	object = c->freelist;
 	if (unlikely(!object || !node_match(c, node)))
@@ -1927,7 +1903,6 @@ redo:
 		object = __slab_alloc(s, gfpflags, node, addr, c);

 	else {
-#ifdef CONFIG_CMPXCHG_LOCAL
 		/*
 		 * The cmpxchg will only match if there was no additional
 		 * operation and if we are on the right processor.
@@ -1948,16 +1923,9 @@ redo:
 			note_cmpxchg_failure("slab_alloc", s, tid);
 			goto redo;
 		}
-#else
-		c->freelist = get_freepointer(s, object);
-#endif
 		stat(s, ALLOC_FASTPATH);
 	}

-#ifndef CONFIG_CMPXCHG_LOCAL
-	local_irq_restore(flags);
-#endif
-
 	if (unlikely(gfpflags & __GFP_ZERO) && object)
 		memset(object, 0, s->objsize);

@@ -2034,11 +2002,9 @@ static void __slab_free(struct kmem_cach
 {
 	void *prior;
 	void **object = (void *)x;
-#ifdef CONFIG_CMPXCHG_LOCAL
 	unsigned long flags;

 	local_irq_save(flags);
-#endif
 	slab_lock(page);
 	stat(s, FREE_SLOWPATH);

@@ -2070,9 +2036,7 @@ checks_ok:

 out_unlock:
 	slab_unlock(page);
-#ifdef CONFIG_CMPXCHG_LOCAL
 	local_irq_restore(flags);
-#endif
 	return;

 slab_empty:
@@ -2084,9 +2048,7 @@ slab_empty:
 		stat(s, FREE_REMOVE_PARTIAL);
 	}
 	slab_unlock(page);
-#ifdef CONFIG_CMPXCHG_LOCAL
 	local_irq_restore(flags);
-#endif
 	stat(s, FREE_SLAB);
 	discard_slab(s, page);
 	return;
@@ -2113,20 +2075,11 @@ static __always_inline void slab_free(st
 {
 	void **object = (void *)x;
 	struct kmem_cache_cpu *c;
-#ifdef CONFIG_CMPXCHG_LOCAL
 	unsigned long tid;
-#else
-	unsigned long flags;
-#endif

 	slab_free_hook(s, x);

-#ifndef CONFIG_CMPXCHG_LOCAL
-	local_irq_save(flags);
-
-#else
 redo:
-#endif

 	/*
 	 * Determine the currently cpus per cpu slab.
@@ -2136,15 +2089,12 @@ redo:
 	 */
 	c = __this_cpu_ptr(s->cpu_slab);

-#ifdef CONFIG_CMPXCHG_LOCAL
 	tid = c->tid;
 	barrier();
-#endif

 	if (likely(page == c->page && c->node != NUMA_NO_NODE)) {
 		set_freepointer(s, object, c->freelist);

-#ifdef CONFIG_CMPXCHG_LOCAL
 		if (unlikely(!irqsafe_cpu_cmpxchg_double(
 				s->cpu_slab->freelist, s->cpu_slab->tid,
 				c->freelist, tid,
@@ -2153,16 +2103,10 @@ redo:
 			note_cmpxchg_failure("slab_free", s, tid);
 			goto redo;
 		}
-#else
-		c->freelist = object;
-#endif
 		stat(s, FREE_FASTPATH);
 	} else
 		__slab_free(s, page, x, addr);

-#ifndef CONFIG_CMPXCHG_LOCAL
-	local_irq_restore(flags);
-#endif
 }

 void kmem_cache_free(struct kmem_cache *s, void *x)

^ permalink raw reply

* pull request: wireless-next-2.6 2011-05-05
From: John W. Linville @ 2011-05-05 19:12 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev

Dave,

Another big Cinco de Mayo batch of stuff intended for 2.6.40...

Highlights include a number of mwifiex bug fixes, a batch of wl12xx
updates (including some new hardware support), a big batch of rtlwifi
fixups in preparation for some new hardware drivers, some mwl8k and
rt2x00 updates, the usual variety of iwlwifi and ath9k updates, a set
of updates to the iwlegacy drivers from Stanislaw, some ssb udpates
form Rafał, a bunch of Bluetooth updates from Gustavo and friends,
and a handful of enhancements to other drivers and to mac80211.

Please let me know if there are problems!

John

---

The following changes since commit 5a412ad7f4c95bb5b756aa12b52646e857e7c75d:

  Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6 (2011-05-04 13:54:50 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6.git for-davem

Adrian Chadd (1):
      ath9k: fix AR9160 xpaBiasLvlFreq endianness handling

Amitkumar Karwar (4):
      cfg80211: module_param to disable HT40 in 2.4GHz band
      mwifiex: check firmware capabilities while initialising 5GHz band parameters
      mwifiex: HT capability information handling
      mwifiex: fix bug in mwifiex_save_curr_bcn()

Arik Nemtsov (5):
      wl12xx: 1281/1283 support - Use different FW file for AP mode wl127x/wl128x chips
      wl12xx: Clamp byte mode transfers for 128x chips
      wl12xx: configure channel/band while FW is off
      mac80211: allow low level drivers to report packet loss
      wl12xx: support FW TX inactivity triggers

Bing Zhao (1):
      mwifiex: fix missing tsf_val TLV

Chaoming_Li (17):
      rtlwifi: Change efuse routines addition of RTL8192SE and RTL8192DE
      rtlwifi: Change wifi.h for rtl8192se and rtl8192de
      rtlwifi: Change base routines for addition of rtl8192se and rtl8192de
      rtlwifi: Change cam routines for addition of rtl8192se and rtl8192de
      rtlwifi: Convert core routines for addition of rtl8192se and rtl8192de
      rtlwifi: Convert pci routines for addition of rtl8192se and rtl8192de
      rtlwifi: Convert ps routines for addition of rtl8192se and rtl8192de
      rtlwifi: Convert rc routines for addition of rtl8192se and rtl8192de
      rtlwifi: Convert regulatory domain routines for addition of rtl8192se and rtl8192de
      rtlwifi: Convert usb routines for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192c-common: Convert common dynamic management routines for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192c-common: Change common firmware routines for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192c-common: Change common PHY routines for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192ce: Change hw routine for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192ce: Change sw and LED routines for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192ce: Change phy and rc routines for addition of rtl8192se and rtl8192de
      rtlwifi: rtl8192ce: Change rtl8192ce routines phy and trx and modify rtl8192cu for addition of rtl8192se and rtl8192de

Christian Lamparter (4):
      p54: implement multicast filter
      carl9170: improve unicast PS buffering
      mac80211: fix too early reorder release timer
      mac80211: consolidate MIC failure report handling

Don Fry (2):
      iwlagn: mod param cleanup
      iwlagn: semaphore and calib cleanup

Eliad Peller (2):
      wl12xx: set the actual tid instead of the ac
      wl12xx: rearrange some ELP wake_up/sleep calls

Gertjan van Wingerde (2):
      rt2x00: Streamline rt2800 eeprom initialisations.
      rt2x00: Introduce capability flag for Bluetooth co-existence.

Gustavo F. Padovan (11):
      Merge master.kernel.org:/.../padovan/bluetooth-2.6
      Bluetooth: Refactor L2CAP channel allocation
      Bluetooth: Move conf_state to struct l2cap_chan
      Bluetooth: Rename l2cap_do_connect() to l2cap_chan_connect()
      Bluetooth: Move some more elements to struct l2cap_chan
      Bluetooth: Move more vars to struct l2cap_chan
      Bluetooth: Move more channel info to struct l2cap_chan
      Bluetooth: Move more vars to struct l2cap_chan
      Bluetooth: Move conn to struct l2cap_chan
      Bluetooth: Fix memory leak with L2CAP channels
      Bluetooth: Don't export l2cap_sock_ops

Ido Yariv (5):
      wl12xx: Clean up and fix the 128x boot sequence
      wl12xx: Clean up the block size alignment code
      wl12xx: Clean up the dummy packet mechanism
      wl12xx: Simplify TX blocks accounting
      wl12xx: Handle platforms without level trigger interrupts

Ivo van Doorn (4):
      rt2x00: Reduce tx status reading timeout
      rt2x00: Optimize TX_STA_FIFO register reading
      rt2x00: Fix optimize register access for rt2800pci
      rt2x00: Add autowake support for USB hardware

Johan Hedberg (14):
      Bluetooth: Add basic discovery commands to the management interface
      Bluetooth: Add discovering event to the Management interface
      Bluetooth: Add automated SSP user confirmation responses
      Bluetooth: Add variable SSP auto-accept delay support
      Bluetooth: Fix HCI_CONN_AUTH_PEND flag for all authentication requests
      Bluetooth: Add confirm_hint parameter to user confirmation requests
      Bluetooth: Fix reason code for pairing rejection
      Bluetooth: Fix logic in hci_pin_code_request_evt
      Bluetooth: Fix link key persistent storage criteria
      Bluetooth: Fix old_key_type logic for non-persistent keys
      Bluetooth: Fix connection key type updating for buggy controllers
      Bluetooth: Remove old_key_type from mgmt_ev_new_key
      Bluetooth: Add store_hint parameter to mgmt_new_key
      Bluetooth: Fix updating conn->auth_type in hci_io_capa_request_evt

Johannes Berg (18):
      iwlagn: simplify error table reading
      iwlagn: clean up some exit code
      iwlagn: refactor down path
      iwlagn: refactor up path
      iwlagn: extend notification wait function
      iwlagn: make iwlagn_wait_notification return error code
      iwlagn: leave notification waits on firmware errors
      iwlagn: implement synchronous firmware load
      iwlagn: combine firmware code/data
      iwlagn: remove hw_ready variable
      mac80211: tear down BA sessions properly on suspend
      iwlagn: avoid hangs when restarting device
      iwlagn: introduce silent grabbing of NIC access
      iwlagn: refactor restart
      iwlagn: use proper good CRC threshold behaviour
      iwlagn: remove spectrum measurement header
      iwlagn: improve RXON checking
      iwlagn: prefer BSS context

John W. Linville (10):
      Merge branch 'for-linville' of git://git.kernel.org/.../luca/wl12xx
      Merge branch 'wireless-next-2.6' of git://git.kernel.org/.../iwlwifi/iwlwifi-2.6
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6
      mwl8k: replace rateinfo bitfields with mask and shift macros
      ath5k: fix uninitialized var warning for txf2txs
      b43: avoid uninitialized variable warnings in phy_n
      mwifiex: fix copy-n-paste 'thinko' for tsf_val
      p54: avoid uninitialized variable warning for freq
      Merge branch 'master' of git://git.kernel.org/.../padovan/bluetooth-next-2.6
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next-2.6 into for-davem

Juuso Oikarinen (3):
      wl12xx: Fix potential incorrect band in rx-status
      wl12xx: Add mutex protection for interface list
      wl12xx: Handle duplicate calling of remove interface

Larry Finger (2):
      rtlwifi: rtl8192ce: rtl8192cu: Fix most sparse warnings
      rtlwifi: Fix typo in pci.c

Luciano Coelho (11):
      wl12xx: add new board_tcxo_clock element to the platform data
      wl12xx: 1281/1283 support - add block size handling for sdio and spi
      wl12xx: use 1 spare TX block instead of two
      wl12xx: set the skbuff priority for dummy packets
      wl12xx: fix SG BT load value to reflect its new meaning
      wl12xx: fix a couple of sparse warnings about undeclared functions
      wl12xx: use a bitmask instead of list of booleans in scanned_ch
      wl12xx: use kstrtoul functions
      wl12xx: move hardcoded hci_io_ds value into the conf struct
      wl12xx: remove unused conf_radio_params structure
      wl12xx: fix sparse warning about undeclared wl12xx_alloc_dummy_packet

Luis R. Rodriguez (1):
      cfg80211: fix regresion on reg user timeout

Mohammed Shafi Shajakhan (3):
      ath9k: remove the unlikely check for autosleep
      ath9k: Add TSFOOR interrupt stats in debug info
      mac80211: Fix a warning due to skipping tailroom reservation for IV

Nishant Sarmukadam (2):
      mwl8k: Reserve buffers for tx management frames
      mwl8k: Enable life time expiry for tx packets in the hardware

Ohad Ben-Cohen (3):
      wl12xx: update bet_max_consecutive
      wl12xx: fix roaming
      wl12xx: fix "JOIN while associated" commentary

Pradeep Nemavat (2):
      mwl8k: Do not stop tx queues
      mwl8k: Add timestamp information for tx packets

Rafał Miłecki (10):
      ssb: pci: trivial: correct amount of maximum retries
      ssb: cc: use correct min_msk for 0x4312
      ssb: cc: add & fix defines
      ssb: cc: clear GPIOPULL registers on init
      ssb: mark bus as powered up earlier
      ssb: update reject bit for Target State Low
      ssb: pci: separate workarounds
      ssb: pci: update PCIe workarounds
      ssb: pci: early fix for SPROM core index
      ssb: cc: prepare clockmode support for cores rev 10+

Rajkumar Manoharan (3):
      ath9k_hw: Fix Tx IQ Calibration hang issue in AR9003 chips
      ath9k: set beacon related ps flags on bss_info change
      mac80211: Fix warnings due to -Wunused-but-set-variable

Randy Dunlap (1):
      libertas: use kernel-doc notation, fix comment style

Senthil Balasubramanian (5):
      ath9k: Fix LED gpio for AR93xx chipsets.
      ath9k_hw: Fix incorrect baseband PLL phase shift for AR9485
      ath9k: optimize the usage of power save wrappers.
      ath9k: cleanup hw pll work handler
      ath9k: Add power save wrappers and modularize hw_pll handler

Shahar Levi (11):
      wl12xx: 1281/1283 support - move IRQ polarity
      wl12xx: 1281/1283 support - Add Definitions
      wl12xx: 1281/1283 support - Add acx commands
      wl12xx: 1281/1283 support - New radio structs and functions
      wl12xx: 1281/1283 support - Loading FW & NVS
      wl12xx: 1281/1283 support - New boot sequence
      wl12xx: 1281/1283 support - use dynamic memory for the RX/TX pools
      wl12xx: 1281/1283 support - Improve Tx & Rx path
      wl12xx: 1281/1283 support - Add dummy packet support
      wl12xx: 1281/1283 support - enable chip support
      wl12xx: Add support for 11n Rx STBC one spatial stream

Stanislaw Gruszka (12):
      iwlwifi: fix possible data overwrite in hcmd callback
      iwlagn: fix tx power initialization
      iwlegacy: remove duplicate initialization in iwl4956_down()
      iwlegacy: enable only rfkill interrupt when device is down
      iwlegacy: simplify init geos
      iwlegacy: remove unneeded disable_hw_scan check
      iwlegacy: remove unneeded __packed
      iwlegacy: remove scan_tx_antennas
      iwlegacy: comment typo fix diable -> disable
      iwlegacy: fix enqueue hcmd race conditions
      iwlegacy: more priv->mutex serialization
      iwlegacy: remove sync_cmd_mutex

Sujith Manoharan (13):
      ath9k: Fix warnings from -Wunused-but-set-variable
      ath9k_htc: Fix AMPDU subframe handling
      ath9k_htc: Fix max A-MPDU size handling
      ath9k_htc: Use power save wrappers when accessing HW
      ath9k_htc: Remove unused macros and structures
      mac80211: Add new API for rate selection
      ath9k_htc: Increase credit size for AR7010 devices
      ath9k_htc: Remove unused WMI_AGGR_LIMIT_CMD
      ath9k_htc: Add a new WMI command to set a rate mask
      ath9k_htc: Add set_bitrate_mask() callback
      ath9k_htc: Dump base eeprom header for UB91/94/95
      ath9k_htc: Dump modal eeprom header for UB91/94/95
      ath9k_htc: Revamp LED management

Vasanthakumar Thiagarajan (24):
      ath9k_hw: Define devid and mac version for AR9340
      ath9k_hw: Take care of few host interface register changes for AR9340
      ath9k_hw: Get AHB clock information from ath9k_platform_data
      ath9k_hw: Configure pll control register accordingly for AR9340
      ath9k_hw: Add initvals.h for ar9340
      ath9k_hw: Initialize mode registers from initvals.h for AR9340
      ath9k_hw: Don't do ani initialization for AR9340
      ath9k_hw: Initialize tx and rx gain table from initvals.h for ar9340
      ath9k_hw: Read spur frequency information from eeprom for AR9340
      ath9k_hw: Configure RF channel freqency for AR9340
      ath9k_hw: Clean up rx/tx chain configuration before AGC/IQ cal
      ath9k_hw: Fix register offset AR_PHY_65NM_CH0_THERM for AR9340
      ath9k_hw: Don't configure AR_CH0_THERM for AR9340
      ath9k_hw: Skip internal regulator configuration for AR9340
      ath9k_hw: Configure tuning capacitance value for AR9340 as well
      ath9k_hw: Enable byte Tx/Rx data swap for AR9340
      ath9k_hw: Configure chain switch table and attenuation control only for active chains
      ath9k_hw: Read iq calibration data only for active chains
      ath9k: Add AR9340 platform id to id table
      ath9k_hw: Assign macversion based on devid for built-in wmac
      ath9k_hw: Disable INTR_HOST1_FATAL to avoid interrupt strom with ar9430
      ath9k_hw: Enable AR9340 support
      ath9k: Fix bug in configuring hw timer
      ath9k: Fix warning: symbol 'ath9k_platform_id_table' was not declared. Should it be static?

Vivek Natarajan (4):
      ath9k_hw: Move bt_stomp to hw from common.
      ath9k_hw: Add support for btcoexistence in AR9300.
      ath9k_hw: Enable generic timer interrupt.
      ath9k: Use ps wrappers for btcoex logic.

Waldemar Rymarkiewicz (6):
      Bluetooth: Add definitions for link key types
      Bluetooth: Don't modify sec_level if auth failed
      Bluetooth: Map sec_level to link key requirements
      Bluetooth: Ignore key unauthenticated for high security
      Bluetooth: Respect local MITM req in io_cap reply
      Bluetooth: Add secure flag for mgmt_pin_code_req

Wey-Yi Guy (5):
      iwlagn: make rxon_assoc static function
      iwlagn: remove 5000 from rxon_assoc structure
      iwlagn: connect and disconnect sequence for RXON
      iwlagn: new 105 series device
      iwlagn: remove un-necessary debugfs callback

Yogesh Ashok Powar (2):
      mac80211: Skip tailroom reservation for full HW-crypto devices
      mwl8k: Reducing extra_tx_headroom for tx optimization in AP mode

 drivers/net/wireless/ath/ath5k/reset.c             |    5 +
 drivers/net/wireless/ath/ath9k/ahb.c               |    6 +-
 drivers/net/wireless/ath/ath9k/ani.c               |    6 -
 drivers/net/wireless/ath/ath9k/ar9003_calib.c      |  387 ++---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |   61 +-
 drivers/net/wireless/ath/ath9k/ar9003_hw.c         |  101 ++-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c        |   36 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.h        |   25 +-
 drivers/net/wireless/ath/ath9k/ar9340_initvals.h   | 1525 ++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/ath9k.h             |    2 +
 drivers/net/wireless/ath/ath9k/beacon.c            |    6 -
 drivers/net/wireless/ath/ath9k/btcoex.c            |  100 ++-
 drivers/net/wireless/ath/ath9k/btcoex.h            |   20 +-
 drivers/net/wireless/ath/ath9k/common.c            |   31 -
 drivers/net/wireless/ath/ath9k/common.h            |    8 -
 drivers/net/wireless/ath/ath9k/debug.c             |    5 +
 drivers/net/wireless/ath/ath9k/debug.h             |    4 +
 drivers/net/wireless/ath/ath9k/eeprom_9287.c       |    3 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c        |    4 +
 drivers/net/wireless/ath/ath9k/gpio.c              |   19 +-
 drivers/net/wireless/ath/ath9k/hif_usb.h           |    3 +
 drivers/net/wireless/ath/ath9k/htc.h               |   89 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c    |    6 +-
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c     |  477 ++++++-
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c      |  204 +---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c      |   41 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c      |   95 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c      |    2 -
 drivers/net/wireless/ath/ath9k/htc_hst.h           |   11 -
 drivers/net/wireless/ath/ath9k/hw.c                |  125 ++-
 drivers/net/wireless/ath/ath9k/hw.h                |   13 +-
 drivers/net/wireless/ath/ath9k/init.c              |    2 +
 drivers/net/wireless/ath/ath9k/mac.c               |   13 +-
 drivers/net/wireless/ath/ath9k/main.c              |   49 +-
 drivers/net/wireless/ath/ath9k/phy.h               |    3 +
 drivers/net/wireless/ath/ath9k/rc.c                |   12 +-
 drivers/net/wireless/ath/ath9k/recv.c              |    5 +-
 drivers/net/wireless/ath/ath9k/reg.h               |   99 +-
 drivers/net/wireless/ath/ath9k/wmi.c               |    4 +-
 drivers/net/wireless/ath/ath9k/wmi.h               |    2 +-
 drivers/net/wireless/ath/ath9k/xmit.c              |   23 -
 drivers/net/wireless/ath/carl9170/carl9170.h       |    2 +
 drivers/net/wireless/ath/carl9170/main.c           |   92 +--
 drivers/net/wireless/ath/carl9170/tx.c             |  157 ++-
 drivers/net/wireless/b43/phy_n.c                   |    7 +-
 drivers/net/wireless/iwlegacy/iwl-4965-lib.c       |    3 -
 drivers/net/wireless/iwlegacy/iwl-core.c           |   20 +-
 drivers/net/wireless/iwlegacy/iwl-core.h           |    1 -
 drivers/net/wireless/iwlegacy/iwl-dev.h            |    4 +-
 drivers/net/wireless/iwlegacy/iwl-hcmd.c           |    4 +-
 drivers/net/wireless/iwlegacy/iwl-helpers.h        |    6 +
 drivers/net/wireless/iwlegacy/iwl-tx.c             |   52 +-
 drivers/net/wireless/iwlegacy/iwl3945-base.c       |   22 +-
 drivers/net/wireless/iwlegacy/iwl4965-base.c       |   45 +-
 drivers/net/wireless/iwlwifi/Makefile              |    1 -
 drivers/net/wireless/iwlwifi/iwl-1000.c            |   19 +-
 drivers/net/wireless/iwlwifi/iwl-2000.c            |   79 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c            |   36 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c            |   37 +-
 drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c     | 1025 -------------
 drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h     |   70 -
 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c      |   41 +-
 drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c        |   50 -
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c         |  124 ++-
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c        |  259 +++--
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c       |  245 +++-
 drivers/net/wireless/iwlwifi/iwl-agn.c             |  545 +++-----
 drivers/net/wireless/iwlwifi/iwl-agn.h             |   45 +-
 drivers/net/wireless/iwlwifi/iwl-commands.h        |  105 +-
 drivers/net/wireless/iwlwifi/iwl-core.c            |   87 +-
 drivers/net/wireless/iwlwifi/iwl-core.h            |   23 +-
 drivers/net/wireless/iwlwifi/iwl-debugfs.c         | 1012 +++++++++++++-
 drivers/net/wireless/iwlwifi/iwl-dev.h             |   35 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom.c          |   50 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom.h          |    3 -
 drivers/net/wireless/iwlwifi/iwl-helpers.h         |   24 -
 drivers/net/wireless/iwlwifi/iwl-io.c              |   36 +-
 drivers/net/wireless/iwlwifi/iwl-io.h              |   11 +
 drivers/net/wireless/iwlwifi/iwl-rx.c              |   57 +-
 drivers/net/wireless/iwlwifi/iwl-spectrum.h        |   92 --
 drivers/net/wireless/iwlwifi/iwl-tx.c              |   15 +-
 drivers/net/wireless/libertas/cfg.c                |   45 +-
 drivers/net/wireless/libertas/cmd.c                |  245 ++--
 drivers/net/wireless/libertas/cmdresp.c            |   19 +-
 drivers/net/wireless/libertas/debugfs.c            |   36 +-
 drivers/net/wireless/libertas/decl.h               |    8 +-
 drivers/net/wireless/libertas/defs.h               |  113 +-
 drivers/net/wireless/libertas/dev.h                |   20 +-
 drivers/net/wireless/libertas/ethtool.c            |    3 +-
 drivers/net/wireless/libertas/host.h               |   33 +-
 drivers/net/wireless/libertas/if_cs.c              |   35 +-
 drivers/net/wireless/libertas/if_spi.c             |  134 ++-
 drivers/net/wireless/libertas/if_spi.h             |   68 +-
 drivers/net/wireless/libertas/if_usb.c             |  113 +-
 drivers/net/wireless/libertas/if_usb.h             |   14 +-
 drivers/net/wireless/libertas/main.c               |   99 +-
 drivers/net/wireless/libertas/mesh.c               |  210 ++-
 drivers/net/wireless/libertas/mesh.h               |    6 +-
 drivers/net/wireless/libertas/rx.c                 |   34 +-
 drivers/net/wireless/libertas/tx.c                 |   34 +-
 drivers/net/wireless/libertas/types.h              |   18 +-
 drivers/net/wireless/mwifiex/11n.c                 |  102 +-
 drivers/net/wireless/mwifiex/11n.h                 |    2 +-
 drivers/net/wireless/mwifiex/cfg80211.c            |   61 +-
 drivers/net/wireless/mwifiex/join.c                |    4 +-
 drivers/net/wireless/mwifiex/main.h                |    2 +-
 drivers/net/wireless/mwifiex/scan.c                |   32 +-
 drivers/net/wireless/mwl8k.c                       |  111 +-
 drivers/net/wireless/p54/eeprom.c                  |    2 +-
 drivers/net/wireless/p54/fwio.c                    |   31 +
 drivers/net/wireless/p54/lmac.h                    |    1 +
 drivers/net/wireless/p54/main.c                    |   31 +
 drivers/net/wireless/p54/p54.h                     |    2 +
 drivers/net/wireless/rt2x00/rt2500usb.c            |    1 +
 drivers/net/wireless/rt2x00/rt2800lib.c            |   31 +-
 drivers/net/wireless/rt2x00/rt2800pci.c            |    4 +-
 drivers/net/wireless/rt2x00/rt2800usb.c            |   14 +-
 drivers/net/wireless/rt2x00/rt2x00.h               |   18 +
 drivers/net/wireless/rt2x00/rt2x00config.c         |   31 +
 drivers/net/wireless/rt2x00/rt2x00dev.c            |   88 ++
 drivers/net/wireless/rt2x00/rt2x00usb.c            |   11 +-
 drivers/net/wireless/rt2x00/rt2x00usb.h            |    4 +-
 drivers/net/wireless/rt2x00/rt73usb.c              |    1 +
 drivers/net/wireless/rtlwifi/base.c                |  720 ++++++++--
 drivers/net/wireless/rtlwifi/base.h                |   60 +-
 drivers/net/wireless/rtlwifi/cam.c                 |  106 ++-
 drivers/net/wireless/rtlwifi/cam.h                 |    5 +-
 drivers/net/wireless/rtlwifi/core.c                |  408 ++++--
 drivers/net/wireless/rtlwifi/core.h                |    1 +
 drivers/net/wireless/rtlwifi/efuse.c               |   97 +-
 drivers/net/wireless/rtlwifi/efuse.h               |    5 +-
 drivers/net/wireless/rtlwifi/pci.c                 |  626 ++++++---
 drivers/net/wireless/rtlwifi/pci.h                 |   15 +-
 drivers/net/wireless/rtlwifi/ps.c                  |  258 +++-
 drivers/net/wireless/rtlwifi/ps.h                  |    9 +
 drivers/net/wireless/rtlwifi/rc.c                  |  212 ++--
 drivers/net/wireless/rtlwifi/rc.h                  |    9 +-
 drivers/net/wireless/rtlwifi/regd.c                |   97 +-
 drivers/net/wireless/rtlwifi/regd.h                |    2 +-
 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c  |  523 ++++++-
 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h  |    2 +
 drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c  |   81 +-
 drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h  |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c |  128 +-
 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h |   76 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/def.h       |   27 -
 drivers/net/wireless/rtlwifi/rtl8192ce/dm.c        |    2 +
 drivers/net/wireless/rtlwifi/rtl8192ce/dm.h        |    1 +
 drivers/net/wireless/rtlwifi/rtl8192ce/hw.c        |  509 +++++---
 drivers/net/wireless/rtlwifi/rtl8192ce/hw.h        |   34 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/led.c       |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/led.h       |    2 -
 drivers/net/wireless/rtlwifi/rtl8192ce/phy.c       |  223 +--
 drivers/net/wireless/rtlwifi/rtl8192ce/phy.h       |   55 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/reg.h       |   58 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.c        |   24 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.h        |   17 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.c        |  122 ++-
 drivers/net/wireless/rtlwifi/rtl8192ce/sw.h        |   14 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c       |  180 +--
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.h       |    7 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c        |   11 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.h        |    5 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/phy.c       |   14 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/phy.h       |   14 +
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.c        |    4 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.h        |    4 +
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c        |    2 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c       |   48 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.h       |    5 +-
 drivers/net/wireless/rtlwifi/usb.c                 |   19 +-
 drivers/net/wireless/rtlwifi/usb.h                 |    2 +
 drivers/net/wireless/rtlwifi/wifi.h                |  155 ++-
 drivers/net/wireless/wl12xx/Kconfig                |    2 +-
 drivers/net/wireless/wl12xx/acx.c                  |   93 +-
 drivers/net/wireless/wl12xx/acx.h                  |   23 +-
 drivers/net/wireless/wl12xx/boot.c                 |  285 +++-
 drivers/net/wireless/wl12xx/boot.h                 |   52 +
 drivers/net/wireless/wl12xx/cmd.c                  |   99 ++-
 drivers/net/wireless/wl12xx/cmd.h                  |   34 +
 drivers/net/wireless/wl12xx/conf.h                 |   29 +-
 drivers/net/wireless/wl12xx/debugfs.c              |    2 +-
 drivers/net/wireless/wl12xx/event.c                |   64 +-
 drivers/net/wireless/wl12xx/event.h                |   17 +-
 drivers/net/wireless/wl12xx/ini.h                  |   98 ++-
 drivers/net/wireless/wl12xx/init.c                 |   51 +-
 drivers/net/wireless/wl12xx/init.h                 |    1 +
 drivers/net/wireless/wl12xx/io.c                   |   11 +
 drivers/net/wireless/wl12xx/io.h                   |    3 +
 drivers/net/wireless/wl12xx/main.c                 |  353 ++++-
 drivers/net/wireless/wl12xx/ps.c                   |    3 -
 drivers/net/wireless/wl12xx/reg.h                  |   15 +-
 drivers/net/wireless/wl12xx/rx.c                   |   44 +-
 drivers/net/wireless/wl12xx/scan.c                 |   17 +-
 drivers/net/wireless/wl12xx/sdio.c                 |   27 +-
 drivers/net/wireless/wl12xx/sdio_test.c            |   20 +-
 drivers/net/wireless/wl12xx/spi.c                  |   17 +-
 drivers/net/wireless/wl12xx/testmode.c             |    6 +-
 drivers/net/wireless/wl12xx/tx.c                   |  234 +++-
 drivers/net/wireless/wl12xx/tx.h                   |   60 +-
 drivers/net/wireless/wl12xx/wl12xx.h               |   66 +-
 drivers/ssb/driver_chipcommon.c                    |   68 +-
 drivers/ssb/driver_chipcommon_pmu.c                |    2 +
 drivers/ssb/driver_pcicore.c                       |  131 ++-
 drivers/ssb/main.c                                 |   23 +-
 include/linux/ath9k_platform.h                     |    2 +
 include/linux/ssb/ssb_driver_chipcommon.h          |   11 +-
 include/linux/ssb/ssb_regs.h                       |    2 +-
 include/linux/wl12xx.h                             |   29 +-
 include/net/bluetooth/hci.h                        |    9 +
 include/net/bluetooth/hci_core.h                   |   16 +-
 include/net/bluetooth/l2cap.h                      |   69 +-
 include/net/bluetooth/mgmt.h                       |   10 +-
 include/net/mac80211.h                             |   17 +
 net/bluetooth/cmtp/core.c                          |    3 +-
 net/bluetooth/hci_conn.c                           |   78 +-
 net/bluetooth/hci_core.c                           |   75 +-
 net/bluetooth/hci_event.c                          |  163 ++-
 net/bluetooth/hci_sysfs.c                          |   31 +
 net/bluetooth/hidp/core.c                          |    6 +-
 net/bluetooth/l2cap_core.c                         |  588 ++++----
 net/bluetooth/l2cap_sock.c                         |  242 ++--
 net/bluetooth/mgmt.c                               |   95 ++-
 net/bluetooth/rfcomm/core.c                        |   21 +-
 net/bluetooth/rfcomm/sock.c                        |    5 +-
 net/mac80211/aes_ccm.c                             |    6 +-
 net/mac80211/cfg.c                                 |   15 +-
 net/mac80211/driver-ops.h                          |   18 +
 net/mac80211/driver-trace.h                        |   27 +
 net/mac80211/ibss.c                                |    7 +-
 net/mac80211/ieee80211_i.h                         |    3 +
 net/mac80211/key.c                                 |   21 +-
 net/mac80211/main.c                                |   18 -
 net/mac80211/mesh.c                                |    3 -
 net/mac80211/mesh_hwmp.c                           |    4 -
 net/mac80211/pm.c                                  |   16 +-
 net/mac80211/rx.c                                  |   49 +-
 net/mac80211/sta_info.c                            |    2 -
 net/mac80211/status.c                              |    8 +
 net/mac80211/tx.c                                  |   15 +-
 net/mac80211/work.c                                |    6 +-
 net/mac80211/wpa.c                                 |   62 +-
 net/wireless/core.c                                |   17 +
 net/wireless/reg.c                                 |    3 +-
 244 files changed, 12283 insertions(+), 6490 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/ar9340_initvals.h
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-spectrum.h

Omnibus patch available here:

	http://www.kernel.org/pub/linux/kernel/people/linville/wireless-next-2.6-2011-05-05.patch.bz2

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: ARM, AF_PACKET: caching problems on Marvell Kirkwood
From: Andrew Lunn @ 2011-05-05 19:46 UTC (permalink / raw)
  To: linux-arm-kernel, netdev, ne, Johann Baudy, Lennert Buytenhek,
	Nicolas Pitre
In-Reply-To: <20110505141107.GC30443@orbit.nwl.cc>

On Thu, May 05, 2011 at 04:11:07PM +0200, Phil Sutter wrote:
> Hi,
> 
> Hasn't anyone experienced this bug but me? Can anyone reproduce the
> described behaviour on his Kirkwood-based (or even generic ARM) machine?
> I am still not sure if this is a problem of just my CPU or common
> amongst Kirkwood/VIPT/ARM machines.

Hi Phil

I can reproduce it on a Kirkwood:

[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977

     Andrew

^ permalink raw reply

* Re: [PATCH V4 5/8]macvtap: macvtap TX zero-copy support
From: Shirley Ma @ 2011-05-05 20:59 UTC (permalink / raw)
  To: Sridhar Samudrala
  Cc: David Miller, mst, Eric Dumazet, Avi Kivity, Arnd Bergmann,
	netdev, kvm, linux-kernel
In-Reply-To: <4DC1DD83.2020801@us.ibm.com>

On Wed, 2011-05-04 at 16:13 -0700, Sridhar Samudrala wrote:
> On Wed, 2011-05-04 at 01:14 -0700, Shirley Ma wrote: 
> > Only when buffer size is greater than GOODCOPY_LEN (256), macvtap
> > enables zero-copy.
> > 
> > Signed-off-by: Shirley Ma <xma@us.ibm.com>
> > ---
> > 
> >  drivers/net/macvtap.c |  126 ++++++++++++++++++++++++++++++++++++++++++++----
> >  1 files changed, 115 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> > index 6696e56..e8bc5ff 100644
> > --- a/drivers/net/macvtap.c
> > +++ b/drivers/net/macvtap.c
> > @@ -60,6 +60,7 @@ static struct proto macvtap_proto = {
> >   */
> >  static dev_t macvtap_major;
> >  #define MACVTAP_NUM_DEVS 65536
> > +#define GOODCOPY_LEN 256
> >  static struct class *macvtap_class;
> >  static struct cdev macvtap_cdev;
> > 
> > @@ -340,6 +341,7 @@ static int macvtap_open(struct inode *inode, struct file *file)
> >  {
> >  	struct net *net = current->nsproxy->net_ns;
> >  	struct net_device *dev = dev_get_by_index(net, iminor(inode));
> > +	struct macvlan_dev *vlan = netdev_priv(dev);
> >  	struct macvtap_queue *q;
> >  	int err;
> > 
> > @@ -369,6 +371,16 @@ static int macvtap_open(struct inode *inode, struct file *file)
> >  	q->flags = IFF_VNET_HDR | IFF_NO_PI | IFF_TAP;
> >  	q->vnet_hdr_sz = sizeof(struct virtio_net_hdr);
> > 
> > +	/*
> > +	 * so far only VM uses macvtap, enable zero copy between guest
> > +	 * kernel and host kernel when lower device supports high memory
> > +	 * DMA
> > +	 */
> Instead of VM uses macvtap, it makes it more clear to say  'KVM virtio
> uses macvtap for guest networking'.
> Also you are checking if lower device allows zerocopy, not high dma.

Sure.

>  
> > +	if (vlan) {
> > +		if (vlan->lowerdev->features & NETIF_F_ZEROCOPY)
> > +			sock_set_flag(&q->sk, SOCK_ZEROCOPY);
> > +	}
> > +
> 
> Do we need to check for vlan? If required, both if conditions can be
> combined. 

Yes, I will run more test before enabling it.

> > 	err = macvtap_set_queue(dev, file, q);
> >  	if (err)
> >  		sock_put(&q->sk);
> > @@ -433,6 +445,80 @@ static inline struct sk_buff *macvtap_alloc_skb(struct sock *sk, size_t prepad,
> >  	return skb;
> >  }
> > 
> > +/* set skb frags from iovec, this can move to core network code for reuse */
> > +static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
> > +				  int offset, size_t count)
> > +{
> > +	int len = iov_length(from, count) - offset;
> > +	int copy = skb_headlen(skb);
> > +	int size, offset1 = 0;
> > +	int i = 0;
> > +	skb_frag_t *f;
> > +
> > +	/* Skip over from offset */
> > +	while (offset >= from->iov_len) {
> > +		offset -= from->iov_len;
> > +		++from;
> > +		--count;
> > +	}
> > +
> > +	/* copy up to skb headlen */
> > +	while (copy > 0) {
> > +		size = min_t(unsigned int, copy, from->iov_len - offset);
> > +		if (copy_from_user(skb->data + offset1, from->iov_base + offset,
> > +				   size))
> > +			return -EFAULT;
> > +		if (copy > size) {
> > +			++from;
> > +			--count;
> > +		}
> > +		copy -= size;
> > +		offset1 += size;
> > +		offset = 0;
> > +	}
> 
> I think you need to check for count reaching zero in the above 2 while
> loops.

Doesn't hurt to check count here, in this case, caller has
copylen/len/offset less than count/len already.

> > +
> > +	if (len == offset1)
> > +		return 0;
> > +
> > +	while (count--) {
> > +		struct page *page[MAX_SKB_FRAGS];
> > +		int num_pages;
> > +		unsigned long base;
> > +
> > +		len = from->iov_len - offset1;
> > +		if (!len) {
> > +			offset1 = 0;
> > +			++from;
> > +			continue;
> > +		}
> > +		base = (unsigned long)from->iov_base + offset1;
> > +		size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
> > +		num_pages = get_user_pages_fast(base, size, 0, &page[i]);
> > +		if ((num_pages != size) ||
> > +		    (num_pages > MAX_SKB_FRAGS - skb_shinfo(skb)->nr_frags))
> > +			/* put_page is in skb free */
> > +			return -EFAULT;
> > +		skb->data_len += len;
> > +		skb->len += len;
> > +		skb->truesize += len;
> > +		while (len) {
> > +			f = &skb_shinfo(skb)->frags[i];
> > +			f->page = page[i];
> > +			f->page_offset = base & ~PAGE_MASK;
> > +			f->size = min_t(int, len, PAGE_SIZE - f->page_offset);
> > +			skb_shinfo(skb)->nr_frags++;
> > +			/* increase sk_wmem_alloc */
> > +			atomic_add(f->size, &skb->sk->sk_wmem_alloc);
> > +			base += f->size;
> > +			len -= f->size;
> > +			i++;
> > +		}
> > +		offset1 = 0;
> > +		++from;
> > +	}
> > +	return 0;
> > +}
> > +
> >  /*
> >   * macvtap_skb_from_vnet_hdr and macvtap_skb_to_vnet_hdr should
> >   * be shared with the tun/tap driver.
> > @@ -515,17 +601,19 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
> > 
> > 
> >  /* Get packet from user space buffer */
> > -static ssize_t macvtap_get_user(struct macvtap_queue *q,
> > -				const struct iovec *iv, size_t count,
> > -				int noblock)
> > +static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
> > +				const struct iovec *iv, unsigned long total_len,
> > +				size_t count, int noblock)
> >  {
> >  	struct sk_buff *skb;
> >  	struct macvlan_dev *vlan;
> > -	size_t len = count;
> > +	unsigned long len = total_len;
> >  	int err;
> >  	struct virtio_net_hdr vnet_hdr = { 0 };
> >  	int vnet_hdr_len = 0;
> > +	int copylen, zerocopy;
> zerocopy can be boolean 

Yes, I have changed it in V5.

> > +	zerocopy = sock_flag(&q->sk, SOCK_ZEROCOPY) && (len > GOODCOPY_LEN);
> >  	if (q->flags & IFF_VNET_HDR) {
> >  		vnet_hdr_len = q->vnet_hdr_sz;
> > 
> > @@ -552,12 +640,28 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
> >  	if (unlikely(len < ETH_HLEN))
> >  		goto err;
> > 
> > -	skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, len, vnet_hdr.hdr_len,
> > -				noblock, &err);
> > +	if (zerocopy)
> > +		/* There are 256 bytes to be copied in skb, so there is enough
> > +		 * room for skb expand head in case it is used.
> > +		 * The rest buffer is mapped from userspace.
> > +		 */
> > +		copylen = GOODCOPY_LEN;
> > +	else
> > +		copylen = len;
> > +
> > +	skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen,
> > +				vnet_hdr.hdr_len, noblock, &err);
> >  	if (!skb)
> >  		goto err;
> > 
> > -	err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len, len);
> > +	if (zerocopy)
> > +		err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count);
> > +	else
> > +		err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len,
> > +						   len);
> > +	if (sock_flag(&q->sk, SOCK_ZEROCOPY))
> > +		memcpy(&skb_shinfo(skb)->ubuf, m->msg_control,
> > +			sizeof(struct skb_ubuf_info));
> Why are you doing a separate check for this memcpy? Is this required
> if the len < 256? 

Yes. But I have changed it V5 based on MST's suggestion to leave copied
buffer maintain in vhost.

> > 	if (err)
> >  		goto err_kfree;
> > 
> > @@ -579,7 +683,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q,
> >  		kfree_skb(skb);
> >  	rcu_read_unlock_bh();
> > 
> > -	return count;
> > +	return total_len;
> > 
> >  err_kfree:
> >  	kfree_skb(skb);
> > @@ -601,8 +705,8 @@ static ssize_t macvtap_aio_write(struct kiocb *iocb, const struct iovec *iv,
> >  	ssize_t result = -ENOLINK;
> >  	struct macvtap_queue *q = file->private_data;
> > 
> > -	result = macvtap_get_user(q, iv, iov_length(iv, count),
> > -			      file->f_flags & O_NONBLOCK);
> > +	result = macvtap_get_user(q, NULL, iv, iov_length(iv, count), count,
> > +				  file->f_flags & O_NONBLOCK);
> >  	return result;
> >  }
> > 
> > @@ -815,7 +919,7 @@ static int macvtap_sendmsg(struct kiocb *iocb, struct socket *sock,
> >  			   struct msghdr *m, size_t total_len)
> >  {
> >  	struct macvtap_queue *q = container_of(sock, struct macvtap_queue, sock);
> > -	return macvtap_get_user(q, m->msg_iov, total_len,
> > +	return macvtap_get_user(q, m, m->msg_iov, total_len, m->msg_iovlen,
> >  			    m->msg_flags & MSG_DONTWAIT);
> >  }
> > 
> > 
> > 
> 

^ permalink raw reply

* Re: [PATCH V4 2/8] netdevice.h: Add a new zerocopy device flag
From: Shirley Ma @ 2011-05-05 21:02 UTC (permalink / raw)
  To: Sridhar Samudrala
  Cc: David Miller, mst, Eric Dumazet, Avi Kivity, Arnd Bergmann,
	netdev, kvm, linux-kernel
In-Reply-To: <4DC1DD9D.6070708@us.ibm.com>

On Wed, 2011-05-04 at 16:13 -0700, Sridhar Samudrala wrote:
> On Wed, 2011-05-04 at 00:55 -0700, Shirley Ma wrote: 
> > Signed-off-by: Shirley Ma <xma@us.ibm.com>
> > ---
> > 
> >  include/linux/netdevice.h |   10 ++++++++++
> >  1 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> > index 0249fe7..0808f1e 100644
> > --- a/include/linux/netdevice.h
> > +++ b/include/linux/netdevice.h
> > @@ -1067,6 +1067,16 @@ struct net_device {
> >  #define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
> >  #define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
> > 
> > +/*
> > + * Bit 31 is for device to map userspace buffers -- zerocopy
> > + * Device can set this flag when it supports HIGHDMA.
> > + * Device can't recycle this kind of skb buffers.
> > + * There are 256 bytes copied, the rest of buffers are mapped.
> > + * The userspace callback should only be called when last reference to this skb
> > + * is gone.
> > + */
> > +#define NETIF_F_ZEROCOPY	(1 << 31)
> > +
> Should we make this TX_ZEROCOPY as we may need a seperate flag for
> RX_ZEROCOPY in future?
> 
> Same with socket flag.

We might be able to use the same flag for both TX and RX. If RX
zero-copy requires only HIGHDMA feature only. If not, then we might need
different feature bit. Same for sock flag.

> Thanks
> Sridhar
> 
> 

^ permalink raw reply

* Re: pull request: wireless-next-2.6 2011-05-05
From: David Miller @ 2011-05-05 21:12 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev
In-Reply-To: <20110505191219.GC3005@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Thu, 5 May 2011 15:12:20 -0400

> Another big Cinco de Mayo batch of stuff intended for 2.6.40...

Aye caramba! :-)

> Highlights include a number of mwifiex bug fixes, a batch of wl12xx
> updates (including some new hardware support), a big batch of rtlwifi
> fixups in preparation for some new hardware drivers, some mwl8k and
> rt2x00 updates, the usual variety of iwlwifi and ath9k updates, a set
> of updates to the iwlegacy drivers from Stanislaw, some ssb udpates
> form Rafał, a bunch of Bluetooth updates from Gustavo and friends,
> and a handful of enhancements to other drivers and to mac80211.
> 
> Please let me know if there are problems!

Pulled, thanks a lot John!

^ permalink raw reply

* Re: [RFC v3 02/10] Revert "lsm: Remove the socket_post_accept() hook"
From: Tetsuo Handa @ 2011-05-05 21:43 UTC (permalink / raw)
  To: paul.moore, sam
  Cc: linux-security-module, linux-kernel, netdev, netfilter-devel,
	hadi, kaber, zbr, root
In-Reply-To: <201105051011.32845.paul.moore@hp.com>

Paul Moore wrote:
> On Tuesday, May 03, 2011 10:28:24 PM Tetsuo Handa wrote:
> > Paul Moore wrote:
> > > On Tuesday, May 03, 2011 10:24:15 AM Samir Bellabes wrote:
> > > > snet needs to reintroduce this hook, as it was designed to be: a hook
> > > > for updating security informations on objects.
> > > 
> > > Looking at this and 5/10 again, it seems that you should be able to do
> > > what you need with the sock_graft() hook.  Am I missing something?
> > > 
> > > My apologies if we've already discussed this approach previously ...
> > 
> > Second problem is that genlmsg_unicast() might return -EAGAIN because we
> > can't sleep inside write_lock_bh()/write_unlock_bh().
> 
> Ah yes, the real problem.  I forgot that snet relied on a user space tool.  I 
> tend to agree with others who have suggested this is not the right approach, 
> but I understand why you want the post_accept() hook; thanks for reminding me.
> 
However, it sounds that Samir says genlmsg_unicast() failure is not fatal.

Samir Bellabes wrote:
> using snet_do_send_event() means that system is sending data to
> userspace. the system is not waiting for a verdict from userspace.
> 
> If error occurs, we actually loose the information data.
> I may be able to write a solution which try to send the data again, but
> we need a exit solution for this loop (a number of try ?).

If genlmsg_unicast() failure is not fatal, snet doesn't need the
socket_post_accept hook. Samir, is genlmsg_unicast() failure fatal for snet?
(Although, I'd like to ask for revival of the hook for TOMOYO anyway.)

^ permalink raw reply

* [PATCH V2 2/3] MIPS: lantiq: add ethernet driver
From: John Crispin @ 2011-05-05 22:10 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: John Crispin, Ralph Hempel, linux-mips, netdev
In-Reply-To: <1304633402-24161-1-git-send-email-blogic@openwrt.org>

This patch adds the driver for the ETOP Packet Processing Engine (PPE32) found
inside the XWAY family of Lantiq MIPS SoCs. This driver makes 100MBit ethernet
work. Support for all 8 dma channels, gbit and the embedded switch found on
the ar9/vr9 still needs to be implemented.

Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Ralph Hempel <ralph.hempel@lantiq.com>
Cc: linux-mips@linux-mips.org
Cc: netdev@vger.kernel.org

---

Changes in V2:
* use spinlocks
* use NAPI
* remove duplicate stats counter

 .../mips/include/asm/mach-lantiq/lantiq_platform.h |    7 +
 .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h |    4 +-
 drivers/net/Kconfig                                |    7 +
 drivers/net/Makefile                               |    1 +
 drivers/net/lantiq_etop.c                          |  794 ++++++++++++++++++++
 5 files changed, 811 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/lantiq_etop.c

diff --git a/arch/mips/include/asm/mach-lantiq/lantiq_platform.h b/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
index 1f1dba6..a305f1d 100644
--- a/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
+++ b/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
@@ -10,6 +10,7 @@
 #define _LANTIQ_PLATFORM_H__
 
 #include <linux/mtd/partitions.h>
+#include <linux/socket.h>
 
 /* struct used to pass info to the pci core */
 enum {
@@ -43,4 +44,10 @@ struct ltq_pci_data {
 	int irq[16];
 };
 
+/* struct used to pass info to network drivers */
+struct ltq_eth_data {
+	struct sockaddr mac;
+	int mii_mode;
+};
+
 #endif
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
index 95f1882..0213601 100644
--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
@@ -81,8 +81,8 @@
 #define PMU_SWITCH		0x10000000
 
 /* ETOP - ethernet */
-#define LTQ_PPE32_BASE_ADDR	0xBE180000
-#define LTQ_PPE32_SIZE		0x40000
+#define LTQ_ETOP_BASE_ADDR	0x1E180000
+#define LTQ_ETOP_SIZE		0x40000
 
 /* DMA */
 #define LTQ_DMA_BASE_ADDR	0x1E104100
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index b30c688..4878587 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2017,6 +2017,13 @@ config FTMAC100
 	  from Faraday. It is used on Faraday A320, Andes AG101 and some
 	  other ARM/NDS32 SoC's.
 
+config LANTIQ_ETOP
+	tristate "Lantiq SoC ETOP driver"
+	depends on SOC_TYPE_XWAY
+	help
+	  Support for the MII0 inside the Lantiq SoC
+
+
 source "drivers/net/fs_enet/Kconfig"
 
 source "drivers/net/octeon/Kconfig"
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index fbfca11..df71da7 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -261,6 +261,7 @@ obj-$(CONFIG_MLX4_CORE) += mlx4/
 obj-$(CONFIG_ENC28J60) += enc28j60.o
 obj-$(CONFIG_ETHOC) += ethoc.o
 obj-$(CONFIG_GRETH) += greth.o
+obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o
 
 obj-$(CONFIG_XTENSA_XT2000_SONIC) += xtsonic.o
 
diff --git a/drivers/net/lantiq_etop.c b/drivers/net/lantiq_etop.c
new file mode 100644
index 0000000..3c9d34f
--- /dev/null
+++ b/drivers/net/lantiq_etop.c
@@ -0,0 +1,794 @@
+/*
+ *   This program is free software; you can redistribute it and/or modify it
+ *   under the terms of the GNU General Public License version 2 as published
+ *   by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *   Copyright (C) 2011 John Crispin <blogic@openwrt.org>
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/uaccess.h>
+#include <linux/in.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/phy.h>
+#include <linux/ip.h>
+#include <linux/tcp.h>
+#include <linux/skbuff.h>
+#include <linux/mm.h>
+#include <linux/platform_device.h>
+#include <linux/ethtool.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+
+#include <asm/checksum.h>
+
+#include <lantiq_soc.h>
+#include <xway_dma.h>
+#include <lantiq_platform.h>
+
+#define LTQ_ETOP_MDIO		0x11804
+#define MDIO_REQUEST		0x80000000
+#define MDIO_READ		0x40000000
+#define MDIO_ADDR_MASK		0x1f
+#define MDIO_ADDR_OFFSET	0x15
+#define MDIO_REG_MASK		0x1f
+#define MDIO_REG_OFFSET		0x10
+#define MDIO_VAL_MASK		0xffff
+
+#define PPE32_CGEN		0x800
+#define LQ_PPE32_ENET_MAC_CFG	0x1840
+
+#define LTQ_ETOP_ENETS0		0x11850
+#define LTQ_ETOP_MAC_DA0	0x1186C
+#define LTQ_ETOP_MAC_DA1	0x11870
+#define LTQ_ETOP_CFG		0x16020
+#define LTQ_ETOP_IGPLEN		0x16080
+
+#define MAX_DMA_CHAN            0x8
+#define MAX_DMA_CRC_LEN		0x4
+#define MAX_DMA_DATA_LEN	0x600
+
+#define ETOP_FTCU		BIT(28)
+#define ETOP_MII_MASK		0xf
+#define ETOP_MII_NORMAL		0xd
+#define ETOP_MII_REVERSE	0xe
+#define ETOP_PLEN_UNDER		0x40
+#define ETOP_CGEN		0x800
+
+/* use 2 static channels for TX/RX */
+#define LTQ_ETOP_TX_CHANNEL	1
+#define LTQ_ETOP_RX_CHANNEL	6
+#define IS_TX(x)		(x == LTQ_ETOP_TX_CHANNEL)
+#define IS_RX(x)		(x == LTQ_ETOP_RX_CHANNEL)
+
+#define ltq_etop_r32(x)		ltq_r32(ltq_etop_membase + (x))
+#define ltq_etop_w32(x, y)	ltq_w32(x, ltq_etop_membase + (y))
+#define ltq_etop_w32_mask(x, y, z)	\
+		ltq_w32_mask(x, y, ltq_etop_membase + (z))
+
+#define DRV_VERSION	"1.0"
+
+static void __iomem *ltq_etop_membase;
+
+struct ltq_etop_chan {
+	int idx;
+	int tx_free;
+	struct net_device *netdev;
+	struct napi_struct napi;
+	struct ltq_dma_channel dma;
+	struct sk_buff *skb[LTQ_DESC_NUM];
+};
+
+struct ltq_etop_priv {
+	struct net_device *netdev;
+	struct ltq_eth_data *pldata;
+	struct resource *res;
+
+	struct mii_bus *mii_bus;
+	struct phy_device *phydev;
+
+	struct ltq_etop_chan ch[MAX_DMA_CHAN];
+	int tx_free[MAX_DMA_CHAN >> 1];
+
+	spinlock_t lock;
+};
+
+static int
+ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
+{
+	ch->skb[ch->dma.desc] = dev_alloc_skb(MAX_DMA_DATA_LEN);
+	if (!ch->skb[ch->dma.desc])
+		return -ENOMEM;
+	ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL,
+		ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN, DMA_FROM_DEVICE);
+	ch->dma.desc_base[ch->dma.desc].addr =
+		CPHYSADDR(ch->skb[ch->dma.desc]->data);
+	ch->dma.desc_base[ch->dma.desc].ctl =
+		LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) | MAX_DMA_DATA_LEN;
+	skb_reserve(ch->skb[ch->dma.desc], NET_IP_ALIGN);
+	return 0;
+}
+
+static void
+ltq_etop_hw_receive(struct ltq_etop_chan *ch)
+{
+	struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
+	struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
+	struct sk_buff *skb = ch->skb[ch->dma.desc];
+	int len = (desc->ctl & LTQ_DMA_SIZE_MASK) - MAX_DMA_CRC_LEN;
+	unsigned long flags;
+
+	spin_lock_irqsave(&priv->lock, flags);
+	if (ltq_etop_alloc_skb(ch)) {
+		netdev_err(ch->netdev,
+			"failed to allocate new rx buffer, stopping DMA\n");
+		ltq_dma_close(&ch->dma);
+	}
+	ch->dma.desc++;
+	ch->dma.desc %= LTQ_DESC_NUM;
+	spin_unlock_irqrestore(&priv->lock, flags);
+
+	skb_put(skb, len);
+	skb->dev = ch->netdev;
+	skb->protocol = eth_type_trans(skb, ch->netdev);
+	netif_receive_skb(skb);
+}
+
+static int
+ltq_etop_poll_rx(struct napi_struct *napi, int budget)
+{
+	struct ltq_etop_chan *ch = container_of(napi, struct ltq_etop_chan, napi);
+	int rx = 0;
+	int complete = 0;
+
+	while ((rx < budget) && !complete) {
+		struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
+
+		if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) {
+			ltq_etop_hw_receive(ch);
+			rx++;
+		} else {
+			complete = 1;
+		}
+	}
+	if (complete || !rx) {
+		napi_complete(&ch->napi);
+		ltq_dma_ack_irq(&ch->dma);
+	}
+	return rx;
+}
+
+static int
+ltq_etop_poll_tx(struct napi_struct *napi, int budget)
+{
+	struct ltq_etop_chan *ch =
+		container_of(napi, struct ltq_etop_chan, napi);
+	struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
+	struct netdev_queue *txq =
+		netdev_get_tx_queue(ch->netdev, ch->idx >> 1);
+	unsigned long flags;
+
+	spin_lock_irqsave(&priv->lock, flags);
+	while ((ch->dma.desc_base[ch->tx_free].ctl &
+			(LTQ_DMA_OWN | LTQ_DMA_C)) == LTQ_DMA_C) {
+		dev_kfree_skb_any(ch->skb[ch->tx_free]);
+		ch->skb[ch->tx_free] = NULL;
+		memset(&ch->dma.desc_base[ch->tx_free], 0,
+			sizeof(struct ltq_dma_desc));
+		ch->tx_free++;
+		ch->tx_free %= LTQ_DESC_NUM;
+	}
+	spin_unlock_irqrestore(&priv->lock, flags);
+
+	if (netif_tx_queue_stopped(txq))
+		netif_tx_start_queue(txq);
+	napi_complete(&ch->napi);
+	ltq_dma_ack_irq(&ch->dma);
+	return 1;
+}
+
+static irqreturn_t
+ltq_etop_dma_irq(int irq, void *_priv)
+{
+	struct ltq_etop_priv *priv = _priv;
+	int ch = irq - LTQ_DMA_CH0_INT;
+
+	napi_schedule(&priv->ch[ch].napi);
+	return IRQ_HANDLED;
+}
+
+static void
+ltq_etop_free_channel(struct net_device *dev, struct ltq_etop_chan *ch)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+
+	ltq_dma_free(&ch->dma);
+	if (ch->dma.irq)
+		free_irq(ch->dma.irq, priv);
+	if (IS_RX(ch->idx)) {
+		int desc;
+		for (desc = 0; desc < LTQ_DESC_NUM; desc++)
+			dev_kfree_skb_any(ch->skb[ch->dma.desc]);
+	}
+}
+
+static void
+ltq_etop_hw_exit(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	int i;
+
+	ltq_pmu_disable(PMU_PPE);
+	for (i = 0; i < MAX_DMA_CHAN; i++)
+		if (IS_TX(i) || IS_RX(i))
+			ltq_etop_free_channel(dev, &priv->ch[i]);
+}
+
+static int
+ltq_etop_hw_init(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	int i;
+
+	ltq_pmu_enable(PMU_PPE);
+
+	switch (priv->pldata->mii_mode) {
+	case PHY_INTERFACE_MODE_RMII:
+		ltq_etop_w32_mask(ETOP_MII_MASK,
+			ETOP_MII_REVERSE, LTQ_ETOP_CFG);
+		break;
+
+	case PHY_INTERFACE_MODE_MII:
+		ltq_etop_w32_mask(ETOP_MII_MASK,
+			ETOP_MII_NORMAL, LTQ_ETOP_CFG);
+		break;
+
+	default:
+		netdev_err(dev, "unknown mii mode %d\n",
+			priv->pldata->mii_mode);
+		return -ENOTSUPP;
+	}
+
+	/* enable crc generation */
+	ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG);
+
+	ltq_dma_init_port(DMA_PORT_ETOP);
+
+	for (i = 0; i < MAX_DMA_CHAN; i++) {
+		int irq = LTQ_DMA_CH0_INT + i;
+		struct ltq_etop_chan *ch = &priv->ch[i];
+
+		ch->idx = ch->dma.nr = i;
+
+		if (IS_TX(i)) {
+			ltq_dma_alloc_tx(&ch->dma);
+			request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
+				"etop_tx", priv);
+		} else if (IS_RX(i)) {
+			ltq_dma_alloc_rx(&ch->dma);
+			for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM;
+					ch->dma.desc++)
+				if (ltq_etop_alloc_skb(ch))
+					return -ENOMEM;
+			ch->dma.desc = 0;
+			request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED,
+				"etop_rx", priv);
+		}
+		ch->dma.irq = irq;
+	}
+	return 0;
+}
+
+static void
+ltq_etop_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+	strcpy(info->driver, "Lantiq ETOP");
+	strcpy(info->bus_info, "internal");
+	strcpy(info->version, DRV_VERSION);
+}
+
+static int
+ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+
+	return phy_ethtool_gset(priv->phydev, cmd);
+}
+
+static int
+ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+
+	return phy_ethtool_sset(priv->phydev, cmd);
+}
+
+static int
+ltq_etop_nway_reset(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+
+	return phy_start_aneg(priv->phydev);
+}
+
+static const struct ethtool_ops ltq_etop_ethtool_ops = {
+	.get_drvinfo = ltq_etop_get_drvinfo,
+	.get_settings = ltq_etop_get_settings,
+	.set_settings = ltq_etop_set_settings,
+	.nway_reset = ltq_etop_nway_reset,
+};
+
+static int
+ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, int phy_reg, u16 phy_data)
+{
+	u32 val = MDIO_REQUEST |
+		((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) |
+		((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET) |
+		phy_data;
+
+	while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST)
+		;
+	ltq_etop_w32(val, LTQ_ETOP_MDIO);
+	return 0;
+}
+
+static int
+ltq_etop_mdio_rd(struct mii_bus *bus, int phy_addr, int phy_reg)
+{
+	u32 val = MDIO_REQUEST | MDIO_READ |
+		((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) |
+		((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET);
+
+	while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST)
+		;
+	ltq_etop_w32(val, LTQ_ETOP_MDIO);
+	while (ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_REQUEST)
+		;
+	val = ltq_etop_r32(LTQ_ETOP_MDIO) & MDIO_VAL_MASK;
+	return val;
+}
+
+static void
+ltq_etop_mdio_link(struct net_device *dev)
+{
+	/* nothing to do  */
+}
+
+static int
+ltq_etop_mdio_probe(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	struct phy_device *phydev = NULL;
+	int phy_addr;
+
+	for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
+		if (priv->mii_bus->phy_map[phy_addr]) {
+			phydev = priv->mii_bus->phy_map[phy_addr];
+			break;
+		}
+	}
+
+	if (!phydev) {
+		netdev_err(dev, "no PHY found\n");
+		return -ENODEV;
+	}
+
+	phydev = phy_connect(dev, dev_name(&phydev->dev), &ltq_etop_mdio_link,
+			0, priv->pldata->mii_mode);
+
+	if (IS_ERR(phydev)) {
+		netdev_err(dev, "Could not attach to PHY\n");
+		return PTR_ERR(phydev);
+	}
+
+	phydev->supported &= (SUPPORTED_10baseT_Half
+			      | SUPPORTED_10baseT_Full
+			      | SUPPORTED_100baseT_Half
+			      | SUPPORTED_100baseT_Full
+			      | SUPPORTED_Autoneg
+			      | SUPPORTED_MII
+			      | SUPPORTED_TP);
+
+	phydev->advertising = phydev->supported;
+	priv->phydev = phydev;
+	pr_info("%s: attached PHY [%s] (phy_addr=%s, irq=%d)\n",
+	       dev->name, phydev->drv->name,
+	       dev_name(&phydev->dev), phydev->irq);
+
+	return 0;
+}
+
+static int
+ltq_etop_mdio_init(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	int i;
+	int err;
+
+	priv->mii_bus = mdiobus_alloc();
+	if (!priv->mii_bus) {
+		netdev_err(dev, "failed to allocate mii bus\n");
+		err = -ENOMEM;
+		goto err_out;
+	}
+
+	priv->mii_bus->priv = dev;
+	priv->mii_bus->read = ltq_etop_mdio_rd;
+	priv->mii_bus->write = ltq_etop_mdio_wr;
+	priv->mii_bus->name = "ltq_mii";
+	snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%x", 0);
+	priv->mii_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
+	if (!priv->mii_bus->irq) {
+		err = -ENOMEM;
+		goto err_out_free_mdiobus;
+	}
+
+	for (i = 0; i < PHY_MAX_ADDR; ++i)
+		priv->mii_bus->irq[i] = PHY_POLL;
+
+	if (mdiobus_register(priv->mii_bus)) {
+		err = -ENXIO;
+		goto err_out_free_mdio_irq;
+	}
+
+	if (ltq_etop_mdio_probe(dev)) {
+		err = -ENXIO;
+		goto err_out_unregister_bus;
+	}
+	return 0;
+
+err_out_unregister_bus:
+	mdiobus_unregister(priv->mii_bus);
+err_out_free_mdio_irq:
+	kfree(priv->mii_bus->irq);
+err_out_free_mdiobus:
+	mdiobus_free(priv->mii_bus);
+err_out:
+	return err;
+}
+
+static void
+ltq_etop_mdio_cleanup(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+
+	phy_disconnect(priv->phydev);
+	mdiobus_unregister(priv->mii_bus);
+	kfree(priv->mii_bus->irq);
+	mdiobus_free(priv->mii_bus);
+}
+
+static int
+ltq_etop_open(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	int i;
+
+	for (i = 0; i < MAX_DMA_CHAN; i++) {
+		struct ltq_etop_chan *ch = &priv->ch[i];
+
+		if (!IS_TX(i) && (!IS_RX(i)))
+			continue;
+		ltq_dma_open(&ch->dma);
+		napi_enable(&ch->napi);
+	}
+	phy_start(priv->phydev);
+	netif_tx_start_all_queues(dev);
+	return 0;
+}
+
+static int
+ltq_etop_stop(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	int i;
+
+	netif_tx_stop_all_queues(dev);
+	phy_stop(priv->phydev);
+	for (i = 0; i < MAX_DMA_CHAN; i++) {
+		struct ltq_etop_chan *ch = &priv->ch[i];
+
+		if (!IS_RX(i) && !IS_TX(i))
+			continue;
+		napi_disable(&ch->napi);
+		ltq_dma_close(&ch->dma);
+	}
+	return 0;
+}
+
+static int
+ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
+{
+	int queue = skb_get_queue_mapping(skb);
+	struct netdev_queue *txq = netdev_get_tx_queue(dev, queue);
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	struct ltq_etop_chan *ch = &priv->ch[(queue << 1) | 1];
+	struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
+	int len;
+	unsigned long flags;
+	u32 byte_offset;
+
+	len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
+
+	if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
+		dev_kfree_skb_any(skb);
+		netdev_err(dev, "tx ring full\n");
+		netif_tx_stop_queue(txq);
+		return NETDEV_TX_BUSY;
+	}
+
+	/* dma needs to start on a 16 byte aligned address */
+	byte_offset = CPHYSADDR(skb->data) % 16;
+	ch->skb[ch->dma.desc] = skb;
+
+	dev->trans_start = jiffies;
+
+	spin_lock_irqsave(&priv->lock, flags);
+	desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len,
+						DMA_TO_DEVICE)) - byte_offset;
+	wmb();
+	desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP |
+		LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK);
+	ch->dma.desc++;
+	ch->dma.desc %= LTQ_DESC_NUM;
+	spin_unlock_irqrestore(&priv->lock, flags);
+
+	if (ch->dma.desc_base[ch->dma.desc].ctl & LTQ_DMA_OWN)
+		netif_tx_stop_queue(txq);
+
+	return NETDEV_TX_OK;
+}
+
+static int
+ltq_etop_change_mtu(struct net_device *dev, int new_mtu)
+{
+	int ret = eth_change_mtu(dev, new_mtu);
+
+	if (!ret) {
+		struct ltq_etop_priv *priv = netdev_priv(dev);
+		unsigned long flags;
+
+		spin_lock_irqsave(&priv->lock, flags);
+		ltq_etop_w32((ETOP_PLEN_UNDER << 16) | new_mtu,
+			LTQ_ETOP_IGPLEN);
+		spin_unlock_irqrestore(&priv->lock, flags);
+	}
+	return ret;
+}
+
+static int
+ltq_etop_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+
+	/* TODO: mii-toll reports "No MII transceiver present!." ?!*/
+	return phy_mii_ioctl(priv->phydev, rq, cmd);
+}
+
+static int
+ltq_etop_set_mac_address(struct net_device *dev, void *p)
+{
+	int ret = eth_mac_addr(dev, p);
+
+	if (!ret) {
+		struct ltq_etop_priv *priv = netdev_priv(dev);
+		unsigned long flags;
+
+		/* store the mac for the unicast filter */
+		spin_lock_irqsave(&priv->lock, flags);
+		ltq_etop_w32(*((u32 *)dev->dev_addr), LTQ_ETOP_MAC_DA0);
+		ltq_etop_w32(*((u16 *)&dev->dev_addr[4]) << 16,
+			LTQ_ETOP_MAC_DA1);
+		spin_unlock_irqrestore(&priv->lock, flags);
+	}
+	return ret;
+}
+
+static void
+ltq_etop_set_multicast_list(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	unsigned long flags;
+
+	/* ensure that the unicast filter is not enabled in promiscious mode */
+	spin_lock_irqsave(&priv->lock, flags);
+	if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI))
+		ltq_etop_w32_mask(ETOP_FTCU, 0, LTQ_ETOP_ENETS0);
+	else
+		ltq_etop_w32_mask(0, ETOP_FTCU, LTQ_ETOP_ENETS0);
+	spin_unlock_irqrestore(&priv->lock, flags);
+}
+
+static u16
+ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb)
+{
+	/* we are currently only using the first queue */
+	return 0;
+}
+
+static int
+ltq_etop_init(struct net_device *dev)
+{
+	struct ltq_etop_priv *priv = netdev_priv(dev);
+	int err;
+
+	ether_setup(dev);
+	dev->watchdog_timeo = 10 * HZ;
+	err = ltq_etop_hw_init(dev);
+	if (err)
+		goto err_hw;
+	ltq_etop_change_mtu(dev, 1500);
+	err = ltq_etop_set_mac_address(dev, &priv->pldata->mac);
+	if (err)
+		goto err_netdev;
+	ltq_etop_set_multicast_list(dev);
+	err = ltq_etop_mdio_init(dev);
+	if (err)
+		goto err_netdev;
+	return 0;
+
+err_netdev:
+	unregister_netdev(dev);
+	free_netdev(dev);
+err_hw:
+	ltq_etop_hw_exit(dev);
+	return err;
+}
+
+static void
+ltq_etop_tx_timeout(struct net_device *dev)
+{
+	int err;
+
+	ltq_etop_hw_exit(dev);
+	err = ltq_etop_hw_init(dev);
+	if (err)
+		goto err_hw;
+	dev->trans_start = jiffies;
+	netif_wake_queue(dev);
+	return;
+
+err_hw:
+	ltq_etop_hw_exit(dev);
+	netdev_err(dev, "failed to restart etop after TX timeout\n");
+}
+
+static const struct net_device_ops ltq_eth_netdev_ops = {
+	.ndo_open = ltq_etop_open,
+	.ndo_stop = ltq_etop_stop,
+	.ndo_start_xmit = ltq_etop_tx,
+	.ndo_change_mtu = ltq_etop_change_mtu,
+	.ndo_do_ioctl = ltq_etop_ioctl,
+	.ndo_set_mac_address = ltq_etop_set_mac_address,
+	.ndo_validate_addr = eth_validate_addr,
+	.ndo_set_multicast_list = ltq_etop_set_multicast_list,
+	.ndo_select_queue = ltq_etop_select_queue,
+	.ndo_init = ltq_etop_init,
+	.ndo_tx_timeout = ltq_etop_tx_timeout,
+};
+
+static int __init
+ltq_etop_probe(struct platform_device *pdev)
+{
+	struct net_device *dev;
+	struct ltq_etop_priv *priv;
+	struct resource *res;
+	int err;
+	int i;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "failed to get etop resource\n");
+		err = -ENOENT;
+		goto err_out;
+	}
+
+	res = devm_request_mem_region(&pdev->dev, res->start,
+		resource_size(res), dev_name(&pdev->dev));
+	if (!res) {
+		dev_err(&pdev->dev, "failed to request etop resource\n");
+		err = -EBUSY;
+		goto err_out;
+	}
+
+	ltq_etop_membase = devm_ioremap_nocache(&pdev->dev,
+		res->start, resource_size(res));
+	if (!ltq_etop_membase) {
+		dev_err(&pdev->dev, "failed to remap etop engine %d\n",
+			pdev->id);
+		err = -ENOMEM;
+		goto err_out;
+	}
+
+	dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4);
+	strcpy(dev->name, "eth%d");
+	dev->netdev_ops = &ltq_eth_netdev_ops;
+	dev->ethtool_ops = &ltq_etop_ethtool_ops;
+	priv = netdev_priv(dev);
+	priv->res = res;
+	priv->pldata = dev_get_platdata(&pdev->dev);
+	priv->netdev = dev;
+	spin_lock_init(&priv->lock);
+
+	for (i = 0; i < MAX_DMA_CHAN; i++) {
+		if (IS_TX(i))
+			netif_napi_add(dev, &priv->ch[i].napi,
+				ltq_etop_poll_tx, 8);
+		else if (IS_RX(i))
+			netif_napi_add(dev, &priv->ch[i].napi,
+				ltq_etop_poll_rx, 32);
+		priv->ch[i].netdev = dev;
+	}
+
+	err = register_netdev(dev);
+	if (err)
+		goto err_free;
+
+	platform_set_drvdata(pdev, dev);
+	return 0;
+
+err_free:
+	kfree(dev);
+err_out:
+	return err;
+}
+
+static int __devexit
+ltq_etop_remove(struct platform_device *pdev)
+{
+	struct net_device *dev = platform_get_drvdata(pdev);
+
+	if (dev) {
+		netif_tx_stop_all_queues(dev);
+		ltq_etop_hw_exit(dev);
+		ltq_etop_mdio_cleanup(dev);
+		unregister_netdev(dev);
+	}
+	return 0;
+}
+
+static struct platform_driver ltq_mii_driver = {
+	.remove = __devexit_p(ltq_etop_remove),
+	.driver = {
+		.name = "ltq_etop",
+		.owner = THIS_MODULE,
+	},
+};
+
+int __init
+init_ltq_etop(void)
+{
+	int ret = platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
+
+	if (ret)
+		pr_err("ltq_etop: Error registering platfom driver!");
+	return ret;
+}
+
+static void __exit
+exit_ltq_etop(void)
+{
+	platform_driver_unregister(&ltq_mii_driver);
+}
+
+module_init(init_ltq_etop);
+module_exit(exit_ltq_etop);
+
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
+MODULE_DESCRIPTION("Lantiq SoC ETOP");
+MODULE_LICENSE("GPL");
-- 
1.7.2.3


^ permalink raw reply related

* Re: [PATCH V2 2/3] MIPS: lantiq: add ethernet driver
From: David Miller @ 2011-05-05 22:10 UTC (permalink / raw)
  To: blogic; +Cc: ralf, ralph.hempel, linux-mips, netdev
In-Reply-To: <1304633402-24161-3-git-send-email-blogic@openwrt.org>

From: John Crispin <blogic@openwrt.org>
Date: Fri,  6 May 2011 00:10:01 +0200

> This patch adds the driver for the ETOP Packet Processing Engine (PPE32) found
> inside the XWAY family of Lantiq MIPS SoCs. This driver makes 100MBit ethernet
> work. Support for all 8 dma channels, gbit and the embedded switch found on
> the ar9/vr9 still needs to be implemented.
> 
> Signed-off-by: John Crispin <blogic@openwrt.org>
> Signed-off-by: Ralph Hempel <ralph.hempel@lantiq.com>

No objections from me and this can go via the MIPS tree:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply

* Re: [PATCH V2 2/3] MIPS: lantiq: add ethernet driver
From: John Crispin @ 2011-05-05 22:16 UTC (permalink / raw)
  To: David Miller; +Cc: ralf, ralph.hempel, linux-mips, netdev
In-Reply-To: <20110505.151049.35056363.davem@davemloft.net>

On 06/05/11 00:10, David Miller wrote:
> From: John Crispin <blogic@openwrt.org>
> Date: Fri,  6 May 2011 00:10:01 +0200
>
>   
>> This patch adds the driver for the ETOP Packet Processing Engine (PPE32) found
>> inside the XWAY family of Lantiq MIPS SoCs. This driver makes 100MBit ethernet
>> work. Support for all 8 dma channels, gbit and the embedded switch found on
>> the ar9/vr9 still needs to be implemented.
>>
>> Signed-off-by: John Crispin <blogic@openwrt.org>
>> Signed-off-by: Ralph Hempel <ralph.hempel@lantiq.com>
>>     
> No objections from me and this can go via the MIPS tree:
>
> Acked-by: David S. Miller <davem@davemloft.net>
>
>   
Thank you !



^ 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