cascardo/linux.git
13 years agodrivers/net/jme: Use pr_<level>
Joe Perches [Sat, 4 Sep 2010 22:21:05 +0000 (22:21 +0000)]
drivers/net/jme: Use pr_<level>

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert jeprintk to pr_err
Remove jeprintk macro define
Remove periods from end of logging messages
Coalesce format strings

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoisdn: cleanup: make buffer smaller
Dan Carpenter [Sat, 4 Sep 2010 08:33:03 +0000 (08:33 +0000)]
isdn: cleanup: make buffer smaller

This showed up in my audit because we use strcpy() to copy "ds" into a
32 character buffer inside the isdn_tty_dial() function.  But it turns
out that we only ever use the first 32 characters so it's OK.  I have
changed the declaration to make the static checkers happy.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoisdn: potential buffer overflows
Dan Carpenter [Sat, 4 Sep 2010 08:38:59 +0000 (08:38 +0000)]
isdn: potential buffer overflows

cs->ics.parm.setup.phone is a 32 character array.  In each of these
cases we're copying from a 35 character array into a 32 character array
so we should use strlcpy() instead of strcpy().

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoNET: bna, fix lock imbalance
Jiri Slaby [Sat, 4 Sep 2010 02:08:41 +0000 (02:08 +0000)]
NET: bna, fix lock imbalance

bnad_set_rx_mode omit to unlock bna_lock on one fail path. Fix that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Debashis Dutt <ddutt@brocade.com>
Cc: Rasesh Mody <rmody@brocade.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/fs_enet/fs_enet-main.c: Add of_node_put to avoid memory leak
Julia Lawall [Sat, 4 Sep 2010 00:12:43 +0000 (00:12 +0000)]
drivers/net/fs_enet/fs_enet-main.c: Add of_node_put to avoid memory leak

In this case, a device_node structure is stored in another structure that
is then freed without first decrementing the reference count of the
device_node structure.

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

// <smpl>
@r exists@
expression x;
identifier f;
position p1,p2;
@@

x@p1->f = \(of_find_node_by_path\|of_find_node_by_name\|of_find_node_by_phandle\|of_get_parent\|of_get_next_parent\|of_get_next_child\|of_find_compatible_node\|of_match_node\|of_find_node_by_type\|of_find_node_with_property\|of_find_matching_node\|of_parse_phandle\|of_node_get\)(...);
... when != of_node_put(x)
kfree@p2(x)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@
cocci.print_main("call",p1)
cocci.print_secs("free",p2)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: pskb_expand_head() optimization
Eric Dumazet [Thu, 2 Sep 2010 23:09:32 +0000 (23:09 +0000)]
net: pskb_expand_head() optimization

pskb_expand_head() blindly takes references on fragments before calling
skb_release_data(), potentially releasing these references.

We can add a fast path, avoiding these atomic operations, if we own the
last reference on skb->head.

Based on a previous patch from David

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Update module information and version
Santiago Leon [Fri, 3 Sep 2010 18:29:53 +0000 (18:29 +0000)]
ibmveth: Update module information and version

Add an entry to the MAINTAINERS file for ibmveth, clean up the copyright
and add all authors. Change the name of the module to reflect the product name
over the last number of years.

Considering all the changes we have made, bump the driver version.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Remove some unnecessary include files
Santiago Leon [Fri, 3 Sep 2010 18:29:47 +0000 (18:29 +0000)]
ibmveth: Remove some unnecessary include files

These files probably came across from the skeleton driver. Remove them.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Convert driver specific assert to BUG_ON
Santiago Leon [Fri, 3 Sep 2010 18:29:41 +0000 (18:29 +0000)]
ibmveth: Convert driver specific assert to BUG_ON

We had a driver specific assert function which wasn't enabled most of the
time. Convert them to BUG_ON and enable them all the time.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Return -EINVAL on all ->probe errors
Santiago Leon [Fri, 3 Sep 2010 18:29:36 +0000 (18:29 +0000)]
ibmveth: Return -EINVAL on all ->probe errors

We had a few cases where we returned success on error.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Coding style fixes
Santiago Leon [Fri, 3 Sep 2010 18:29:30 +0000 (18:29 +0000)]
ibmveth: Coding style fixes

Fix most of the kernel coding style issues in ibmveth.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Some formatting fixes
Santiago Leon [Fri, 3 Sep 2010 18:29:25 +0000 (18:29 +0000)]
ibmveth: Some formatting fixes

IbmVethNumBufferPools -> IBMVETH_NUM_BUFF_POOLS

Also change IBMVETH_MAX_MTU -> IBMVETH_MIN_MTU, it refers to the minimum
size not the maximum.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Convert driver specific error functions to netdev_err
Santiago Leon [Fri, 3 Sep 2010 18:29:19 +0000 (18:29 +0000)]
ibmveth: Convert driver specific error functions to netdev_err

