safe/jmp/linux-2.6
14 years agoNET: atlx, fix memory leak
Jiri Slaby [Wed, 6 Jan 2010 06:54:16 +0000 (06:54 +0000)]
NET: atlx, fix memory leak

Stanse found a memory leak in atl2_get_eeprom. eeprom_buff is not
freed/assigned on all paths. Fix that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <chris.snook@gmail.com>
Cc: Jie Yang <jie.yang@atheros.com>
Cc: atl1-devel@lists.sourceforge.net
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agopcmcia: ncmlan_cs: remove odd bracket
Alexander Beregalov [Wed, 6 Jan 2010 13:05:46 +0000 (13:05 +0000)]
pcmcia: ncmlan_cs: remove odd bracket

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocs89x0: Always report failure to request interrupt
Mark Brown [Thu, 7 Jan 2010 08:53:05 +0000 (00:53 -0800)]
cs89x0: Always report failure to request interrupt

A failure on request_irq() is always fatal but unlike other fatal
errors it's only reported to the user if net_debug is set. Make the
diagnostic unconditional and raise the priority so that errors are
more obvious to the user.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Make it easier to parse /proc/net/dev contents.
Jesper Dangaard Brouer [Tue, 5 Jan 2010 05:50:52 +0000 (05:50 +0000)]
net: Make it easier to parse /proc/net/dev contents.

The contents of /proc/net/dev is annoying to parse, because
it changes whether there is a space after the "ethX:" or not.
It depends upon the size of the "Receive bytes" counter,
if the number is below 7 digits, then there is whitespaces
else if the number is 8 digits or above there is no space
between the ":" and the number.

This patch changes the output to assure there is always a space
between the ":" and the number.  Given that all existing userspace
application already need to handle the whitespaces, I see
no breakage of existing tools.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: RFC3069, private VLAN proxy arp support
Jesper Dangaard Brouer [Tue, 5 Jan 2010 05:50:47 +0000 (05:50 +0000)]
net: RFC3069, private VLAN proxy arp support

This is to be used together with switch technologies, like RFC3069,
that where the individual ports are not allowed to communicate with
each other, but they are allowed to talk to the upstream router.  As
described in RFC 3069, it is possible to allow these hosts to
communicate through the upstream router by proxy_arp'ing.

This patch basically allow proxy arp replies back to the same
interface (from which the ARP request/solicitation was received).

