Netdev List
 help / color / mirror / Atom feed
* Re: Poll about irqsafe_cpu_add and others
From: Eric Dumazet @ 2011-03-17 18:55 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: David Miller, linux-kernel, linux-arch, netdev, netfilter-devel
In-Reply-To: <alpine.DEB.2.00.1103171338350.18529@router.home>

Le jeudi 17 mars 2011 à 13:42 -0500, Christoph Lameter a écrit :
> On Thu, 17 Mar 2011, Eric Dumazet wrote:
> 
> > By the way, I noticed :
> >
> > DECLARE_PER_CPU(u64, xt_u64);
> > __this_cpu_add(xt_u64, 2) translates to following x86_32 code :
> >
> > 	mov	$xt_u64,%eax
> > 	add	%fs:0x0,%eax
> > 	addl	$0x2,(%eax)
> > 	adcl	$0x0,0x4(%eax)
> >
> >
> > I wonder why we dont use :
> >
> > 	addl	$0x2,%fs:xt_u64
> > 	addcl	$0x0,%fs:xt_u64+4
> 
> The compiler is fed the following
> 
> 	*__this_cpu_ptr(xt_u64) += 2
> 
> __this_cpu_ptr makes it:
> 
> 	*(xt_u64 + __my_cpu_offset) += 2
> 
> So the compiler calculates the address first and then increments it.
> 
> The compiler could optimize this I think. Wonder why that does not happen.

Compiler is really forced to compute addr, thats why.

Hmm, we should not fallback to generic ops I think, but tweak 

percpu_add_op() { 
...
	case 8: 
#if CONFIG_X86_64_SMP
                if (pao_ID__ == 1)                                      \
                        asm("incq "__percpu_arg(0) : "+m" (var));       \
                else if (pao_ID__ == -1)                                \
                        asm("decq "__percpu_arg(0) : "+m" (var));       \
                else                                                    \
                        asm("addq %1, "__percpu_arg(0)                  \
                            : "+m" (var)                                \
                            : "re" ((pao_T__)(val)));                   \
                break;                                                  \

#else
                asm("addl %1, "__percpu_arg(0)                  	\
                            : "+m" (var)                                \
                            : "ri" ((u32)(val)));                   	\
		asm("adcl %1, "__percpu_arg(0) 				\
			: "+m" ((char *)var+4)				\
			: "ri" ((u32)(val>>32));			\
                break;                                                  \

#endif
....
}

^ permalink raw reply

* Re: bnx2 vlan issue
From: Jesse Gross @ 2011-03-17 19:16 UTC (permalink / raw)
  To: Seblu; +Cc: netdev
In-Reply-To: <AANLkTi=rOjHZt_F01UfunrTm=2r1BO5QGFDeV9XyKX4G@mail.gmail.com>

On Thu, Mar 17, 2011 at 11:02 AM, Seblu <seblu@seblu.net> wrote:
> On Thu, Mar 17, 2011 at 3:51 PM, Seblu <seblu@seblu.net> wrote:
>> Good Afternoon Gentleman,
>>
>> I've an issue with a 2.6.38 (vanilla) on a debian unstable distro. I
>> attached an lspci and lshw about hardware. I also attached debian
>> network config file.
>>
>> My host is a host kvm which run vm on different networks (vlan). I
>> have 2 1Gbit/s card (eth0, eth1) and 1 10Gbit/s card (eth2).
>> I use bonding (bond0) mode 1 on the 1Gbit/s cards.
>>
>> vlan 14 and 15 are only availlable trought 1G cards. Same tagging on
>> both cards in switch. 14 is untagged (need for pxe) and 15 is tagged.
>>
>> Every network on my host is in a bridge. Eg:
>> vlan 15 is in br15 by bond0.15 as member,
>> vlan 14 is in br14 by bond0 as member,
>> vlan 20 is in br20 by eth2.20
>>
>> The issue is simple, packets from vlan 15 which are tagged are not
>> visible on bond0.15 but in bond0 (see capture). Like if there is no
>> vlan.
>>
>>
>> in dmesg in see something like : "8021q: adding VLAN 0 to HW filter on
>> device bond0".
>> Maybe there is something wrong with hardware filtering?
>>
>> I don't find a way to disable hw vlan filtering.
>> # ethtool -K eth1 rxvlan off
>> Cannot set device flag settings: Invalid argument
>>
>> I found a way to make thing work and don't work by one command.
>> # rmmod bonding
>> # ifdown br14
>> # ifdown br15
>> # ifup --force bond0
>> # ifup --force bond0.15
>> # ifup --force br15
>> => i can ping my ip on 15 working
>> if i make ifup --force br14, i lost connectivity on vlan 15.
>>
>> I don't have isssue when bond0 is not member of br14. So vlan on
>> bonding seems to be broken.
>>
> I done more test this afternoon.
>
> I set an ip on bond0, ip on bond0.15 is still pingeable.
> I created a bridge. Until I don't add bond0 in my bridge, bond0.15 is
> still pingeable.
>
>
>
> Now is see a relation with a similar issue come with 2.6.37. This become
> eth0 => network 1
> eth0.42 =>  network 2
> br0 => eth0 + eth1 (network1)
>
> Since 2.6.37, eth0.42 (network2) become unavailable, and it is only
> possible to do something like:
> br0 => eth0 + eth1 (network1)
> br0.42 => network 2
>
> To conclude:
> add a bonding interface in a bridge, kill vlan setted on it.
> add a real interface in a bridge, kill vlan setted on it.
>
> So, i don't see how we can restore a per bridge vlan. Why do you
> remove this possibility in 2.6.37?

It was a bug that it worked at all and whether it worked depended on
the hardware/firmware/driver.  If an interface is attached to a
bridge, the bridge takes all the packets received on that interface,
including vlan packets.

There are a few ways to setup vlans and bridging that work on all
kernels and with all NICs:

* vlans on interface, bridges contain vlan devices.  This gives you a
bridge for each vlan.
* bridge on interface, vlans on bridge device.  This gives you a
bridge with all packets and vlan devices can give you specific vlans.
* Use ebtables rules in the bridge to accept/reject certain packets as desired.

^ permalink raw reply

* Re: [PATCH V11 2/4] ptp: Added a clock that uses the eTSEC found on the MPC85xx.
From: Grant Likely @ 2011-03-17 19:21 UTC (permalink / raw)
  To: Richard Cochran
  Cc: Scott Wood, Mike Frysinger, Russell King, Arnd Bergmann,
	Peter Zijlstra, linux-api-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, David Miller, Paul Mackerras,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	netdev-u79uwXL29TY76Z2rM5mHXA, John Stultz, Thomas Gleixner,
	Rodolfo Giometti, Christoph Lameter, Alan Cox, Krzysztof Halasa
In-Reply-To: <20110225075320.GA4032-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>

On Fri, Feb 25, 2011 at 08:53:20AM +0100, Richard Cochran wrote:
> On Thu, Feb 24, 2011 at 11:27:31AM -0600, Scott Wood wrote:
> 
> > My vote, if it goes in a separate node at all, is "fsl,etsec-ptp",
> 
> So, that is what the patch does.
> 
> > and let the driver use SVR.
> 
> What is SVR?

An on chip register that provides the exact version of the SoC.  (As
opposed to PVR which is the version of the cpu core).

g.

^ permalink raw reply

* Re: Poll about irqsafe_cpu_add and others
From: Christoph Lameter @ 2011-03-17 19:21 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, linux-kernel, linux-arch, netdev, netfilter-devel
In-Reply-To: <1300388139.6315.418.camel@edumazet-laptop>

On Thu, 17 Mar 2011, Eric Dumazet wrote:

> > > I wonder why we dont use :
> > >
> > > 	addl	$0x2,%fs:xt_u64
> > > 	addcl	$0x0,%fs:xt_u64+4
> >
> > The compiler is fed the following
> >
> > 	*__this_cpu_ptr(xt_u64) += 2
> >
> > __this_cpu_ptr makes it:
> >
> > 	*(xt_u64 + __my_cpu_offset) += 2
> >
> > So the compiler calculates the address first and then increments it.
> >
> > The compiler could optimize this I think. Wonder why that does not happen.
>
> Compiler is really forced to compute addr, thats why.
>
> Hmm, we should not fallback to generic ops I think, but tweak
>
> percpu_add_op() {

percpu_add_op() is not used. This is a 64 bit operation on a 32 bit
machine thus we fall back to this_cpu_generic_to_op()

#define __this_cpu_generic_to_op(pcp, val, op)                          \
do {                                                                    \
        *__this_cpu_ptr(&(pcp)) op val;                                 \
} while (0)

^ permalink raw reply

* Re: sky2, vlan and nat/masquerading
From: Jesse Gross @ 2011-03-17 19:23 UTC (permalink / raw)
  To: Christian Hesse; +Cc: netdev
In-Reply-To: <20110315085326.1a1019aa@leda.vpn.lugor.de>

On Tue, Mar 15, 2011 at 12:53 AM, Christian Hesse <mail@eworm.de> wrote:
> On Mon, 14 Mar 2011 18:55:17 -0700 Jesse Gross <jesse@nicira.com> wrote:
>> On Mon, Mar 14, 2011 at 3:11 AM, Christian Hesse <mail@eworm.de> wrote:
>> > Ok, let me explain step by step:
>>
>> Thank you, this helps a lot in understanding your setup.
>>
>> >
>> > * Host sends icmp echo request (172.16.0.21 -> 192.168.100.3) to router
>> >  172.16.0.1, the packet is untagged.
>> > * Switch receives the packet on native interface with vid 2, tags it and
>> > sends it to the trunk)
>> > * Netbook receives the packet from trunk, untags it an queues it to vlan
>> >  interface 2.
>> > * Netbook nats the packet (192.168.x.140 > 192.168.100.3), tags it with
>> > vlan 2 and sends it to the trunk.
>>
>> For clarity, I'm assuming that this is supposed to be vlan 1?
>
> Sorry, little typo. Yes, you are right.
>
>> > * Switch receives the packet from trunk, untags it and sends it to native
>> >  interface with vlan 1.
>> > * The packet and its answer (192.168.100.3 -> 192.168.x.140) make their
>> > way through the network.
>> > * Switch receives the icmp echo reply on native interface with vlan 1,
>> > tags it and sends it to the trunk
>> > * Netbook receives the packet from trunk, untags it an queues it to vlan
>> >  interface 1.
>> > * Netbooks restores the original addresses from nat (192.168.100.3 ->
>> >  172.16.0.21), _tags_it_with_vlan_0_, tags it with vlan 2 and sends it to
>> > the trunk
>>
>> Can you capture a packet trace on the netbook's Ethernet interface to
>> see what it thinks it is sending?
>
> Ok, I have two traces for you: from the vlan interface and from the native
> interface. First ping to 172.16.0.65 is ok, second one to 192.168.100.3 fails.
>
> Please don't be confused, vlan 1 is vlan 3 this time and addresses
> changed a little bit. ;)