Use netdev_err to standardise the error output.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Convert driver specific debug to netdev_dbg
Santiago Leon [Fri, 3 Sep 2010 18:29:14 +0000 (18:29 +0000)]
ibmveth: Convert driver specific debug to netdev_dbg

Use netdev_dbg to standardise the debug output.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Remove redundant function prototypes
Santiago Leon [Fri, 3 Sep 2010 18:29:08 +0000 (18:29 +0000)]
ibmveth: Remove redundant function prototypes

These functions appear before their use, so we can remove the redundant
prototypes.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Convert to netdev_alloc_skb
Santiago Leon [Fri, 3 Sep 2010 18:29:03 +0000 (18:29 +0000)]
ibmveth: Convert to netdev_alloc_skb

We were using alloc_skb which doesn't create any headroom. Change it to
use netdev_alloc_skb to match most other drivers.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: remove procfs code
Santiago Leon [Fri, 3 Sep 2010 18:28:58 +0000 (18:28 +0000)]
ibmveth: remove procfs code

We export all the driver specific statistics via ethtool, so there is no need
to duplicate this in procfs.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Enable IPv6 checksum offload
Santiago Leon [Fri, 3 Sep 2010 18:28:52 +0000 (18:28 +0000)]
ibmveth: Enable IPv6 checksum offload

This patch enables TCP checksum offload support for IPv6 on ibmveth.
This completely eliminates the generation and checking of the checksum
for IPv6 packets that are completely virtual and never touch a physical
network.  A basic TCPIPV6_STREAM netperf run showed a ~30% throughput
improvement when an MTU of 64000 was used.

This featured is enabled by default, as is the case for IPv4 checksum
offload.  When checksum offload is enabled the driver will negotiate
IPv4 and IPv6 offload with the firmware separately and enable what
is available.  As long as either IPv4 or IPv6 offload is supported
and enabled the device will report that checksum offload is enabled.
The device stats, available through ethtool, will display which
checksum offload features are supported/enabled by firmware.

Performance testing against a stock kernel shows no regression for IPv4
or IPv6 in terms of throughput or processor utilization with checksum
disabled or enabled.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Remove duplicate checksum offload setup code
Santiago Leon [Fri, 3 Sep 2010 18:28:47 +0000 (18:28 +0000)]
ibmveth: Remove duplicate checksum offload setup code

Remove code in the device probe function where we set up the checksum
offload feature and replace it with a call to an existing function that
is doing the same.  This is done to clean up the driver in preparation
of adding IPv6 checksum offload support.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Add optional flush of rx buffer
Santiago Leon [Fri, 3 Sep 2010 18:28:41 +0000 (18:28 +0000)]
ibmveth: Add optional flush of rx buffer

On some machines we can improve the bandwidth by ensuring rx buffers are
not in the cache. Add a module option that is disabled by default that flushes
rx buffers on insertion.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Add scatter-gather support
Santiago Leon [Fri, 3 Sep 2010 18:28:36 +0000 (18:28 +0000)]
ibmveth: Add scatter-gather support

ibmveth can scatter gather up to 6 segments. If we go over this then
we have no option but to call skb_linearize, like other drivers with
similar limitations do.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Use lighter weight read memory barrier in ibmveth_poll
Anton Blanchard [Tue, 7 Sep 2010 01:21:41 +0000 (18:21 -0700)]
ibmveth: Use lighter weight read memory barrier in ibmveth_poll

We want to order the read in ibmveth_rxq_pending_buffer and the read of
ibmveth_rxq_buffer_valid which are both cacheable memory. smp_rmb() is good
enough for this.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Add rx_copybreak
Santiago Leon [Fri, 3 Sep 2010 18:28:25 +0000 (18:28 +0000)]
ibmveth: Add rx_copybreak

For small packets, create a new skb and copy the packet into it so we
avoid tearing down and creating a TCE entry.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Add tx_copybreak
Santiago Leon [Fri, 3 Sep 2010 18:28:20 +0000 (18:28 +0000)]
ibmveth: Add tx_copybreak

Use the existing bounce buffer if we send a buffer under a certain size.
This saves the overhead of a TCE map/unmap.

I can't see any reason for the wmb() in the bounce buffer case, if we need
a barrier it will be before we call h_send_logical_lan but we have
nothing in the common case. Remove it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Remove LLTX
Santiago Leon [Fri, 3 Sep 2010 18:28:15 +0000 (18:28 +0000)]
ibmveth: Remove LLTX

The ibmveth adapter needs locking in the transmit routine to protect
the bounce_buffer but it sets LLTX and forgets to add any of its own
locking.

Just remove the deprecated LLTX option. Remove the stats lock in the process.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: batch rx buffer replacement
Santiago Leon [Fri, 3 Sep 2010 18:28:09 +0000 (18:28 +0000)]
ibmveth: batch rx buffer replacement