Tunable per device via proc "proxy_arp_pvlan":
  /proc/sys/net/ipv4/conf/*/proxy_arp_pvlan

This switch technology is known by different vendor names:
 - In RFC 3069 it is called VLAN Aggregation.
 - Cisco and Allied Telesyn call it Private VLAN.
 - Hewlett-Packard call it Source-Port filtering or port-isolation.
 - Ericsson call it MAC-Forced Forwarding (RFC Draft).

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agofix bonding: allow arp_ip_targets on separate vlans to use arp validation
Andy Gospodarek [Wed, 6 Jan 2010 12:56:37 +0000 (12:56 +0000)]
fix bonding: allow arp_ip_targets on separate vlans to use arp validation

On Wed, Jan 06, 2010 at 10:10:03PM +0100, Eric Dumazet wrote:
> Le 06/01/2010 19:38, Eric Dumazet a écrit :
> >
> > (net-next-2.6 doesnt work well on my bond/vlan setup, I suspect I need a bisection)
>
> David, I had to revert 1f3c8804acba841b5573b953f5560d2683d2db0d
> (bonding: allow arp_ip_targets on separate vlans to use arp validation)
>
> Or else, my vlan devices dont work (unfortunatly I dont have much time
> these days to debug the thing)
>
> My config :
>
>               +---------+
> vlan.103 -----+ bond0   +--- eth1 (bnx2)
>               |         +
> vlan.825 -----+         +--- eth2 (tg3)
>               +---------+
>
> $ cat /proc/net/bonding/bond0
> Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
>
> Bonding Mode: fault-tolerance (active-backup)
> Primary Slave: None
> Currently Active Slave: eth2
> MII Status: up
> MII Polling Interval (ms): 100
> Up Delay (ms): 0
> Down Delay (ms): 0
>
> Slave Interface: eth1  (bnx2)
> MII Status: down
> Link Failure Count: 1
> Permanent HW addr: 00:1e:0b:ec:d3:d2
>
> Slave Interface: eth2   (tg3)
> MII Status: up
> Link Failure Count: 0
> Permanent HW addr: 00:1e:0b:92:78:50
>

This patch fixes up a problem with found with commit
1f3c8804acba841b5573b953f5560d2683d2db0d.  The original change
overloaded null_or_orig, but doing that prevented any packet handlers
that were not tied to a specific device (i.e. ptype->dev == NULL) from
ever receiving any frames.

The null_or_orig variable cannot be overloaded, and must be kept as NULL
to prevent the frame from being ignored by packet handlers designed to
accept frames on any interface.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohso: fixed missing newlines
Jan Dumon [Tue, 5 Jan 2010 04:53:00 +0000 (04:53 +0000)]
hso: fixed missing newlines

Fixed missing newlines in calls to dev_warn & dev_err.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohso: Fix for 5 sec timeouts with v2.x firmware
Jan Dumon [Tue, 5 Jan 2010 04:52:42 +0000 (04:52 +0000)]
hso: Fix for 5 sec timeouts with v2.x firmware

Don't send flow control settings to any port other than the modem port.
Older firmware ignored this request but did sent a reply. Newer firmware just
ignores it without reply and causes a 5 second timeout every time a port
(except for the modem port) is opened or if tiocm settings are changed.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohso: Attempt to recover from usb bus errors
Jan Dumon [Tue, 5 Jan 2010 04:52:13 +0000 (04:52 +0000)]
hso: Attempt to recover from usb bus errors

Attempt to reset the usb device when we receive usb bus errors.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohso: don't change the state of a closed port
Jan Dumon [Tue, 5 Jan 2010 04:51:28 +0000 (04:51 +0000)]
hso: don't change the state of a closed port

Don't change the state of a port if it's not open. This fixes an issue where a
port sometimes has to be opened twice before data can be received.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohso: Fix for endian issues on big endian machines
Jan Dumon [Tue, 5 Jan 2010 04:51:02 +0000 (04:51 +0000)]
hso: Fix for endian issues on big endian machines

Some fields are always little endian and have to be converted on big endian
machines.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohso: Add Vendor/Product ID's for new devices
Jan Dumon [Tue, 5 Jan 2010 04:50:31 +0000 (04:50 +0000)]
hso: Add Vendor/Product ID's for new devices

Add product ID's for new devices.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years ago8139too: make PCI device ids constant
Márton Németh [Mon, 4 Jan 2010 13:03:02 +0000 (13:03 +0000)]
8139too: make PCI device ids constant

The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make pci_device_id also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
identifier I1, I2, x;
@@
struct I1 {
  ...
  const struct I2 *x;
  ...
};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
  .x = E,
};
@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoclaw: use "claw" as root device name
Ursula Braun [Mon, 4 Jan 2010 03:14:45 +0000 (03:14 +0000)]
claw: use "claw" as root device name

Claw module cannot be loaded together with qeth, because "qeth" has
been errorneously used as root device name. It is changed into "claw".

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoPhonet: reject unsupported sendmsg/recvmsg flags
Rémi Denis-Courmont [Mon, 4 Jan 2010 02:02:49 +0000 (02:02 +0000)]
Phonet: reject unsupported sendmsg/recvmsg flags

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoPhonet: zero-copy GPRS TX
Rémi Denis-Courmont [Mon, 4 Jan 2010 02:02:48 +0000 (02:02 +0000)]
Phonet: zero-copy GPRS TX

Send aligned pipe payload if requested to do so. Then, the socket buffer
needs not be fragmented anymore.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoPhonet: zero-copy aligned GPRS RX
Rémi Denis-Courmont [Mon, 4 Jan 2010 02:02:47 +0000 (02:02 +0000)]
Phonet: zero-copy aligned GPRS RX

Newer Nokia cellular modems can use aligned payload for their GPRS pipe.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/mac8390.c: Add mac8390_init function
Joe Perches [Mon, 4 Jan 2010 11:53:03 +0000 (11:53 +0000)]
drivers/net/mac8390.c: Add mac8390_init function

Reduce indentation, make code a little neater.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/mac8390.c: Checkpatch cleanups
Joe Perches [Mon, 4 Jan 2010 11:53:02 +0000 (11:53 +0000)]
drivers/net/mac8390.c: Checkpatch cleanups

Use #include <linux/ not #include <asm/
Add spaces after arguments
Comment neatening
Make a couple of arrays static const
Align function arguments
Wrap text at 80 columns where reasonable
Cuddle brace else

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/mac8390.c: Convert printk(KERN_<level> to pr_<level>(
Joe Perches [Mon, 4 Jan 2010 11:53:01 +0000 (11:53 +0000)]
drivers/net/mac8390.c: Convert printk(KERN_<level> to pr_<level>(

Use printk_once
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert printks without KERN_<level> to pr_info and pr_cont

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/mac8390.c: Remove useless memcpy casting
Joe Perches [Mon, 4 Jan 2010 11:53:00 +0000 (11:53 +0000)]
drivers/net/mac8390.c: Remove useless memcpy casting

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/mac8390.c: Indent case labels
Joe Perches [Mon, 4 Jan 2010 11:52:59 +0000 (11:52 +0000)]
drivers/net/mac8390.c: Indent case labels

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agopcnet_cs: add cis of KTI PE520 pcmcia network card
Ken Kawasaki [Thu, 7 Jan 2010 04:37:58 +0000 (20:37 -0800)]
pcnet_cs: add cis of KTI PE520 pcmcia network card

pcnet_cs,serial_cs:

add cis of KTI PE520 pcmcia network card,
and serial card(Sierra Wireless AC860).

Signed-off-by: Ken Kawasaki <ken_kawasaki@spring.nifty.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoip: fix mc_loop checks for tunnels with multicast outer addresses
Octavian Purdila [Thu, 7 Jan 2010 04:37:01 +0000 (20:37 -0800)]
ip: fix mc_loop checks for tunnels with multicast outer addresses

When we have L3 tunnels with different inner/outer families
(i.e. IPV4/IPV6) which use a multicast address as the outer tunnel
destination address, multicast packets will be loopbacked back to the
sending socket even if IP*_MULTICAST_LOOP is set to disabled.

The mc_loop flag is present in the family specific part of the socket
(e.g. the IPv4 or IPv4 specific part).  setsockopt sets the inner
family mc_loop flag. When the packet is pushed through the L3 tunnel
it will eventually be processed by the outer family which if different
will check the flag in a different part of the socket then it was set.

Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agophy: SMSC device Energy Detect power-down mode
Giuseppe Cavallaro [Thu, 7 Jan 2010 04:35:14 +0000 (20:35 -0800)]
phy: SMSC device Energy Detect power-down mode

SMSC Ethernet Transceivers (LAN88710, LAN8710, LAN8720, LAN8187,
LAN8700, LAN83C185) provide a mechanism to conserve power when
the device is not connected to an active link partner
(Energy Detect Mode).
So this patch enables the Energy Detect power-down mode
for these Transceivers.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoucc_geth: Fix the wrong the Rx/Tx FIFO size
Dave Liu [Thu, 7 Jan 2010 04:32:38 +0000 (20:32 -0800)]
ucc_geth: Fix the wrong the Rx/Tx FIFO size

current the Rx/Tx FIFO size settings cause problem
when four UEC ethernets work simultaneously.

eg: GETH1, UEM-J15, GETH2, UEC-J5 on 8569MDS board

 $ ifconfig eth0 10.193.20.166
 $ ifconfig eth1 10.193.20.167
 $ ifconfig eth2 10.193.20.168
 then
 $ ifconfig eth3 10.193.20.169

The fourth ethernet will cause all of interface broken,
you cann't ping successfully any more.
The patch fix this issue for MPC8569 Rev1.0 and Rev2.0

Signed-off-by: Dave Liu <daveliu@freescale.com>
Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Add napi gro frags interface.
Ron Mercer [Sat, 2 Jan 2010 10:37:44 +0000 (10:37 +0000)]
qlge: Add napi gro frags interface.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Add RX frame handlers for non-split frames.
Ron Mercer [Sat, 2 Jan 2010 10:37:43 +0000 (10:37 +0000)]
qlge: Add RX frame handlers for non-split frames.

New handlers are added here to handle:
1) Small frames (<256 bytes) in a single small buffer.  Allocate a new
skb and copy the frame.

2) Large frame (>256 bytes) in a page chunk. Allocate an skb, tack it on frags,
post to napi_gro_receive().

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Turn on RX header split based on platform.
Ron Mercer [Sat, 2 Jan 2010 10:37:42 +0000 (10:37 +0000)]
qlge: Turn on RX header split based on platform.

Using 4-byte aligned headers is problematic for some architectures.
Since qlge uses 4-byte aligned rx buffers we split headers for these
architectures into a separate buffer and then recopy to align on 2-byte boundary.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Lock transmit queue while disabling device
Mike McCormack [Thu, 31 Dec 2009 00:55:31 +0000 (00:55 +0000)]
sky2: Lock transmit queue while disabling device

netif_device_detach() does not take the tx_lock, so it's possible that
a call to sky2_xmit_frame is still in progress after
netif_device_detach() is complete.

Take netif_tx_lock() to make sure all transmits have stopped while
we're disabling the devices and that no other CPU is still
transmitting a frame after we've disabling the device.

Proposed fix for "sky2 panic under load" reported by Berck E. Nash.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosky2: Refactor sky2_get_regs into two functions
Mike McCormack [Thu, 31 Dec 2009 00:49:43 +0000 (00:49 +0000)]
sky2: Refactor sky2_get_regs into two functions

Separate code deciding which registers can be accessed out of
sky2_get_regs in preparation for adding more conditions into it.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocxgb3i: Fix flags test.
David S. Miller [Mon, 4 Jan 2010 22:36:40 +0000 (14:36 -0800)]
cxgb3i: Fix flags test.

As noticed by Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoipvs: Add boundary check on ioctl arguments
Arjan van de Ven [Mon, 4 Jan 2010 15:37:12 +0000 (16:37 +0100)]
ipvs: Add boundary check on ioctl arguments

The ipvs code has a nifty system for doing the size of ioctl command
copies; it defines an array with values into which it indexes the cmd
to find the right length.

Unfortunately, the ipvs code forgot to check if the cmd was in the
range that the array provides, allowing for an index outside of the
array, which then gives a "garbage" result into the length, which
then gets used for copying into a stack buffer.

Fix this by adding sanity checks on these as well as the copy size.

[ horms@verge.net.au: adjusted limit to IP_VS_SO_GET_MAX ]
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetxen: fix ethtool link test
Sucheta Chakraborty [Sat, 2 Jan 2010 03:25:19 +0000 (03:25 +0000)]
netxen: fix ethtool link test

o Fix ethtool link test for NX3031 chip.
o Remove unused code from phy interrupt callback

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetxen: fix ethtool register dump
Sucheta Chakraborty [Sat, 2 Jan 2010 03:25:18 +0000 (03:25 +0000)]
netxen: fix ethtool register dump

o Dump registers such as tx ring and rx ring counter, firmware state,
  niu regs, etc. which can be useful for debugging purpose.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agorrunner: fix buffer overflow
Dan Carpenter [Sat, 2 Jan 2010 04:08:46 +0000 (04:08 +0000)]
rrunner: fix buffer overflow

tx_skbuff is define as:
        struct sk_buff          *tx_skbuff[TX_RING_ENTRIES];

EVT_RING_ENTRIES is 64 and TX_RING_ENTRIES is 32.

This function is in a error path so that's why it wasn't noticed.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobroadcom: Fix &&/|| confusion in bcm54xx_adjust_rxrefclk()
roel kluin [Wed, 30 Dec 2009 06:43:06 +0000 (06:43 +0000)]
broadcom: Fix &&/|| confusion in bcm54xx_adjust_rxrefclk()

This always evaluates to true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoaxnet_cs: remove unnecessary spin_unlock_irqrestore
Ken Kawasaki [Mon, 28 Dec 2009 15:17:24 +0000 (15:17 +0000)]
axnet_cs: remove unnecessary spin_unlock_irqrestore

axnet_cs:
    remove unnecessary spin_unlock_irqrestore,spin_lock_irqsave.

Signed-off-by: Ken Kawasaki <ken_kawasaki@spring.nifty.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Test off by one in sh_eth_reset()
roel kluin [Wed, 30 Dec 2009 01:43:45 +0000 (01:43 +0000)]
net: Test off by one in sh_eth_reset()

If no break occurred, cnt reaches 0 after the loop.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoniu: timeout ignored in tcam_wait_bit()
roel kluin [Sun, 27 Dec 2009 04:10:59 +0000 (04:10 +0000)]
niu: timeout ignored in tcam_wait_bit()

With `while (--limit > 0)' i reaches 0 after the loop, so upon timeout the
error was not returned.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoatarilance: timeout ignored in lance_open()
roel kluin [Sun, 27 Dec 2009 03:26:12 +0000 (03:26 +0000)]
atarilance: timeout ignored in lance_open()

With `while (--i > 0)' i reaches 0 after the loop, so upon timeout the
error was not issued.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net : Correct the size argument to kzalloc
Julia Lawall [Tue, 29 Dec 2009 09:15:42 +0000 (09:15 +0000)]
drivers/net : Correct the size argument to kzalloc

lp->rx_skb has type struct sk_buff **, not struct sk_buff *, so the
elements of the array should have pointer type, not structure type.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocxgb3i: Fix a login over vlan issue
Rakesh Ranjan [Sun, 27 Dec 2009 07:03:08 +0000 (12:33 +0530)]
cxgb3i: Fix a login over vlan issue

Fix a target login issue, when parent interface is vlan and we are using cxgb3i sepecific
private ip address in '/etc/iscsi/ifaces/' iface file.

Acked-by: Karen Xie <kxie@chelsio.com>
Signed-off-by: Rakesh Ranjan <rakesh@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agohamradio: avoid null deref v3
Dan Carpenter [Mon, 28 Dec 2009 06:54:55 +0000 (06:54 +0000)]
hamradio: avoid null deref v3

This should address the problems in version 1 (lazy) and version 2 (ugly).

Bump the stats on orig_dev not on the newly assigned NULL dev variable.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agousbnet: test off by one
roel kluin [Sun, 27 Dec 2009 11:22:08 +0000 (11:22 +0000)]
usbnet: test off by one

With `while (i++ < MII_TIMEOUT)' i reaches MII_TIMEOUT + 1 after the loop
This is probably unlikely a problem in practice.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/can: Correct NULL test
Julia Lawall [Sun, 27 Dec 2009 11:27:44 +0000 (11:27 +0000)]
drivers/net/can: Correct NULL test

Test the just-allocated value for NULL rather than some other value.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y;
statement S;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
(
if ((x) == NULL) S
|
if (
-   y
+   x
       == NULL)
 S
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotipc: use kconfig to limit numeric ranges
Amerigo Wang [Thu, 24 Dec 2009 17:26:48 +0000 (17:26 +0000)]
tipc: use kconfig to limit numeric ranges

We can rely on kconfig to limit these numbers,
no need to limit them at compile time/run time.

Users who modify these numbers manually should
be responsible for themself. :)

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Per Liden <per.liden@ericsson.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Cc: Allan Stephens <allan.stephens@windriver.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocan/netlink: add CAN_CTRLMODE_ONE_SHOT
Marc Kleine-Budde [Wed, 23 Dec 2009 01:27:48 +0000 (01:27 +0000)]
can/netlink: add CAN_CTRLMODE_ONE_SHOT

This patch adds the flag CAN_CTRLMODE_ONE_SHOT. It is used as mask
or flag in the "struct can_ctrlmode".

It allows userspace via netlink to set a CAN controller into the special
"one-shot" mode. In this mode, if supported by the CAN controller, it
tries only once to deliver a CAN frame and aborts it if an error
(e.g.: arbitration lost) happens.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocan: Speed up CAN frame receiption by using ml_priv
Oliver Hartkopp [Fri, 25 Dec 2009 06:47:47 +0000 (06:47 +0000)]
can: Speed up CAN frame receiption by using ml_priv

this patch removes the hlist that contains the CAN receiver filter lists.
It uses the 'midlayer private' pointer ml_priv and links the filters directly
to the CAN netdevice, which allows to omit the walk through the complete CAN
devices hlist for each received CAN frame.

This patch is tested and does not remove any locking.

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/isdn: eliminate duplicated test
Julia Lawall [Mon, 21 Dec 2009 14:25:32 +0000 (14:25 +0000)]
drivers/isdn: eliminate duplicated test

The code checked slot_rx twice.  Check slot_tx by analogy with the bank
case.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression E;
@@

(
*E && E
|
*E || E
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet/sctp/socket.c: squish warning
Andrew Morton [Mon, 21 Dec 2009 14:25:06 +0000 (14:25 +0000)]
net/sctp/socket.c: squish warning

net/sctp/socket.c: In function 'sctp_setsockopt_autoclose':
net/sctp/socket.c:2090: warning: comparison is always false due to limited range of data type

Cc: Andrei Pelinescu-Onciul <andrei@iptel.org>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/cxgb3: Use kzalloc for allocating only one thing
Julia Lawall [Fri, 18 Dec 2009 21:16:52 +0000 (21:16 +0000)]
drivers/net/cxgb3: Use kzalloc for allocating only one thing

Use kzalloc rather than kcalloc(1,...)

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agorose_loopback_timer sets VC number <= ROSE_DEFAULT_MAXVC
Bernard Pidoux F6BVP [Thu, 17 Dec 2009 05:25:18 +0000 (05:25 +0000)]
rose_loopback_timer sets VC number <= ROSE_DEFAULT_MAXVC

cat /proc/net/rose displayed a rose sockets abnormal lci value, i.e.
greater than maximum number of VCs per neighbour allowed.
This number prevents further test of lci value during rose operations.

Example (lines shortened) :
[bernard]# cat /proc/net/rose
dest_addr  dest_call src_addr   src_call  dev   lci neigh st vs vr va
*          *         2080175520 F6BVP-1   rose0 000 00000  0  0  0  0
2080175520 FPAD-0    2080175520 WP-0      rose0 FFE 00001  3  0  0  0

Here are the default parameters :

linux/include/net/rose.h:#define ROSE_DEFAULT_MAXVC 50 /* Maximum number of VCs per neighbour */
linux/net/rose/af_rose.c:int sysctl_rose_maximum_vcs = ROSE_DEFAULT_MAXVC;