Hmm, it's pretty interesting that the extra vlan tag magically
appears.  I'll have to reproduce it to investigate further, as the
source isn't readily obvious to me.  You said that if you swap out a
different NIC but keep everything else the same the problem goes away?
 That also is strange because the packet capture should take place
before the driver.

Can you try using ethtool to turn off txvlan and see if that makes a difference?

^ permalink raw reply

* why dev_watchdog() timer freezes TX queues
From: Jean-Mickael Guerin @ 2011-03-17 19:25 UTC (permalink / raw)
  To: netdev

Hello,

Is it required to set FROZEN all tx queues in dev_watchdog() timer?
On timeout netif_tx_lock() blocks TX on all queues, even if STOPPED
was not set on any queue.

Jean-Mickael



^ permalink raw reply

* Re: [PATCH net-2.6] ethtool: Compat handling for struct ethtool_rxnfc
From: Alexander Duyck @ 2011-03-17 19:50 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev@vger.kernel.org, Santwona Behera
In-Reply-To: <1300383272.2569.13.camel@bwh-desktop>

On 3/17/2011 10:34 AM, Ben Hutchings wrote:
> This structure was accidentally defined such that its layout can
> differ between 32-bit and 64-bit processes.  Add compat structure
> definitions and an ioctl wrapper function.
>
> Signed-off-by: Ben Hutchings<bhutchings@solarflare.com>
> Cc: stable@kernel.org [2.6.30+]
> ---
> David,
>
> I still haven't received any response on whether the ETHTOOL_GRXCLSRLALL
> wrapping works with a real driver, but perhaps you could test it against
> niu?  I think sparc32 and sparc64 have the same alignment for u64 so
> this wrapper isn't strictly necessary, but it would still be used.  (Or
> we can arrange to disable the conversion when compat_ethtool_rxnfc is
> equivalent to ethtool_rxnfc.)
>
> Ben.

I'll try to pull this into my current development tree and test it while 
working on the next set of RFC patches for ixgbe w/ updated flow 
director.  I probably won't have it done until the middle of next week 
though.

Thanks,

Alex

^ permalink raw reply

* Re: [PATCH] Add useful per-connection TCP stats for diagnosis purpose.
From: Jerry Chu @ 2011-03-17 20:16 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1300351330.10164.712.camel@edumazet-laptop>

Eric, thanks for the prompt feedback.

On Thu, Mar 17, 2011 at 1:42 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le jeudi 17 mars 2011 à 01:06 -0700, H.K. Jerry Chu a écrit :
>> From: Jerry Chu <hkchu@google.com>
>>
>> This patch add a number of very useful counters/stats (defined in
>> tcp_stats.h) to help diagnosing TCP related problems.
>>
>> create_time     - when the connection was created (in jiffies)
>> total_inbytes   - total inbytes as consumed by the receiving apps.
>> total_outbytes  - total outbytes sent down from the transmitting apps.
>>
>> total_outdatasegs - total data carrying segments sent so far, including
>>               retransmitted ones.
>>
>> total_xmit      - total accumulated time (usecs) when the connection
>>               has something to send.
>>
>> total_retrans_time - total time (usecs, accumulated) the connection
>>               spends trying to recover lost packets. For each
>>               loss event the time is measured from the lost packet
>>               was first sent till the retransmitted packet was
>>               eventually ack'ed.
>>
>> total_cwnd_limit - total time (usecs, excluding time spent on loss
>>               recovery) the xmit is stopped due to cwnd limited
>>
>> total_swnd_limit - total time (usecs) theconnection is swnd limited
>>
>> The following two counters are for listeners only:
>>
>> accepted_reqs   - total # of accepted connection requests.
>> listen_drops    - total # of dropped SYN reqs (SYN cookies excluded) due
>>               to listener's queue overflow.
>>
>> total_retrans_time/total_retrans ratio gives a rough picture of how
>> quickly in average the connection can recover from a pkt loss. E.g.,
>> when the network is more congested, or the traffic contains mainly
>> smaller RPC where tail drop often requires RTO to recover,
>> the total_retrans_time/total_retrans ratio tends to be higher.
>>
>> Currently the new counters/stats are exported through /proc/net/tcp.
>
> Please dont. Use iproute2 instead.
>
>> Some simple, abbreviated field names have been added to the output of
>> /proc/net/tcp in order to allow backward/forward compatibility in the
>> future. Obviously the new counters/stats can also be easily exported
>> through other APIs.
>>
>
> /proc/net/tcp is legacy. You should touch it eventually, but after
> "other APIS" are done. It was the old way (quick but a bit ugly)

Understood. /proc/net/tcp is a much more expedient way of exporting these
counters because it doesn't requires any additional, special tool to read it,
unless other APIs (e.g., netlink). Note that backward compatibility to
/proc/net/tcp has been ensured by adding field names in the heading.

>
>
>
>> Signed-off-by: H.K. Jerry Chu <hkchu@google.com>
>> ---
>>  include/linux/ktime.h    |    3 ++
>>  include/linux/tcp.h      |    1 +
>>  include/net/tcp_stats.h  |   65 ++++++++++++++++++++++++++++++++++++++++++++++
>>  net/ipv4/tcp.c           |   30 ++++++++++++++++++---
>>  net/ipv4/tcp_input.c     |   13 +++++++++
>>  net/ipv4/tcp_ipv4.c      |   41 ++++++++++++++++++++++++++---
>>  net/ipv4/tcp_minisocks.c |    9 ++++++
>>  net/ipv4/tcp_output.c    |   47 +++++++++++++++++++++++++++++++--
>>  net/ipv6/tcp_ipv6.c      |    8 +++++
>>  9 files changed, 206 insertions(+), 11 deletions(-)
>>  create mode 100644 include/net/tcp_stats.h
>>
>> diff --git a/include/linux/ktime.h b/include/linux/ktime.h
>> index e1ceaa9..e60e758 100644
>> --- a/include/linux/ktime.h
>> +++ b/include/linux/ktime.h
>> @@ -333,6 +333,9 @@ extern void ktime_get_ts(struct timespec *ts);
>>  /* Get the real (wall-) time in timespec format: */
>>  #define ktime_get_real_ts(ts)        getnstimeofday(ts)
>
> Hmm, this kind of changes are out of netdev scope and should be avoided

Ok. (It was moved out of tcp_stats.h only at the last minute.)

>
>>
>> +#define ktime_since(a)               ktime_to_us(ktime_sub(ktime_get(), (a)))
>
> us are implied in ktime_since() ? thats strange.

Ok.

>
>> +#define ktime_zero(a)                ktime_equal((a), ktime_set(0, 0))
>
> ktime_zero() sounds like : "give me zero time" or "clear the ktime
> field".

Yes I actually have been flip-flopping on the name...