At the moment we try and replenish the receive ring on every rx interrupt.
We even have a pool->threshold but aren't using it.

To limit the maximum latency incurred when refilling, change the threshold
from 1/2 to 7/8 and reduce the largest rx pool from 768 buffers to 512 which
should be more than enough.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoibmveth: Remove integer divide caused by modulus
Santiago Leon [Fri, 3 Sep 2010 18:28:04 +0000 (18:28 +0000)]
ibmveth: Remove integer divide caused by modulus

Replace some modulus operators with an increment and compare to avoid
an integer divide.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agons83820: Use predefined autoneg constants
Denis Kirjanov [Fri, 3 Sep 2010 10:05:41 +0000 (10:05 +0000)]
ns83820: Use predefined autoneg constants

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agons83820: Add copper device settings
Denis Kirjanov [Fri, 3 Sep 2010 10:05:40 +0000 (10:05 +0000)]
ns83820: Add copper device settings

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agons83820: Remove unused have_optical variable.
Denis Kirjanov [Fri, 3 Sep 2010 10:05:39 +0000 (10:05 +0000)]
ns83820: Remove unused have_optical variable.

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotipc: Fix misleading error code when enabling Ethernet bearers
Allan Stephens [Fri, 3 Sep 2010 08:33:42 +0000 (08:33 +0000)]
tipc: Fix misleading error code when enabling Ethernet bearers

Cause TIPC to return EAGAIN if it is unable to enable a new Ethernet
bearer because one or more recently disabled Ethernet bearers are
temporarily consuming resources during shut down.  (The previous error
code, EDQUOT, is now returned only if all available Ethernet bearer
data structures are fully enabled at the time the request to enable an
additional bearer is received.)

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotipc: Ensure outgoing messages on Ethernet have sufficient headroom
Allan Stephens [Fri, 3 Sep 2010 08:33:40 +0000 (08:33 +0000)]
tipc: Ensure outgoing messages on Ethernet have sufficient headroom

Add code to expand the headroom of an outgoing TIPC message if the
sk_buff has insufficient room to hold the header for the associated
Ethernet device.  This change is necessary to ensure that messages
TIPC does not create itself (eg. incoming messages that are being
routed to another node) do not cause problems, since TIPC has no
control over the amount of headroom available in such messages.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotipc: Minor optimizations to name table translation code
Allan Stephens [Fri, 3 Sep 2010 08:33:39 +0000 (08:33 +0000)]
tipc: Minor optimizations to name table translation code

Optimizes TIPC's name table translation code to avoid unnecessary
manipulation of the node address field of the resulting port id when
name translation fails.  This change is possible because a valid port
id cannot have a reference field of zero, so examining the reference
only is sufficient to determine if the translation was successful.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agowan: make read-only data const
stephen hemminger [Thu, 2 Sep 2010 14:29:35 +0000 (14:29 +0000)]
wan: make read-only data const

Change several wan drivers to make strings and other initialize
only parameters const.

Compile tested only (with no new warnings)

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agor8169: fix rx checksum offload
Eric Dumazet [Mon, 6 Sep 2010 03:04:05 +0000 (20:04 -0700)]
r8169: fix rx checksum offload

While porting GRO to r8169, I found this driver has a bug in its rx
path.

All skbs given to network stack had their ip_summed set to
CHECKSUM_NONE, while hardware said they had correct TCP/UDP checksums.

The reason is driver sets skb->ip_summed on the original skb before the
copy eventually done by copybreak. The fresh skb gets the ip_summed =
CHECKSUM_NONE value, forcing network stack to recompute checksum, and
preventing my GRO patch to work.

Fix is to make the ip_summed setting after skb copy.

Note : rx_copybreak current value is 16383, so all frames are copied...

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb3: Avoid flush_workqueue() deadlock.
Casey Leedom [Thu, 2 Sep 2010 13:07:32 +0000 (13:07 +0000)]
cxgb3: Avoid flush_workqueue() deadlock.

Don't call flush_workqueue() on the cxgb3 Work Queue in cxgb_down() when
we're being called from the fatal error task ... which is executing on the
cxgb3 Work Queue.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb3: Leave interrupts for fatal errors asserted in common code.
Casey Leedom [Thu, 2 Sep 2010 13:07:31 +0000 (13:07 +0000)]
cxgb3: Leave interrupts for fatal errors asserted in common code.

Platform code needs to deal with them now.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb3: Set FATALPERREN.
Casey Leedom [Thu, 2 Sep 2010 13:07:30 +0000 (13:07 +0000)]
cxgb3: Set FATALPERREN.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb3: Add register bit definition for Fatal Parity Error.
Casey Leedom [Thu, 2 Sep 2010 13:07:29 +0000 (13:07 +0000)]
cxgb3: Add register bit definition for Fatal Parity Error.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: remove two kmemcheck annotations
Eric Dumazet [Fri, 3 Sep 2010 06:27:08 +0000 (06:27 +0000)]
net: remove two kmemcheck annotations

