safe/jmp/linux-2.6
14 years agotunnels: fix netns vs proto registration ordering
Alexey Dobriyan [Tue, 16 Feb 2010 09:05:04 +0000 (09:05 +0000)]
tunnels: fix netns vs proto registration ordering

Same stuff as in ip_gre patch: receive hook can be called before netns
setup is done, oopsing in net_generic().

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agogre: fix netns vs proto registration ordering
Alexey Dobriyan [Tue, 16 Feb 2010 07:57:44 +0000 (07:57 +0000)]
gre: fix netns vs proto registration ordering

GRE protocol receive hook can be called right after protocol addition is done.
If netns stuff is not yet initialized, we're going to oops in
net_generic().

This is remotely oopsable if ip_gre is compiled as module and packet
comes at unfortunate moment of module loading.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
David S. Miller [Tue, 16 Feb 2010 19:15:13 +0000 (11:15 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/kaber/nf-next-2.6

14 years agoethtool: reduce stack usage
Eric Dumazet [Tue, 16 Feb 2010 05:51:33 +0000 (21:51 -0800)]
ethtool: reduce stack usage

dev_ethtool() is currently using 604 bytes of stack, even with gcc-4.4.2

objdump -d vmlinux | scripts/checkstack.pl
...
0xc04bbc33 dev_ethtool [vmlinux]: 604
...
Adding noinline attributes to selected functions can reduce stack usage.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: emaclite: adding MDIO and phy lib support
John Linn [Tue, 16 Feb 2010 05:51:00 +0000 (21:51 -0800)]
net: emaclite: adding MDIO and phy lib support

These changes add MDIO and phy lib support to the driver as the
IP core now supports the MDIO bus.

The MDIO bus and phy are added as a child to the emaclite in the device
tree as illustrated below.

mdio {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@7 {
compatible = "marvell,88e1111";
reg = <7>;
} ;
}

Signed-off-by: Sadanand Mutyala <Sadanand.Mutyala@xilinx.com>
Signed-off-by: John Linn <john.linn@xilinx.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoX25: Dont let x25_bind use addresses containing characters
andrew hendry [Sun, 14 Feb 2010 02:00:45 +0000 (02:00 +0000)]
X25: Dont let x25_bind use addresses containing characters

Addresses should be all digits.
Stops x25_bind using addresses containing characters.

Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoX25: Fix x25_create errors for bad protocol and ENOBUFS
andrew hendry [Sun, 14 Feb 2010 02:00:11 +0000 (02:00 +0000)]
X25: Fix x25_create errors for bad protocol and ENOBUFS

alloc_socket failures should return -ENOBUFS
a bad protocol should return -EINVAL

Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: implement EEH pci error recovery handlers
Sathya Perla [Sun, 14 Feb 2010 21:22:01 +0000 (21:22 +0000)]
be2net: implement EEH pci error recovery handlers

The code has been tested on IBM pSeries server.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoxfrm: Flushing empty SPD generates false events
jamal [Thu, 11 Feb 2010 00:53:13 +0000 (00:53 +0000)]
xfrm: Flushing empty SPD generates false events

Observed similar behavior on SPD as previouly seen on SAD flushing..
This fixes it.

cheers,
jamal
commit 428b20432dc31bc2e01a94cd451cf5a2c00d2bf4
Author: Jamal Hadi Salim <hadi@cyberus.ca>
Date:   Thu Feb 11 05:49:38 2010 -0500

    xfrm: Flushing empty SPD generates false events

    To see the effect make sure you have an empty SPD.
    On window1 "ip xfrm mon" and on window2 issue "ip xfrm policy flush"
    You get prompt back in window1 and you see the flush event on window2.
    With this fix, you still get prompt on window1 but no event on window2.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoxfrm: Flushing empty SAD generates false events
jamal [Wed, 10 Feb 2010 23:51:27 +0000 (23:51 +0000)]
xfrm: Flushing empty SAD generates false events

To see the effect make sure you have an empty SAD.
-On window1 "ip xfrm mon"
-on window2 issue "ip xfrm state flush"
You get prompt back in window1
and you see the flush event on window2.
With this fix, you still get prompt on window1 but no
event on window2.

I was tempted to return -ESRCH on window1 (which would
show "RTNETLINK answers: No such process") but didnt want
to change current behavior.

cheers,
jamal
commit 5f3dd4a772326166e1bcf54acc2391df00dc7ab5
Author: Jamal Hadi Salim <hadi@cyberus.ca>
Date:   Thu Feb 11 04:41:36 2010 -0500

    xfrm: Flushing empty SAD generates false events

    To see the effect make sure you have an empty SAD.
    On window1 "ip xfrm mon" and on window2 issue "ip xfrm state flush"
    You get prompt back in window1 and you see the flush event on window2.
    With this fix, you still get prompt on window1 but no event on window2.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoIPv6: Delete redundant counter of IPSTATS_MIB_REASMFAILS
Shan Wei [Thu, 11 Feb 2010 00:12:45 +0000 (00:12 +0000)]
IPv6: Delete redundant counter of IPSTATS_MIB_REASMFAILS

When no more memory can be allocated, fq_find() will return NULL and
increase the value of IPSTATS_MIB_REASMFAILS. In this case,
ipv6_frag_rcv() also increase the value of IPSTATS_MIB_REASMFAILS.

So, the patch deletes redundant counter of IPSTATS_MIB_REASMFAILS in fq_find().
and deletes the unused parameter of idev.

Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/macvtap: fix reference counting
Arnd Bergmann [Thu, 11 Feb 2010 05:55:39 +0000 (05:55 +0000)]
net/macvtap: fix reference counting

The RCU usage in the original code was broken because
there are cases where we possibly sleep with rcu_read_lock
held. As a fix, change the macvtap_file_get_queue to
get a reference on the socket and the netdev instead of
taking the full rcu_read_lock.

Also, change macvtap_file_get_queue failure case to
not require a subsequent macvtap_file_put_queue, as
pointed out by Ed Swierk.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Ed Swierk <eswierk@aristanetworks.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Acked-by: Sridhar Samudrala <sri@us.ibm.com>
Acked-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocxgb3: fix link flap
Divy Le Ray [Sat, 13 Feb 2010 09:44:35 +0000 (09:44 +0000)]
cxgb3: fix link flap

The driver is expected to report that the link is up
when the phy Rx signal is established and the mac
has not detected a link fault.
The code is however broken, the driver does not check the link fault
status when the phy link status changes.
The link fault status being checked within a short period of time,
it leads to link up/link down events.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocxgb3: FIx VLAN over Jumbo frames
Divy Le Ray [Sat, 13 Feb 2010 09:44:30 +0000 (09:44 +0000)]
cxgb3: FIx VLAN over Jumbo frames

The mac is expected to auto-inflate the Maximum Frame size for VLAN
tagged frames. It however does not work with jumbo frames.
Work around the bug adding 4 to the Maximum Frame for MTUs
greater than 1536.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoixgbe: Cleanup incorrect header comments
Peter Waskiewicz [Fri, 12 Feb 2010 13:48:44 +0000 (13:48 +0000)]
ixgbe: Cleanup incorrect header comments

The recent n-tuple patches added some comments to the headers
of the Flow Director functions that aren't accurate.  This
cleans them up, and is a purely cosmetic patch.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoethtool: Move n-tuple capability check into set_flags
Peter Waskiewicz [Fri, 12 Feb 2010 13:48:25 +0000 (13:48 +0000)]
ethtool: Move n-tuple capability check into set_flags

set_flags should check if the underlying device supports
n-tuple filter programming before setting the device flags
on the netdevice.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoethtool: Fix filter addition when caching n-tuple filters
Peter Waskiewicz [Fri, 12 Feb 2010 13:48:05 +0000 (13:48 +0000)]
ethtool: Fix filter addition when caching n-tuple filters

We can allow a filter to be added successfully to the underlying
hardware, but still return an error if the cached list memory
allocation fails.  This patch fixes that condition.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetfilter: CONFIG_COMPAT: allow delta to exceed 32767
Florian Westphal [Mon, 15 Feb 2010 17:17:10 +0000 (18:17 +0100)]
netfilter: CONFIG_COMPAT: allow delta to exceed 32767

with 32 bit userland and 64 bit kernels, it is unlikely but possible
that insertion of new rules fails even tough there are only about 2000
iptables rules.

This happens because the compat delta is using a short int.
Easily reproducible via "iptables -m limit" ; after about 2050
rules inserting new ones fails with -ELOOP.

Note that compat_delta included 2 bytes of padding on x86_64, so
structure size remains the same.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: ebtables: avoid explicit XT_ALIGN() in match/targets
Florian Westphal [Mon, 15 Feb 2010 17:16:26 +0000 (18:16 +0100)]
netfilter: ebtables: avoid explicit XT_ALIGN() in match/targets

This will cause trouble once CONFIG_COMPAT support is added to ebtables.
xt_compat_*_offset() calculate the kernel/userland structure size delta
using:

XT_ALIGN(size) - COMPAT_XT_ALIGN(size)

If the match/target sizes are aligned at registration time,
delta is always zero.

Should have zero effect for existing systems: xtables uses
XT_ALIGN() whenever it deals with match/target sizes.

Signed-off-by: Florian Westphal <fwestphal@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: ebtables: abort if next_offset is too small
Florian Westphal [Mon, 15 Feb 2010 17:15:55 +0000 (18:15 +0100)]
netfilter: ebtables: abort if next_offset is too small

next_offset must be > 0, otherwise this loops forever.
The offset also contains the size of the ebt_entry structure
itself, so anything smaller is invalid.

Signed-off-by: Florian Westphal <fwestphal@astaro.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: ctnetlink: add zone support
Patrick McHardy [Mon, 15 Feb 2010 17:14:57 +0000 (18:14 +0100)]
netfilter: ctnetlink: add zone support

Parse and dump the conntrack zone in ctnetlink.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: nf_conntrack: add support for "conntrack zones"
Patrick McHardy [Mon, 15 Feb 2010 17:13:33 +0000 (18:13 +0100)]
netfilter: nf_conntrack: add support for "conntrack zones"

Normally, each connection needs a unique identity. Conntrack zones allow
to specify a numerical zone using the CT target, connections in different
zones can use the same identity.

Example:

iptables -t raw -A PREROUTING -i veth0 -j CT --zone 1
iptables -t raw -A OUTPUT -o veth1 -j CT --zone 1

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: nf_conntrack: pass template to l4proto ->error() handler
Patrick McHardy [Mon, 15 Feb 2010 16:45:08 +0000 (17:45 +0100)]
netfilter: nf_conntrack: pass template to l4proto ->error() handler

The error handlers might need the template to get the conntrack zone
introduced in the next patches to perform a conntrack lookup.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: xtables: add const qualifiers
Jan Engelhardt [Fri, 26 Jun 2009 05:51:59 +0000 (07:51 +0200)]
netfilter: xtables: add const qualifiers

This should make it easier to remove redundant arguments later.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xtables: constify args in compat copying functions
Jan Engelhardt [Fri, 26 Jun 2009 06:23:19 +0000 (08:23 +0200)]
netfilter: xtables: constify args in compat copying functions

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xtables: print details on size mismatch
Jan Engelhardt [Thu, 25 Jun 2009 16:32:12 +0000 (18:32 +0200)]
netfilter: xtables: print details on size mismatch

Print which revision has been used and which size are which
(kernel/user) for easier debugging.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: get rid of the grossness in netfilter.h
Jan Engelhardt [Sat, 13 Jun 2009 02:13:26 +0000 (04:13 +0200)]
netfilter: get rid of the grossness in netfilter.h

GCC is now smart enough to follow the inline trail correctly.
vmlinux size remain the same.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: reduce NF_HOOK by one argument
Jan Engelhardt [Fri, 5 Jun 2009 15:31:46 +0000 (17:31 +0200)]
netfilter: reduce NF_HOOK by one argument

No changes in vmlinux filesize.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: iptables: remove unused function arguments
Jan Engelhardt [Sat, 31 Oct 2009 23:36:40 +0000 (00:36 +0100)]
netfilter: iptables: remove unused function arguments

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xt_recent: inform user when hitcount is too large
Jan Engelhardt [Mon, 15 Feb 2010 15:31:35 +0000 (16:31 +0100)]
netfilter: xt_recent: inform user when hitcount is too large

It is one of these things that iptables cannot catch and which can
cause "Invalid argument" to be printed. Without a hint in dmesg, it is
not going to be helpful.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoniu: Refinements to kernel logging.
David S. Miller [Mon, 15 Feb 2010 08:07:00 +0000 (00:07 -0800)]
niu: Refinements to kernel logging.

Fix unconditional empty kerne log message every interrupt.

Kill some informational log messages that are superfluous
and anyways occur before the netdev is registered.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomac80211: Fix error introduced in netdev_mc_count() changes.
David S. Miller [Mon, 15 Feb 2010 06:49:52 +0000 (22:49 -0800)]
mac80211: Fix error introduced in netdev_mc_count() changes.

Commit 4cd24eaf0c6ee7f0242e34ee77ec899f255e66b5
("net: use netdev_mc_count and netdev_mc_empty when appropriate")
added this hunk to net/mac80211/iface.c:

  __dev_addr_unsync(&local->mc_list, &local->mc_count,
-   &dev->mc_list, &dev->mc_count);
+   &dev->mc_list, dev->mc_count);

which is definitely not correct, introduced a warning (reported
by Stephen Rothwell):

net/mac80211/iface.c: In function 'ieee80211_stop':
net/mac80211/iface.c:416: warning: passing argument 4 of '__dev_addr_unsync' makes pointer from integer without a cast
include/linux/netdevice.h:1967: note: expected 'int *' but argument is of type 'int'

and is thus reverted here.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agovhost-net: switch to smp barriers
Michael S. Tsirkin [Mon, 1 Feb 2010 07:21:02 +0000 (07:21 +0000)]
vhost-net: switch to smp barriers

vhost-net only uses memory barriers to control SMP effects
(communication with userspace potentially running on a different CPU),
so it should use SMP barriers and not mandatory barriers for memory
access ordering, as suggested by Documentation/memory-barriers.txt

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoniu: Use pr_<level>, netdev_<level> and netif_<level> macros
Joe Perches [Mon, 15 Feb 2010 06:40:39 +0000 (22:40 -0800)]
niu: Use pr_<level>, netdev_<level> and netif_<level> macros

Remove #define PFX
Add pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert printks to pr_<level>
Convert printks without levels to pr_cont
Convert pr_<level> with np->dev to netdev_<level>
Convert dev_<level> to netdev_<level>
Convert niudbg to netif_printk
Convert niuinfo, niuwarn macros to netif_<level>(priv, type, dev...
Coalesce long formats
Convert embedded function names to "%s", __func__
Always use "%s()..." when __func__ is printed

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoethtool: Fix includes build break
David S. Miller [Mon, 15 Feb 2010 06:38:54 +0000 (22:38 -0800)]
ethtool: Fix includes build break

Based upon a patch by Oliver Hartkopp <oliver@hartkopp.net>.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Fix first line of kernel-doc for a few functions
Ben Hutchings [Mon, 15 Feb 2010 06:35:47 +0000 (22:35 -0800)]
net: Fix first line of kernel-doc for a few functions

The function name must be followed by a space, hypen, space, and a
short description.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Mon, 15 Feb 2010 06:30:54 +0000 (22:30 -0800)]
Merge branch 'master' of /linux/kernel/git/davem/net-2.6

Conflicts:
net/mac80211/rate.c

14 years agoMerge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/linville...
David S. Miller [Mon, 15 Feb 2010 01:45:59 +0000 (17:45 -0800)]
Merge branch 'master' of ssh:///linux/kernel/git/linville/wireless-next-2.6

14 years agoMerge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/linville...
David S. Miller [Sun, 14 Feb 2010 19:56:38 +0000 (11:56 -0800)]
Merge branch 'master' of ssh:///linux/kernel/git/linville/wireless-2.6

14 years agotg3: Update driver version to 3.107
Matt Carlson [Fri, 12 Feb 2010 14:47:13 +0000 (14:47 +0000)]
tg3: Update driver version to 3.107

This patch updates the tg3 version to 3.107.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Fix AC131 loopback test errors for 5785
Matt Carlson [Fri, 12 Feb 2010 14:47:12 +0000 (14:47 +0000)]
tg3: Fix AC131 loopback test errors for 5785

The AC131 does not enable the forced transmit clock settings
immediately.  The workaround is to read the register again to get the
setting to take effect.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Fix napi assignments in loopback test
Matt Carlson [Fri, 12 Feb 2010 14:47:11 +0000 (14:47 +0000)]
tg3: Fix napi assignments in loopback test

The 57765 lacks TSS support.  This renders the napi assignments
incorrect in the loopback test function.  This patch fixes the problem.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Reset phy during bringup when using phylib
Matt Carlson [Fri, 12 Feb 2010 14:47:10 +0000 (14:47 +0000)]
tg3: Reset phy during bringup when using phylib

The driver puts the phy into low-power mode when it releases the device.
If the device were to be reacquired, the phy needs a reset to bring it
back to full powered operation.  This patch allows phylib-enabled
devices to reset the phy.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Turn off multiple DMA reads for 5717
Matt Carlson [Fri, 12 Feb 2010 14:47:09 +0000 (14:47 +0000)]
tg3: Turn off multiple DMA reads for 5717

The 5717's DMA read engine has a bug when initiating multiple DMA reads
across the PCIe bus.  This patch disables the feature.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Fix 57765 A0 bootcode race condition
Matt Carlson [Fri, 12 Feb 2010 14:47:08 +0000 (14:47 +0000)]
tg3: Fix 57765 A0 bootcode race condition

On A0 revision of 57765 asic rev devices, the bootcode will perform some
hardware operations, after the magic signature is presented, that will
collide with setup operations performed by the driver.  The best way to
avoid the contention is to have the driver delay an additional 10
milliseconds.  B0 revisions of the chip will make this workaround
unnecessary.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Unwedge stuck MSI-X vectors
Matt Carlson [Fri, 12 Feb 2010 14:47:07 +0000 (14:47 +0000)]
tg3: Unwedge stuck MSI-X vectors

The previous patch changed the code so that new rx buffer submissions to
the hardware stall if a new submission would overwrite data needed by an
unserviced rx packet.  On very busy 5717 and 57765 asic rev devices,
there is a corner case where the hardware will fail to assert an MSI-X
interrupt for rx traffic.  If that vector's interrupt never has another
reason to assert, any rx buffers held will never be serviced.  If the
buffers are never serviced and the hardware consumes all the available
rx packets for other rx rings, deadlock will result.

The most reliable and least intrusive way to work around the problem is
to detect the case where new submissions would overwrite existing data
and force all rx interrupt vectors to fire.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Prevent rx producer ring overruns
Matt Carlson [Fri, 12 Feb 2010 14:47:06 +0000 (14:47 +0000)]
tg3: Prevent rx producer ring overruns

When operating in RSS mode, it is possible for one rx return ring to
submit enough rx buffers back to the hardware such that it inadvertently
overwrites data needed by another rx return ring.  This patch addresses
the problem by looking for non-NULL skb pointers in the
rx_[std|jmb]_buffers rings that parallel the rx producer rings.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotg3: Give MSI-X vec 1 rx backlog space
Matt Carlson [Fri, 12 Feb 2010 14:47:05 +0000 (14:47 +0000)]
tg3: Give MSI-X vec 1 rx backlog space

RSS ring 1 is responsible for submitting new rx buffers to the
hardware on behalf of all the other RSS rx return rings.  Up until now
this ring submitted its new rx buffers to the producer ring directly.
The following patch will require that this ring have a place to put
backlogged rx packets.  As a consequence, it can no longer submit new
buffers to the producer ring.

This patch adds code to allocate an extra shadow producer ring for this
RSS ring and adds RSS ring 1 to the list of rings needing buffer
transfers.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoigb: support for VF configuration tools
Williams, Mitch A [Wed, 10 Feb 2010 01:44:24 +0000 (01:44 +0000)]
igb: support for VF configuration tools

Add support to the igb driver for VF configuration mechanisms through the
PF interface.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agortnetlink: Add VF config code to rtnetlink
Williams, Mitch A [Wed, 10 Feb 2010 01:44:05 +0000 (01:44 +0000)]
rtnetlink: Add VF config code to rtnetlink

Add code to allow rtnetlink clients to query and set VF information through
the PF driver.
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Add netdev ops for SR-IOV configuration
Williams, Mitch A [Wed, 10 Feb 2010 01:43:46 +0000 (01:43 +0000)]
net: Add netdev ops for SR-IOV configuration

Add netdev ops for configuring SR-IOV VF devices through the PF driver.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoif_link: Add SR-IOV configuration methods
Williams, Mitch A [Wed, 10 Feb 2010 01:43:24 +0000 (01:43 +0000)]
if_link: Add SR-IOV configuration methods

Add SR-IOV VF management methods to IFLA_LINKINFO. This allows userspace to
use rtnetlink to configure VF network devices.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agopci: Add SR-IOV convenience functions and macros
Williams, Mitch A [Wed, 10 Feb 2010 01:43:04 +0000 (01:43 +0000)]
pci: Add SR-IOV convenience functions and macros

Add and export pci_num_vf to allow other subsystems to determine how many
virtual function devices are associated with an SR-IOV physical function
device.
Add macros dev_is_pci, dev_is_ps, and dev_num_vf to make it easier for
non-PCI specific code to determine SR-IOV capabilities.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoudp: remove redundant variable
Gerrit Renker [Wed, 10 Feb 2010 20:26:19 +0000 (20:26 +0000)]
udp: remove redundant variable

The variable 'copied' is used in udp_recvmsg() to emphasize that the passed
'len' is adjusted to fit the actual datagram length. But the same can be
done by adjusting 'len' directly. This patch thus removes the indirection.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodccp: support for passing MSG_TRUNC
Gerrit Renker [Wed, 10 Feb 2010 20:26:18 +0000 (20:26 +0000)]
dccp: support for passing MSG_TRUNC

DCCP is datagram-oriented but lacks UDP's support for MSG_TRUNC as defined in
recvmsg(2)/recv(2). Hence the following 'Hello world\0' receiver

  len = recv(fd, buf, 10, MSG_PEEK | MSG_TRUNC);

wrongly (always) returns 10, while in UDP it returns 12 as expected.
This patch adds the missing MSG_TRUNC support to recvmsg().

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: version 1.27
stephen hemminger [Fri, 12 Feb 2010 06:58:07 +0000 (06:58 +0000)]
sky2: version 1.27

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Avoid down and up during sky2_reset
Mike McCormack [Fri, 12 Feb 2010 06:58:06 +0000 (06:58 +0000)]
sky2: Avoid down and up during sky2_reset

Rewrite sky2_reset to work with interrupts disabled and
 avoid freeing and reallocing memory.

The old code used sky2_down and sky2_up to implement sky2_reset,
 which meant interrupts could not be disabled, and the transmit and
 receive ring buffers would be free'd and reallocated.

To avoid the interrupt handler waking the transmit queue while
 we're doing a reset, it's better to have interrupts and NAPI
 polls disabled.

Note: Modified Mike's patch to do IRQ disable in sky2_down before
 calling sky2_hw_down - Stephen

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Refactor sky2_down into two functions
Mike McCormack [Fri, 12 Feb 2010 06:58:05 +0000 (06:58 +0000)]
sky2: Refactor sky2_down into two functions

Create a sky2_hw_down that brings the hardware down.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminber <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Refactor sky2_up into two functions
Mike McCormack [Fri, 12 Feb 2010 06:58:04 +0000 (06:58 +0000)]
sky2: Refactor sky2_up into two functions

Move hardware initialization into sky2_hw_up.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Allocate initial skbs in sky2_alloc_buffers
Mike McCormack [Fri, 12 Feb 2010 06:58:03 +0000 (06:58 +0000)]
sky2: Allocate initial skbs in sky2_alloc_buffers

Allocate everything in one place so there's a single point
of failure in sky2_up, and sky2_rx_start can no longer fail.

Don't leave the hardware in a partially initialized state in the
case rx ring allocation fails.

As with the old code, the rx ring still needs to be fully
allocated for sky2_up to succeed.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Factor out code to calculate packet sizes
Mike McCormack [Fri, 12 Feb 2010 06:58:02 +0000 (06:58 +0000)]
sky2: Factor out code to calculate packet sizes

Move code to calculate receive threshold and packet size out of
sky2_rx_start() so that is can be called from elsewhere easily.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: jumbo packet changes
stephen hemminger [Fri, 12 Feb 2010 06:58:01 +0000 (06:58 +0000)]
sky2: jumbo packet changes

Change how FIFO is programmed in jumbo mode (to match vendor driver).
Mostly cosmetic, the only register change is that the bits 22,23
are not programemd used.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: dont enable PME legacy mode
stephen hemminger [Fri, 12 Feb 2010 06:58:00 +0000 (06:58 +0000)]
sky2: dont enable PME legacy mode

This bit is not changed by vendor driver, and should be left alone.
The documentation implies this a debug bit.
  0 = WAKE# only asserted when VMAIN not available
  1 = WAKE# is depend on wake events and independent of VMAIN.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: WoL changes
stephen hemminger [Fri, 12 Feb 2010 06:57:59 +0000 (06:57 +0000)]
sky2: WoL changes

Change Wake On Lan code to be similar to vendor driver. The definition
of Y2_HW_WOL_ON is confusing; what it means is transition to firmware SPI
setting when doing power change.

Since same code is done for both shutdown and suspend, use common
code path.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: fix sparse warning
stephen hemminger [Fri, 12 Feb 2010 06:57:58 +0000 (06:57 +0000)]
sky2: fix sparse warning

Warning about hidden variable

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoxfrm: use proper kernel types
jamal [Tue, 9 Feb 2010 13:21:17 +0000 (13:21 +0000)]
xfrm: use proper kernel types

kernel side should use uxx instead of __uxx types

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoxfrm: validate attributes
jamal [Tue, 9 Feb 2010 03:59:38 +0000 (03:59 +0000)]
xfrm: validate attributes

Some XFRM attributes were not going through basic validation.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/skge.c: Use netif_printk macros
Joe Perches [Tue, 9 Feb 2010 11:49:53 +0000 (11:49 +0000)]
drivers/net/skge.c: Use netif_printk macros

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/qlge: Use netif_printk helpers
Joe Perches [Tue, 9 Feb 2010 11:49:52 +0000 (11:49 +0000)]
drivers/net/qlge: Use netif_printk helpers

Convert QPRINTK macros to netif_<level> equivalents.
Expands and standardizes the logging message output.
Removes __func__ from most logging messages.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/jme: Use netif_printk helpers
Joe Perches [Tue, 9 Feb 2010 11:49:51 +0000 (11:49 +0000)]
drivers/net/jme: Use netif_printk helpers

Convert uses of msg_<type> to netif_<level>(
Remove msg_<type> macros

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/r8196.c: Use netif_printk macros
Joe Perches [Tue, 9 Feb 2010 11:49:50 +0000 (11:49 +0000)]
drivers/net/r8196.c: Use netif_printk macros

Simplify the logic a bit, make the message logs a bit more consistent.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoinclude/linux/netdevice.h: Add netif_printk helpers
Joe Perches [Tue, 9 Feb 2010 11:49:49 +0000 (11:49 +0000)]
include/linux/netdevice.h: Add netif_printk helpers

Add macros to test a private structure for msg_enable bits
and the netif_msg_##bit to test and call netdev_printk if set

Simplifies logic in callers and adds message logging consistency

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/atl1e: Use netdev_printk helpers
Joe Perches [Tue, 9 Feb 2010 11:49:48 +0000 (11:49 +0000)]
drivers/net/atl1e: Use netdev_printk helpers

Logging messages sometimes had duplicated "ATL1E" output.

For instance:
ATL1E 0000:03:00.0: ATL1E: eth0 NIC Link is Up<100 Mbps Full Duplex>
is now:
ATL1E 0000:03:00.0: eth0: NIC Link is Up <100 Mbps Full Duplex>

Add some consistency to logging messages
Add some missing \n's to logging messages
Miscellaneous typo spelling corrections
Change atl1e_validate_option argument from pdev to adapter

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetdevice.h: Add netdev_printk helpers like dev_printk
Joe Perches [Tue, 9 Feb 2010 11:49:47 +0000 (11:49 +0000)]
netdevice.h: Add netdev_printk helpers like dev_printk

These netdev_printk routines take a struct net_device * and emit
dev_printk logging messages adding "%s: " ... netdev->dev.parent
to the dev_printk format and arguments.

This can create some uniformity in the output message log.

These helpers should not be used until a successful alloc_netdev.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Fix SFE4002 initialisation
Steve Hodgson [Fri, 12 Feb 2010 20:32:27 +0000 (12:32 -0800)]
sfc: Fix SFE4002 initialisation

From: Steve Hodgson <shodgson@solarflare.com>

Commit 357d46a17e54c9a87e0e6ef3930ff4ab2d232b81 "sfc: QT202x: Remove
unreliable MMD check at initialisation" broke initialisation of the
SFE4002.  efx_mdio_reset_mmd() returns a positive value rather than 0
on success.  The above commit causes this value to be propagated up
by qt202x_reset_phy(), which is treated as a failure by its callers.
Change qt202x_reset_phy() to return 0 if successful.

The PCI layer treats >0 as "fail, but please call remove() anyway",
which means that unloading the driver would cause a crash.  Add a
WARN_ON() on the failure path of efx_pci_probe() to provide early
warning if there are any other cases where we do this.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoIPv6: remove trivial nested _bh suffix
stephen hemminger [Mon, 8 Feb 2010 19:48:52 +0000 (19:48 +0000)]
IPv6: remove trivial nested _bh suffix

Don't need to disable bottom half it is already down in the
previous lock. Move some blank lines to group locking in same
context.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoIPv6: keep permanent addresses on admin down
stephen hemminger [Mon, 8 Feb 2010 19:48:05 +0000 (19:48 +0000)]
IPv6: keep permanent addresses on admin down

Permanent IPV6 addresses should not be removed when the link is
set to admin down, only when device is removed.

When link is lost permanent addresses should be marked as tentative
so that when link comes back they are subject to duplicate address
detection (if DAD was enabled for that address).

Other routing systems keep manually configured IPv6 addresses
when link is set down.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: bug fix in be_read_eeprom
Ajit Khaparde [Mon, 8 Feb 2010 17:51:26 +0000 (17:51 +0000)]
be2net: bug fix in be_read_eeprom

The offset to read the eeprom data was missing and
wrong eeprom data was being dumped. This patch fixes this.

>From Suresh R <sureshr@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: remove ASIC generation number from Kconfig
Ajit Khaparde [Tue, 9 Feb 2010 01:39:05 +0000 (01:39 +0000)]
be2net: remove ASIC generation number from Kconfig

Since the driver is supporting multiple generations of the ASIC
don't mention any ASIC generation number.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: change the driver description
Ajit Khaparde [Tue, 9 Feb 2010 01:38:06 +0000 (01:38 +0000)]
be2net: change the driver description

Since the driver is supporting multiple generations of the ASIC
remove ASIC generation information from the driver description.
This information is displayed by modinfo.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: fix to limit max vlans supported in certain skews
Ajit Khaparde [Tue, 9 Feb 2010 01:34:57 +0000 (01:34 +0000)]
be2net: fix to limit max vlans supported in certain skews

In certain skews the ASIC can support only 16 vlans per interface.
Once the limit is crossed, the ASIC is programmed in vlan promiscuous mode.
Switch off the vlan promiscuous mode once the number of vlans
falls back to the max vlans supported.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: minor code optimizations
Ajit Khaparde [Tue, 9 Feb 2010 01:34:21 +0000 (01:34 +0000)]
be2net: minor code optimizations

Couple of code optimizations in the Rx path (to avoid a memset).

From: Sathya P <sathyap@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: bug fix in be_change_mtu
Ajit Khaparde [Tue, 9 Feb 2010 01:32:43 +0000 (01:32 +0000)]
be2net: bug fix in be_change_mtu

Current code allows the new mtu to cross the supported value.
This patch fixes the boundary checks.

From: Suresh R <sureshr@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: bug fix for flashing the BladeEngine3 ASIC
Ajit Khaparde [Tue, 9 Feb 2010 01:30:35 +0000 (01:30 +0000)]
be2net: bug fix for flashing the BladeEngine3 ASIC

Now flashing both BE2 and BE3 devices is supported.

From: Naresh G <nareshg@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: remove unused pci device id
Ajit Khaparde [Tue, 9 Feb 2010 01:28:35 +0000 (01:28 +0000)]
be2net: remove unused pci device id

We are not going to use this device id.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agovirtio_net: remove send queue
Shirley Ma [Mon, 8 Feb 2010 14:14:42 +0000 (14:14 +0000)]
virtio_net: remove send queue

Now we have a virtio detach API (in commit
f9bfbebf34eab707b065116cdc9699d25ba4252a), we don't need to track xmit
skbs in the virio_net driver, which improves transmission performance.

Signed-off-by: Shirley Ma <xma@us.ibm.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Makefile change for KSZ884X driver
Tristram Ha [Mon, 8 Feb 2010 11:40:04 +0000 (11:40 +0000)]
net: Makefile change for KSZ884X driver

Add Micrel KSZ884X network driver for KSZ8841/KSZ8842 PCI Ethernet chips.

Signed-off-by: Tristram Ha <Tristram.Ha@micrel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Kconfig change for KSZ884X driver
Tristram Ha [Mon, 8 Feb 2010 11:38:28 +0000 (11:38 +0000)]
net: Kconfig change for KSZ884X driver

Add Micrel KSZ8841/KSZ8842 PCI Ethernet chip support.

Signed-off-by: Tristram Ha <Tristram.Ha@micrel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Micrel KSZ8841/2 PCI Ethernet driver
Tristram Ha [Mon, 8 Feb 2010 11:36:53 +0000 (11:36 +0000)]
net: Micrel KSZ8841/2 PCI Ethernet driver

This is a new network driver for Micrel KSZ8841/KSZ8842 PCI Ethernet chips.  The same driver can run both chips at the same time.  It supports IPv4 TCP hardware checksumming and so can use scatter/gather transmission.

The KSZ8842 switch has 2 ports.  Some users like to take direct control of those ports.  So KSZ8842 has a multiple devices mode in which the driver creates another network device so that users can specify which port to send packets.  This mode is enabled by passing the "multi_dev=1" parameter to the driver during loading.

The KSZ884X can receive huge frames with size up to 1916 bytes.  To use this feature change the network device MTU from 1500 to 1898.

The KSZ884X driver has 3 packet receive processing functions for the normal mode, multiple devices mode, and huge frame mode.  Those functions are identical except for more checking for the new features.  In normal programming point of view the huge frame version is the one to use because it covers all the cases, but this is done for performance consideration because the target clients for the KSZ884X chips are embedded systems, which unlike desktop PC may not have powerful CPU.

Signed-off-by: Tristram Ha <Tristram.Ha@micrel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: move am79c961's probe function to .devinit.text
Uwe Kleine-König [Fri, 12 Feb 2010 20:10:47 +0000 (12:10 -0800)]
net: move am79c961's probe function to .devinit.text

A pointer to am79c961_probe is passed to the core via
platform_driver_register and so the function must not disappear when the
.init sections are discarded.  Otherwise (if also having HOTPLUG=y)
unbinding and binding a device to the driver via sysfs will result in an
oops as does a device being registered late.

An alternative to this patch is using platform_driver_probe instead of
platform_driver_register plus removing the pointer to the probe function
from the struct platform_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoipv6: fib: fix crash when changing large fib while dumping it
Patrick McHardy [Mon, 8 Feb 2010 05:19:03 +0000 (05:19 +0000)]
ipv6: fib: fix crash when changing large fib while dumping it

When the fib size exceeds what can be dumped in a single skb, the
dump is suspended and resumed once the last skb has been received
by userspace. When the fib is changed while the dump is suspended,
the walker might contain stale pointers, causing a crash when the
dump is resumed.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
IP: [<ffffffffa01bce04>] fib6_walk_continue+0xbb/0x124 [ipv6]
PGD 5347a067 PUD 65c7067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
...
RIP: 0010:[<ffffffffa01bce04>]
[<ffffffffa01bce04>] fib6_walk_continue+0xbb/0x124 [ipv6]
...
Call Trace:
 [<ffffffff8104aca3>] ? mutex_spin_on_owner+0x59/0x71
 [<ffffffffa01bd105>] inet6_dump_fib+0x11b/0x1b9 [ipv6]
 [<ffffffff81371af4>] netlink_dump+0x5b/0x19e
 [<ffffffff8134f288>] ? consume_skb+0x28/0x2a
 [<ffffffff81373b69>] netlink_recvmsg+0x1ab/0x2c6
 [<ffffffff81372781>] ? netlink_unicast+0xfa/0x151
 [<ffffffff813483e0>] __sock_recvmsg+0x6d/0x79
 [<ffffffff81348a53>] sock_recvmsg+0xca/0xe3
 [<ffffffff81066d4b>] ? autoremove_wake_function+0x0/0x38
 [<ffffffff811ed1f8>] ? radix_tree_lookup_slot+0xe/0x10
 [<ffffffff810b3ed7>] ? find_get_page+0x90/0xa5
 [<ffffffff810b5dc5>] ? filemap_fault+0x201/0x34f
 [<ffffffff810ef152>] ? fget_light+0x2f/0xac
 [<ffffffff813519e7>] ? verify_iovec+0x4f/0x94
 [<ffffffff81349a65>] sys_recvmsg+0x14d/0x223

Store the serial number when beginning to walk the fib and reload
pointers when continuing to walk after a change occured. Similar
to other dumping functions, this might cause unrelated entries to
be missed when entries are deleted.

Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomac80211: fix handling of null-rate control in rate_control_get_rate
Juuso Oikarinen [Fri, 12 Feb 2010 08:05:45 +0000 (10:05 +0200)]
mac80211: fix handling of null-rate control in rate_control_get_rate

For hardware with IEEE80211_HW_HAS_RATE_CONTROL the rate controller is not
initialized. However, calling functions such as ieee80211_beacon_get result
in the rate_control_get_rate function getting called, which is accessing
(in this case uninitialized) rate control structures unconditionally.

Fix by exiting the function before setting the rates for HW with
IEEE80211_HW_HAS_RATE_CONTROL set. The initialization of the ieee80211_tx_info
struct is intentionally still executed.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Kalle Valo <kalle.valo@nokia.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agodccp: allow probing of CCID-array length
Gerrit Renker [Sun, 7 Feb 2010 20:20:28 +0000 (20:20 +0000)]
dccp: allow probing of CCID-array length

This fixes a problem in the DCCP getsockopt() API: currently there is no way
for a user to a priori know the number of built-in CCIDs, other than trying
DCCP_SOCKOPT_AVAILABLE_CCIDS in a loop, incrementing the option length until
EINVAL is no longer returned.

This patch truncates the array to the user-provided length. No copy is made
when the length is <= 0.

Due to the length restriction in do_dccp_getsockopt() to sizeof(int), the
minimum array length remains 4, which is a reasonable default (only 3
CCIDs, CCID-2..4, are currently defined).

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoinet: Remove bogus IGMPv3 report handling
Herbert Xu [Sun, 7 Feb 2010 17:26:30 +0000 (17:26 +0000)]
inet: Remove bogus IGMPv3 report handling

Currently we treat IGMPv3 reports as if it were an IGMPv2/v1 report.
This is broken as IGMPv3 reports are formatted differently.  So we
end up suppressing a bogus multicast group (which should be harmless
as long as the leading reserved field is zero).

In fact, IGMPv3 does not allow membership report suppression so
we should simply ignore IGMPv3 membership reports as a host.

This patch does exactly that.  I kept the case statement for it
so people won't accidentally add it back thinking that we overlooked
this case.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomacb: straighten out macb_mii_probe function
Jiri Pirko [Mon, 8 Feb 2010 05:12:08 +0000 (05:12 +0000)]
macb: straighten out macb_mii_probe function

Use "phy_find_first" instead of manual lookup. Also use "phy_connect_direct"
instead of "phy_connect" since we already have phy_device pointer here.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: use netdev_mc_count and netdev_mc_empty when appropriate
Jiri Pirko [Mon, 8 Feb 2010 04:30:35 +0000 (04:30 +0000)]
net: use netdev_mc_count and netdev_mc_empty when appropriate

This patch replaces dev->mc_count in all drivers (hopefully I didn't miss
anything). Used spatch and did small tweaks and conding style changes when
it was suitable.

Jirka

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoiwlwifi: fix AMSDU Rx after paged Rx patch
Shanyu Zhao [Thu, 11 Feb 2010 18:42:22 +0000 (10:42 -0800)]
iwlwifi: fix AMSDU Rx after paged Rx patch

Previous patch "use paged Rx" broke AMSDU Rx functionality. If an AP
sends out A-MSDU packets the station will crash.  Fix it by linearizing
skbuff for AMSDU packet before handing it to mac80211 since mac80211
doesn't support paged skbuff.

This fixes http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2155

Reported-by: Norbert Preining <preining@logic.at>
Signed-off-by: Shanyu Zhao <shanyu.zhao@intel.com>
Acked-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: add a workaround for ack timeout issues
Felix Fietkau [Thu, 11 Feb 2010 17:07:19 +0000 (18:07 +0100)]
ath9k: add a workaround for ack timeout issues

Adding support for setting the coverage class in some cases broke
association and data transfer, as it overwrote the initial ACK timeout
value from the initvals with a smaller value.
I don't know why the new value works in 5 GHz (matches the initval
there), but not in 2.4 GHz (initvals use 64us here), so until the
problem is fully understood, the value should be increased again.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agonetfilter: don't use INIT_RCU_HEAD()
Alexey Dobriyan [Fri, 12 Feb 2010 05:25:36 +0000 (06:25 +0100)]
netfilter: don't use INIT_RCU_HEAD()

call_rcu() will unconditionally reinitialize RCU head anyway.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: nf_conntrack: elegantly simplify nf_ct_exp_net()
Alexey Dobriyan [Fri, 12 Feb 2010 05:24:46 +0000 (06:24 +0100)]
netfilter: nf_conntrack: elegantly simplify nf_ct_exp_net()

Remove #ifdef at nf_ct_exp_net() by using nf_ct_net().

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>