With the following patch, rose_loopback_timer() attributes a VC number
within limits.

Signed-off-by: Bernard Pidoux <f6bvp@amsat.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agovia-velocity: Give RX descriptors to the NIC later on open or MTU change
Ben Hutchings [Mon, 14 Dec 2009 16:05:09 +0000 (16:05 +0000)]
via-velocity: Give RX descriptors to the NIC later on open or MTU change

velocity_open() calls velocity_give_many_rx_descs(), which gives RX
descriptors to the NIC, before installing an interrupt handler or
calling velocity_init_registers().  I think this is very unsafe and it
appears to explain the bug report <http://bugs.debian.org/508527>.

On MTU change, velocity_give_many_rx_descs() is again called before
velocity_init_registers().  I'm not sure whether this is unsafe but
it does look wrong.

Therefore, move the calls to velocity_give_many_rx_descs() after
request_irq() and velocity_init_registers().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Jan Ceuleers <jan.ceuleers@computer.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobonding: allow arp_ip_targets on separate vlans to use arp validation
Andy Gospodarek [Mon, 14 Dec 2009 10:48:58 +0000 (10:48 +0000)]
bonding: allow arp_ip_targets on separate vlans to use arp validation

This allows a bond device to specify an arp_ip_target as a host that is
not on the same vlan as the base bond device and still use arp
validation.  A configuration like this, now works:

BONDING_OPTS="mode=active-backup arp_interval=1000 arp_ip_target=10.0.100.1 arp_validate=3"

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
8: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::213:21ff:febe:33e9/64 scope link
       valid_lft forever preferred_lft forever
9: bond0.100@bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue
    link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
    inet 10.0.100.2/24 brd 10.0.100.255 scope global bond0.100
    inet6 fe80::213:21ff:febe:33e9/64 scope link
       valid_lft forever preferred_lft forever

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
ARP Polling Interval (ms): 1000
ARP IP target/s (n.n.n.n form): 10.0.100.1

Slave Interface: eth1
MII Status: up
Link Failure Count: 1
Permanent HW addr: 00:40:05:30:ff:30

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:13:21:be:33:e9

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agofsl_pq_mdio: Fix iomem unmapping for non-eTSEC2.0 controllers
Anton Vorontsov [Wed, 30 Dec 2009 08:23:34 +0000 (08:23 +0000)]
fsl_pq_mdio: Fix iomem unmapping for non-eTSEC2.0 controllers

We use a rather complicated logic to support eTSEC and eTSEC2.0
registers maps in a single driver. Currently, the code tries to
unmap 'regs', but for non-eTSEC2.0 controllers 'regs' doesn't
point to a mapping start, and this might cause badness on probe
failure or module removal:

 Freescale PowerQUICC MII Bus: probed
 Trying to vfree() nonexistent vm area (e107f000)
 ------------[ cut here ]------------
 Badness at c00a7754 [verbose debug info unavailable]
 NIP: c00a7754 LR: c00a7754 CTR: c02231ec
 [...]
 NIP [c00a7754] __vunmap+0xec/0xf4
 LR [c00a7754] __vunmap+0xec/0xf4
 Call Trace:
 [df827e50] [c00a7754] __vunmap+0xec/0xf4 (unreliable)
 [df827e70] [c001519c] iounmap+0x44/0x54
 [df827e80] [c028b924] fsl_pq_mdio_probe+0x1cc/0x2fc
 [df827eb0] [c02fb9b4] of_platform_device_probe+0x5c/0x84
 [df827ed0] [c0229928] really_probe+0x78/0x1a8
 [df827ef0] [c0229b20] __driver_attach+0xa4/0xa8