__alloc_skb() uses a memset() to clear all the beginning of skb,
including bitfields contained in 'flags1' & 'flags2'.

We dont need any more to use kmemcheck_annotate_bitfield() on these
fields. However, we still need it for the clone part, which is not
cleared.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotulip: use integrated netdev stats
Eric Dumazet [Fri, 3 Sep 2010 03:52:43 +0000 (03:52 +0000)]
tulip: use integrated netdev stats

struct tulip_private is a bit large (order-1 allocation even on 32bit
arch), try to shrink it, remove its net_device_stats field.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipv6: Update ip-sysctl.txt documentation for recent changes to accept_ra and forwarding
Thomas Graf [Fri, 3 Sep 2010 05:47:30 +0000 (05:47 +0000)]
ipv6: Update ip-sysctl.txt documentation for recent changes to accept_ra and forwarding

Documentation for recent changes to the tunables accept_ra and
forwarding.

Signed-off-by: Thomas Graf <tgraf@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipv6: add special mode forwarding=2 to send RS while configured as router
Thomas Graf [Fri, 3 Sep 2010 03:04:20 +0000 (03:04 +0000)]
ipv6: add special mode forwarding=2 to send RS while configured as router

Similar to accepting router advertisement, the IPv6 stack does not send router
solicitations if forwarding is enabled.

This patch enables this behavior to be overruled by setting forwarding to the
special value 2.

Signed-off-by: Thomas Graf <tgraf@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipv6: add special mode accept_ra=2 to accept RA while configured as router
Thomas Graf [Fri, 3 Sep 2010 02:59:14 +0000 (02:59 +0000)]
ipv6: add special mode accept_ra=2 to accept RA while configured as router

The current IPv6 behavior is to not accept router advertisements while
forwarding, i.e. configured as router.

This does make sense, a router is typically not supposed to be auto
configured. However there are exceptions and we should allow the
current behavior to be overwritten.

Therefore this patch enables the user to overrule the "if forwarding
enabled then don't listen to RAs" rule by setting accept_ra to the
special value of 2.

An alternative would be to ignore the forwarding switch alltogether
and solely accept RAs based on the value of accept_ra. However, I
found that if not intended, accepting RAs as a router can lead to
strange unwanted behavior therefore we it seems wise to only do so
if the user explicitely asks for this behavior.

Signed-off-by: Thomas Graf <tgraf@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net: avoid some skb->ip_summed initializations
Eric Dumazet [Thu, 2 Sep 2010 20:07:41 +0000 (13:07 -0700)]
drivers/net: avoid some skb->ip_summed initializations

fresh skbs have ip_summed set to CHECKSUM_NONE (0)

We can avoid setting again skb->ip_summed to CHECKSUM_NONE in drivers.

Introduce skb_checksum_none_assert() helper so that we keep this
assertion documented in driver sources.

Change most occurrences of :

skb->ip_summed = CHECKSUM_NONE;

by :

skb_checksum_none_assert(skb);

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoMerge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
David S. Miller [Thu, 2 Sep 2010 19:45:44 +0000 (12:45 -0700)]
Merge branch 'for-davem' of git://git./linux/kernel/git/linville/wireless-next-2.6

13 years agobna: fix stats handling
Eric Dumazet [Thu, 2 Sep 2010 19:45:02 +0000 (12:45 -0700)]
bna: fix stats handling

get_stats() method incorrectly clears a global array before folding
various stats. This can break SNMP applications.

Switch to 64 bit flavor to work on a user supplied buffer, and provide
64bit counters even on 32bit arches.

