safe/jmp/linux-2.6
14 years agonetfilter: nf_conntrack: use mod_timer_pending() for conntrack refresh
Patrick McHardy [Sat, 13 Jun 2009 10:21:49 +0000 (12:21 +0200)]
netfilter: nf_conntrack: use mod_timer_pending() for conntrack refresh

Use mod_timer_pending() instead of atomic sequence of del_timer()/
add_timer(). mod_timer_pending() does not rearm an inactive timer,
so we don't need the conntrack lock anymore to make sure we don't
accidentally rearm a timer of a conntrack which is in the process
of being destroyed.

With this change, we don't need to take the global lock anymore at all,
counter updates can be performed under the per-conntrack lock.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: nf_log: fix sleeping function called from invalid context
Patrick McHardy [Sat, 13 Jun 2009 10:21:10 +0000 (12:21 +0200)]
netfilter: nf_log: fix sleeping function called from invalid context

Fix regression introduced by 17625274 "netfilter: sysctl support of
logger choice":

BUG: sleeping function called from invalid context at /mnt/s390test/linux-2.6-tip/arch/s390/include/asm/uaccess.h:234
in_atomic(): 1, irqs_disabled(): 0, pid: 3245, name: sysctl
CPU: 1 Not tainted 2.6.30-rc8-tipjun10-02053-g39ae214 #1
Process sysctl (pid: 3245, task: 000000007f675da0, ksp: 000000007eb17cf0)
0000000000000000 000000007eb17be8 0000000000000002 0000000000000000
       000000007eb17c88 000000007eb17c00 000000007eb17c00 0000000000048156
       00000000003e2de8 000000007f676118 000000007eb17f10 0000000000000000
       0000000000000000 000000007eb17be8 000000000000000d 000000007eb17c58
       00000000003e2050 000000000001635c 000000007eb17be8 000000007eb17c30
Call Trace:
(Ý<00000000000162e6>¨ show_trace+0x13a/0x148)
 Ý<00000000000349ea>¨ __might_sleep+0x13a/0x164
 Ý<0000000000050300>¨ proc_dostring+0x134/0x22c
 Ý<0000000000312b70>¨ nf_log_proc_dostring+0xfc/0x188
 Ý<0000000000136f5e>¨ proc_sys_call_handler+0xf6/0x118
 Ý<0000000000136fda>¨ proc_sys_read+0x26/0x34
 Ý<00000000000d6e9c>¨ vfs_read+0xac/0x158
 Ý<00000000000d703e>¨ SyS_read+0x56/0x88
 Ý<0000000000027f42>¨ sysc_noemu+0x10/0x16

Use the nf_log_mutex instead of RCU to fix this.

Reported-and-tested-by: Maran Pakkirisamy <maranpsamy@in.ibm.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agovirtio_net: Fix IP alignment on non-mergeable RX path
Herbert Xu [Fri, 12 Jun 2009 03:55:17 +0000 (20:55 -0700)]
virtio_net: Fix IP alignment on non-mergeable RX path