Fix this by introducing a proper priv structure (finally!), which
now holds 'regs' and 'map' fields separately.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoucc_geth: Fix netdev watchdog triggering on suspend
Anton Vorontsov [Wed, 30 Dec 2009 08:23:32 +0000 (08:23 +0000)]
ucc_geth: Fix netdev watchdog triggering on suspend

Sometimes ucc_geth fails to suspend with the following trace:

 ucc_geth e0103000.ucc: suspend
 ucc_geth e0102000.ucc: suspend
 NETDEV WATCHDOG: eth0 (ucc_geth): transmit queue 0 timed out
 ------------[ cut here ]------------
 Badness at net/sched/sch_generic.c:255
 NIP: c021cb5c LR: c021cb5c CTR: c01ab4b4
 [...]
 NIP [c021cb5c] dev_watchdog+0x298/0x2a8
 LR [c021cb5c] dev_watchdog+0x298/0x2a8
 Call Trace:
 [c0389da0] [c021cb5c] dev_watchdog+0x298/0x2a8 (unreliable)
 [c0389e00] [c0031ed8] run_timer_softirq+0x16c/0x1dc
 [c0389e50] [c002c638] __do_softirq+0xa4/0x11c
 [...]

This patch fixes the issue by properly detaching the device on
suspend, and attaching it back on resume.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agophylib: Properly reinitialize PHYs after hibernation
Anton Vorontsov [Wed, 30 Dec 2009 08:23:30 +0000 (08:23 +0000)]
phylib: Properly reinitialize PHYs after hibernation