Fix a bug in bnad_netdev_hwstats_fill(), for rx_fifo_errors, missing a
folding (only the last counter was taken into account)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
John W. Linville [Thu, 2 Sep 2010 17:30:07 +0000 (13:30 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-next-2.6 into for-davem

13 years agonet: arp: code cleanup
Changli Gao [Thu, 2 Sep 2010 03:56:51 +0000 (03:56 +0000)]
net: arp: code cleanup

Clean the code up according to Documentation/CodingStyle.

Don't initialize the variable dont_send in arp_process().

Remove the temporary varialbe flags in arp_state_to_flags().

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: dev_add_pack() & __dev_remove_pack() changes
Eric Dumazet [Thu, 2 Sep 2010 03:53:46 +0000 (03:53 +0000)]
net: dev_add_pack() & __dev_remove_pack() changes

Add a small helper ptype_head() to get the head to manipulate

dev_add_pack() & __dev_remove_pack() can use a spinlock without
blocking BH, since softirq use RCU, and these functions are run from
process context only.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: Improve comments in include/linux/phy.h
Peter Meerwald [Thu, 2 Sep 2010 04:06:24 +0000 (04:06 +0000)]
net: Improve comments in include/linux/phy.h

Correct state range of PHY bus addresses (i.e. 0-31) in comment,
make spelling of PHY consistent in comments.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipvs: use pkts for SCTP too
Julian Anastasov [Wed, 1 Sep 2010 22:19:14 +0000 (22:19 +0000)]
ipvs: use pkts for SCTP too

Use correctly the in_pkts packet counter also for SCTP

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: another last_rx round
Eric Dumazet [Thu, 2 Sep 2010 16:19:32 +0000 (09:19 -0700)]
net: another last_rx round

Kill last_rx use in l2tp and two net drivers

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agostarfire: Temporary kludge to fix powerpc build.
David S. Miller [Thu, 2 Sep 2010 01:35:59 +0000 (18:35 -0700)]
starfire: Temporary kludge to fix powerpc build.

Add a dma_addr_t 64-bit case for powerpc with 64-bit phys addresses.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotcp: update also tcp_output with regard to RFC 5681
Gerrit Renker [Wed, 1 Sep 2010 00:28:35 +0000 (00:28 +0000)]
tcp: update also tcp_output with regard to RFC 5681

Thanks to Ilpo Jarvinen, this updates also the initial window
setting for tcp_output with regard to RFC 5681.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: make rx_queue sysfs_ops const
stephen hemminger [Tue, 31 Aug 2010 12:14:13 +0000 (12:14 +0000)]
net: make rx_queue sysfs_ops const

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agopxa168_eth: remove duplicated #include
Huang Weiyi [Mon, 30 Aug 2010 13:06:20 +0000 (13:06 +0000)]
pxa168_eth: remove duplicated #include

Remove duplicated #include('s) in
  drivers/net/pxa168_eth.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomac80211: only cancel software-based scans on suspend
John W. Linville [Wed, 1 Sep 2010 20:12:28 +0000 (16:12 -0400)]
mac80211: only cancel software-based scans on suspend

Otherwise the hardware scan handler could access an invalid scan request
structure.  The driver should cancel any pending hardware scans during
the suspend process anyway, so also add a warning if the hardware scan
is still pending when the device resumes.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agonet: skbuff.c cleanup
Eric Dumazet [Wed, 1 Sep 2010 05:25:10 +0000 (05:25 +0000)]
net: skbuff.c cleanup

(skb->data - skb->head) can be changed by skb_headroom(skb)

Remove some uses of NET_SKBUFF_DATA_USES_OFFSET, using
(skb_end_pointer(skb) - skb->head) or
(skb_tail_pointer(skb) - skb->head) : compiler does the right thing,
and this is more readable for us ;)

(struct skb_shared_info *) casts in pskb_expand_head() to help memcpy()
to use aligned moves.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoskge: add GRO support
Eric Dumazet [Tue, 31 Aug 2010 18:25:32 +0000 (18:25 +0000)]
skge: add GRO support

- napi_gro_flush() is exported from net/core/dev.c, to avoid
  an irq_save/irq_restore in the packet receive path.
- use napi_gro_receive() instead of netif_receive_skb()
- use napi_gro_flush() before calling __napi_complete()
- turn on NETIF_F_GRO by default
- Tested on a Marvell 88E8001 Gigabit NIC

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/can/mscan/mpc5xxx_can.c: Add of_node_put to avoid memory leak
Julia Lawall [Tue, 31 Aug 2010 07:44:00 +0000 (07:44 +0000)]
drivers/net/can/mscan/mpc5xxx_can.c: Add of_node_put to avoid memory leak

Add a call to of_node_put in the error handling code following a call to
of_find_matching_node.

This patch also moves the existing call to of_node_put after the call to
iounmap in the error handling code, to make it possible to jump to
of_node_put without doing iounmap.  These appear to be disjoint operations,
so the ordering doesn't matter.

This patch furthermore changes the -ENODEV result in the error handling
code for of_find_matching_node to a return of 0, as found in the error
handling code for of_iomap, because the return type of the function is
unsigned.

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

// <smpl>
@r exists@
local idexpression x;
expression E,E1,E2;
statement S;
@@

*x =
(of_find_node_by_path
|of_find_node_by_name
|of_find_node_by_phandle
|of_get_parent
|of_get_next_parent
|of_get_next_child
|of_find_compatible_node
|of_match_node
|of_find_node_by_type
|of_find_node_with_property
|of_find_matching_node
|of_parse_phandle
)(...);
...
if (x == NULL) S
<... when != x = E
*if (...) {
  ... when != of_node_put(x)
      when != if (...) { ... of_node_put(x); ... }
(
  return <+...x...+>;
|
*  return ...;
)
}
...>
(
E2 = x;
|
of_node_put(x);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agons83820: Use helper to disable chip interrupts
Denis Kirjanov [Mon, 30 Aug 2010 21:19:15 +0000 (21:19 +0000)]
ns83820: Use helper to disable chip interrupts

Use helper routine to disable chip interrupts.

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: tunnels should use rcu_dereference
Eric Dumazet [Mon, 30 Aug 2010 11:07:25 +0000 (11:07 +0000)]
net: tunnels should use rcu_dereference

tunnel4_handlers, tunnel64_handlers, tunnel6_handlers and
tunnel46_handlers are protected by RCU, but we dont use appropriate rcu
primitives to scan them. rcu_lock() is already held by caller.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Update version to 1.52.53-5
Yaniv Rosner [Wed, 1 Sep 2010 09:51:37 +0000 (09:51 +0000)]
bnx2x: Update version to 1.52.53-5

Update version to 1.52.53-5

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Add BCM84823 to the supported PHYs
Yaniv Rosner [Wed, 1 Sep 2010 09:51:35 +0000 (09:51 +0000)]
bnx2x: Add BCM84823 to the supported PHYs

Add BCM84823 to the supported PHYs

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Change BCM848xx LED configuration
Yaniv Rosner [Wed, 1 Sep 2010 09:51:33 +0000 (09:51 +0000)]
bnx2x: Change BCM848xx LED configuration

Change 848xx LED configuration according to the new microcode (Boards
were shipped with only with the new microcode)

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Remove unneeded setting of XAUI low power to BCM8727
Yaniv Rosner [Wed, 1 Sep 2010 09:51:30 +0000 (09:51 +0000)]
bnx2x: Remove unneeded setting of XAUI low power to BCM8727

Remove unneeded setting of XAUI low power to BCM8727. This was required
only in older microcode which is not in the field.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Change BCM848xx configuration according to IEEE
Yaniv Rosner [Wed, 1 Sep 2010 09:51:25 +0000 (09:51 +0000)]
bnx2x: Change BCM848xx configuration according to IEEE

Change BCM848xx behavior to fit IEEE such that setting 10Mb/100Mb will
use force speed, and setting 1Gb/10Gb will use auto-negotiation with the
specific speed advertised

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Reset link before any new link settings
Yaniv Rosner [Wed, 1 Sep 2010 09:51:23 +0000 (09:51 +0000)]
bnx2x: Reset link before any new link settings

Reset link before any new link settings to avoid potential link issue
caused by previous link settings

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Fix potential link issue In BCM8727 based boards
Yaniv Rosner [Wed, 1 Sep 2010 09:51:20 +0000 (09:51 +0000)]
bnx2x: Fix potential link issue In BCM8727 based boards

In BCM8727 based boards, setting default 10G link speed after link was
set to 1G may lead to link down issue. The problem was setting the right
value, but to the wrong registers

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Fix potential link issue of BCM8073/BCM8727
Yaniv Rosner [Wed, 1 Sep 2010 09:51:17 +0000 (09:51 +0000)]
bnx2x: Fix potential link issue of BCM8073/BCM8727

Fix potential link issue caused by insufficient delay time during SPIROM
load of BCM8073/BCM8727

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: add cksum flag
Amit Kumar Salecha [Tue, 31 Aug 2010 17:17:53 +0000 (17:17 +0000)]
qlcnic: add cksum flag

o New CKSUM flag added by fw to notify cksum is verified.
o Update version to 5.0.9

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: mac vlan learning support
Amit Kumar Salecha [Tue, 31 Aug 2010 17:17:52 +0000 (17:17 +0000)]
qlcnic: mac vlan learning support

Hypervisor allows, two VM's interfaces to have same mac address.
These VM's interfaces get differentiate with Vlan tag.
This patch add support to learn and configure mac+vlan filter on device.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: support mac learning
Amit Kumar Salecha [Tue, 31 Aug 2010 17:17:51 +0000 (17:17 +0000)]
qlcnic: support mac learning

Device eswitch need to configure with VM's mac address.
Hypervisor doesn't provide any utility/callbacks to get VM's mac address.
Unicast mac address filter improves performance and also provide
packet loopback capability i.e communication between VM.

Above features is by default off, can be turned on with module parameter
'mac_learn'.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix mac override capability
Rajesh Borundia [Tue, 31 Aug 2010 17:17:50 +0000 (17:17 +0000)]
qlcnic: fix mac override capability

o Rename mac_learning to mac_override
o Added check in set_mac to return error if mac override is disabled.
o Disabling mac_override only supported for Non priviledged functions.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix panic while using eth_hdr
Rajesh Borundia [Tue, 31 Aug 2010 17:17:49 +0000 (17:17 +0000)]
qlcnic: fix panic while using eth_hdr

o skb->mac_header is not set, so machine panics while using function eth_hdr.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix mac anti spoof policy
Rajesh Borundia [Tue, 31 Aug 2010 17:17:48 +0000 (17:17 +0000)]
qlcnic: fix mac anti spoof policy

o Allow enabling/disabling mac anti spoof policy only for
  Non privilege functions.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix for setting default eswitch config
Rajesh Borundia [Tue, 31 Aug 2010 17:17:47 +0000 (17:17 +0000)]
qlcnic: fix for setting default eswitch config

o Default eswitch config was set, even before eswitch capabilty get detected.
As a result setting default config was getting fail.

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix mac addr read
Rajesh Borundia [Tue, 31 Aug 2010 17:17:46 +0000 (17:17 +0000)]
qlcnic: fix mac addr read

o Mac addr was read from flash for every fw reset
for Non-priviledge function.It should be read only once.
o Remove unnecessary get_mac_addr callback

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: add api version in reg dump
Rajesh Borundia [Tue, 31 Aug 2010 17:17:45 +0000 (17:17 +0000)]
qlcnic: add api version in reg dump

o ethtool reg version bumped to 2

Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: backout firmware initialization update
Sony Chacko [Tue, 31 Aug 2010 17:17:44 +0000 (17:17 +0000)]
qlcnic: backout firmware initialization update

o Backing out "firmware initialization update" changes, commit-id
  "d4066833bb1b35fefb1dd45eb2b10659d46bf151".
o fix heartbit spelling, it should be heartbeat

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agostmmac: Fix another build warning.
David S. Miller [Wed, 1 Sep 2010 03:56:48 +0000 (20:56 -0700)]
stmmac: Fix another build warning.

drivers/net/stmmac/dwmac100_core.c: In function 'dwmac100_dump_mac_regs':
drivers/net/stmmac/dwmac100_core.c:47: warning: cast from pointer to integer of different size

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agogro: unexport tcp4_gro_receive and tcp4_gro_complete
Eric Dumazet [Tue, 31 Aug 2010 10:23:47 +0000 (10:23 +0000)]
gro: unexport tcp4_gro_receive and tcp4_gro_complete

tcp4_gro_receive() and tcp4_gro_complete() dont need to be exported.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: add a comment on netdev->last_rx
Eric Dumazet [Tue, 31 Aug 2010 07:40:16 +0000 (07:40 +0000)]
net: add a comment on netdev->last_rx

As some driver authors seem to reintroduce dev->last_rx use,
add a comment to strongly discourage this.

Since commit 6cf3f41e6c0 (bonding, net: Move last_rx update into bonding
recv logic), network drivers dont need to update last_rx themselves,
unless they use this field to implement a timeout.

Not updating last_rx helps not dirtying a cache line, improving
performance in SMP.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agopktgen: remove non used variable
Eric Dumazet [Tue, 31 Aug 2010 01:57:35 +0000 (01:57 +0000)]
pktgen: remove non used variable

remove non used variable "queue" in pg_cleanup

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agovlan: Use vlan_dev_real_dev in vlan_hwaccel_do_receive
Jiri Pirko [Tue, 31 Aug 2010 04:58:18 +0000 (04:58 +0000)]
vlan: Use vlan_dev_real_dev in vlan_hwaccel_do_receive

[patch net-next-2.6] vlan: Use vlan_dev_real_dev in vlan_hwaccel_do_receive

Use helper as in other places.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoPhonet: do not set POLLOUT in case of send buffer overflow
Rémi Denis-Courmont [Mon, 30 Aug 2010 12:57:05 +0000 (12:57 +0000)]
Phonet: do not set POLLOUT in case of send buffer overflow

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoPhonet: correct sendmsg() error code from sock_alloc_send_skb()
Rémi Denis-Courmont [Mon, 30 Aug 2010 12:57:04 +0000 (12:57 +0000)]
Phonet: correct sendmsg() error code from sock_alloc_send_skb()

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoPhonet: restore flow control credits when sending fails
Rémi Denis-Courmont [Mon, 30 Aug 2010 12:57:03 +0000 (12:57 +0000)]
Phonet: restore flow control credits when sending fails

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomac80211: cancel scan in ieee80211_restart_hw if software scan pending
John W. Linville [Mon, 30 Aug 2010 19:12:02 +0000 (15:12 -0400)]
mac80211: cancel scan in ieee80211_restart_hw if software scan pending

This function exists to clean-up after a hardware error or something
similar.  The restart is accomplished using the same infrastructure used
to resume after a suspend.  The suspend path cancels running scans, so
it seems appropriate to do that here as well for software-based scans.
If a hardware-based scan is pending, issue a warning message since this
indicates that the drivers has failed to clean-up after itself.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Cleanup rt2x00usb_watchdog_reset_tx
Ivo van Doorn [Mon, 30 Aug 2010 19:15:51 +0000 (21:15 +0200)]
rt2x00: Cleanup rt2x00usb_watchdog_reset_tx

rt2x00usb_watchdog_reset_tx performs the same task
as rt2x00usb_kill_tx_queue, with the only difference
is that it waits for all entries to be returned to
the driver and for all frames the status has been
reported to mac80211.

We can easily split this task by calling rt2x00usb_kill_tx_queue,
sleep for a short period and invoke the TX status reporting
function. By adding the sleep() to the kill_entry we make sure
that even during shutdown we guarentee the entry has been killed when
the function returns. To make this work correctly the interrupt
handlers have to be updated to prevent checking for the RADIO_ENABLED
flag too early which prevents the ownership of the entry to be reset.
Additionally a check for the DEVICE_PRESENT flag is not required but
is nice to prevent race conditions when the device was unplugged.

Additionally rather then calling rt2x00usb_work_txdone() for
status reporting we let the driver perform the TX status reporting
first. If this is not sufficient then rt2x00usb_work_txdone() will
still be used to cleanup the mess.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Split watchdog check into a DMA and STATUS timeout
Ivo van Doorn [Mon, 30 Aug 2010 19:15:19 +0000 (21:15 +0200)]
rt2x00: Split watchdog check into a DMA and STATUS timeout

The watchdog for rt2800usb triggers frequently causing all URB's
to be canceled often enough to interrupt the normal TX flow.
More research indicated that not the URB upload to the USB host
were hanging, but instead the TX status reports.

To correctly detect what is going on, we introduce Q_INDEX_DMA_DONE
which is an index counter between Q_INDEX_DONE and Q_INDEX and indicates
if the frame has been transfered to the device.

This also requires the rt2x00queue timeout functions to be updated
to differentiate between a DMA timeout (time between Q_INDEX and
Q_INDEX_DMA_DONE timeout) and a STATUS timeout (time between
Q_INDEX_DMA_DONE and Q_INDEX_DONE timeout)

All Q_INDEX_DMA_DONE code was taken from the RFC from
Helmut Schaa <helmut.schaa@googlemail.com> for the implementation
for watchdog for rt2800pci.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Correctly kill beacon queue
Ivo van Doorn [Mon, 30 Aug 2010 19:14:56 +0000 (21:14 +0200)]
rt2x00: Correctly kill beacon queue

USB devices upload their beacon and then automatically send
it out every beacon interval. However when killing a TX queue
we only kill the URB and not the actual transmission of the beacon.

This will reset the Beacon register to prevent any beacons from
being transmitted.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Set PWR_PIN_CFG during initialization
Ivo van Doorn [Mon, 30 Aug 2010 19:14:38 +0000 (21:14 +0200)]
rt2x00: Set PWR_PIN_CFG during initialization

Add PWR_PIN_CFG initialization for rt2800usb at the same point
as rt2800pci.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Don't set unicast/BSSID masks when clearning MAC or BSSID
Ivo van Doorn [Mon, 30 Aug 2010 19:14:15 +0000 (21:14 +0200)]
rt2x00: Don't set unicast/BSSID masks when clearning MAC or BSSID

When configuring the MAC_ADDR or MAC_BSSID with an empty address,
the UNICAST_TO_ME_MASK and BSS_ID_MASK must also be reset to prevent
invalid interpretation of the addresses.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Wakeup hardware before loading firmware
Ivo van Doorn [Mon, 30 Aug 2010 19:13:54 +0000 (21:13 +0200)]
rt2x00: Wakeup hardware before loading firmware

According to the legacy drivers the AUTOWAKEUP_CFG
register must be reset to 0 before loading the firmware.

Instead of during rt2800{pci,usb}_write_firmware it
must actually be done in rt2800_load_firmware() before
resetting the WPDMA_GLO_CFG and PWR_PIN_CFG registers.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Validate TX status results with current data entry
Ivo van Doorn [Mon, 30 Aug 2010 19:13:30 +0000 (21:13 +0200)]
rt2x00: Validate TX status results with current data entry

Instead of printing a warning when the PID, ACK, or WCID of
an entry don't match the TX status report, we should skip the
entry to search for the entry which actually does match
the TX status data.

This reduces the number of watchdog errors on the TX queues
for rt2800usb, and seems to improve the reliability of the
TX flow a bit.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Add rt2800_wait_csr_ready
Ivo van Doorn [Mon, 30 Aug 2010 19:13:08 +0000 (21:13 +0200)]
rt2x00: Add rt2800_wait_csr_ready

Similar to rt2800_wait_wpdma_ready() we can add a
function to waiting until the CSR is ready. This
centralizes some additional code into rt2800lib.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Update rt2800 comments regarding AMPDU and PACKET_ID in TXWI
Helmut Schaa [Mon, 30 Aug 2010 19:12:47 +0000 (21:12 +0200)]
rt2x00: Update rt2800 comments regarding AMPDU and PACKET_ID in TXWI

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: Rename txentry_desc.queue -> txentry_desc.qid
Helmut Schaa [Mon, 30 Aug 2010 19:12:24 +0000 (21:12 +0200)]
rt2x00: Rename txentry_desc.queue -> txentry_desc.qid

Variables containing queue ids are called qid everywhere else, hence
rename the queue field in txentry_desc to qid as well.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>