We need to enforce the IP alignment on the non-mergeable RX path just
like the other RX path.  Not doing so results in misaligned IP
headers.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
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 [Fri, 12 Jun 2009 03:00:44 +0000 (20:00 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/kaber/nf-next-2.6

14 years agonet: ntohs() misuse
Eric Dumazet [Fri, 12 Jun 2009 00:23:24 +0000 (17:23 -0700)]
net: ntohs() misuse

Some drivers incorrectly use ntohs() instead of htons()

A cleanup as htons() returns same result than ntohs(),
but better to use the proper one.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoMerge branch 'linux-2.6.31.y' of git://git.kernel.org/pub/scm/linux/kernel/git/inaky...
David S. Miller [Fri, 12 Jun 2009 00:11:33 +0000 (17:11 -0700)]
Merge branch 'linux-2.6.31.y' of git://git./linux/kernel/git/inaky/wimax

14 years agonetfilter: ip_tables: fix build error
Patrick McHardy [Thu, 11 Jun 2009 23:53:09 +0000 (01:53 +0200)]
netfilter: ip_tables: fix build error

Fix build error introduced by commit bb70dfa5 (netfilter: xtables:
consolidate comefrom debug cast access):

net/ipv4/netfilter/ip_tables.c: In function 'ipt_do_table':
net/ipv4/netfilter/ip_tables.c:421: error: 'comefrom' undeclared (first use in this function)
net/ipv4/netfilter/ip_tables.c:421: error: (Each undeclared identifier is reported only once
net/ipv4/netfilter/ip_tables.c:421: error: for each function it appears in.)

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agowimax: fix gcc warnings in sh4 when calling BUG()
Inaky Perez-Gonzalez [Thu, 11 Jun 2009 18:13:41 +0000 (11:13 -0700)]
wimax: fix gcc warnings in sh4 when calling BUG()

SH4's BUG() seems to confuse the compiler as it is considered to
return; thus, some functions would trigger usage of uninitialized
variables or non-void functions returning void.

Work around by initializing/returning.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax: fix warning caused by not checking retval of rfkill_set_hw_state()
Inaky Perez-Gonzalez [Thu, 11 Jun 2009 18:12:48 +0000 (11:12 -0700)]
wimax: fix warning caused by not checking retval of rfkill_set_hw_state()

Caused by an API update. The return value can be safely ignored, as
there is notthing we can do with it.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agomISDN: cleanup mISDNhw.h
Karsten Keil [Thu, 11 Jun 2009 13:52:10 +0000 (15:52 +0200)]
mISDN: cleanup mISDNhw.h

Remove unused stuff.

Signed-off-by: Karsten Keil <keil@b1-systems.de>
14 years agomISDN: Do not disable IRQ in ph_data_ind()
Karsten Keil [Tue, 9 Jun 2009 12:38:39 +0000 (14:38 +0200)]
mISDN: Do not disable IRQ in ph_data_ind()

This fix triggering the WARN_ON_ONCE(in_irq() || irqs_disabled()); in
local_bh_enable().

Here is no need to grab this lock, this was wrong at all and may
cause a deadlock and access to freed memory, since on a TEI remove
the current listelement can be deleted under us. So this is clearly
a case for list_for_each_entry_safe.

Signed-off-by: Karsten Keil <keil@b1-systems.de>
14 years agodrivers/isdn/i4l/isdn_tty.c: fix check for array overindexing
Roel Kluin [Wed, 10 Jun 2009 19:52:44 +0000 (12:52 -0700)]
drivers/isdn/i4l/isdn_tty.c: fix check for array overindexing

The check for overindexing of dev->mdm.info[] has an off-by-one.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Karsten Keil <keil@b1-systems.de>
14 years agomISDN: Free hfcpci IRQ if init was not successful
Andreas Mohr [Tue, 2 Jun 2009 16:15:12 +0000 (18:15 +0200)]
mISDN: Free hfcpci IRQ if init was not successful

If we get no interrupts for after 3 resets we need to unregister
the interrupt function, which is already done outside the loop.

Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Karsten Keil <keil@b1-systems.de>
14 years agomISDN: Fix overlapping data access
Karsten Keil [Tue, 2 Jun 2009 13:37:37 +0000 (15:37 +0200)]
mISDN: Fix overlapping data access

Remove code rewriting a buffer by itself.
This fix bug 12970 on bugzilla.kernel.org.

Signed-off-by: Karsten Keil <keil@b1-systems.de>
14 years agoISDN:Fix DMA alloc for hfcpci
Karsten Keil [Tue, 2 Jun 2009 12:57:35 +0000 (14:57 +0200)]
ISDN:Fix DMA alloc for hfcpci

Replace wrong code with correct DMA API functions.

Signed-off-by: Karsten Keil <keil@b1-systems.de>
14 years agonetfilter: nf_ct_tcp: fix up build after merge
Patrick McHardy [Thu, 11 Jun 2009 14:16:09 +0000 (16:16 +0200)]
netfilter: nf_ct_tcp: fix up build after merge

Replace the last occurence of tcp_lock by the per-conntrack lock.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net...
Patrick McHardy [Thu, 11 Jun 2009 14:00:49 +0000 (16:00 +0200)]
Merge branch 'master' of git://git./linux/kernel/git/davem/net-next-2.6

14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluet...
David S. Miller [Thu, 11 Jun 2009 12:47:43 +0000 (05:47 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/holtmann/bluetooth-next-2.6

14 years agobonding: fix multiple module load problem
Stephen Hemminger [Thu, 11 Jun 2009 12:46:04 +0000 (05:46 -0700)]
bonding: fix multiple module load problem

Some users still load bond module multiple times to create bonding
devices.  This accidentally was broken by a later patch about
the time sysfs was fixed.  According to Jay, it was broken
by:
   commit b8a9787eddb0e4665f31dd1d64584732b2b5d051
   Author: Jay Vosburgh <fubar@us.ibm.com>
   Date:   Fri Jun 13 18:12:04 2008 -0700

     bonding: Allow setting max_bonds to zero

Note: sysfs and procfs still produce WARN() messages when this is done
so the sysfs method is the recommended API.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoneigh: fix state transition INCOMPLETE->FAILED via Netlink request
Timo Teras [Thu, 11 Jun 2009 11:16:28 +0000 (04:16 -0700)]
neigh: fix state transition INCOMPLETE->FAILED via Netlink request

The current code errors out the INCOMPLETE neigh entry skb queue only from
the timer if maximum probes have been attempted and there has been no reply.
This also causes the transtion to FAILED state.

However, the neigh entry can be also updated via Netlink to inform that the
address is unavailable.  Currently, neigh_update() just stops the timers and
leaves the pending skb's unreleased. This results that the clean up code in
the timer callback is never called, preventing also proper garbage collection.

This fixes neigh_update() to process the pending skb queue immediately if
INCOMPLETE -> FAILED state transtion occurs due to a Netlink request.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agowimax/i2400m: use -EL3RST to indicate device reset instead of -ERESTARTSYS
Cindy H Kao [Thu, 11 Jun 2009 00:06:19 +0000 (17:06 -0700)]
wimax/i2400m: use -EL3RST to indicate device reset instead of -ERESTARTSYS

When the i2400m device resets, the driver code will force some
functions to return a -ERESTARTSYS error code, which can is used by
the caller to determine which recovery actions to take.

However, in certain situations the only thing that can be done is to
bubble up said error code to user space, for handling.

However, -ERESTARSYS was a poor choice, as it is supposed to be used
by the kernel only.

As such, replace -ERESTARTSYS with -EL3RST; as well, in
i2400m_msg_to_dev(), when the device is in boot mode (following a
recent reset), return -EL3RST instead of -ENODEV (meaning the device
is in bootrom mode after a reset, not that the device was
disconnected, and thus, normal commands cannot be executed).

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: when bootstrap fails, reinitialize the bootrom
Cindy H Kao [Wed, 10 Jun 2009 23:52:10 +0000 (16:52 -0700)]
wimax/i2400m: when bootstrap fails, reinitialize the bootrom

When a device reset happens during firmware load [in
i2400m_dev_bootstrap()], __i2400m_dev_start() will retry a number of
times. However, for those retries to be able to accomplish anything,
the device's bootrom has to be reinitialized.

Thus, on the retry path, pass the I2400M_MAC_REINIT to the firmware
load code.

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m/sdio: Move all the RX code to a unified, IRQ based receive routine
Inaky Perez-Gonzalez [Thu, 7 May 2009 08:02:39 +0000 (01:02 -0700)]
wimax/i2400m/sdio: Move all the RX code to a unified, IRQ based receive routine

The current SDIO code was working in polling mode for boot-mode
(firmware load) mode. This was causing issues on some hardware.

Moved all the RX code to use a unified IRQ handler that based on the
type of data the device is sending can discriminate and decide which
is the right destination.

As well, all the reads from the device are made to be at least the
block size (256); the driver will ignore the rest when not needed.

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: don't reset device when bootrom init retries are exceeded
Inaky Perez-Gonzalez [Fri, 5 Jun 2009 01:31:26 +0000 (09:31 +0800)]
wimax/i2400m: don't reset device when bootrom init retries are exceeded

When i2400m_bootrom_init() fails to put the device into a state of
being ready to accept firmware, the driver was currently trying to
reset it if it failed to do so. This is not too useful; as part of
trying to put the device in the right state a few resets have already
been tried.

At this point, things are probably fried out and an extra reset might
do more harm than good (for example causing reseting of other
functions in the same composite device).

So it is left up to the callers to determine the error path to take
(at the end this is always i2400m_setup(), who depending on how many
retries are left, might give up on the device).

From a fix by Cindy H. Kao.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m/sdio: Add device specific poke table.
Dirk Brandewie [Thu, 21 May 2009 18:56:35 +0000 (11:56 -0700)]
wimax/i2400m/sdio: Add device specific poke table.

Add a poke table for the SDIO device (as it is different than USB).

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
14 years agowimax/i2400m: move boot time poke table out of common driver
Dirk Brandewie [Thu, 21 May 2009 18:56:34 +0000 (11:56 -0700)]
wimax/i2400m: move boot time poke table out of common driver

This change moves the table of "pokes" performed on the device at boot
time to the bus specific portion of the driver.

Different models of the i2400m device supported by this driver require
different poke tables, thus having a single table that works for all
is impossible. For that, the table is moved to the bus-specific
driver, who can decide which table to use based on the specifics of
the device and point the generic driver to it.

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
14 years agowimax/i2400m: Allow bus-specific driver to specify retry count
Inaky Perez-Gonzalez [Wed, 3 Jun 2009 08:13:14 +0000 (16:13 +0800)]
wimax/i2400m: Allow bus-specific driver to specify retry count

The code that sets up the i2400m (firmware load and general driver
setup after it) includes a couple of retry loops.

The SDIO device sometimes can get in more complicated corners than the
USB one (due to its interaction with other SDIO functions), that
require trying a few more times.

To solve that, without having a failing USB device taking longer to be
considered dead, allow the retry counts to be specified by the
bus-specific driver, which the general driver takes as a parameter.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: if a device reboot happens during probe, handle it
Inaky Perez-Gonzalez [Wed, 3 Jun 2009 01:45:55 +0000 (09:45 +0800)]
wimax/i2400m: if a device reboot happens during probe, handle it

When a device reboot happens when we are under probe, with init_mutex
taken, make sure we can recover. Have dev_reset_handle set boot mode
and i2400m_msg_to_dev() will see it and fail gracefully instead of
timing out.

Found and diagnosed by Cindy H. Kao.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: fix oops when the TX FIFO fills up due to a missing check
Inaky Perez-Gonzalez [Wed, 27 May 2009 08:04:40 +0000 (01:04 -0700)]
wimax/i2400m: fix oops when the TX FIFO fills up due to a missing check

When the TX FIFO filled up and i2400m_tx_new() failed to allocate a
new TX message header, a missing check for said condition was causing a
kernel oops when trying to dereference a NULL i2400m->tx_msg pointer.

Found and diagnosed by Cindy H. Kao.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: don't reset device on i2400m_dev_shutdown()
Inaky Perez-Gonzalez [Fri, 22 May 2009 02:46:45 +0000 (19:46 -0700)]
wimax/i2400m: don't reset device on i2400m_dev_shutdown()

i2400m_dev_shutdown() tried to reset the device to put it in a known
state before shutting down.

But that turned out to be pointless. We reach this case in two paths:

 1 - when the device resets, to clean up state
 2 - when the driver is unloaded, for the same

however, in both cases it is pointless; in (1) the device is already
reset, why do it again? in (2) we can't -- the USB stack, for example,
doesn't allow communicating with the device when the driver is being
unbound and if the device is disconnected, the device is gone already.

So just remove it. Leave the function as a placeholder for future
cleanups that will be done from data allocated by the driver during
device operation.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: fix panic due to missed corner cases on tail_room calculation
Inaky Perez-Gonzalez [Thu, 21 May 2009 00:40:35 +0000 (17:40 -0700)]
wimax/i2400m: fix panic due to missed corner cases on tail_room calculation

i2400m_tx_skip_tail() needs to handle the special case of being called
when the tail room that is left over in the FIFO is zero.

This happens when a TX message header was opened at the very end of
the FIFO (without payloads). The i2400m_tx_close() code already marked
said TX message (header) to be skipped and this function should be
doing nothing.

It is called anyway because it is part of a common "corner case" path
handling which takes care of more cases than only this one.

The tail room computation was also improved to take care of the case
when tx_in is at the end of the buffer boundary; tail_room has to be
modded (%) to the buffer size. To do that in a single well-documented
place, __i2400m_tx_tail_room() is introduced and used.

Treat i2400m->tx_in == 0 as a corner case and handle it accordingly.

Found and diagnosed by Cindy H. Kao.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: fix panic/warnings caused by missed check on empty TX message
Inaky Perez-Gonzalez [Thu, 21 May 2009 00:16:05 +0000 (17:16 -0700)]
wimax/i2400m: fix panic/warnings caused by missed check on empty TX message

In some situations, when a new TX message header is started, there
might be no space for data payloads. In this case the message is left
with zero payloads and the i2400m_tx_close() function has just to mark
it as "to skip". If it tries to go ahead it will overwrite things
because there is no space to add padding as defined by the
bus-specific layer. This can cause buffer overruns and in some stress
cases, panics.

Found and diagnosed by Cindy H. Kao.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: rename misleading I2400M_PL_PAD to I2400M_PL_ALIGN
Inaky Perez-Gonzalez [Wed, 20 May 2009 23:53:30 +0000 (16:53 -0700)]
wimax/i2400m: rename misleading I2400M_PL_PAD to I2400M_PL_ALIGN

The constant is being use as an alignment factor, not as a padding
factor; made reading/reviewing the code quite confusing.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m/sdio: Implement I2400M_RT_BUS reset type
Dirk Brandewie [Tue, 12 May 2009 14:54:00 +0000 (07:54 -0700)]
wimax/i2400m/sdio: Implement I2400M_RT_BUS reset type

This reset type causes the WiMAX function to be disabled and
re-enabled, which will force the WiMAX device to reset and enter boot
mode.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
14 years agowimax/i2400m: Change d_printf() level for secure boot messages
Dirk Brandewie [Tue, 12 May 2009 13:22:27 +0000 (06:22 -0700)]
wimax/i2400m: Change d_printf() level for secure boot messages

Changing debug level of print out to support validation engineers
getting the messages they need.

Signed-off-by: <dirk.j.brandewie@intel.com>
14 years agowimax/i2400m: i2400m_schedule_work() doesn't need i2400m->work_queue
Inaky Perez-Gonzalez [Fri, 8 May 2009 19:46:26 +0000 (12:46 -0700)]
wimax/i2400m: i2400m_schedule_work() doesn't need i2400m->work_queue

By mistake, the BUG_ON() check was left in there and it will fail when
called if i2400m->work_queue is still not setup.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: i2400m's work queue should be initialized before RX support
Inaky Perez-Gonzalez [Fri, 8 May 2009 20:02:41 +0000 (13:02 -0700)]
wimax/i2400m: i2400m's work queue should be initialized before RX support

RX support is the only user of the work-queue, to process
reports/notifications from the device. Thus, it needs the work queue
to be initialized first.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: don't call netif_start_queue() in _tx_msg_sent()
Inaky Perez-Gonzalez [Fri, 8 May 2009 15:58:51 +0000 (08:58 -0700)]
wimax/i2400m: don't call netif_start_queue() in _tx_msg_sent()

Reported and fixed by Cindy H Kao.

When the device is stopped __i2400m_dev_stop() stops the network
queue.

However, when this is done in the middle of heavy network operation,
when the bus-specific subdriver is still wrapping up and it reports a
sent TX transaction with _tx_msg_sent() right after the device was
stopped, the queue was being started again, which was causing a stream
of oopsen and finally a panic.

In any case, said call has no place there. It's a left over from an
early implementation that was discarded later on.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: introduce module parameter to disable entering power save
Inaky Perez-Gonzalez [Thu, 7 May 2009 17:27:42 +0000 (10:27 -0700)]
wimax/i2400m: introduce module parameter to disable entering power save

The i2400m driver waits for the device to report being ready for
entering power save before asking it to do so. This module parameter
allows control of said operation; if disabled, the driver won't ask
the device to enter power save mode.

This is useful in setups where power saving is not so important or
when the overhead imposed by network reentry after power save is not
acceptable; by combining this with parameter 'idle_mode_disabled', the
driver will always maintain both the connection and the device in
active state.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agonet: No more expensive sock_hold()/sock_put() on each tx
Eric Dumazet [Thu, 11 Jun 2009 09:55:43 +0000 (02:55 -0700)]
net: No more expensive sock_hold()/sock_put() on each tx

One of the problem with sock memory accounting is it uses
a pair of sock_hold()/sock_put() for each transmitted packet.

This slows down bidirectional flows because the receive path
also needs to take a refcount on socket and might use a different
cpu than transmit path or transmit completion path. So these
two atomic operations also trigger cache line bounces.

We can see this in tx or tx/rx workloads (media gateways for example),
where sock_wfree() can be in top five functions in profiles.

We use this sock_hold()/sock_put() so that sock freeing
is delayed until all tx packets are completed.

As we also update sk_wmem_alloc, we could offset sk_wmem_alloc
by one unit at init time, until sk_free() is called.
Once sk_free() is called, we atomic_dec_and_test(sk_wmem_alloc)
to decrement initial offset and atomicaly check if any packets
are in flight.

skb_set_owner_w() doesnt call sock_hold() anymore

sock_wfree() doesnt call sock_put() anymore, but check if sk_wmem_alloc
reached 0 to perform the final freeing.

Drawback is that a skb->truesize error could lead to unfreeable sockets, or
even worse, prematurely calling __sk_free() on a live socket.

Nice speedups on SMP. tbench for example, going from 2691 MB/s to 2711 MB/s
on my 8 cpu dev machine, even if tbench was not really hitting sk_refcnt
contention point. 5 % speedup on a UDP transmit workload (depends
on number of flows), lowering TX completion cpu usage.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetxen: No need to check vfree() pointer.
Figo.zhang [Thu, 11 Jun 2009 09:49:10 +0000 (02:49 -0700)]
netxen: No need to check vfree() pointer.

vfree() does its own 'NULL' check, so no need for check before
calling it.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: Fix be_tx_q_clean() being called on freed queues
Sathya Perla [Wed, 10 Jun 2009 02:23:50 +0000 (02:23 +0000)]
be2net: Fix be_tx_q_clean() being called on freed queues

In the tx queue destroy path, be_tx_q_clean() is currently called after the tx queues are freed; it must be called before.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: Fix early reset of rx-completion
Sathya Perla [Wed, 10 Jun 2009 02:23:28 +0000 (02:23 +0000)]
be2net: Fix early reset of rx-completion

be_rx_compl_get() must not reset(via the valid word) the rx_compl as the rx_compl is not processed yet; it must be reset after it is processed.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: Fix rx stats updation in non-lro path
Sathya Perla [Wed, 10 Jun 2009 02:21:56 +0000 (02:21 +0000)]
be2net: Fix rx stats updation in non-lro path

rx stats are not getting updated when an rx_compl with only one frag is rcvd in non-lro path.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: fix netdev stats rx_errors and rx_dropped
Sathya Perla [Wed, 10 Jun 2009 02:21:16 +0000 (02:21 +0000)]
be2net: fix netdev stats rx_errors and rx_dropped

Fix netdev stat rx_errors to cover length related errors and checksum errors and rx_dropped to the pkts dropped due to lack of buffers

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agobe2net: Use cancel_delayed_work_sync instead of cancel_delayed_work()
Sathya Perla [Wed, 10 Jun 2009 02:18:35 +0000 (02:18 +0000)]
be2net: Use cancel_delayed_work_sync instead of cancel_delayed_work()

Use cancel_delayed_work_sycn instead of cancel_delayed_work() to reliably kill be_worker() as it rearms itself.

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agotehuti: No need check vfree() pointer.
Figo.zhang [Wed, 10 Jun 2009 04:18:38 +0000 (04:18 +0000)]
tehuti: No need check vfree() pointer.

vfree() does its own 'NULL' check, so no need for check before
calling it.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agovxge: No need for check vfree() pointer.
Figo.zhang [Wed, 10 Jun 2009 04:21:55 +0000 (04:21 +0000)]
vxge: No need for check vfree() pointer.

vfree() does its own 'NULL' check, so no need for check before
calling it.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocxgb3: remove __GFP_NOFAIL usage
Divy Le Ray [Tue, 9 Jun 2009 23:25:21 +0000 (23:25 +0000)]
cxgb3: remove __GFP_NOFAIL usage

Pre-allocate a skb at init time to be used for control messages to the HW
if skb allocation fails.

Tolerate failures to send messages initializing some memories at the cost of
parity error detection for these memories.
Retry sending connection id release messages if both alloc_skb(GFP_ATOMIC)
and alloc_skb(GFP_KERNEL) fail.
Do not bring the interface up if messages binding queue set to port fail to
be sent.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agor8169: use dev_kfree_skb() instead of dev_kfree_skb_irq()
Eric Dumazet [Tue, 9 Jun 2009 22:55:53 +0000 (22:55 +0000)]
r8169: use dev_kfree_skb() instead of dev_kfree_skb_irq()

rtl8169_tx_interrupt() is used from NAPI context, it can
directly free skbs. dev_kfree_skb_irq() is a leftover from
pre-NAPI times of this driver.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosfc: Expose 100/1000BASE-T MDI-X status via ethtool
Ben Hutchings [Wed, 10 Jun 2009 05:30:05 +0000 (05:30 +0000)]
sfc: Expose 100/1000BASE-T MDI-X status via ethtool

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agomdio: Expose 10GBASE-T MDI-X status via ethtool
Ben Hutchings [Wed, 10 Jun 2009 05:28:04 +0000 (05:28 +0000)]
mdio: Expose 10GBASE-T MDI-X status via ethtool

This is available in a standard MDIO register in 10GBASE-T PHYs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Allow RX buf rings to be > than 4096 bytes.
Ron Mercer [Wed, 10 Jun 2009 15:49:34 +0000 (15:49 +0000)]
qlge: Allow RX buf rings to be > than 4096 bytes.

RX buffer rings can be comprised of non-contiguous fixed
size chunks of memory. The ring is given to the hardware
as a pointer to a location that stores the location of
the queue.  If the queue is greater than 4096 bytes then
the hardware gets a list of said pointers.
This patch addes the necessary logic to generate the list if
the queue size exceeds 4096.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Relax alignment on TX harware queue.
Ron Mercer [Wed, 10 Jun 2009 15:49:33 +0000 (15:49 +0000)]
qlge: Relax alignment on TX harware queue.

The alignment was on size of queue boundary, but the hardware
only requires 4-byte alignment.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoatl1c: WAKE_MCAST tested twice, not WAKE_UCAST
Roel Kluin [Wed, 10 Jun 2009 09:55:03 +0000 (09:55 +0000)]
atl1c: WAKE_MCAST tested twice, not WAKE_UCAST

The WAKE_MCAST bit is tested twice, the first should be WAKE_UCAST.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Jie Yang <jie.yang@atheros.com>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <csnook@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agode2104x: support for systems lacking cache coherence
Risto Suominen [Wed, 10 Jun 2009 09:55:00 +0000 (09:55 +0000)]
de2104x: support for systems lacking cache coherence

Add a configurable Descriptor Skip Length for systems that lack cache
coherence.

(akpm: I think this should be done as a module parameter, not a
compile-tinme option)

Signed-off-by: Risto Suominen <Risto.Suominen@gmail.com>
Cc: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net/macvlan.c: fix cloning of tagged VLAN interfaces
sg.tweak@gmail.com [Wed, 10 Jun 2009 09:55:02 +0000 (09:55 +0000)]
drivers/net/macvlan.c: fix cloning of tagged VLAN interfaces

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

akpm: the reporter disappeared, so I typed it in again.

It is not possible to make clone of tagged VLAN interface to be used as
mac-based vlan interfave.

How reproducible:
Use any 802.1q tagged vlan interface, e.g. eth2.700 and clone it:

  ip link add link eth2.700 address 00:04:75:cb:38:09 macvlan0 type macvlan
  ip link set dev macvlan0 up
  ip addr add 10.195.1.1/24 dev macvlan0

So far, so good. Now try to ping anything via macvlan0:

  ping 10.195.1.2

Actual results:
For every attempted packet tx kernel writes to console:

------------[ cut here ]------------
WARNING: at net/8021q/vlan_dev.c:254 vlan_dev_hard_header+0x36/0x126 [8021q]()
Hardware name: M22ES
Modules linked in: arptable_filter arp_tables bridge veth macvlan arc4 ecb
ppp_mppe ppp_async crc_ccitt ppp_generic slhc autofs4 sunrpc 8021q garp stp
ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_tcpudp
x_tables dm_mirror dm_region_hash dm_log dm_multipath dm_mod sbs sbshc lp
floppy snd_intel8x0 joydev snd_seq_dummy snd_intel8x0m snd_ac97_codec
ide_cd_mod ac97_bus snd_seq_oss cdrom snd_seq_midi_event serio_raw snd_seq
snd_seq_device snd_pcm_oss snd_mixer_oss parport_pc snd_pcm parport battery
8139cp snd_timer i2c_sis96x ac button snd rtc_cmos rtc_core 8139too soundcore
rtc_lib mii i2c_core pcspkr snd_page_alloc pata_sis libata sd_mod scsi_mod ext3
jbd ehci_hcd ohci_hcd uhci_hcd [last unloaded: ip_tables]
Pid: 0, comm: swapper Tainted: G        W  2.6.29.3 #1
Call Trace:
 [<c0425f48>] warn_slowpath+0x60/0x9f
 [<c0425f6f>] warn_slowpath+0x87/0x9f
 [<dffb850d>] vlan_dev_hard_header+0x0/0x126 [8021q]
 [<dffb8543>] vlan_dev_hard_header+0x36/0x126 [8021q]
 [<dffb850d>] vlan_dev_hard_header+0x0/0x126 [8021q]
 [<df83155d>] macvlan_hard_header+0x3c/0x47 [macvlan]
 [<df831521>] macvlan_hard_header+0x0/0x47 [macvlan]
 [<c062bf3f>] arp_create+0xef/0x1ff
 [<c062c08c>] arp_send+0x3d/0x54
 [<c062c916>] arp_solicit+0x16c/0x177
 [<c05fadd2>] neigh_timer_handler+0x227/0x269
 [<c05fabab>] neigh_timer_handler+0x0/0x269
 [<c042ce4d>] run_timer_softirq+0xf0/0x141
 [<c0429e5a>] __do_softirq+0x76/0xf8
 [<c0429de4>] __do_softirq+0x0/0xf8
 <IRQ>  [<c044fb67>] handle_level_irq+0x0/0xad
 [<c0429db7>] irq_exit+0x35/0x62
 [<c04046bb>] do_IRQ+0xdf/0xf4
 [<c04035a7>] common_interrupt+0x27/0x2c
 [<c04079c5>] default_idle+0x2a/0x3d
 [<c0401bb6>] cpu_idle+0x57/0x70

Macvlan driver always uses standard ethernet header length for all types
of interface to which it is linked.  This patch fixes this problem.

Reported-by: <sg.tweak@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe100: add non-MII PHY support
Andreas Mohr [Wed, 10 Jun 2009 09:55:04 +0000 (09:55 +0000)]
e100: add non-MII PHY support

Restore support for cards with MII-lacking PHYs as compared to removed
pre-2.6.29 eepro100 driver: use full low-level MII I/O access abstraction
by providing clean PHY-specific mdio_ctrl() functions for either standard
MII-compliant cards, slightly special ones or non-MII PHY ones.

We now have another netdev_priv member for mdio_ctrl(), thus we have some
array indirection, but we save some additional opcodes for specific
phy_82552_v handling in the common case.

[akpm@linux-foundation.org: cleanups]
Signed-off-by: Andreas Mohr <andi@lisas.de>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Bruce Allan <bruce.w.allan@intel.com>
Cc: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
Cc: John Ronciak <john.ronciak@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoieee802154: Use '%Zu' printf format for size_t.
David S. Miller [Thu, 11 Jun 2009 09:10:19 +0000 (02:10 -0700)]
ieee802154: Use '%Zu' printf format for size_t.

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 [Thu, 11 Jun 2009 06:41:43 +0000 (23:41 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-next-2.6

14 years agocfg80211: fix rfkill locking problem
Johannes Berg [Wed, 10 Jun 2009 14:50:29 +0000 (16:50 +0200)]
cfg80211: fix rfkill locking problem

rfkill currently requires a global lock within the
rfkill_register() function, and holds that lock over
calls to the set_block() methods. This means that we
cannot hold a lock around rfkill_register() that we
also require in set_block(), directly or indirectly.
Fix cfg80211 to register rfkill outside the block
locked by its global lock. Much of what cfg80211 does
in the locked block doesn't need to be locked anyway.

Reported-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: disable PS while probing AP
Johannes Berg [Wed, 10 Jun 2009 13:16:52 +0000 (15:16 +0200)]
mac80211: disable PS while probing AP

When associated, but probing the AP because we detected
beacon loss, we need to disable powersave to be able to
receive the probe response. Change the code to do that by
checking whether we're trying to probe when determining
the possibility of going into PS, and recalculate the PS
ability at the necessary spots.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: disable moving between PS modes during scan
Luis R. Rodriguez [Wed, 10 Jun 2009 13:16:15 +0000 (15:16 +0200)]
mac80211: disable moving between PS modes during scan

We don't want to trigger moving between PS mode during scan,
because then we will sometimes end up sending nullfunc frames
during scan. We're supposed to only send one prior to scan
and after scan.

This fixes an oops which occured due to an assert in ath9k:

http://marc.info/?l=linux-wireless&m=124277331319024

The assert was happening because the rate control algorithm
figures it should find at least one valid dual stream or
single stream rate. Since we allow mac80211 to send nullfunc
frames during scan and dynamic PS was enabled at times we ended
up trying to send nullfunc frames for the target sta on the
wrong band for which we have no valid rate to communicate with
it. This breaks the assumptions in rate control.

We determine we also need to disable moving between PS modes
when not associated so lets just add that now as well, and we
should not have a ps_sdata when that interface cannot actually
go into PS because it's not associated.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: minor rfkill cleanup
Bob Copeland [Wed, 10 Jun 2009 03:43:11 +0000 (23:43 -0400)]
ath5k: minor rfkill cleanup

Always enable rfkill since the ifdefs in the code is not really worth
the Kconfig option.  Also fix a few code style things, and remove the
usage of the ah_gpio[] array so we can remove it later.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: clean up return value of __ieee80211_parse_tx_radiotap
Johannes Berg [Tue, 9 Jun 2009 17:48:25 +0000 (19:48 +0200)]
mac80211: clean up return value of __ieee80211_parse_tx_radiotap

The return type has more than two values, but it can validly
only ever return TX_DROP and TX_CONTINUE, so use a bool
instead of ieee80211_tx_result.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: don't use master netdev name
Johannes Berg [Tue, 9 Jun 2009 14:18:32 +0000 (16:18 +0200)]
mac80211: don't use master netdev name

Always use the wiphy name instead.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k: Fix tx stuck when connected to aggr disabled HT AP
Vasanthakumar Thiagarajan [Tue, 9 Jun 2009 09:58:21 +0000 (15:28 +0530)]
ath9k: Fix tx stuck when connected to aggr disabled HT AP

This patch along with my previous patch in mac80211 "Fix the
way ADDBA count..", fixes hang in tx when connected to an HT
AP which rejects/times out on addba req.

AGGR_ADDBA_PROGRESS should be cleared in aggr state when addba
negotiation is terminated due to either addba response is timed out
or addba is denied by the AP. With out clearing this bit,
all frames are queued onto s/w queue for getting tx'd as aggr and
will never be scheduled onto hw queue.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: Fix the way ADDBA request count being modified
Vasanthakumar Thiagarajan [Tue, 9 Jun 2009 08:41:46 +0000 (14:11 +0530)]
mac80211: Fix the way ADDBA request count being modified

addba_req_num[tid] is supposed to have the count of consecutive
addba request attempts on 'tid' which failed. This count is checked
against a retry threshold (3 times) before starting the addba negotiation.
This patch fixes the way this addba count is incremented/reset and thereby
avoids indefinite addba attempts.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agocfg80211: fix for duplicate response for driver reg request
Luis R. Rodriguez [Tue, 9 Jun 2009 01:54:37 +0000 (18:54 -0700)]
cfg80211: fix for duplicate response for driver reg request

As Pavel puts userspace can be stupid and should not
cause kernel crashes. In this case Pavel was able to
find a crash here but unable to reproduce. Either way
lets deal with this.

This should fix:

------------[ cut here ]------------
kernel BUG at /home/proski/src/linux-2.6/net/wireless/reg.c:2132!
Oops: Exception in kernel mode, sig: 5 [#1]
PowerMac
Modules linked in: ath5k ath [last unloaded: scsi_wait_scan]
NIP: c02f3eac LR: c02f3d08 CTR: 00000000
REGS: ef107aa0 TRAP: 0700   Not tainted  (2.6.30-rc8-wl)
MSR: 00029032 <EE,ME,CE,IR,DR>  CR: 88002442  XER: 20000000
TASK = ef84acb0[834] 'crda' THREAD: ef106000
GPR00: ef953840 ef107b50 ef84acb0 ef1380bc 00000006 c035a5c8 ef107b90 c035a5c8
GPR08: 00080005 efb68980 c0445628 ef130004 28002422 10019ce0 10012d3c 00000001
GPR16: 1070b2ac 00000005 48023558 1070b380 4802304c 00000000 ef107ddc c035a5c8
GPR24: ef107b78 c0443350 ef8bcb00 00000005 ef138080 c04a6a70 c04a0000 ef8bcb00
NIP [c02f3eac] set_regdom+0x4c4/0x4ec
LR [c02f3d08] set_regdom+0x320/0x4ec
Call Trace:
[ef107b50] [c02f3d08] set_regdom+0x320/0x4ec (unreliable)
[ef107b70] [c02f9d10] nl80211_set_reg+0x140/0x2d0
[ef107bc0] [c02aa2b8] genl_rcv_msg+0x204/0x228
[ef107c10] [c02a97cc] netlink_rcv_skb+0xe8/0x10c
[ef107c30] [c02aa094] genl_rcv+0x3c/0x5c
[ef107c40] [c02a9050] netlink_unicast+0x308/0x36c
[ef107c80] [c02a92bc] netlink_sendmsg+0x208/0x2f0
[ef107cd0] [c0282048] sock_sendmsg+0xac/0xe4
[ef107db0] [c02822b4] sys_sendmsg+0x234/0x2d8
[ef107f00] [c0283a88] sys_socketcall+0x108/0x258
[ef107f40] [c0012790] ret_from_syscall+0x0/0x38

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agob43: Add fw capabilities
Michael Buesch [Mon, 8 Jun 2009 19:04:57 +0000 (21:04 +0200)]
b43: Add fw capabilities

Add automagic feature flags, so the firmware can tell the driver
about supported features and the driver can switch features on/off as
needed.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorfkill: don't impose global states on resume (just restore the previous states)
Alan Jenkins [Mon, 8 Jun 2009 12:12:23 +0000 (13:12 +0100)]
rfkill: don't impose global states on resume (just restore the previous states)

Once rfkill-input is disabled, the "global" states will only be used as
default initial states.

Since the states will always be the same after resume, we shouldn't
generate events on resume.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agosony-laptop: no need to unblock rfkill on load
Alan Jenkins [Mon, 8 Jun 2009 10:31:11 +0000 (11:31 +0100)]
sony-laptop: no need to unblock rfkill on load

The re-written rfkill core ensures rfkill devices are initialized to
the system default state.  The core calls set_block after registration
so the driver shouldn't need to.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorfkill: remove set_global_sw_state
Alan Jenkins [Mon, 8 Jun 2009 12:27:27 +0000 (13:27 +0100)]
rfkill: remove set_global_sw_state

rfkill_set_global_sw_state() (previously rfkill_set_default()) will no
longer be exported by the rewritten rfkill core.

Instead, platform drivers which can provide persistent soft-rfkill state
across power-down/reboot should indicate their initial state by calling
rfkill_set_sw_state() before registration.  Otherwise, they will be
initialized to a default value during registration by a set_block call.

We remove existing calls to rfkill_set_sw_state() which happen before
registration, since these had no effect in the old model.  If these
drivers do have persistent state, the calls can be put back (subject
to testing :-).  This affects hp-wmi and acer-wmi.

Drivers with persistent state will affect the global state only if
rfkill-input is enabled.  This is required, otherwise booting with
wireless soft-blocked and pressing the wireless-toggle key once would
have no apparent effect.  This special case will be removed in future
along with rfkill-input, in favour of a more flexible userspace daemon
(see Documentation/feature-removal-schedule.txt).

Now rfkill_global_states[n].def is only used to preserve global states
over EPO, it is renamed to ".sav".

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: do not pass PS frames out of mac80211 again
Johannes Berg [Sun, 7 Jun 2009 19:58:37 +0000 (21:58 +0200)]
mac80211: do not pass PS frames out of mac80211 again

In order to handle powersave frames properly we had needed
to pass these out to the device queues again, and introduce
the skb->requeue bit. This, however, also has unnecessary
overhead by needing to 'clean up' already tried frames, and
this clean-up code is also buggy when software encryption
is used.

Instead of sending the frames via the master netdev queue
again, simply put them into the pending queue. This also
fixes a problem where frames for that particular station
could be reordered when some were still on the software
queues and older ones are re-injected into the software
queue after them.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agosony: fix rfkill code
Johannes Berg [Sun, 7 Jun 2009 19:57:08 +0000 (21:57 +0200)]
sony: fix rfkill code

During the rfkill conversion I added code to call
sony_nc_rfkill_set with the wrong argument, causing
a segfault Reinette reported. The compiler could not
catch that because the argument is, and needs to be,
void *.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorfkill: remove input Kconfig
Johannes Berg [Mon, 8 Jun 2009 06:14:28 +0000 (08:14 +0200)]
rfkill: remove input Kconfig

Now that we added the ioctl, there's no need to ask
the user to configure this. We will keep it enabled
for now, and eventually swap the default to n. Also
let embedded users select it only if they need it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agob43/legacy: port to cfg80211 rfkill
Johannes Berg [Sun, 7 Jun 2009 17:30:34 +0000 (12:30 -0500)]
b43/legacy: port to cfg80211 rfkill

This ports the b43/legacy rfkill code to the new API offered
by cfg80211 and thus removes a lot of useless stuff.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: added cfg80211 based rfkill support
Tobias Doerffel [Tue, 9 Jun 2009 15:33:27 +0000 (17:33 +0200)]
ath5k: added cfg80211 based rfkill support

This patch introduces initial rfkill support for the ath5k driver
based on rfkill support in the cfg80211 framework.
All rfkill related code is separated into newly created rfkill.c.

Changes to existing code are minimal:

* added a new data structure ath5k_rfkill to the ath5k_softc structure
* inserted calls to HW rfkill init/deinit routines
* ath5k_intr() has been extended to handle AR5K_INT_GPIO interrupts

Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorfkill: print events when input handler is disabled/enabled
Johannes Berg [Sun, 7 Jun 2009 10:26:52 +0000 (12:26 +0200)]
rfkill: print events when input handler is disabled/enabled

It is useful for debugging when we know if something disabled
the in-kernel rfkill input handler.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoar9170: xmit code revamp
Christian Lamparter [Sat, 6 Jun 2009 03:07:23 +0000 (05:07 +0200)]
ar9170: xmit code revamp

This patch is a back-port from aggregation testing code.

In the past, we didn't limit the amount of active tx urbs.
However, ar9170 only has a limited buffer reserved for
pending data frames.

This wasn't much of a problem with the slower 802.11b/g.
We simply stopped the full queue and moved on to something different
in the mean time. But - as you guessed it -  this simple approach
stands in way for a decent aggregation implementation.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoar9170: interpret firmware debug commands
Johannes Berg [Fri, 5 Jun 2009 09:47:43 +0000 (11:47 +0200)]
ar9170: interpret firmware debug commands

This adds new commands that the original firmware will not send
but we can use them to debug firmware.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211 : fix unaligned rx skb
matthieu castet [Thu, 4 Jun 2009 20:16:18 +0000 (22:16 +0200)]
mac80211 : fix unaligned rx skb

mac80211 is checking is the skb is aligned on 32 bit boundary.
But it is checking against ethernet header, whereas Linux expect IP
header aligned.  And ethernet ether size is 6*2+2=14, so aligning
ethernet header make IP header unaligned.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agob43: Fix possible unaligned u32 access
Matthieu CASTET [Thu, 4 Jun 2009 21:18:33 +0000 (23:18 +0200)]
b43: Fix possible unaligned u32 access

Fix possible unaligned u32 access in b43_generate_plcp_hdr().
Unaligned data is read/write with a u32 pointer instead of using the
packed structure. Some versions of gcc ignore the "packed" attribute, if the
structure element is accessed through a local pointer.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agomac80211: fix minstrel single-rate memory corruption
Bob Copeland [Fri, 5 Jun 2009 12:21:50 +0000 (08:21 -0400)]
mac80211: fix minstrel single-rate memory corruption

The minstrel rate controller periodically looks up rate indexes in
a sampling table.  When accessing a specific row and column, minstrel
correctly does a bounds check which, on the surface, appears to handle
the case where mi->n_rates < 2.  However, mi->sample_idx is actually
defined as an unsigned, so the right hand side is taken to be a huge
positive number when negative, and the check will always fail.

Consequently, the RC will overrun the array and cause random memory
corruption when communicating with a peer that has only a single rate.
The max value of mi->sample_idx is around 25 so casting to int should
have no ill effects.

Without the change, uptime is a few minutes under load with an AP
that has a single hard-coded rate, and both the AP and STA could
potentially crash.  With the change, both lasted 12 hours with a
steady load.

Thanks to Ognjen Maric for providing the single-rate clue so I could
reproduce this.

This fixes http://bugzilla.kernel.org/show_bug.cgi?id=12490 on the
regression list (also http://bugzilla.kernel.org/show_bug.cgi?id=13000).

Cc: stable@kernel.org
Reported-by: Sergey S. Kostyliov <rathamahata@gmail.com>
Reported-by: Ognjen Maric <ognjen.maric@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agonet/libertas: remove GPIO-CS handling in SPI interface code
Sebastian Andrzej Siewior [Thu, 4 Jun 2009 19:57:03 +0000 (21:57 +0200)]
net/libertas: remove GPIO-CS handling in SPI interface code

This removes the dependency on GPIO framework and lets the SPI host
driver handle the chip select. The SPI host driver is required to keep
the CS active for the entire message unless cs_change says otherwise.
This patch collects the two/three single SPI transfers into a message.
Also the delay in read path in case use_dummy_writes are not used is
moved into the SPI host driver.

Tested-by: Mike Rapoport <mike@compulab.co.il>
Tested-by: Andrey Yurovsky <andrey@cozybit.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorndis_wlan: cleanup: rename all rndis_wext* objects to rndis_wlan*
Jussi Kivilinna [Thu, 4 Jun 2009 17:13:25 +0000 (20:13 +0300)]
rndis_wlan: cleanup: rename all rndis_wext* objects to rndis_wlan*

Driver used to be named rndis_wext before inclusion to upstream. Since
rndis_wlan is being converted to cfg80211, use of rndis_wext* names
can be confusing. So rename all rndis_wext to rndis_wlan (as should
have been when driver was renamed).

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agorndis_wlan: cleanup: capitalize enum labels
Jussi Kivilinna [Thu, 4 Jun 2009 17:13:19 +0000 (20:13 +0300)]
rndis_wlan: cleanup: capitalize enum labels

Capitalize enum labels as told in Documents/CodingStyle.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoiwlwifi: port to cfg80211 rfkill
Johannes Berg [Thu, 4 Jun 2009 16:26:06 +0000 (18:26 +0200)]
iwlwifi: port to cfg80211 rfkill

This ports the iwlwifi rfkill code to the new API offered by
cfg80211 and thus removes a lot of useless stuff. The soft-
rfkill is completely removed since that is now handled by
setting the interfaces down.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agonetfilter: nf_conntrack: use per-conntrack locks for protocol data
Patrick McHardy [Wed, 10 Jun 2009 12:32:47 +0000 (14:32 +0200)]
netfilter: nf_conntrack: use per-conntrack locks for protocol data

Introduce per-conntrack locks and use them instead of the global protocol
locks to avoid contention. Especially tcp_lock shows up very high in
profiles on larger machines.

This will also allow to simplify the upcoming reliable event delivery patches.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agocan: sja1000_of_platform: fix build problems with printk format
Wolfgang Grandegger [Wed, 10 Jun 2009 08:12:39 +0000 (01:12 -0700)]
can: sja1000_of_platform: fix build problems with printk format

According to "Documentation/printk-formats.txt", if the type is
dependent on a config option for its size, like resource_size_t,
we should use a format specifier of its largest possible type and
explicitly cast to it.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosunrpc/auth_gss: Call rcu_barrier() on module unload.
Jesper Dangaard Brouer [Mon, 8 Jun 2009 03:11:48 +0000 (03:11 +0000)]
sunrpc/auth_gss: Call rcu_barrier() on module unload.

As the module uses rcu_call() we should make sure that all
rcu callback has been completed before removing the code.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agosctp: protocol.c call rcu_barrier() on unload.
Jesper Dangaard Brouer [Mon, 8 Jun 2009 03:11:43 +0000 (03:11 +0000)]
sctp: protocol.c call rcu_barrier() on unload.

On module unload call rcu_barrier(), this is needed as synchronize_rcu()
is not strong enough.  The kmem_cache_destroy() does invoke
synchronize_rcu() but it does not provide same protection.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agocan: af_can.c use rcu_barrier() on module unload.
Jesper Dangaard Brouer [Mon, 8 Jun 2009 03:11:38 +0000 (03:11 +0000)]
can: af_can.c use rcu_barrier() on module unload.

This module uses rcu_call() thus it should use rcu_barrier()
on module unload.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Acked-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonfnetlink_queue: Use rcu_barrier() on module unload.
Jesper Dangaard Brouer [Mon, 8 Jun 2009 03:11:33 +0000 (03:11 +0000)]
nfnetlink_queue: Use rcu_barrier() on module unload.

This module uses rcu_call() thus it should use rcu_barrier() on module unload.

Also fixed a trivial typo 'nfetlink' -> 'nfnetlink' in comment.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years ago8021q: Vlan driver should use rcu_barrier() on unload instead of syncronize_net()
Jesper Dangaard Brouer [Mon, 8 Jun 2009 03:11:28 +0000 (03:11 +0000)]
8021q: Vlan driver should use rcu_barrier() on unload instead of syncronize_net()

The VLAN 8021q driver needs to call rcu_barrier() when unloading the module,
instead of syncronize_net().  This is needed to make sure that outstanding
call_rcu() callbacks have completed, before the callback function code is
removed on module unload.

Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: bugfix: Get rid of errant spin_unlock().
Ron Mercer [Tue, 9 Jun 2009 06:35:12 +0000 (06:35 +0000)]
qlge: bugfix: Get rid of errant spin_unlock().

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Add set TX csum ethtool op.
Ron Mercer [Tue, 9 Jun 2009 05:39:31 +0000 (05:39 +0000)]
qlge: Add set TX csum ethtool op.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Add support for varied pcie function numbers.
Ron Mercer [Tue, 9 Jun 2009 05:39:32 +0000 (05:39 +0000)]
qlge: Add support for varied pcie function numbers.

Currently we support only PCIe NIC functions zero and one, and FCoE
functions as 3 and 4. Future configurations can mix these up in any
fashion.
This patch removes the 0-1 dependancy and allows usage of any of the 4
functions. We also find the alternate NIC function (if exist) and
determine our port number based on the comparison of the two functions:
Lower function number gets first port, higher function gets second port.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Add support for using alternate MAC address.
Ron Mercer [Tue, 9 Jun 2009 05:39:33 +0000 (05:39 +0000)]
qlge: Add support for using alternate MAC address.

Extract either manufacturer or Bladecenter Open Fabric
Manager (BOFM) MAC address.  BOFM may indicate an
alternate MAC address.  This patch honors that request
by extracting the MAC address from a different
flash location if a flag is set.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoqlge: Drop inbound frames > MTU.
Ron Mercer [Tue, 9 Jun 2009 05:39:28 +0000 (05:39 +0000)]
qlge: Drop inbound frames > MTU.

The max frame size register is set higher than the MTU to
accomodate FCoE frames.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>