Since hibernation assumes power loss, we should fully reinitialize
PHYs (including platform fixups), as if PHYs were just attached.

This patch factors phy_init_hw() out of phy_attach_direct(), then
converts mdio_bus to dev_pm_ops and adds an appropriate restore()
callback.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agophylib: Fix deadlock on resume
Anton Vorontsov [Wed, 30 Dec 2009 08:23:28 +0000 (08:23 +0000)]
phylib: Fix deadlock on resume

Sometimes kernel hangs on resume with the following trace:

 ucc_geth e0102000.ucc: resume
 INFO: task bash:1764 blocked for more than 120 seconds.
 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
 bash          D 0fecf43c     0  1764   1763 0x00000000
 Call Trace:
 [cf9a7c10] [c0012868] ret_from_except+0x0/0x14 (unreliable)
 --- Exception: cf9a7ce0 at __switch_to+0x4c/0x6c
     LR = 0xcf9a7cc0
 [cf9a7cd0] [c0008c14] __switch_to+0x4c/0x6c (unreliable)
 [cf9a7ce0] [c028bcfc] schedule+0x158/0x260
 [cf9a7d10] [c028c720] __mutex_lock_slowpath+0x80/0xd8
 [cf9a7d40] [c01cf388] phy_stop+0x20/0x70
 [cf9a7d50] [c01d514c] ugeth_resume+0x6c/0x13c
 [...]

Here is why.

On suspend:

- PM core starts suspending devices, ucc_geth_suspend gets called;

- ucc_geth calls phy_stop() on suspend. Note that phy_stop() is
  mostly asynchronous so it doesn't block ucc_geth's suspend routine,
  it just sets PHY_HALTED state and disables PHY's interrupts;

- Suddenly the state machine gets scheduled, it grabs the phydev->lock
  mutex and tries to process the PHY_HALTED state, so it calls
  phydev->adjust_link(phydev->attached_dev). In ucc_geth case
  adjust_link() calls msleep(), which reschedules the code flow back to
  PM core, which now finishes suspend and so we end up sleeping with
  phydev->lock mutex held.

On resume:

- PM core starts resuming devices (notice that nobody rescheduled
  the state machine yet, so the mutex is still held), the core calls
  ucc_geth's resume routine;

- ucc_geth_resume restarts the PHY with phy_stop()/phy_start()
  sequence, and the phy_*() calls are trying to grab the phydev->lock
  mutex. Here comes the deadlock.

This patch fixes the issue by stopping the state machine on suspend
and starting it again on resume.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.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/linville/wirel...
David S. Miller [Wed, 30 Dec 2009 21:51:29 +0000 (13:51 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-next-2.6

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
John W. Linville [Wed, 30 Dec 2009 20:25:08 +0000 (15:25 -0500)]
Merge git://git./linux/kernel/git/linville/wireless-2.6

Conflicts:
drivers/net/wireless/libertas/scan.c

14 years agoSubject: drivers/net/sh_eth.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:10:35 +0000 (20:10 -0800)]
Subject: drivers/net/sh_eth.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/r8169.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:10:01 +0000 (20:10 -0800)]
drivers/net/r8169.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/octeon/octeon_mgmt.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:09:07 +0000 (20:09 -0800)]
drivers/net/octeon/octeon_mgmt.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/smc911x.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:08:09 +0000 (20:08 -0800)]
drivers/net/smc911x.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/sunvnet.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:07:27 +0000 (20:07 -0800)]
drivers/net/sunvnet.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/usb/catc.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:06:45 +0000 (20:06 -0800)]
drivers/net/usb/catc.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/s390/net/qeth_l2_main.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:05:37 +0000 (20:05 -0800)]
drivers/s390/net/qeth_l2_main.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/xilinx_emaclite.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:04:53 +0000 (20:04 -0800)]
drivers/net/xilinx_emaclite.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/via-velocity.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:04:14 +0000 (20:04 -0800)]
drivers/net/via-velocity.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/usb/rtl8150.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:03:28 +0000 (20:03 -0800)]
drivers/net/usb/rtl8150.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/igbvf/netdev.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:02:29 +0000 (20:02 -0800)]
drivers/net/igbvf/netdev.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/lib82596.c: use %pM to shown MAC address
H Hartley Sweeten [Wed, 30 Dec 2009 04:01:46 +0000 (20:01 -0800)]
drivers/net/lib82596.c: use %pM to shown MAC address

Use the %pM kernel extension to display the MAC address.