>
>> +
>>  static inline ktime_t ns_to_ktime(u64 ns)
>>  {
>>       static const ktime_t ktime_zero = { .tv64 = 0 };
>> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
>> index e64f4c6..ea5cb5d 100644
>> --- a/include/linux/tcp.h
>> +++ b/include/linux/tcp.h
>> @@ -460,6 +460,7 @@ struct tcp_sock {
>>        * contains related tcp_cookie_transactions fields.
>>        */
>>       struct tcp_cookie_values  *cookie_values;
>> +     struct tcp_stats        *conn_stats;
>>  };
>
> Really, using separate cache lines to store some stats is expensive.
> You should add counters in existing structure, to avoid additional cache
> line dirties. Carefully placing stats in already dirtied cache lines.

This was how it was done initially but then we wanted to allow future
extension to include possibly a lot more counters, something like Web100
(RFC4898). For the latter the memory/performance hit will likely require
a config option, and a separate structure will make this easier. Does it
make sense?

>
> You also should use native ktime_t infrastructure, to make the maths
> really fast in fast path.
>
> Only when stats are to be returned to user, you'll have to convert the
> native timestamps to user exportable ones.

Good point! Will do. (I mistakenly thought ktime_t is a larger structure.)

>
> Quite frankly, using u64 fields allow nanosec resolution.

I wish to use less bits because the final report only needs ms or even
sec resolution but the intermediate computation needs to capture usec
resolution.

>
> BTW, we probably could 'export' sk->sk_drops for TCP, like we do for
> UDP.

There are many other potentially useful counters/stats (spurious_retrans,
min_rtt, total_rto,...) but there is a tradeoff against memory/performance hit
so for the first round I'm focusing on what i feel is the most useful set.

Thanks,

Jerry

>
>
>
>

^ permalink raw reply

* Re: [PATCH] Add useful per-connection TCP stats for diagnosis purpose.
From: Stephen Hemminger @ 2011-03-17 21:20 UTC (permalink / raw)
  To: Jerry Chu; +Cc: Eric Dumazet, netdev
In-Reply-To: <AANLkTi=sLkXreC3LNsDuFDSeNMebr+ScMc12=gngd2cc@mail.gmail.com>

On Thu, 17 Mar 2011 13:16:15 -0700
Jerry Chu <hkchu@google.com> wrote:

> Eric, thanks for the prompt feedback.
> 
> On Thu, Mar 17, 2011 at 1:42 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Le jeudi 17 mars 2011 à 01:06 -0700, H.K. Jerry Chu a écrit :
> >> From: Jerry Chu <hkchu@google.com>
> >>
> >> This patch add a number of very useful counters/stats (defined in
> >> tcp_stats.h) to help diagnosing TCP related problems.
> >>
> >> create_time     - when the connection was created (in jiffies)
> >> total_inbytes   - total inbytes as consumed by the receiving apps.
> >> total_outbytes  - total outbytes sent down from the transmitting apps.
> >>
> >> total_outdatasegs - total data carrying segments sent so far, including
> >>               retransmitted ones.
> >>
> >> total_xmit      - total accumulated time (usecs) when the connection
> >>               has something to send.
> >>
> >> total_retrans_time - total time (usecs, accumulated) the connection
> >>               spends trying to recover lost packets. For each
> >>               loss event the time is measured from the lost packet
> >>               was first sent till the retransmitted packet was
> >>               eventually ack'ed.
> >>
> >> total_cwnd_limit - total time (usecs, excluding time spent on loss
> >>               recovery) the xmit is stopped due to cwnd limited
> >>
> >> total_swnd_limit - total time (usecs) theconnection is swnd limited
> >>
> >> The following two counters are for listeners only:
> >>
> >> accepted_reqs   - total # of accepted connection requests.
> >> listen_drops    - total # of dropped SYN reqs (SYN cookies excluded) due
> >>               to listener's queue overflow.
> >>
> >> total_retrans_time/total_retrans ratio gives a rough picture of how
> >> quickly in average the connection can recover from a pkt loss. E.g.,
> >> when the network is more congested, or the traffic contains mainly
> >> smaller RPC where tail drop often requires RTO to recover,
> >> the total_retrans_time/total_retrans ratio tends to be higher.
> >>
> >> Currently the new counters/stats are exported through /proc/net/tcp.
> >
> > Please dont. Use iproute2 instead.
> >
> >> Some simple, abbreviated field names have been added to the output of
> >> /proc/net/tcp in order to allow backward/forward compatibility in the
> >> future. Obviously the new counters/stats can also be easily exported
> >> through other APIs.
> >>
> >
> > /proc/net/tcp is legacy. You should touch it eventually, but after
> > "other APIS" are done. It was the old way (quick but a bit ugly)
> 
> Understood. /proc/net/tcp is a much more expedient way of exporting these
> counters because it doesn't requires any additional, special tool to read it,
> unless other APIs (e.g., netlink). Note that backward compatibility to
> /proc/net/tcp has been ensured by adding field names in the heading.
> 
> >
> >
> >
> >> Signed-off-by: H.K. Jerry Chu <hkchu@google.com>
> >> ---
> >>  include/linux/ktime.h    |    3 ++
> >>  include/linux/tcp.h      |    1 +
> >>  include/net/tcp_stats.h  |   65 ++++++++++++++++++++++++++++++++++++++++++++++
> >>  net/ipv4/tcp.c           |   30 ++++++++++++++++++---
> >>  net/ipv4/tcp_input.c     |   13 +++++++++
> >>  net/ipv4/tcp_ipv4.c      |   41 ++++++++++++++++++++++++++---
> >>  net/ipv4/tcp_minisocks.c |    9 ++++++
> >>  net/ipv4/tcp_output.c    |   47 +++++++++++++++++++++++++++++++--
> >>  net/ipv6/tcp_ipv6.c      |    8 +++++
> >>  9 files changed, 206 insertions(+), 11 deletions(-)
> >>  create mode 100644 include/net/tcp_stats.h
> >>
> >> diff --git a/include/linux/ktime.h b/include/linux/ktime.h
> >> index e1ceaa9..e60e758 100644
> >> --- a/include/linux/ktime.h
> >> +++ b/include/linux/ktime.h
> >> @@ -333,6 +333,9 @@ extern void ktime_get_ts(struct timespec *ts);
> >>  /* Get the real (wall-) time in timespec format: */
> >>  #define ktime_get_real_ts(ts)        getnstimeofday(ts)
> >
> > Hmm, this kind of changes are out of netdev scope and should be avoided
> 
> Ok. (It was moved out of tcp_stats.h only at the last minute.)
> 
> >
> >>
> >> +#define ktime_since(a)               ktime_to_us(ktime_sub(ktime_get(), (a)))
> >
> > us are implied in ktime_since() ? thats strange.
> 
> Ok.
> 
> >
> >> +#define ktime_zero(a)                ktime_equal((a), ktime_set(0, 0))
> >
> > ktime_zero() sounds like : "give me zero time" or "clear the ktime
> > field".
> 
> Yes I actually have been flip-flopping on the name...
> 
> >
> >> +
> >>  static inline ktime_t ns_to_ktime(u64 ns)
> >>  {
> >>       static const ktime_t ktime_zero = { .tv64 = 0 };
> >> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
> >> index e64f4c6..ea5cb5d 100644
> >> --- a/include/linux/tcp.h
> >> +++ b/include/linux/tcp.h
> >> @@ -460,6 +460,7 @@ struct tcp_sock {
> >>        * contains related tcp_cookie_transactions fields.
> >>        */
> >>       struct tcp_cookie_values  *cookie_values;
> >> +     struct tcp_stats        *conn_stats;
> >>  };
> >
> > Really, using separate cache lines to store some stats is expensive.
> > You should add counters in existing structure, to avoid additional cache
> > line dirties. Carefully placing stats in already dirtied cache lines.
> 
> This was how it was done initially but then we wanted to allow future
> extension to include possibly a lot more counters, something like Web100
> (RFC4898). For the latter the memory/performance hit will likely require
> a config option, and a separate structure will make this easier. Does it
> make sense?
> 
> >
> > You also should use native ktime_t infrastructure, to make the maths
> > really fast in fast path.
> >
> > Only when stats are to be returned to user, you'll have to convert the
> > native timestamps to user exportable ones.
> 
> Good point! Will do. (I mistakenly thought ktime_t is a larger structure.)
> 
> >
> > Quite frankly, using u64 fields allow nanosec resolution.
> 
> I wish to use less bits because the final report only needs ms or even
> sec resolution but the intermediate computation needs to capture usec
> resolution.
> 
> >
> > BTW, we probably could 'export' sk->sk_drops for TCP, like we do for
> > UDP.
> 
> There are many other potentially useful counters/stats (spurious_retrans,
> min_rtt, total_rto,...) but there is a tradeoff against memory/performance hit
> so for the first round I'm focusing on what i feel is the most useful set.
> 
> Thanks,
> 
> Jerry

These stats are best added via netlink, the tool ss already prints lots
of similar stats. Look at INET_DIAG_INFO and the output of:
 ss -i -t






-- 

^ permalink raw reply

* Re: sky2, vlan and nat/masquerading
From: Christian Hesse @ 2011-03-17 21:40 UTC (permalink / raw)
  To: Jesse Gross; +Cc: netdev
In-Reply-To: <AANLkTikeVWuDMhws4JX0S+WhKFja8zU_2ZY3KZZUAXks@mail.gmail.com>

On Thu, 17 Mar 2011 12:23:48 -0700 Jesse Gross <jesse@nicira.com> wrote:
> Hmm, it's pretty interesting that the extra vlan tag magically
> appears.  I'll have to reproduce it to investigate further, as the
> source isn't readily obvious to me.  You said that if you swap out a
> different NIC but keep everything else the same the problem goes away?
>  That also is strange because the packet capture should take place
> before the driver.

Correctly. I tested with asix and mcs7830.

> Can you try using ethtool to turn off txvlan and see if that makes a
> difference?

Sure. I will give it a try tomorrow.
-- 
Schoene Gruesse
Chris

^ permalink raw reply

* Re: [PATCHv2 3/9] macb: unify at91 and avr32 platform data
From: Jamie Iles @ 2011-03-17 21:51 UTC (permalink / raw)
  To: Jamie Iles
  Cc: Peter Korsgaard, Russell King - ARM Linux, avictor.za@gmail.com,
	plagnioj, linux-arm-kernel, nicolas.ferre, netdev
In-Reply-To: <20110317093403.GA15396@pulham.picochip.com>

On Thu, Mar 17, 2011 at 09:34:03AM +0000, Jamie Iles wrote:
> Ok, I'll rename to macb_platform_data and update at91_ether to use 
> that with a comment describing that we're sharing the platform data 
> with macb.  At least that gets rid of the preprocessor stuff in 
> board.h for at91 too.

So here's the updated patch with changes to the at91_ether driver to 
share the data with macb.

Russell, are you happy to take this series?  If so, how would you prefer 
it, in the patch system or as a git pull?

Jamie

----

>From 7e719117365953dbabe292c1fbc5bd0c1590698c Mon Sep 17 00:00:00 2001
From: Jamie Iles <jamie@jamieiles.com>
Date: Tue, 8 Mar 2011 20:17:06 +0000
Subject: [PATCHv3 3/9] macb: unify at91 and avr32 platform data

Both at91 and avr32 defines its own platform data structure for
the macb driver and both share common structures though at91
includes a currently unused phy_irq_pin.  Create a common
macb_platform_data for macb that both at91 and avr32 can use.  In
future we can use this to support other architectures that use the
same IP block with the macb driver.

v2: rename eth_platform_data to macb_platform_data and allow at91_ether
to share the platform data with macb.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
---
 arch/arm/mach-at91/at572d940hf_devices.c    |    6 +++---
 arch/arm/mach-at91/at91cap9_devices.c       |    6 +++---
 arch/arm/mach-at91/at91rm9200_devices.c     |    6 +++---
 arch/arm/mach-at91/at91sam9260_devices.c    |    6 +++---
 arch/arm/mach-at91/at91sam9263_devices.c    |    6 +++---
 arch/arm/mach-at91/at91sam9g45_devices.c    |    6 +++---
 arch/arm/mach-at91/board-1arm.c             |    2 +-
 arch/arm/mach-at91/board-afeb-9260v1.c      |    2 +-
 arch/arm/mach-at91/board-at572d940hf_ek.c   |    2 +-
 arch/arm/mach-at91/board-cam60.c            |    2 +-
 arch/arm/mach-at91/board-cap9adk.c          |    2 +-
 arch/arm/mach-at91/board-carmeva.c          |    2 +-
 arch/arm/mach-at91/board-cpu9krea.c         |    2 +-
 arch/arm/mach-at91/board-cpuat91.c          |    2 +-
 arch/arm/mach-at91/board-csb337.c           |    2 +-
 arch/arm/mach-at91/board-csb637.c           |    2 +-
 arch/arm/mach-at91/board-eb9200.c           |    2 +-
 arch/arm/mach-at91/board-ecbat91.c          |    2 +-
 arch/arm/mach-at91/board-eco920.c           |    2 +-
 arch/arm/mach-at91/board-foxg20.c           |    2 +-
 arch/arm/mach-at91/board-gsia18s.c          |    2 +-
 arch/arm/mach-at91/board-kafa.c             |    2 +-
 arch/arm/mach-at91/board-kb9202.c           |    2 +-
 arch/arm/mach-at91/board-neocore926.c       |    2 +-
 arch/arm/mach-at91/board-pcontrol-g20.c     |    2 +-
 arch/arm/mach-at91/board-picotux200.c       |    2 +-
 arch/arm/mach-at91/board-qil-a9260.c        |    2 +-
 arch/arm/mach-at91/board-rm9200dk.c         |    2 +-
 arch/arm/mach-at91/board-rm9200ek.c         |    2 +-
 arch/arm/mach-at91/board-sam9-l9260.c       |    2 +-
 arch/arm/mach-at91/board-sam9260ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9263ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9g20ek.c        |    2 +-
 arch/arm/mach-at91/board-sam9m10g45ek.c     |    2 +-
 arch/arm/mach-at91/board-snapper9260.c      |    2 +-
 arch/arm/mach-at91/board-stamp9g20.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9260.c        |    2 +-
 arch/arm/mach-at91/board-usb-a9263.c        |    2 +-
 arch/arm/mach-at91/board-yl-9200.c          |    2 +-
 arch/arm/mach-at91/include/mach/board.h     |   14 ++------------
 arch/avr32/boards/atngw100/setup.c          |    2 +-
 arch/avr32/boards/atstk1000/atstk1002.c     |    2 +-
 arch/avr32/boards/favr-32/setup.c           |    2 +-
 arch/avr32/boards/hammerhead/setup.c        |    2 +-
 arch/avr32/boards/merisc/setup.c            |    2 +-
 arch/avr32/boards/mimc200/setup.c           |    2 +-
 arch/avr32/mach-at32ap/at32ap700x.c         |    8 ++++----
 arch/avr32/mach-at32ap/include/mach/board.h |    7 ++-----
 drivers/net/arm/at91_ether.c                |    3 ++-
 drivers/net/arm/at91_ether.h                |    4 +++-
 drivers/net/macb.c                          |   10 ++++------
 include/linux/platform_data/macb.h          |   17 +++++++++++++++++
 52 files changed, 91 insertions(+), 86 deletions(-)
 create mode 100644 include/linux/platform_data/macb.h

diff --git a/arch/arm/mach-at91/at572d940hf_devices.c b/arch/arm/mach-at91/at572d940hf_devices.c
index 0fc20a2..503b080 100644
--- a/arch/arm/mach-at91/at572d940hf_devices.c
+++ b/arch/arm/mach-at91/at572d940hf_devices.c
@@ -140,7 +140,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -167,7 +167,7 @@ static struct platform_device at572d940hf_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -196,7 +196,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at572d940hf_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index d1f775e..70d39fec 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -198,7 +198,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -225,7 +225,7 @@ static struct platform_device at91cap9_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -262,7 +262,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91cap9_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 7b53922..ca504a0 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -127,7 +127,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -154,7 +154,7 @@ static struct platform_device at91rm9200_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -191,7 +191,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91rm9200_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 07eb7b0..f6d4c57 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -128,7 +128,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -155,7 +155,7 @@ static struct platform_device at91sam9260_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -192,7 +192,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9260_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index fb5c23a..d4a310c 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -138,7 +138,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -165,7 +165,7 @@ static struct platform_device at91sam9263_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -202,7 +202,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9263_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 1e8f275..679247f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -283,7 +283,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
 	[0] = {
@@ -310,7 +310,7 @@ static struct platform_device at91sam9g45_eth_device = {
 	.num_resources	= ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
 	if (!data)
 		return;
@@ -347,7 +347,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
 	platform_device_register(&at91sam9g45_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 8a3fc84..ab4fefc 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -64,7 +64,7 @@ static void __init onearm_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata onearm_eth_data = {
+static struct macb_platform_data __initdata onearm_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index cba7f77..6d8bfa1 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -109,7 +109,7 @@ static struct spi_board_info afeb9260_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata afeb9260_macb_data = {
+static struct macb_platform_data __initdata afeb9260_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA9,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-at572d940hf_ek.c b/arch/arm/mach-at91/board-at572d940hf_ek.c
index 3929f1c..c57cf34 100644
--- a/arch/arm/mach-at91/board-at572d940hf_ek.c
+++ b/arch/arm/mach-at91/board-at572d940hf_ek.c
@@ -104,7 +104,7 @@ static struct at91_mmc_data __initdata eb_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata eb_eth_data = {
+static struct macb_platform_data __initdata eb_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PB25,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index b54e3e6..fcab5ba 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -121,7 +121,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = {
 /*
  * MACB Ethernet device
  */
-static struct __initdata at91_eth_data cam60_macb_data = {
+static struct __initdata macb_platform_data cam60_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PB5,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index e727444..6196438 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -158,7 +158,7 @@ static struct at91_mmc_data __initdata cap9adk_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cap9adk_macb_data = {
+static struct macb_platform_data __initdata cap9adk_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 2e74a19..a5db698 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -62,7 +62,7 @@ static void __init carmeva_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata carmeva_eth_data = {
+static struct macb_platform_data __initdata carmeva_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 3838594..0cd73fc 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -104,7 +104,7 @@ static struct at91_udc_data __initdata cpu9krea_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cpu9krea_macb_data = {
+static struct macb_platform_data __initdata cpu9krea_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2f4dd8c..1faf4ff 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -83,7 +83,7 @@ static void __init cpuat91_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata cpuat91_eth_data = {
+static struct macb_platform_data __initdata cpuat91_eth_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 464839d..e090e3b 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -63,7 +63,7 @@ static void __init csb337_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata csb337_eth_data = {
+static struct macb_platform_data __initdata csb337_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC2,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 431688c..01d5e01 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -57,7 +57,7 @@ static void __init csb637_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata csb637_eth_data = {
+static struct macb_platform_data __initdata csb637_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC0,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 6cf6566..5a439ec 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -65,7 +65,7 @@ static void __init eb9200_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata eb9200_eth_data = {
+static struct macb_platform_data __initdata eb9200_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index de2fd04..029832d 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -65,7 +65,7 @@ static void __init ecb_at91init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata ecb_at91eth_data = {
+static struct macb_platform_data __initdata ecb_at91eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index a158a0c..7475432 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -47,7 +47,7 @@ static void __init eco920_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata eco920_eth_data = {
+static struct macb_platform_data __initdata eco920_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC2,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index dfc7dfe..a405841 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -141,7 +141,7 @@ static struct spi_board_info foxg20_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata foxg20_macb_data = {
+static struct macb_platform_data __initdata foxg20_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index bc28136..5de9a6b 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -98,7 +98,7 @@ static struct at91_udc_data __initdata udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index d2e1f4e..0e1096c 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -62,7 +62,7 @@ static void __init kafa_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata kafa_eth_data = {
+static struct macb_platform_data __initdata kafa_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index a13d206..9fe14a2 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -71,7 +71,7 @@ static void __init kb9202_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata kb9202_eth_data = {
+static struct macb_platform_data __initdata kb9202_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PB29,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index fe5f1d4..02f2e4d 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -161,7 +161,7 @@ static struct at91_mmc_data __initdata neocore926_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata neocore926_macb_data = {
+static struct macb_platform_data __initdata neocore926_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index feb6578..a719aef 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -129,7 +129,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 55dad3a..f7c5ae0 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -65,7 +65,7 @@ static void __init picotux200_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata picotux200_eth_data = {
+static struct macb_platform_data __initdata picotux200_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 69d15a8..1173fd9 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -110,7 +110,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 4c1047c..6dcb06a 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -70,7 +70,7 @@ static void __init dk_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata dk_eth_data = {
+static struct macb_platform_data __initdata dk_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 9df1be8..e325eb8 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -70,7 +70,7 @@ static void __init ek_init_irq(void)
 	at91rm9200_init_interrupts(NULL);
 }
 
-static struct at91_eth_data __initdata ek_eth_data = {
+static struct macb_platform_data __initdata ek_eth_data = {
 	.phy_irq_pin	= AT91_PIN_PC4,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 25a26be..1e29e79 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -115,7 +115,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 0,
 };
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index de1816e..8c84331 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -156,7 +156,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index bfe490d..a88d8c5 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -163,7 +163,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index ca8198b..48a5f4c 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -128,7 +128,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA7,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 6c999db..933a21d 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -120,7 +120,7 @@ static struct mci_platform_data __initdata mci1_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PD5,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 0a99b3c..8c9eb1b 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -70,7 +70,7 @@ static struct at91_udc_data __initdata snapper9260_udc_data = {
 	.vbus_polled		= 1,
 };
 
-static struct at91_eth_data snapper9260_macb_data = {
+static struct macb_platform_data snapper9260_macb_data = {
 	.is_rmii	= 1,
 };
 
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index f8902b1..821afb0 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -163,7 +163,7 @@ static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA28,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 07784ba..8cc7868 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -84,7 +84,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PA31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index b614508..242da50 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -97,7 +97,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
 	.phy_irq_pin	= AT91_PIN_PE31,
 	.is_rmii	= 1,
 };
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index e0f0080..2aa861c 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -112,7 +112,7 @@ static struct gpio_led yl9200_leds[] = {
 /*
  * Ethernet
  */
-static struct at91_eth_data __initdata yl9200_eth_data = {
+static struct macb_platform_data __initdata yl9200_eth_data = {
 	.phy_irq_pin		= AT91_PIN_PB28,
 	.is_rmii		= 1,
 };
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 2b499eb..5e5acc4 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -40,6 +40,7 @@
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -81,18 +82,7 @@ extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
   /* atmel-mci platform config */
 extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
 
- /* Ethernet (EMAC & MACB) */
-struct at91_eth_data {
-	u32		phy_mask;
-	u8		phy_irq_pin;	/* PHY IRQ */
-	u8		is_rmii;	/* using RMII interface? */
-};
-extern void __init at91_add_device_eth(struct at91_eth_data *data);
-
-#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9) \
-	|| defined(CONFIG_ARCH_AT91SAM9G45) || defined(CONFIG_ARCH_AT572D940HF)
-#define eth_platform_data	at91_eth_data
-#endif
+extern void __init at91_add_device_eth(struct macb_platform_data *data);
 
  /* USB Host */
 struct at91_usbh_data {
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 659d119..1e14083 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -113,7 +113,7 @@ struct eth_addr {
 	u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static struct spi_board_info spi0_board_info[] __initdata = {
 	{
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 6ce30fb..47906ba 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -110,7 +110,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2] = {
+static struct macb_platform_data __initdata eth_data[2] = {
 	{
 		/*
 		 * The MDIO pullups on STK1000 are a bit too weak for
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 86fab77..27bd6fb 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -50,7 +50,7 @@ struct eth_addr {
 	u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[1];
-static struct eth_platform_data __initdata eth_data[1] = {
+static struct macb_platform_data __initdata eth_data[1] = {
 	{
 		.phy_mask	= ~(1U << 1),
 	},
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index da14fbd..9d1efd1 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -102,7 +102,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[1];
-static struct eth_platform_data __initdata eth_data[1];
+static struct macb_platform_data __initdata eth_data[1];
 
 /*
  * The next two functions should go away as the boot loader is
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index e61bc94..ed137e3 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -52,7 +52,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static int ads7846_get_pendown_state_PB26(void)
 {
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index c4da5cb..05358aa 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -86,7 +86,7 @@ struct eth_addr {
 	u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static struct spi_eeprom eeprom_25lc010 = {
 		.name = "25lc010",
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index e67c999..a8d2e6c 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1064,7 +1064,7 @@ void __init at32_setup_serial_console(unsigned int usart_id)
  * -------------------------------------------------------------------- */
 
 #ifdef CONFIG_CPU_AT32AP7000
-static struct eth_platform_data macb0_data;
+static struct macb_platform_data macb0_data;
 static struct resource macb0_resource[] = {
 	PBMEM(0xfff01800),
 	IRQ(25),
@@ -1073,7 +1073,7 @@ DEFINE_DEV_DATA(macb, 0);
 DEV_CLK(hclk, macb0, hsb, 8);
 DEV_CLK(pclk, macb0, pbb, 6);
 
-static struct eth_platform_data macb1_data;
+static struct macb_platform_data macb1_data;
 static struct resource macb1_resource[] = {
 	PBMEM(0xfff01c00),
 	IRQ(26),
@@ -1083,7 +1083,7 @@ DEV_CLK(hclk, macb1, hsb, 9);
 DEV_CLK(pclk, macb1, pbb, 7);
 
 struct platform_device *__init
-at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
+at32_add_device_eth(unsigned int id, struct macb_platform_data *data)
 {
 	struct platform_device *pdev;
 	u32 pin_mask;
@@ -1160,7 +1160,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
 		return NULL;
 	}
 
-	memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data));
+	memcpy(pdev->dev.platform_data, data, sizeof(struct macb_platform_data));
 	platform_device_register(pdev);
 
 	return pdev;
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index 6174020..cb340ae 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
 #define GPIO_PIN_NONE	(-1)
 
@@ -41,12 +42,8 @@ struct atmel_uart_data {
 void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
 struct platform_device *at32_add_device_usart(unsigned int id);
 
-struct eth_platform_data {
-	u32	phy_mask;
-	u8	is_rmii;
-};
 struct platform_device *
-at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
+at32_add_device_eth(unsigned int id, struct macb_platform_data *data);
 
 struct spi_board_info;
 struct platform_device *
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index e07b314..cb85318 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -25,6 +25,7 @@
 #include <linux/skbuff.h>
 #include <linux/dma-mapping.h>
 #include <linux/ethtool.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/gfp.h>
@@ -983,7 +984,7 @@ static const struct net_device_ops at91ether_netdev_ops = {
 static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address,
 			struct platform_device *pdev, struct clk *ether_clk)
 {
-	struct at91_eth_data *board_data = pdev->dev.platform_data;
+	struct macb_platform_data *board_data = pdev->dev.platform_data;
 	struct net_device *dev;
 	struct at91_private *lp;
 	unsigned int val;
diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h
index 353f4da..3725fbb0 100644
--- a/drivers/net/arm/at91_ether.h
+++ b/drivers/net/arm/at91_ether.h
@@ -85,7 +85,9 @@ struct recv_desc_bufs
 struct at91_private
 {
 	struct mii_if_info mii;			/* ethtool support */
-	struct at91_eth_data board_data;	/* board-specific configuration */
+	struct macb_platform_data board_data;	/* board-specific
+						 * configuration (shared with
+						 * macb for common data */
 	struct clk *ether_clk;			/* clock */
 
 	/* PHY */
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e3860d6..aee1e51 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -18,12 +18,10 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 
-#include <mach/board.h>
-#include <mach/cpu.h>
-
 #include "macb.h"
 
 #define RX_BUFFER_SIZE		128
@@ -190,7 +188,7 @@ static int macb_mii_probe(struct net_device *dev)
 {
 	struct macb *bp = netdev_priv(dev);
 	struct phy_device *phydev;
-	struct eth_platform_data *pdata;
+	struct macb_platform_data *pdata;
 	int ret;
 
 	phydev = phy_find_first(bp->mii_bus);
@@ -227,7 +225,7 @@ static int macb_mii_probe(struct net_device *dev)
 
 static int macb_mii_init(struct macb *bp)
 {
-	struct eth_platform_data *pdata;
+	struct macb_platform_data *pdata;
 	int err = -ENXIO, i;
 
 	/* Enable management port */
@@ -1107,7 +1105,7 @@ static const struct net_device_ops macb_netdev_ops = {
 
 static int __init macb_probe(struct platform_device *pdev)
 {
-	struct eth_platform_data *pdata;
+	struct macb_platform_data *pdata;
 	struct resource *regs;
 	struct net_device *dev;
 	struct macb *bp;
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 0000000..e7c748f
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * 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.
+ */
+#ifndef __MACB_PDATA_H__
+#define __MACB_PDATA_H__
+
+struct macb_platform_data {
+	u32		phy_mask;
+	u8		phy_irq_pin;	/* PHY IRQ */
+	u8		is_rmii;	/* using RMII interface? */
+};
+
+#endif /* __MACB_PDATA_H__ */
-- 
1.7.4


^ permalink raw reply related

* Re: bnx2 vlan issue
From: Seblu @ 2011-03-17 23:22 UTC (permalink / raw)
  To: Jesse Gross; +Cc: netdev
In-Reply-To: <AANLkTimAnHcoVDY_p8PqZLMJdMz2w7bMnSbOwzn4aR4i@mail.gmail.com>

On Thu, Mar 17, 2011 at 8:16 PM, Jesse Gross <jesse@nicira.com> wrote:
> On Thu, Mar 17, 2011 at 11:02 AM, Seblu <seblu@seblu.net> wrote:
>> On Thu, Mar 17, 2011 at 3:51 PM, Seblu <seblu@seblu.net> wrote:
>
> It was a bug that it worked at all and whether it worked depended on
> the hardware/firmware/driver.  If an interface is attached to a
> bridge, the bridge takes all the packets received on that interface,
> including vlan packets.
ok i see.

>
> There are a few ways to setup vlans and bridging that work on all
> kernels and with all NICs:
>
> * vlans on interface, bridges contain vlan devices.  This gives you a
> bridge for each vlan.
Except for untagged isn't it? This is why i fail. I need to have a
bridge with the untagged vlan from an interface.
Before 2.6.37 (with most of drivers/firmware/hardware i use) when a
vlan is defined on an interface, for example eth0, eth0.15 show vlan15
frames and eth0 show untagged frames.

I've tryed eth0.0, expecting to have untagged vlan, but this doesnt work.
How can I create a bridge with the untagged vlan from an interface?

> * bridge on interface, vlans on bridge device.  This gives you a
> bridge with all packets and vlan devices can give you specific vlans.
I cannot use this schema, i used bridge to bring together vnet
interface and vlan interface.

> * Use ebtables rules in the bridge to accept/reject certain packets as desired.
I don't see how use ebtables to push untagged frame to a dedicated
iface which can be added in a bridge.

-- 
Sébastien Luttringer
www.seblu.net

^ permalink raw reply

* [ANN] Compat-wireless for 2.6.38 - vanilla and cherry pick releases
From: Luis R. Rodriguez @ 2011-03-18  1:22 UTC (permalink / raw)
  To: linux-wireless, linux-bluetooth; +Cc: netdev, linux-kernel

The juicy URLs:

http://wireless.kernel.org/en/users/Download/stable

http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.38/compat-wireless-2.6.38-3.tar.bz2
sha1sum: f1fb354dc2c4a8788bcd65b0e3105d58094450d8

http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.38/compat-wireless-2.6.38-3-ns.tar.bz2
sha1sum: 305e5c7e24246d082f88ffa1c7ad219db1138058

ChangeLog:

http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.38/ChangeLog-2.6.38-wireless

I've only test compiled so far against 2.6.35 the entire tarball and
only load tested against iwlagn.

The boring verbiage:

Linus moved on with life and released 2.6.38, we get to do the same
now with our backported BT, 802.11 and networking components down to
the latest supported kernel listed on kernel.org (sometimes even
further). We get two releases, a vanilla release and a secondary
release that has patches sucked out from linux-next.git which are
pending to be propagated into 2.6.38.1 and also a select few cherry
picked patches from linux-next.git which are not stable material but
have been reported to help with stability.

The pending-stable stuff sucked out from linux-next.git :

mcgrof@tux ~/devel/compat-wireless-2.6 (git::linux-2.6.38.y)$ ls -1
pending-stable/
0001-ath9k_hw-Fix-incorrect-macversion-and-macrev-checks.patch
0002-ath9k_hw-read-and-backup-AR_WA-register-value-even-b.patch
0004-rtl8187-Change-rate-control-feedback.patch
0005-ath9k-remove-support-for-the-FIF_PROMISC_IN_BSS-filt.patch

The cherry picked stuff from linux-next.git :

mcgrof@tux ~/devel/compat-wireless-2.6 (git::linux-2.6.38.y)$ ls -1
linux-next-cherry-picks/
0001a-ath9k_hw-Add-a-function-to-read-sqsum_dvc.patch
0001b-ath9k-Fix-a-PLL-hang-issue-observed-with-AR9485.patch
0001c-ath9k-Cancel-pll_work-while-disabling-radio.patch
0002-ath9k-Fix-incorrect-GPIO-LED-pin-for-AR9485.patch
0003-ath9k_hw-Read-noise-floor-only-for-available-chains-.patch
0004-ath9k_hw-Improve-idle-power-consumption-for-AR9485.patch
0005-ath9k_hw-Increase-the-wait-count-for-nf-load.patch
0006-ath9k_hw-fix-REG_SET_BIT-and-REG_CLR_BIT-for-multipl.patch
0007-ath9k-fix-stopping-tx-dma-on-reset.patch
0008-ath9k-disable-beaconing-before-stopping-beacon-queue.patch
0009-ath9k-improve-reliability-of-beacon-transmission-and.patch
0010-ath9k-fix-aggregation-related-interoperability-issue.patch
0011-staging-Fix-some-incorrect-use-of-positive-error-cod.patch
0012-staging-ath6kl-Fixing-a-NULL-pointer-exception.patch
0013-staging-ath6kl-Fixing-key-settings-for-WPA-WPA2.patch
0014-staging-ath6kl-Return-correct-scan-complete-status.patch
0015-staging-ath6kl-Fixing-target-crash-due-to-mismatch-c.patch
0016-staging-ath6kl-Fixing-driver-initialization-for-manu.patch
0017-staging-ath6kl-Consolidating-hardware-configuration.patch
0018-staging-ath6kl-Adding-support-for-txop-bursting-enab.patch
0019-staging-ath6kl-Fixing-a-memory-leak.patch
0020-staging-ath6kl-Fixing-a-memory-leak.patch
0021-staging-ath6kl-Add-configuration-for-excessive-TX-re.patch
0022-staging-ath6kl-Fixing-memory-leak.patch
0023-staging-ath6kl-Fixing-the-cached-copy-of-the-BSS-fil.patch
0024-staging-ath6kl-Adding-state-in-driver-to-track-the-s.patch
0025-staging-ath6kl-Fixing-accidental-overwriting-of-prob.patch
0026-staging-ath6kl-Fixing-disappearing-of-scan-list-due-.patch
0027-staging-ath6kl-buffer-overflow-in-SEND_FRAME-ioctl.patch
0028-staging-ath6kl-Eliminate-cfg80211-warnings.patch

A lot of these patches have required a manual backport so feel free to
reuse elsewhere if you find useful.

Below is the compat.git and compat-wireless ChangeLog, for more details visit:

http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.38/ChangeLog-2.6.38-wireless


===============================================
ChangeLog for compat-wireless for linux-2.6.38
===============================================

This is the ChangeLog for the Linux kernel project compat-wireless.
It provides a backport of a few Linux kernel subsystems down to
older kernels:

  * 802.11
  * Bluetooth
  * Ethernet

For more details refer to the home page:

http://wireless.kernel.org/en/users/Download/stable/

The compat-wireless project consists of code from three projects:

  * The Linux kernel: linux-2.6-allstable.git
  * Compat-wirelesS: compat-wireless.git
  * Compat: compat.git

The compat-wireless stable releases incorporates code from from
each of these git trees for the respective upstream Linux kernel
stable release. A branch called linux-2.6.3x.y exists for each
stable release. Below we provide the ChangeLog of changes from
the previous branched release to the new branched release.

Release: linux-2.6.38


Updates from the compat.git project:
====================================

git shortlog linux-2.6.37.y..linux-2.6.38.y

Felix Fietkau (6):
      compat: backport pm_qos_*_request
      compat: backport pm_qos_request
      compat: add a wrapper for rfkill.h
      compat: fix pm_qos_params compile error on 2.6.35
      compat: fix a typo in pm_qos_update_request for 2.6.35
      compat: backport LED class software blinking

Hauke Mehrtens (16):
      compat: add missing pm_runtime.h
      compat: backport Generic exponentially weighted moving average (EWMA)
      compat: update wireless.h with new version from linux-next
      compat: backport pr_warn
      compat: fix build with CONFIG_LEDS_CLASS=m
      compat: fix build for kernel <= 2.6.29
      compat: backport skb_checksum_start_offset
      compat backport no_printk
      compat: backport pci_is_pcie and pci_pcie_cap
      compat: backport pci_wake_from_d3
      compat: backport alloc_workqueue
      compat: add generic functions for suspend/resume
      compat: backport kfifo
      compat: backport alloc_ordered_workqueue
      compat: add support for kernel 2.6.38
      compat: backport tty_{lock,unlock,locked}

Johannes Berg (3):
      Felix's patch backported my software blink emulation,     but if
the kernel is 2.6.25 or newer we can also try     the HW offload
first.
      Signed-off-by: Johannes Berg <johannes.berg@intel.com>
      This has disappeared upstream and is no longer used.

Luis R. Rodriguez (3):
      compat: backport sign_extend32()
      compat: backport PCI_EXP_LNKCTL_ES added for on 2.6.29
      compat: add check for CONFIG_COMPAT_KFIFO=m

Updates from the compat-wireless.git project:
=============================================

git shortlog linux-2.6.37.y..linux-2.6.38.y

Dave Vasilevsky (1):
      compat-wireless: Rename config option to CONFIG_B43_PHY_N

Felix Fietkau (1):
      compat-wireless: remove unnecessary chunks from the rfkill patch

Greg Whiteley (1):
      compat-wireless: rt2800pci (and rt2x00pci) don't unload on 'make unload'

Hauke Mehrtens (33):
      compat-wireless: make patches apply again
      compat-wireless: Backport pci power management
      compat-wireless: make patches apply again
      compat-wireless: fix compile error with iwl
      compat-wireless: add missing rename for CONFIG_IWL4965
      compat-wireless: WL1251_SDIO needs WL12XX_PLATFORM_DATA
      compat-wireless: make patches apply again
      compat-wireless: generate CONFIG_COMPAT_KERNEL_38
      compat-wireless: make BRCMFMAC compile
      compat-wireless: correct rt2x00 config options
      compat-wireless: rename config symbols to CONFIG_WL12XX
      compat-wireless: fix CONFIG_BRCM80211 config option
      compat-wireless: remove double definition of CONFIG_SSB_DEBUG
      compat-wireless: make patches apply again
      compat-wireless: make patches apply again
      compat-wireless: make crap patches apply again
      compat-wireless: add new config options for ath5k
      compat-wireless: make patches apply again
      compat-wireless: make patch apply again
      compat-wireless: make patches apply again.
      compat-wireless: use pci_is_pcie()
      compat-wireless: add support for RTL8192CE
      compat-wireless: build led support conditionally
      compat-wireless: fix power managemnet backport
      compat-wireless: remove patches applied mainline
      compat-wireless: rtl8187 and rtl8180 moved
      compat-wireless: use generic suspend resume
      compat-wireless: make patches apply again.
      compat-wireless: use backported kfifo
      compat-wireless: make NEXT_TREE configurable.
      compat-wireless: update patches in enable-older-kernels
      compat-wireless: do not write git-clone
      compat-wireless: backport of alloc_ordered_workqueue into compat.git

Johannes Berg (1):
      compat-wirelesS: fix Intel driver-select

Luciano Coelho (1):
      compat-wireless: apply changes needed after wl1271->wl12xx renaming

Luis R. Rodriguez (57):
      compat-wireless: refresh patches
      compat-wireless: refresh crap patches
      compat-wireless: remove 28-pm-qos-params.patch
      compat-wireless: disable ar9170 when selecting ath
      compat-wireless: disable brcm80211 when selecting ath
      Revert "compat-wireless: apply changes needed after
wl1271->wl12xx renaming"
      compat-wireless: refresh patches
      compat-wireless: refresh crap patches
      Revert "Revert "compat-wireless: apply changes needed after
wl1271->wl12xx renaming""
      compat-wireless: refresh patches
      compat-wireless: refresh crap patches
      compat-wireless: refresh patches
      compat-wireless: refresh patches
      compat-wireless: fix crap packetlog patch
      compat-wireless: refresh crap patches
      compat-wireless: refresh patches
      compat-wireless: refresh crap patches
      compat-wireless: refresh patches
      compat-wireless: refresh crap patches
      compat-wireless: refresh patches
      compat-wireless: fix admin-update.sh for stable cherry picks
      compat-wireless: fix stable patch pull count
      compat-wireless: refresh patches for linux-next next-20101217
      compat-wireless: refresh crap patches for next-20101217
      compat-wireless: rt2x00 no uses a kfifo on the header
      compat-wireless: refresh patches
      compat-wireless: refresh crap patches
      compat-wireless: refresh patches for v2.6.38-rc2
      compat-wireless: refresh crap patches
      compat-wireless: First release for v2.6.37-rc3
      compat-wireless: fix stable pending tag mismatch output
      compat-wireless: skip directory if patches directory is empty
      compat-wireless: refresh patches
      compat-wireless: fix disable_bt
      compat-wireless: fix intel drivers on driver-select
      compat-wireless: refresh patches for 2.6.38-rc7
      compat-wireless: refresh crap patches for 2.6.38-rc7
      compat-wireless: remove old pending-stable ignore patch
      compat-wireless: remove present stable patch ath9k memory leak on PAPRD
      compat-wireless: empty commit to bump tag based on compat.git updates
      compat-wireless: refresh patches for v2.6.38 final
      compat-wireless: fix gen-stable-release.sh for git tree updates
      compat-wireless: add ath9k linux-cherry-picks for 2.6.38
      compat-wireless: fix
0008-ath9k-disable-beaconing-before-stopping-beacon-queue.patch
      compat-wireless: backport first series of patches for ath6kl
from linux-next
      compat-wireless: add second series of cherry picks for ath6kl
from linux-next
      compat-wireless: cherry pick ath6kl-Consolidating-hardware-configuration
      compat-wireless: backport two more ath6kl cherry picked patches
from linux-next
      compat-wireless: backport two more ath6kl cherry picked patches
      compat-wireless: backport last set of cherry picked patches for
ath6kl from linux-next
      compat-wireless: refresh linux-next-cherry-picks/ for 2.6.38
      compat-wireless: cherry pick
ath9k-Fix-a-PLL-hang-issue-observed-with-AR9485.patch
      compat-wireless: cherry pick for ath9k:
ath9k_hw-Add-a-function-to-read-sqsum_dvc.patch
      compat-wireless: add missing hunk for
0009-ath9k-improve-reliability-of-beacon-transmission-and.patch
      compat-wireless: fix hunk for
linux-next-cherry-picks/0009-ath9k-improve-reliability-of-beacon-transmission-and.patch
      compat-wireless: fix Makefile
      compat-wireless: add all pending-stable patches for 2.6.38

Senthil Balasubramanian (1):
      compat-wireless: Fix ath9k debug log issue.

Sven-Haegar Koch (1):
      compat-wireless: fix activesync devices

Timo Lindhorst (1):
      Add the header file for the new bluetooth management interface
to the     list of bluetooth include files.

Walter Goldens (2):
      compat-wireless: complete rtlwifi/RTL8192CE support
      compat-wireless: unify some driver-select colors

^ permalink raw reply

* Re: SO_BINDTODEVICE inconsistency between IPv4 and IPv6
From: Brian Haley @ 2011-03-18  1:26 UTC (permalink / raw)
  To: David Woodhouse; +Cc: netdev, Yuniverg, Michael, Yedvab, Nadav
In-Reply-To: <1300357750.2589.46.camel@macbook.infradead.org>

On 03/17/2011 06:29 AM, David Woodhouse wrote:
> We've discovered strange behaviour when we listen on in6addr_any and use
> SO_BINDTODEVICE to bind to the lo device.
> 
> We can connect to any IPv4 address that is local to the machine, on any
> interface. (This is true whether we listen on AF_INET6/in6addr_any and
> accept IPv4 connections on the IPv6 socket, or whether we just listen on
> AF_INET/INADDR_ANY).
> 
> The IPv6 behaviour is different — the only IPv6 address that we can
> connect to is ::1.
> 
> See attached test case, which listens with SO_BINDTODEVICE as described.
> Note that it needs to be run as root because SO_BINDTODEVICE is a
> privileged operation.
> 
> Why this difference? Ideally, we want the Legacy IP behaviour to happen
> for IPv6 too; we want local clients to be able to connect to *any* local
> IP address to talk to our service, but we don't want to accept
> connections from the outside.
> 
<snip>

> telnet> close
> Connection closed.
> [root@macbook dwmw2]# telnet 2001:8b0:10b:1:216:eaff:fe05:bbb8 9999
> Trying 2001:8b0:10b:1:216:eaff:fe05:bbb8...
> telnet: connect to address 2001:8b0:10b:1:216:eaff:fe05:bbb8: Connection refused
> telnet: Unable to connect to remote host: Connection refused

Hmm, "connection refused", do you have any iptables rules installed?  Connecting
to a local global address worked fine for me on 2.6.32-30 using a home-grown
test app.

BTW, the one difference you will see with this is that trying to connect to
a link-local won't work without specifying a scope (like an interface), so
that is different than IPv4.

-Brian

^ permalink raw reply

* IPv6 SO_BINDTODEVICE and Multiple default routes
From: Eduardo Panisset @ 2011-03-18  1:54 UTC (permalink / raw)
  To: netdev

Hi,

I have two interfaces (wlan0) and (eth0) up and running on my laptop.
Also I have two v6 default routes and neighbor cache set up, as below:

ip route
default via fe80::21a:70ff:fee6:b155 dev eth0  proto ra  metric 996
mtu 1280 advmss 1220 hoplimit 0
default via fe80::21a:70ff:fee6:b155 dev wlan0  proto ra  metric 999
mtu 1280 advmss 1220 hoplimit 0

ip -6 neigh
fe80::21a:70ff:fee6:b155 dev wlan0 lladdr 00:1a:70:e6:b1:55 router STALE
2001:470:c1fa:1083:: dev wlan0 lladdr 00:1a:70:e6:b1:55 STALE
2001:470:c1fa:1083:: dev eth0 lladdr 00:1a:70:e6:b1:55 STALE
fe80::21a:70ff:fee6:b155 dev eth0 lladdr 00:1a:70:e6:b1:55 router REACHABLE

Im opening 2 UDPv6 sockets, and using SO_BINDTODEVICE so as to bind
each one respectively to "wlan0" and "eth0".

However the communication takes place just over eth0 socket. Over
wlan0 the application gets the message "Network Unreachable". However
if I configure the two default routes with the same metric then the
binding to "wlan0" comes to work nicely.

Debugging the ip6_pol_route function inside the kernel I could figure
out that the default route to "wlan0" is not being considered at all
when the metrics for the two v6 default routes are different from each
other, it's considered if the metrics for the two default routes are
the same, though.

Is this behaviour expected ?

Regards,
Eduardo Panisset.

^ permalink raw reply

* Re: [PATCH 2/2] virtio_net: remove send completion interrupts and avoid TX queue overrun through packet drop
From: Shirley Ma @ 2011-03-18  3:28 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Rusty Russell, David Miller, kvm, netdev, Herbert Xu
In-Reply-To: <1300375115.3255.45.camel@localhost.localdomain>

On Thu, 2011-03-17 at 08:18 -0700, Shirley Ma wrote:
> On Thu, 2011-03-17 at 07:02 +0200, Michael S. Tsirkin wrote:
> > So, this just tries to make sure there's enough space for
> > max packet in the ring, if not - drop and return OK.
> > Why bother checking beforehand though?
> > If that's what we want to do, we can just call add_buf and see
> > if it fails?
> 
> In add_buf, there is an additional kick, see below. I added check
> capacity to avoid this, thought it would be better performance. I will
> retest it w/i add_buf to see the performance difference.
> 
>         if (vq->num_free < out + in) {
>                 pr_debug("Can't add buf len %i - avail = %i\n",
>                          out + in, vq->num_free);
>                 /* FIXME: for historical reasons, we force a notify
> here
> if
>                  * there are outgoing parts to the buffer.  Presumably
> the
>                  * host should service the ring ASAP. */
>                 if (out)
>                         vq->notify(&vq->vq);
>                 END_USE(vq);
>                 return -ENOSPC;
>         }
> 

More test results:

UDP_STREAM test results (% is guest vcpu, guest has 2 vpus):

Send(netperf)
----

size	2.6.38-rc8	2.6.38-rc8+	2.6.38-rc8
			addbuf failure	check capacity
-----------------------------------------------------
1K	1541.0/50.14%	2169.1/50.03%	3018.9/50%
2K	1649.7/33.74%	3362.6/50.18%	4518.8/50.47%	
4K	2957.8/44.83%	5965.9/50.03%	9592.5/50%
8K	3788/39.01%	9852.8/50.25%	15483.8/50%
16K	4736.1/34.13%	14946.5/50.01%	21645.0/50%

Recv(netserver w/i recv errors)
----
1K	1541/8.36%	1554.4/9.67%	1675.1/11.26%
2K	1649.7/33.4%	1945.5/5.59%	2160.6/5.99%
4K	2556.3/5.07%	3044.8/7.12%	3118.9/7.86%
8K	3775/39.01%	4361/9/9.14%	4017.1/7.89%
16K	4466.4/8.56%	4435.2/10.95%	4446.8/9.92%

TCP_STREAM test results (% is guest vcpu, guest has two vcpus):

size	2.6.38-rc8	2.6.38-rc8+	2.6.38-rc8
			addbuf failure	check capacity
------------------------------------------------------
1K	2381.10/42.49%	5686.01/50.08%	5599.15/50.42%
2K	3205.08/49.18%	8675.93/48.59%	9241.86/48.42%	
4K	5231.24/34.12%	9309.67/42.07%	9321.87/40.94%
8K	7952.74/35.85%	9001.95/38.26%	9265.45/37.63%
16K	8260.68/35.07%	7911.52/34.35%	8310.29/34.28%
64K	9103.75/28.98%	9219.12/31.52%	9094.38/29.44%

qemu-kvm host cpu utilization also saved for both addbuf failure and
check capacity patches, vhost cpu utilization are similar in all case.

Looks like the additional guest notify in add_buf doesn't cost that much
than I thought to be.

Thanks
Shirley


^ permalink raw reply

* [PATCH 01/36] net,rcu: convert call_rcu(free_dm_hw_stat) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:39 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D071.5020703@cn.fujitsu.com>



The rcu callback free_dm_hw_stat() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(free_dm_hw_stat).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/core/drop_monitor.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 36e603c..32365e7 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -207,14 +207,6 @@ static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi)
 	rcu_read_unlock();
 }
 
-
-static void free_dm_hw_stat(struct rcu_head *head)
-{
-	struct dm_hw_stat_delta *n;
-	n = container_of(head, struct dm_hw_stat_delta, rcu);
-	kfree(n);
-}
-
 static int set_all_monitor_traces(int state)
 {
 	int rc = 0;
@@ -245,7 +237,7 @@ static int set_all_monitor_traces(int state)
 		list_for_each_entry_safe(new_stat, temp, &hw_stats_list, list) {
 			if (new_stat->dev == NULL) {
 				list_del_rcu(&new_stat->list);
-				call_rcu(&new_stat->rcu, free_dm_hw_stat);
+				kfree_rcu(new_stat, rcu);
 			}
 		}
 		break;
@@ -314,7 +306,7 @@ static int dropmon_net_event(struct notifier_block *ev_block,
 				new_stat->dev = NULL;
 				if (trace_state == TRACE_OFF) {
 					list_del_rcu(&new_stat->list);
-					call_rcu(&new_stat->rcu, free_dm_hw_stat);
+					kfree_rcu(new_stat, rcu);
 					break;
 				}
 			}
-- 
1.7.4

^ permalink raw reply related

* [PATCH 02/36] scsi,rcu: convert call_rcu(fc_rport_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:41 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar
  Cc: Lai Jiangshan, Jens Axboe, Robert Love, James E.J. Bottomley,
	Neil Horman, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, Eric Dumazet, Stephen Hemminger, Tejun Heo,
	Jarek Poplawski, linux-kernel, devel, linux-scsi, netdev
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback fc_rport_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(fc_rport_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 drivers/scsi/libfc/fc_rport.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index a7175ad..29abab0 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -151,18 +151,6 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
 }
 
 /**
- * fc_rport_free_rcu() - Free a remote port
- * @rcu: The rcu_head structure inside the remote port
- */
-static void fc_rport_free_rcu(struct rcu_head *rcu)
-{
-	struct fc_rport_priv *rdata;
-
-	rdata = container_of(rcu, struct fc_rport_priv, rcu);
-	kfree(rdata);
-}
-
-/**
  * fc_rport_destroy() - Free a remote port after last reference is released
  * @kref: The remote port's kref
  */
@@ -171,7 +159,7 @@ static void fc_rport_destroy(struct kref *kref)
 	struct fc_rport_priv *rdata;
 
 	rdata = container_of(kref, struct fc_rport_priv, kref);
-	call_rcu(&rdata->rcu, fc_rport_free_rcu);
+	kfree_rcu(rdata, rcu);
 }
 
 /**
-- 
1.7.4

^ permalink raw reply related

* [PATCH 03/36] net,rcu: convert call_rcu(fc_rport_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:42 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback fc_rport_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(fc_rport_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv4/fib_semantics.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 12d3dc3..730c03e 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -145,16 +145,8 @@ static const struct
 	},
 };
 
-
 /* Release a nexthop info record */
 
-static void free_fib_info_rcu(struct rcu_head *head)
-{
-	struct fib_info *fi = container_of(head, struct fib_info, rcu);
-
-	kfree(fi);
-}
-
 void free_fib_info(struct fib_info *fi)
 {
 	if (fi->fib_dead == 0) {
@@ -168,7 +160,7 @@ void free_fib_info(struct fib_info *fi)
 	} endfor_nexthops(fi);
 	fib_info_cnt--;
 	release_net(fi->fib_net);
-	call_rcu(&fi->rcu, free_fib_info_rcu);
+	kfree_rcu(fi, rcu);
 }
 
 void fib_release_info(struct fib_info *fi)
-- 
1.7.4

^ permalink raw reply related

* [PATCH 04/36] net,rcu: convert call_rcu(__leaf_info_free_rcu) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:42 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback __leaf_info_free_rcu() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(__leaf_info_free_rcu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv4/fib_trie.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 0f28034..6a60915 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -350,14 +350,9 @@ static inline void free_leaf(struct leaf *l)
 	call_rcu_bh(&l->rcu, __leaf_free_rcu);
 }
 
-static void __leaf_info_free_rcu(struct rcu_head *head)
-{
-	kfree(container_of(head, struct leaf_info, rcu));
-}
-
 static inline void free_leaf_info(struct leaf_info *leaf)
 {
-	call_rcu(&leaf->rcu, __leaf_info_free_rcu);
+	kfree_rcu(leaf, rcu);
 }
 
 static struct tnode *tnode_alloc(size_t size)
-- 
1.7.4

^ permalink raw reply related

* [PATCH 05/36] block,rcu: convert call_rcu(disk_free_ptbl_rcu_cb) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:42 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback disk_free_ptbl_rcu_cb() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(disk_free_ptbl_rcu_cb).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 block/genhd.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index cbf1112..2800cc8 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1018,14 +1018,6 @@ static const struct attribute_group *disk_attr_groups[] = {
 	NULL
 };
 
-static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
-{
-	struct disk_part_tbl *ptbl =
-		container_of(head, struct disk_part_tbl, rcu_head);
-
-	kfree(ptbl);
-}
-
 /**
  * disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way
  * @disk: disk to replace part_tbl for
@@ -1046,7 +1038,7 @@ static void disk_replace_part_tbl(struct gendisk *disk,
 
 	if (old_ptbl) {
 		rcu_assign_pointer(old_ptbl->last_lookup, NULL);
-		call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb);
+		kfree_rcu(old_ptbl, rcu_head);
 	}
 }
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 06/36] net,rcu: convert call_rcu(__gen_kill_estimator) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:43 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback __gen_kill_estimator() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(__gen_kill_estimator).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/core/gen_estimator.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 7c23733..43b03dd 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -249,13 +249,6 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
 }
 EXPORT_SYMBOL(gen_new_estimator);
 
-static void __gen_kill_estimator(struct rcu_head *head)
-{
-	struct gen_estimator *e = container_of(head,
-					struct gen_estimator, e_rcu);
-	kfree(e);
-}
-
 /**
  * gen_kill_estimator - remove a rate estimator
  * @bstats: basic statistics
@@ -279,7 +272,7 @@ void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
 		write_unlock(&est_lock);
 
 		list_del_rcu(&e->list);
-		call_rcu(&e->e_rcu, __gen_kill_estimator);
+		kfree_rcu(e, e_rcu);
 	}
 	spin_unlock_bh(&est_tree_lock);
 }
-- 
1.7.4

^ permalink raw reply related

* [PATCH 07/36] net,rcu: convert call_rcu(ip_mc_list_reclaim) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:44 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback ip_mc_list_reclaim() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(ip_mc_list_reclaim).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv4/igmp.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index e0e77e2..cf187b6 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -149,17 +149,11 @@ static void ip_mc_clear_src(struct ip_mc_list *pmc);
 static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
 			 int sfcount, __be32 *psfsrc, int delta);
 
-
-static void ip_mc_list_reclaim(struct rcu_head *head)
-{
-	kfree(container_of(head, struct ip_mc_list, rcu));
-}
-
 static void ip_ma_put(struct ip_mc_list *im)
 {
 	if (atomic_dec_and_test(&im->refcnt)) {
 		in_dev_put(im->interface);
-		call_rcu(&im->rcu, ip_mc_list_reclaim);
+		kfree_rcu(im, rcu);
 	}
 }
 
-- 
1.7.4

^ permalink raw reply related

* [PATCH 08/36] net,rcu: convert call_rcu(ip_sf_socklist_reclaim) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:44 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback ip_sf_socklist_reclaim() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(ip_sf_socklist_reclaim).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv4/igmp.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index cf187b6..cf98a36 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1830,12 +1830,6 @@ done:
 }
 EXPORT_SYMBOL(ip_mc_join_group);
 
-static void ip_sf_socklist_reclaim(struct rcu_head *rp)
-{
-	kfree(container_of(rp, struct ip_sf_socklist, rcu));
-	/* sk_omem_alloc should have been decreased by the caller*/
-}
-
 static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
 			   struct in_device *in_dev)
 {
@@ -1852,7 +1846,7 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
 	rcu_assign_pointer(iml->sflist, NULL);
 	/* decrease mem now to avoid the memleak warning */
 	atomic_sub(IP_SFLSIZE(psf->sl_max), &sk->sk_omem_alloc);
-	call_rcu(&psf->rcu, ip_sf_socklist_reclaim);
+	kfree_rcu(psf, rcu);
 	return err;
 }
 
@@ -2020,7 +2014,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
 				newpsl->sl_addr[i] = psl->sl_addr[i];
 			/* decrease mem now to avoid the memleak warning */
 			atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
-			call_rcu(&psl->rcu, ip_sf_socklist_reclaim);
+			kfree_rcu(psl, rcu);
 		}
 		rcu_assign_pointer(pmc->sflist, newpsl);
 		psl = newpsl;
@@ -2121,7 +2115,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
 			psl->sl_count, psl->sl_addr, 0);
 		/* decrease mem now to avoid the memleak warning */
 		atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
-		call_rcu(&psl->rcu, ip_sf_socklist_reclaim);
+		kfree_rcu(psl, rcu);
 	} else
 		(void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
 			0, NULL, 0);
-- 
1.7.4

^ permalink raw reply related

* [PATCH 09/36] net,rcu: convert call_rcu(ip_mc_socklist_reclaim) to kfree_rcu()
From: Lai Jiangshan @ 2011-03-18  3:45 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Jens Axboe, Robert Love,
	"James E.J. Bottomley" <James.Bottom
In-Reply-To: <4D82D3FF.2080303@cn.fujitsu.com>



The rcu callback ip_mc_socklist_reclaim() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(ip_mc_socklist_reclaim).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 net/ipv4/igmp.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index cf98a36..998dff0 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1850,14 +1850,6 @@ static int ip_mc_leave_src(struct sock *sk, struct ip_mc_socklist *iml,
 	return err;
 }
 
-
-static void ip_mc_socklist_reclaim(struct rcu_head *rp)
-{
-	kfree(container_of(rp, struct ip_mc_socklist, rcu));
-	/* sk_omem_alloc should have been decreased by the caller*/
-}
-
-
 /*
  *	Ask a socket to leave a group.
  */
@@ -1897,7 +1889,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
 		rtnl_unlock();
 		/* decrease mem now to avoid the memleak warning */
 		atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
-		call_rcu(&iml->rcu, ip_mc_socklist_reclaim);
+		kfree_rcu(iml, rcu);
 		return 0;
 	}
 	if (!in_dev)
@@ -2312,7 +2304,7 @@ void ip_mc_drop_socket(struct sock *sk)
 			ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr);
 		/* decrease mem now to avoid the memleak warning */
 		atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
-		call_rcu(&iml->rcu, ip_mc_socklist_reclaim);
+		kfree_rcu(iml, rcu);
 	}
 	rtnl_unlock();
 }
-- 
1.7.4

^ permalink raw reply related


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