The only difference in the output is that the MAC address is
shown in the usual colon-separated hex notation instead of
space-separated.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.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/linville/wirel...
David S. Miller [Wed, 30 Dec 2009 03:44:25 +0000 (19:44 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-2.6

14 years agoRevert "b43: Enforce DMA descriptor memory constraints"
John W. Linville [Tue, 29 Dec 2009 19:07:42 +0000 (14:07 -0500)]
Revert "b43: Enforce DMA descriptor memory constraints"

This reverts commit 9bd568a50c446433038dec2a5186c5c57c3dbd23.

That commit is shown to cause allocation failures during initialization
on some machines.

http://bugzilla.kernel.org/show_bug.cgi?id=14844

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: annotate sleeping driver ops
Kalle Valo [Wed, 23 Dec 2009 12:15:47 +0000 (13:15 +0100)]
mac80211: annotate sleeping driver ops

To make it easier to notice cases of calling sleeping ops in atomic context,
annotate driver-ops.h with appropiate might_sleep() calls. At the same time,
also document in mac80211.h the op functions with missing contexts.

mac80211 doesn't seem to use get_tx_stats anywhere currently. Just to be on
the safe side, I documented it to be atomic, but hopefully the op can be
removed in the future.

Compile-tested only.

Signed-off-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: remove requeue from work
Johannes Berg [Wed, 23 Dec 2009 12:15:46 +0000 (13:15 +0100)]
mac80211: remove requeue from work

There's no need to be requeueing the work struct
since we check for the scan after removing items
due to possible timeouts.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: remove struct ieee80211_if_init_conf
Johannes Berg [Wed, 23 Dec 2009 12:15:45 +0000 (13:15 +0100)]
mac80211: remove struct ieee80211_if_init_conf

All its members (vif, mac_addr, type) are now available
in the vif struct directly, so we can pass that instead
of the conf struct. I generated this patch (except the
mac80211 and header file changes) with this semantic
patch:

@@
identifier conf, fn, hw;
type tp;
@@
tp fn(struct ieee80211_hw *hw,
-struct ieee80211_if_init_conf *conf)
+struct ieee80211_vif *vif)
{
<...
(
-conf->type
+vif->type
|
-conf->mac_addr
+vif->addr
|
-conf->vif
+vif
)
...>
}

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211/cfg80211: add station events
Johannes Berg [Wed, 23 Dec 2009 12:15:44 +0000 (13:15 +0100)]
mac80211/cfg80211: add station events

When, for instance, a new IBSS peer is found, userspace
wants to be notified. Add events for all new stations
that mac80211 learns about.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: make off-channel work generic
Johannes Berg [Wed, 23 Dec 2009 12:15:43 +0000 (13:15 +0100)]
mac80211: make off-channel work generic

This changes mac80211 to allow being off-channel for
any type of work, not just the 'remain-on-channel'
work. This also helps fast transition to a BSS on a
different channel.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: support remain-on-channel command
Johannes Berg [Wed, 23 Dec 2009 12:15:42 +0000 (13:15 +0100)]
mac80211: support remain-on-channel command

This implements the new remain-on-channel cfg80211
command in mac80211, extending the work interface.

Also change the work purge code to be able to clean
up events properly (pretending they timed out.)

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agocfg80211: add remain-on-channel command
Jouni Malinen [Wed, 23 Dec 2009 12:15:41 +0000 (13:15 +0100)]
cfg80211: add remain-on-channel command

Add new commands for requesting the driver to remain awake
on a specified channel for the specified amount of time
(and another command to cancel such an operation). This
can be used to implement userspace-controlled off-channel
operations, like Public Action frame exchange on another
channel than the operation channel.

The off-channel operation should behave similarly to scan,
i.e. the local station (if associated) moves into power
save mode to request the AP to buffer frames for it and
then moves to the other channel to allow the off-channel
operation to be completed. The duration parameter can be
used to request enough time to receive a response from
the target station.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: Generalize off-channel operation helpers from scan code
Jouni Malinen [Wed, 23 Dec 2009 12:15:40 +0000 (13:15 +0100)]
mac80211: Generalize off-channel operation helpers from scan code

The off-channel operations for going into power save mode (station
mode) or stop beaconing (AP/IBSS) are not limited to scanning. Move
these into a separate file and allow them to be used for other
purposes, too.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: proper bss private data handling
Johannes Berg [Wed, 23 Dec 2009 12:15:39 +0000 (13:15 +0100)]
mac80211: proper bss private data handling

cfg80211 offers private data for each BSS struct,
which mac80211 uses. However, mac80211 uses internal
and external (cfg80211) BSS pointers interchangeably
and has a hack to put the cfg80211 bss struct into
the private struct.

Remove this hack, properly converting between the
pointers wherever necessary.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: split up and insert custom IEs correctly
Johannes Berg [Wed, 23 Dec 2009 12:15:38 +0000 (13:15 +0100)]
mac80211: split up and insert custom IEs correctly

Currently, we insert all user-specified IEs before the HT
IE for association, and after the HT IE for probe requests.
For association, that's correct only if the user-specified
IEs are RSN only, incorrect in all other cases including
WPA. Change this to split apart the user-specified IEs in
two places for association: before the HT IE (e.g. RSN),
after the HT IE (generally empty right now I think?) and
after WMM (all other vendor-specific IEs). For probes,
split the IEs in different places to be correct according
to the spec.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: refactor association
Johannes Berg [Wed, 23 Dec 2009 12:15:37 +0000 (13:15 +0100)]
mac80211: refactor association

Refactor the code to reserve an skb of the right size
(instead of hoping 200 bytes are enough forever), and
also put HT IE generation into an own function.

Additionally, put the HT IE before the vendor-specific
WMM IE. This still leaves things not quite ordered
correctly, due to user-specified IEs, add a note about
that for now.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: rewrite a few work messages
Johannes Berg [Wed, 23 Dec 2009 12:15:36 +0000 (13:15 +0100)]
mac80211: rewrite a few work messages

The station we're authenticating/associating with
may not always be an AP in the sense that word is
mostly understood, so print only the MAC address
of the peer instead.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: generalise work handling
Johannes Berg [Wed, 23 Dec 2009 12:15:35 +0000 (13:15 +0100)]
mac80211: generalise work handling

In order to use auth/assoc for different purposes
other than MLME, it needs to be split up. For other
purposes, a generic work handling (potentially on
another channel) will be useful.

To achieve that, this patch moves much of the MLME
work handling out of mlme into a new work API. The
API can currently handle probing a specific AP,
authentication and association. The MLME previously
handled probe/authentication as one step and will
continue to do so, but they are separate in the new
work handling.

Work items are RCU-managed to be able to check for
existence of an item for a specific frame in the RX
path, but they can be re-used which the MLME right
now will do for its combined probe/auth step.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: generalise management work a bit
Johannes Berg [Wed, 23 Dec 2009 12:15:34 +0000 (13:15 +0100)]
mac80211: generalise management work a bit

As a first step of generalising management work,
this renames a few things and puts more information
directly into the struct so that auth/assoc need
not access the BSS pointer as often -- in fact it
can be removed from auth completely. Also since the
previous patch made sure a new work item is used
for association, we can make the different data a
union.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: let cfg80211 manage auth state
Johannes Berg [Wed, 23 Dec 2009 12:15:33 +0000 (13:15 +0100)]
mac80211: let cfg80211 manage auth state

mac80211 currently hangs on to the auth state by
keeping it on the work list. That can lead to
confusing behaviour like rejecting scans while
authenticated to any AP (but not yet associated.)
It also means that it needs to keep track of the
work struct while associated for when it gets
disassociated (or disassociates.)

Change this to free the work struct after the
authentication completed successfully and
allocate a new one for associating, thereby
letting cfg80211 manage the auth state. Another
change necessary for this is to tell cfg80211
about all unicast deauth frames sent to mac80211
since now it can no longer check the auth state,
but that check was racy anyway.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: introduce flush operation
Johannes Berg [Wed, 23 Dec 2009 12:15:32 +0000 (13:15 +0100)]
mac80211: introduce flush operation

We've long lacked a good confirmation that frames
have really gone out, e.g. before going off-channel
for a scan. Add a flush() operation that drivers
can implement to provide that confirmation, and use
it in a few places:
 * before scanning sends the nullfunc frames
 * after scanning sends the nullfunc frames, if any
 * when going idle, to send any pending frames

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: add ieee80211_sdata_running
Johannes Berg [Wed, 23 Dec 2009 12:15:31 +0000 (13:15 +0100)]
mac80211: add ieee80211_sdata_running

Instead of always using netif_running(sdata->dev)
use ieee80211_sdata_running(sdata) now which is
just an inline containing netif_running() for now.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agortl8187: remove priv->mode
John W. Linville [Tue, 22 Dec 2009 23:13:05 +0000 (18:13 -0500)]
rtl8187: remove priv->mode

It is checked in add_interface, but there it is easily replaced with
a check of priv->vif.  If that information should become necessary,
it is available in vif->type anyway.

It is also checked in led_turn_on and led_turn_off, where I made the
substitutions as described above.  Of course, these checks seem to
have been incorrect since the driver was using NL80211_IFTYPE_MONITOR
to indicate no interface rather than NL80211_IFTYPE_UNSPECIFIED.
Anyway, I think these checks may be extraneous...?

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agortl8180: remove priv->mode
John W. Linville [Tue, 22 Dec 2009 23:13:04 +0000 (18:13 -0500)]
rtl8180: remove priv->mode

It is only checked in add_interface, and there it is easily replaced
with a check of priv->vif.  If that information should become necessary,
it is available in vif->type anyway.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Cleanup chip handling helper functions.
Gertjan van Wingerde [Tue, 22 Dec 2009 23:03:25 +0000 (00:03 +0100)]
rt2x00: Cleanup chip handling helper functions.

Let each of them take a struct rt2x00_dev pointer as argument instead of
a mixture of struct rt2x00_chip and struct rt2x00_dev pointers.
Preparation for further clean ups in the rt2x00 chip handling, especially
for rt2800 devices.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: convert RT2800PCI_PCI and RT2800PCI_SOC Kconfig symbols to booleans.
Gertjan van Wingerde [Tue, 22 Dec 2009 23:03:24 +0000 (00:03 +0100)]
rt2x00: convert RT2800PCI_PCI and RT2800PCI_SOC Kconfig symbols to booleans.

There is no need for Kconfig symbols RT2800PCI_PCI and RT2800PCI_SOC to be
tristates, as they are only used to check whether RT2800 PCI or SOC support
is to be compiled in.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Let rt2800lib check CONFIG_RT2X00_LIB_USB instead of CONFIG_RT2800USB
Gertjan van Wingerde [Tue, 22 Dec 2009 23:03:23 +0000 (00:03 +0100)]
rt2x00: Let rt2800lib check CONFIG_RT2X00_LIB_USB instead of CONFIG_RT2800USB

rt2800lib currently checks whether RT2800USB is enabled in the configuration.
Strictly speaking this is not necessary, it only needs to know whether the
generic rt2x00usb library functions are available. Therefore check for
RT2X00_LIB_USB instead.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Fix checks for rt2800 SOC support.
Gertjan van Wingerde [Tue, 22 Dec 2009 23:03:22 +0000 (00:03 +0100)]
rt2x00: Fix checks for rt2800 SOC support.

Fix checking for SOC support in rt2800pci. The wrong config (an unexisting
one) was checked.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowireless: remove CONFIG_WIRELESS_OLD_REGULATORY
John W. Linville [Fri, 18 Dec 2009 22:59:02 +0000 (17:59 -0500)]
wireless: remove CONFIG_WIRELESS_OLD_REGULATORY

This is no longer needed with the availability of
CONFIG_CFG80211_INTERNAL_REGDB.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowl1271: Prevent performing "join" before association
Juuso Oikarinen [Fri, 11 Dec 2009 13:41:10 +0000 (15:41 +0200)]
wl1271: Prevent performing "join" before association

There is a minor bug in the code causing a "join" to be performed before
there is an intention to associate. Fix this.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>