]> bbs.cooldavid.org Git - net-next-2.6.git/log
net-next-2.6.git
13 years agoixgbe: potential null dereference
Dan Carpenter [Tue, 27 Jul 2010 00:05:56 +0000 (00:05 +0000)]
ixgbe: potential null dereference

The e_dev_err() macro dereferences "adapter" which is NULL here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoks8842: Support DMA when accessed via timberdale
Richard Röjfors [Tue, 27 Jul 2010 12:57:01 +0000 (12:57 +0000)]
ks8842: Support DMA when accessed via timberdale

This patch adds support for RX and TX DMA via the DMA API,
this is only supported when the KS8842 is accessed via timberdale.

There is no support for DMA on the generic bus interface it self,
a state machine inside the FPGA is handling RX and TX transfers to/from
buffers in the FPGA. The host CPU can do DMA to and from these buffers.

The FPGA has to handle the RX interrupts, so these must be enabled in
the ks8842 but not in the FPGA. The driver must not disable the RX interrupt
that would mean that the data transfers into the FPGA buffers would stop.

The host shall not enable TX interrupts since TX is handled by the FPGA,
the host is notified by DMA callbacks when transfers are finished.

Which DMA channels to use are added as parameters in the platform data struct.

Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agostmmac: fix automatic PAD/FCS stripping
Giuseppe CAVALLARO [Tue, 27 Jul 2010 00:09:47 +0000 (00:09 +0000)]
stmmac: fix automatic PAD/FCS stripping

For Simple Ethernet frames (802.2 and 802.3) the GMAC Core
never strips pad and fcs. This means the ACS has no effect
on IPv4/6 frames.
The FL bits, in the RDES0, include the FCS so the driver
has to remove it in SW.
For 802.3 frame format with LLC or LLC-SNAP, when set the ACS
bit, the HW strips both PAD and FCS.
The FL bits, in the RDES0, actually represents the frame length
already stripped.
This patch fixes this logic within the device driver that
erroneously removed 4byte from 802.3 frames already stripped
corrupting the payload.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agostmmac: fix timer setup when use dual mac Kconfig
Giuseppe CAVALLARO [Tue, 27 Jul 2010 00:09:46 +0000 (00:09 +0000)]
stmmac: fix timer setup when use dual mac Kconfig

The driver erroneously sets the tmrate to zero when the
TMU initialisation fails. This actually generates problems
while using the dual GMAC configuration.

With this patch, enabling both the dual gmac and the timer
optimisation, the first interface opened will use the tmu
channel 2, the second one won't be able to use the timer but
will continue to work without mitigating the interrupts by
using the external timer (i.e. TMU channel 2).

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Update MAINTAINERS according to new location
Dmitry Kravkov [Tue, 27 Jul 2010 12:37:58 +0000 (12:37 +0000)]
bnx2x: Update MAINTAINERS according to new location

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: update driver version to 1.52.53-3
Dmitry Kravkov [Tue, 27 Jul 2010 12:37:06 +0000 (12:37 +0000)]
bnx2x: update driver version to 1.52.53-3

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Move statistics handling code to bnx2x_stats.*
Dmitry Kravkov [Tue, 27 Jul 2010 12:36:15 +0000 (12:36 +0000)]
bnx2x: Move statistics handling code to bnx2x_stats.*

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Create separate file for ethtool routines
Dmitry Kravkov [Tue, 27 Jul 2010 12:35:24 +0000 (12:35 +0000)]
bnx2x: Create separate file for ethtool routines

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Create bnx2x_cmn.* files
Dmitry Kravkov [Tue, 27 Jul 2010 12:34:34 +0000 (12:34 +0000)]
bnx2x: Create bnx2x_cmn.* files

Newly created files have no functionality changes,
but includes some functionality from bnx2x_main.c which
is common for PF and coming in the future VF driver.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: move global variable load_count to bnx2x.h
Dmitry Kravkov [Tue, 27 Jul 2010 12:33:43 +0000 (12:33 +0000)]
bnx2x: move global variable load_count to bnx2x.h

This will allow access to this global variable (used in no-mcp
mode) from different object files.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: store module parameters in driver main structure
Dmitry Kravkov [Tue, 27 Jul 2010 12:32:19 +0000 (12:32 +0000)]
bnx2x: store module parameters in driver main structure

Store module parameters during initialization of main driver
structure. This will allow access to the parameters from different
files.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: Create separate folder for bnx2x driver
Dmitry Kravkov [Tue, 27 Jul 2010 12:31:10 +0000 (12:31 +0000)]
bnx2x: Create separate folder for bnx2x driver

This commit includes files movement to newly created folder
using git-mv command and fixes references in cnic and bnx2x code
to each other.

files moved using following:
#!/bin/bash
mkdir drivers/net/bnx2x/
list=$(cd drivers/net/ && ls bnx2x*.[ch])
for f in $list; do
        git mv -f drivers/net/$f drivers/net/bnx2x/$f
done

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoigbvf, ixgbevf: use dev_hw_addr_random
Stefan Assmann [Mon, 26 Jul 2010 23:24:50 +0000 (23:24 +0000)]
igbvf, ixgbevf: use dev_hw_addr_random

Both igbvf and ixgbevf should set addr_assign_type to NET_ADDR_RANDOM
so udev creates persistent net rules by matching the device path.
Do this by using the dev_hw_addr_random helper function.

Signed-off-by: Stefan Assmann <sassmann@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoixgbe: priority tagging FCoE frames without FCoE offload
John Fastabend [Mon, 26 Jul 2010 20:41:31 +0000 (20:41 +0000)]
ixgbe: priority tagging FCoE frames without FCoE offload

The DCB user priority for FCoE is available regardless of whether
FCoE offload is enabled (IXGBE_FLAG_FCOE_ENABLED bit is set).
This allows proper DCB user priority tagging for FCoE
traffic on both 82598 and 82599 devices.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoe1000: use netif_<level> instead of netdev_<level>
Emil Tantilov [Tue, 27 Jul 2010 06:37:21 +0000 (23:37 -0700)]
e1000: use netif_<level> instead of netdev_<level>

This patch restores the ability to set msglvl through ethtool.
The issue was introduced by:
commit 675ad47375c76a7c3be4ace9554d92cd55518ced

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agousbnet: use jiffies in schedule_timeout(), not msecs
Kulikov Vasiliy [Sun, 25 Jul 2010 22:25:42 +0000 (22:25 +0000)]
usbnet: use jiffies in schedule_timeout(), not msecs

usbnet_terminate_urbs() uses schedule_timeout() with argument 3 msecs.
schedule_timeout() uses jiffies as argument, so convert msecs to jiffies
with msecs_to_jiffies().

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoks8842: Support 100Mbps when accessed via timberdale
Richard Röjfors [Sun, 25 Jul 2010 22:51:05 +0000 (22:51 +0000)]
ks8842: Support 100Mbps when accessed via timberdale

This patch removes the code which disables 100Mbps advertising when
the ks8842 is accessed via timberdale.

At higher speed it's good to be nice to the internal state machine
of timberdale by acking interrupts. That is done by a write to the
interrupt ack register (IAR).

Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: handle snprintf() return
Dan Carpenter [Sun, 25 Jul 2010 21:23:59 +0000 (21:23 +0000)]
caif: handle snprintf() return

snprintf() returns the number of bytes that would have been written.  It
can be larger than the size of the buffer.  The current code won't
overflow, but people cut and paste this stuff so lets do it right and
also make the static checkers happy.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agogenetlink: use genl_register_family_with_ops()
Changli Gao [Sun, 25 Jul 2010 23:21:05 +0000 (23:21 +0000)]
genetlink: use genl_register_family_with_ops()

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrop_monitor: use genl_register_family_with_ops()
Changli Gao [Tue, 27 Jul 2010 03:59:42 +0000 (20:59 -0700)]
drop_monitor: use genl_register_family_with_ops()

[ Fix unused local variable build warnings. -DaveM ]

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agogenetlink: cleanup code according to CodingStyle
Changli Gao [Sun, 25 Jul 2010 20:46:01 +0000 (20:46 +0000)]
genetlink: cleanup code according to CodingStyle

If the function is exported, the EXPORT* macro for it should follow immediately
after the closing function brace line.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/netlink/genetlink.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoethoc: add devinit/devexit section initializers
Jonas Bonn [Tue, 27 Jul 2010 01:45:05 +0000 (18:45 -0700)]
ethoc: add devinit/devexit section initializers

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoigb: restore EEPROM values of MDICNFG on reset with 82580
Nick Nunley [Mon, 26 Jul 2010 13:15:29 +0000 (13:15 +0000)]
igb: restore EEPROM values of MDICNFG on reset with 82580

On a reset the MDICNFG.Destination and MDICNFG.COM_MDIO
register fields are not restored to the EEPROM default.
This patch modifies the reset code to read the EEPROM
and restore the default values.

Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoigb: add support for SGMII-based MDIO PHYs
Nick Nunley [Mon, 26 Jul 2010 13:15:06 +0000 (13:15 +0000)]
igb: add support for SGMII-based MDIO PHYs

This patch adds support for external MDIO PHYs, in addition to
the standard SFP support for SGMII PHYs over the I2C interface.

Signed-off-by: Nicholas Nunley <nicholas.d.nunley@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoe1000e: Drop a useless statement
Jean Delvare [Mon, 26 Jul 2010 12:20:43 +0000 (12:20 +0000)]
e1000e: Drop a useless statement

err is set again a few lines below.

Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/qla3xxx.c: Checkpatch cleanups
Joe Perches [Thu, 22 Jul 2010 15:36:17 +0000 (15:36 +0000)]
drivers/net/qla3xxx.c: Checkpatch cleanups

Remove typedefs
Indentation and spacing
Use a temporary for a very long pointer variable
More 80 column compatible
Convert a switch to if/else if

Compile tested only, depends on patch "Update logging message style"

(old)
$ scripts/checkpatch.pl -f drivers/net/qla3xxx.c | grep "^total:"
total: 209 errors, 82 warnings, 3995 lines checked

(new)
$ scripts/checkpatch.pl -f drivers/net/qla3xxx.c | grep "^total:"
total: 2 errors, 0 warnings, 3970 lines checked

$ size drivers/net/qla3xxx.o.*
   text    data     bss     dec     hex filename
  50413     212   13864   64489    fbe9 drivers/net/qla3xxx.o.old
  49959     212   13728   63899    f99b drivers/net/qla3xxx.o.new

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/qla3xxx.c: Update logging message style
Joe Perches [Thu, 22 Jul 2010 12:33:31 +0000 (12:33 +0000)]
drivers/net/qla3xxx.c: Update logging message style

Use pr_<level>
Use netdev_<level>
Use netif_<level>
Remove #define PFX
Improve a couple of loops to avoid deep indentation.

Compile tested only

$ size drivers/net/qla3xxx.o.*
   text    data     bss     dec     hex filename
  51603     212   13864   65679   1008f drivers/net/qla3xxx.o.old
  50413     212   13864   64489    fbe9 drivers/net/qla3xxx.o.new

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agowireless: Make COMPAT_NETLINK_MESSAGES depend upon WEXT_CORE
David S. Miller [Mon, 26 Jul 2010 20:13:49 +0000 (13:13 -0700)]
wireless: Make COMPAT_NETLINK_MESSAGES depend upon WEXT_CORE

WIRELESS_EXT is not the correct dependency.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonetlink: netlink_recvmsg() fix
Eric Dumazet [Mon, 26 Jul 2010 20:09:16 +0000 (13:09 -0700)]
netlink: netlink_recvmsg() fix

commit 1dacc76d0014
(net/compat/wext: send different messages to compat tasks)
introduced a race condition on netlink, in case MSG_PEEK is used.

An skb given by skb_recv_datagram() might be shared, we must copy it
before any modification, or risk fatal corruption.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoforcedeth: Fix different hardware statistics versions.
Mike Ditto [Mon, 26 Jul 2010 04:54:28 +0000 (21:54 -0700)]
forcedeth: Fix different hardware statistics versions.

The macros for the values of the bit field describing the four
different versions of statistics supported by different hardware
variants were being misused.  Where the code was trying to test if the
hardware implements V3, it was actually testing whether it implements
any of V1, V2, or V3, causing the driver to report statistics that
don't really exist in the hardware, with bogus values.

Signed-off-by: Mike Ditto <mditto@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet-next: Fix an overflow bug in vmxnet3 Tx descriptor
Bhavesh Davda [Sat, 24 Jul 2010 14:43:29 +0000 (14:43 +0000)]
net-next: Fix an overflow bug in vmxnet3 Tx descriptor

Fix an overflow bug in vmxnet3 Tx descriptor

This patch fixes a bug where a 16K buffer on a Tx descriptor was overflowing
into the 'gen' bit in the descriptor thereby corrupting the descriptor and
stalling the transmit ring.

Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
Signed-off-by: Matthew Delco <delcoM@vmware.com>
Signed-off-by: Ronghua Zhang <ronghua@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years ago3c59x: Add ethtool WOL support
Andrew O. Shadoura [Sat, 24 Jul 2010 16:24:17 +0000 (16:24 +0000)]
3c59x: Add ethtool WOL support

This patch adds wrappers for ethtool to get or set wake-on-LAN
setting without re-inserting the kernel module.

Signed-off-by: Andrew O. Shadoura <andrew@beldisplaytech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix diag resource allocation
Sony Chacko [Sat, 24 Jul 2010 18:32:18 +0000 (18:32 +0000)]
qlcnic: fix diag resource allocation

netif_device_attach missing from error path in qlcnic_diag_alloc_res

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 agoqlcnic: fix loopback test
Amit Kumar Salecha [Sat, 24 Jul 2010 18:32:17 +0000 (18:32 +0000)]
qlcnic: fix loopback test

o Loopback not supported for virtual function.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: pskb_expand_head() optimization
Eric Dumazet [Thu, 22 Jul 2010 19:09:08 +0000 (19:09 +0000)]
net: pskb_expand_head() optimization

Move frags[] at the end of struct skb_shared_info, and make
pskb_expand_head() copy only the used part of it instead of whole array.

This should avoid kmemcheck warnings and speedup pskb_expand_head() as
well, avoiding a lot of cache misses.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agosysfs: add attribute to indicate hw address assignment type
Stefan Assmann [Thu, 22 Jul 2010 02:50:21 +0000 (02:50 +0000)]
sysfs: add attribute to indicate hw address assignment type

Add addr_assign_type to struct net_device and expose it via sysfs.
This new attribute has the purpose of giving user-space the ability to
distinguish between different assignment types of MAC addresses.

For example user-space can treat NICs with randomly generated MAC
addresses differently than NICs that have permanent (locally assigned)
MAC addresses.
For the former udev could write a persistent net rule by matching the
device path instead of the MAC address.
There's also the case of devices that 'steal' MAC addresses from slave
devices. In which it is also be beneficial for user-space to be aware
of the fact.

This patch also introduces a helper function to assist adoption of
drivers that generate MAC addresses randomly.

Signed-off-by: Stefan Assmann <sassmann@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoixgbe: fix ethtool stats
Eric Dumazet [Fri, 23 Jul 2010 13:44:21 +0000 (13:44 +0000)]
ixgbe: fix ethtool stats

In latest changes about 64bit stats on 32bit arches,
[commit 28172739f0a276eb8 (net: fix 64 bit counters on 32 bit arches)],
I missed ixgbe uses a bit of magic in its ixgbe_gstrings_stats
definition.

IXGBE_NETDEV_STAT() must now assume offsets relative to
rtnl_link_stats64, not relative do dev->stats.

As a bonus, we also get 64bit stats on ethtool -S

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqlcnic: fix bandwidth check
Rajesh Borundia [Fri, 23 Jul 2010 21:24:25 +0000 (21:24 +0000)]
qlcnic: fix bandwidth check

Fix maximum and minmum bandwith value.

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 agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
David S. Miller [Fri, 23 Jul 2010 21:03:38 +0000 (14:03 -0700)]
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6

Conflicts:
drivers/net/wireless/iwlwifi/iwl-commands.h

13 years ago3c59x: Fix call to mdio_sync() with the wrong argument
Ben Hutchings [Thu, 22 Jul 2010 14:18:28 +0000 (14:18 +0000)]
3c59x: Fix call to mdio_sync() with the wrong argument

commit a095cfc40ec7ebe63e9532383c5b5c2a27b14075
"3c59x: Specify window explicitly for access to windowed registers"
changed the first parameter to mdio_sync(), from a pointer to the
register mapping, to a pointer to the vortex_private structure,
and changed all but one of the call sites.  Fix that last one.

Reported-by: Luca Falavigna <dktrkranz@debian.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: s2io: fix buffer overflow
Kulikov Vasiliy [Fri, 23 Jul 2010 06:36:15 +0000 (06:36 +0000)]
net: s2io: fix buffer overflow

vpd_data[] is allocated as kmalloc(256, GFP_KERNEL), so if cnt = 255
then (cnt + 3) overflows 256. memset() is executed without checking.
vpd_data[cnt+2] must be less than 256-cnt-2 as the latter is number of
vpd_data[] elements to copy.

Do not fill with zero the beginning of nic->serial_num as it will
be filled with vpd_data[].

String in product_name[] should be terminated by '\0'.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomv643xx_eth: potential null dereference
Dan Carpenter [Fri, 23 Jul 2010 01:05:05 +0000 (01:05 +0000)]
mv643xx_eth: potential null dereference

We assume that "pd" can be null on the previous line, and throughout the
function so we should check it here as well.  This was introduced by
9b2c2ff7a1c0 "mv643xx_eth: use sw csum for big packets"

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: 3c59x: fix leak of iomaps
Kulikov Vasiliy [Fri, 23 Jul 2010 06:44:44 +0000 (06:44 +0000)]
net: 3c59x: fix leak of iomaps

If vortex_probe1() fails we should unmap ioaddr mapped earlier.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: core: don't use own hex_to_bin() method
Andy Shevchenko [Fri, 23 Jul 2010 03:18:10 +0000 (03:18 +0000)]
net: core: don't use own hex_to_bin() method

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agowireless: use newly introduced hex_to_bin()
Andy Shevchenko [Fri, 23 Jul 2010 03:18:09 +0000 (03:18 +0000)]
wireless: use newly introduced hex_to_bin()

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Corey Thomas <coreythomas@charter.net>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agousb: usbnet: use newly introduced hex_to_bin()
Andy Shevchenko [Fri, 23 Jul 2010 03:18:08 +0000 (03:18 +0000)]
usb: usbnet: use newly introduced hex_to_bin()

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers: net: use newly introduced hex_to_bin()
Andy Shevchenko [Fri, 23 Jul 2010 03:18:07 +0000 (03:18 +0000)]
drivers: net: use newly introduced hex_to_bin()

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers: atm: don't use private copy of hex_to_bin()
Andy Shevchenko [Fri, 23 Jul 2010 03:18:06 +0000 (03:18 +0000)]
drivers: atm: don't use private copy of hex_to_bin()

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
Cc: linux-atm-general@lists.sourceforge.net
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: bump the driver version number
Ajit Khaparde [Fri, 23 Jul 2010 02:05:36 +0000 (02:05 +0000)]
be2net: bump the driver version number

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: variable name changes
Ajit Khaparde [Fri, 23 Jul 2010 02:04:54 +0000 (02:04 +0000)]
be2net: variable name changes

This patch changes names of some variables.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: supress printing error when mac query fails for VF
Ajit Khaparde [Fri, 23 Jul 2010 19:42:40 +0000 (12:42 -0700)]
be2net: supress printing error when mac query fails for VF

When a virtual function driver in initialized, the network mac
query command can fail. Skip display of error message in that case.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: code to support tx rate configuration on virtual functions
Ajit Khaparde [Fri, 23 Jul 2010 01:52:13 +0000 (01:52 +0000)]
be2net: code to support tx rate configuration on virtual functions

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: add vlan support for sriov virtual functions
Ajit Khaparde [Fri, 23 Jul 2010 01:51:22 +0000 (01:51 +0000)]
be2net: add vlan support for sriov virtual functions

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: add support to get vf config
Ajit Khaparde [Fri, 23 Jul 2010 01:50:34 +0000 (01:50 +0000)]
be2net: add support to get vf config

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobe2net: change to call pmac_del only if necessary
Ajit Khaparde [Fri, 23 Jul 2010 01:49:04 +0000 (01:49 +0000)]
be2net: change to call pmac_del only if necessary

If a mac address has not been configured for a VF,
there is no need to call be_cmd_pmac_del.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: avoid useless removal of multicast addresses
Ursula Braun [Thu, 22 Jul 2010 23:15:10 +0000 (23:15 +0000)]
qeth: avoid useless removal of multicast addresses

Function qeth_l2_remove_device invokes qeth_l2_del_all_mc at the end.
This is needless, because it is already called in the offline function.
And even more this is invalid, because multicast addresses cannot be
removed in DOWN state. Thus this patch deletes invocation of
qeth_l2_del_all_mc in function qeth_l2_remove_device.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: Use memdup_user when user data is immediately copied into the allocated region.
Julia Lawall [Thu, 22 Jul 2010 23:15:09 +0000 (23:15 +0000)]
qeth: Use memdup_user when user data is immediately copied into the allocated region.

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

// <smpl>
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@

-  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+  to = memdup_user(from,size);
   if (
-      to==NULL
+      IS_ERR(to)
                 || ...) {
   <+... when != goto l1;
-  -ENOMEM
+  PTR_ERR(to)
   ...+>
   }
-  if (copy_from_user(to, from, size) != 0) {
-    <+... when != goto l2;
-    -EFAULT
-    ...+>
-  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: return zero from reply callback functions
Ursula Braun [Thu, 22 Jul 2010 23:15:08 +0000 (23:15 +0000)]
qeth: return zero from reply callback functions

Reply callback functions in qeth should return zero if command
response consists of one part only, otherwise qeth continues
waiting for further parts of the command response.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoclaw: A claw device is a group of just 2 ccw devices
Ursula Braun [Thu, 22 Jul 2010 23:15:07 +0000 (23:15 +0000)]
claw: A claw device is a group of just 2 ccw devices

When creating a claw device, just 2 subchannels have to be grouped.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: avoid loop if ipa command response is missing
Ursula Braun [Thu, 22 Jul 2010 23:15:06 +0000 (23:15 +0000)]
qeth: avoid loop if ipa command response is missing

If qeth issues an ipa command, but for some reasons the response
never comes back, qeth reaches a timeout.
Reset the irq_pending flag of the write channel in timeout handling
code and trigger a recovery to avoid endless looping for the following
ipa command.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: serialize sysfs-triggered device configurations
Ursula Braun [Thu, 22 Jul 2010 23:15:05 +0000 (23:15 +0000)]
qeth: serialize sysfs-triggered device configurations

This patch serializes device removal and other sysfs-triggered
configurations by moving removal of sysfs-attributes to the beginning
of the remove functions. And it serializes online/offline setting
and discipline-switching (causing reestablishing of the net_device)
by making use of a new discipline mutex.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: Clear mac_bits field when switching between Layer 2 and Layer 3
Carsten Otte [Thu, 22 Jul 2010 23:15:04 +0000 (23:15 +0000)]
qeth: Clear mac_bits field when switching between Layer 2 and Layer 3

This patch fixes a problem that occurs when switching from layer 3 to layer 2
mode. Resetting this mac_bits makes sure that we retrieve our mac address from
the card, otherwise the interface simply would'nt work.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoqeth: IP address takeover flag setting
Klaus-Dieter Wacker [Thu, 22 Jul 2010 23:15:03 +0000 (23:15 +0000)]
qeth: IP address takeover flag setting

The qeth IP address flag setting is possible when device is
offline. When setting device online afterwards the current set
IP addresses have to be correctly registered with the device
regarding the IP address takeover attribute.

Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agostmmac: handle allocation errors in setup functions
Dan Carpenter [Thu, 22 Jul 2010 01:16:48 +0000 (01:16 +0000)]
stmmac: handle allocation errors in setup functions

If the allocations fail in either dwmac1000_setup() or dwmac100_setup()
then return NULL.  These are called from stmmac_mac_device_setup().  The
check for NULL returns in stmmac_mac_device_setup() needed to be moved
forward a couple lines.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: precedence bug
Dan Carpenter [Thu, 22 Jul 2010 01:11:31 +0000 (01:11 +0000)]
caif: precedence bug

Negate has precedence over comparison so the original assert only
checked that "rfml->fragment_size" was larger than 1 or 0.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobonding: don't lock when copying/clearing VLAN list on slave
Jay Vosburgh [Wed, 21 Jul 2010 12:14:48 +0000 (12:14 +0000)]
bonding: don't lock when copying/clearing VLAN list on slave

When copying VLAN information to or removing from a slave
during slave addition or removal, the bonding code currently holds
the bond->lock for write to prevent concurrent modification of the
vlan_list / vlgrp.

This is unnecessary, as all of these operations occur under
RTNL.  Holding the bond->lock also caused might_sleep issues for
some drivers' ndo_vlan_* functions.  This patch removes the extra
locking.

Problem reported by Michael Chan <mchan@broadcom.com>

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Cc: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobonding: change test for presence of VLANs
Jay Vosburgh [Wed, 21 Jul 2010 12:14:47 +0000 (12:14 +0000)]
bonding: change test for presence of VLANs

After commit ad1afb00393915a51c21b1ae8704562bf036855f
("vlan_dev: VLAN 0 should be treated as "no vlan tag" (802.1p packet)")
it is now regular practice for a VLAN "add vid" for VLAN 0 to
arrive prior to any VLAN registration or creation of a vlan_group.

This patch updates the bonding code that tests for the presence
of VLANs configured above bonding.  The new logic tests for bond->vlgrp
to determine if a registration has occured, instead of testing that
bonding's internal vlan_list is empty.

The old code would panic when vlan_list was not empty, but
vlgrp was still NULL (because only an "add vid" for VLAN 0 had occured).

Bonding still adds VLAN 0 to its internal list so that 802.1p
frames are handled correctly on transmit when non-VLAN accelerated
slaves are members of the bond.  The test against bond->vlan_list
remains in bond_dev_queue_xmit for this reason.

Modification to the bond->vlgrp now occurs under lock (in
addition to RTNL), because not all inspections of it occur under RTNL.

Additionally, because 8021q will never issue a "kill vid" for
VLAN 0, there is now logic in bond_uninit to release any remaining
entries from vlan_list.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Cc: Pedro Garcia <pedro.netdev@dondevamos.com>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet/fec: restore interrupt mask after software-reset in fec_stop()
Wolfram Sang [Wed, 21 Jul 2010 02:51:13 +0000 (02:51 +0000)]
net/fec: restore interrupt mask after software-reset in fec_stop()

After the change from mdio polling to irq, it became necessary to
restore the interrupt mask after resetting the chip in fec_stop().
Otherwise, with all irqs disabled, no communication with the PHY will be
possible after e.g. un-/replugging the cable and the device gets
stalled.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years ago3c59x: handle pci_iomap() errors
Kulikov Vasiliy [Wed, 21 Jul 2010 02:00:36 +0000 (02:00 +0000)]
3c59x: handle pci_iomap() errors

pci_iomap() can fail, handle this case and return -ENOMEM from probe
function.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: RTA_MARK addition
Eric Dumazet [Tue, 20 Jul 2010 22:03:14 +0000 (22:03 +0000)]
net: RTA_MARK addition

Add a new rt attribute, RTA_MARK, and use it in
rt_fill_info()/inet_rtm_getroute() to support following commands :

ip route get 192.168.20.110 mark NUMBER
ip route get 192.168.20.108 from 192.168.20.110 iif eth1 mark NUMBER
ip route list cache [192.168.20.110] mark NUMBER

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoCAN: Add Flexcan CAN controller driver
Marc Kleine-Budde [Wed, 29 Jul 2009 08:20:10 +0000 (10:20 +0200)]
CAN: Add Flexcan CAN controller driver

This core is found on some Freescale SoCs and also some Coldfire
SoCs. Support for Coldfire is missing though at the moment as
they have an older revision of the core which does not have RX FIFO
support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
13 years agor6040: Fix args to phy_mii_ioctl().
David S. Miller [Thu, 22 Jul 2010 04:10:49 +0000 (21:10 -0700)]
r6040: Fix args to phy_mii_ioctl().

Reported by Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agovhost net: Fix warning.
David S. Miller [Thu, 22 Jul 2010 04:09:23 +0000 (21:09 -0700)]
vhost net: Fix warning.

Reported by Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: remove last uses of __attribute__((packed))
Gustavo F. Padovan [Wed, 21 Jul 2010 10:59:58 +0000 (10:59 +0000)]
net: remove last uses of __attribute__((packed))

Network code uses the __packed macro instead of __attribute__((packed)).

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoirda: Use __packed annotation instead IRDA_PACKED macro
Gustavo F. Padovan [Wed, 21 Jul 2010 10:59:57 +0000 (10:59 +0000)]
irda: Use __packed annotation instead IRDA_PACKED macro

Remove IRDA_PACKED macro, which maps to __attribute__((packed)). IRDA is
one of the last users of __attribute__((packet)). Networking code uses
__packed now.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/irda: use for_each_pci_dev()
Kulikov Vasiliy [Sat, 3 Jul 2010 06:04:15 +0000 (06:04 +0000)]
drivers/net/irda: use for_each_pci_dev()

Use for_each_pci_dev() to simplify the code.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/qlge: Use pr_<level>, shrink text a bit
Joe Perches [Wed, 21 Jul 2010 21:44:18 +0000 (14:44 -0700)]
drivers/net/qlge: Use pr_<level>, shrink text a bit

Add and use a few neatening macros
Remove PFX
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert printk(KERN_ERR to pr_err(

$ size drivers/net/qlge/built-in.o.*
  text    data     bss     dec     hex filename
 116456    2312   25712  144480   23460 drivers/net/qlge/built-in.o.old
 114909    2312   25728  142949   22e65 drivers/net/qlge/built-in.o.new

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomac80211: proper IBSS locking
Johannes Berg [Wed, 21 Jul 2010 09:30:27 +0000 (11:30 +0200)]
mac80211: proper IBSS locking

IBSS has never had locking, instead relying on some
memory barriers etc. That's hard to get right, and
I think we had it wrong too until the previous patch.
Since this is not performance sensitive, it doesn't
make sense to have the maintenance overhead of that,
so add proper locking.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: fix IBSS lockdep complaint
Johannes Berg [Wed, 21 Jul 2010 08:52:40 +0000 (10:52 +0200)]
mac80211: fix IBSS lockdep complaint

Bob reported a lockdep complaint originating in
the mac80211 IBSS code due to the common work
struct patch. The reason is that the IBSS and
station mode code have different locking orders
for the cfg80211 wdev lock and the work struct
(where "locking" implies running/canceling).

Fix this by simply not canceling the work in
the IBSS code, it is not necessary since when
the REQ_RUN bit is cleared, the work will run
without effect if it runs. When the interface
is set down, it is flushed anyway, so there's
no concern about it running after memory has
been invalidated either.

This fixes
https://bugzilla.kernel.org/show_bug.cgi?id=16419

Additionally, looking into this I noticed that
there's a small window while the IBSS is torn
down in which the work may be rescheduled and
the REQ_RUN bit be set again after leave() has
cleared it when a scan finishes at exactly the
same time. Avoid that by setting the ssid_len
to zero before clearing REQ_RUN which signals
to the scan finish code that this interface is
not active.

Reported-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomac80211: refuse shared key auth when WEP is unavailable
Johannes Berg [Wed, 21 Jul 2010 08:09:25 +0000 (10:09 +0200)]
mac80211: refuse shared key auth when WEP is unavailable

When WEP is not available, we should reject shared
key authentication because it could never succeed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agocfg80211: fix race between sysfs and cfg80211
Maxime Bizon [Wed, 21 Jul 2010 15:21:38 +0000 (17:21 +0200)]
cfg80211: fix race between sysfs and cfg80211

device_add() is called before adding the phy to the cfg80211 device
list.

So if a userspace program uses sysfs uevents to detect new phy
devices, and queries nl80211 to get phy info, it can get ENODEV even
though the phy exists in sysfs.

An easy workaround is to hold the cfg80211 mutex until the phy is
present in sysfs/cfg80211/debugfs.

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agob43: silence phy_n sparse warnings
Larry Finger [Wed, 21 Jul 2010 16:48:05 +0000 (11:48 -0500)]
b43: silence phy_n sparse warnings

drivers/net/wireless/b43/phy_n.c:512:53: warning: cast truncates bits from constant value (ffff0fff becomes fff)
drivers/net/wireless/b43/phy_n.c:765:66: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
drivers/net/wireless/b43/phy_n.c:1012:38: warning: cast truncates bits from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/phy_n.c:1119:38: warning: cast truncates bits from constant value (ffff0fff becomes fff)
drivers/net/wireless/b43/phy_n.c:2458:56: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
drivers/net/wireless/b43/phy_n.c:2933:38: warning: cast truncates bits from constant value (ffff0fff becomes fff)
drivers/net/wireless/b43/phy_n.c:3294:57: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agob43: silence most sparse warnings
John W. Linville [Wed, 21 Jul 2010 15:37:19 +0000 (11:37 -0400)]
b43: silence most sparse warnings

  CHECK   drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/main.c:111:5: warning: symbol 'b43_modparam_pio' was not declared. Should it be static?
  CHECK   drivers/net/wireless/b43/phy_g.c
drivers/net/wireless/b43/phy_g.c:975:56: warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
  CHECK   drivers/net/wireless/b43/phy_lp.c
drivers/net/wireless/b43/phy_lp.c:2701:6: warning: symbol 'b43_lpphy_op_switch_analog' was not declared. Should it be static?
drivers/net/wireless/b43/phy_lp.c:1148:30: warning: cast truncates bits from constant value (ffff1fff becomes 1fff)
drivers/net/wireless/b43/phy_lp.c:1525:30: warning: cast truncates bits from constant value (ffff1fff becomes 1fff)
drivers/net/wireless/b43/phy_lp.c:1529:30: warning: cast truncates bits from constant value (ffff1fff becomes 1fff)
  CHECK   drivers/net/wireless/b43/wa.c
drivers/net/wireless/b43/wa.c:385:60: warning: cast truncates bits from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/wa.c:403:55: warning: cast truncates bits from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/wa.c:405:55: warning: cast truncates bits from constant value (ffff00ff becomes ff)
drivers/net/wireless/b43/wa.c:415:71: warning: cast truncates bits from constant value (ffff0fff becomes fff)

AFAICT, none of these amount to real bugs.  But this reduces warning
spam from sparse w/o significantly affecting readability of the code (IMHO).

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoarch/um/drivers: remove duplicate structure field initialization
Julia Lawall [Tue, 20 Jul 2010 12:25:17 +0000 (12:25 +0000)]
arch/um/drivers: remove duplicate structure field initialization

There are two initializations of ndo_set_mac_address, one to a local
function that is not used otherwise and one to a function that is defined
elsewhere.

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

// <smpl>
@r@
identifier I, s, fld;
position p0,p;
expression E;
@@

struct I s =@p0 { ... .fld@p = E, ...};

@s@
identifier I, s, r.fld;
position r.p0,p;
expression E;
@@

struct I s =@p0 { ... .fld@p = E, ...};

@script:python@
p0 << r.p0;
fld << r.fld;
ps << s.p;
pr << r.p;
@@

if int(ps[0].line)<int(pr[0].line) or int(ps[0].column)<int(pr[0].column):
  cocci.print_main(fld,p0)
// </smpl>

akpm:

- Use the standard eth_mac_addr() in uml_net_set_mac()

- Remove unneeded and racy local set_ether_mac()

- Remove duplicated (and incorrect)
  uml_netdev_ops.ndo_set_mac_address initializer.

Fixes 8bb95b39a16ed55226810596f92216c53329d2fe ("uml: convert network
device to netdevice ops").

[akpm@linux-foundation.org: rework as above]
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/cxgb3/t3_hw.c: use new hex_to_bin() method
Andy Shevchenko [Tue, 20 Jul 2010 12:25:16 +0000 (12:25 +0000)]
drivers/net/cxgb3/t3_hw.c: use new hex_to_bin() method

Get rid of own implementation of hex_to_bin().

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Acked-by: Divy Le Ray <divy@chelsio.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Wed, 21 Jul 2010 01:25:24 +0000 (18:25 -0700)]
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

Conflicts:
drivers/vhost/net.c
net/bridge/br_device.c

Fix merge conflict in drivers/vhost/net.c with guidance from
Stephen Rothwell.

Revert the effects of net-2.6 commit 573201f36fd9c7c6d5218cdcd9948cee700b277d
since net-next-2.6 has fixes that make bridge netpoll work properly thus
we don't need it disabled.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agortl8180: improve signal reporting for rtl8185 hardware
John W. Linville [Mon, 19 Jul 2010 20:35:20 +0000 (16:35 -0400)]
rtl8180: improve signal reporting for rtl8185 hardware

The existing code seemed to be somewhat based on the datasheet, but
varied substantially from the vendor-provided driver.  This mirrors the
handling of the rtl8185 case from that driver, but still neglects the
specifics for the rtl8180 hardware.  Those details are a bit muddled...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agomwl8k: correct/silence sparse warnings
John W. Linville [Tue, 20 Jul 2010 17:55:00 +0000 (13:55 -0400)]
mwl8k: correct/silence sparse warnings

drivers/net/wireless/mwl8k.c:1541:21: warning: incorrect type in assignment (different base types)
drivers/net/wireless/mwl8k.c:1541:21:    expected restricted __le16 [usertype] result
drivers/net/wireless/mwl8k.c:1541:21:    got int
drivers/net/wireless/mwl8k.c:1575:42:    expected unsigned short [unsigned] [usertype] cmd
drivers/net/wireless/mwl8k.c:1575:42:    got restricted __le16 [usertype] code
drivers/net/wireless/mwl8k.c:1587:50: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1587:50:    expected unsigned short [unsigned] [usertype] cmd
drivers/net/wireless/mwl8k.c:1587:50:    got restricted __le16 [usertype] code
drivers/net/wireless/mwl8k.c:1592:50: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1592:50:    expected unsigned short [unsigned] [usertype] cmd
drivers/net/wireless/mwl8k.c:1592:50:    got restricted __le16 [usertype] code
drivers/net/wireless/mwl8k.c:1845:27: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1845:27:    expected unsigned int [unsigned] [usertype] <noident>
drivers/net/wireless/mwl8k.c:1845:27:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/mwl8k.c:1848:27: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1848:27:    expected unsigned int [unsigned] [usertype] <noident>
drivers/net/wireless/mwl8k.c:1848:27:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/mwl8k.c:1851:27: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1851:27:    expected unsigned int [unsigned] [usertype] <noident>
drivers/net/wireless/mwl8k.c:1851:27:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/mwl8k.c:1854:27: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1854:27:    expected unsigned int [unsigned] [usertype] <noident>
drivers/net/wireless/mwl8k.c:1854:27:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/mwl8k.c:1857:27: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1857:27:    expected unsigned int [unsigned] [usertype] <noident>
drivers/net/wireless/mwl8k.c:1857:27:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/mwl8k.c:1860:27: warning: incorrect type in argument 1 (different base types)
drivers/net/wireless/mwl8k.c:1860:27:    expected unsigned int [unsigned] [usertype] <noident>
drivers/net/wireless/mwl8k.c:1860:27:    got restricted __le32 [usertype] <noident>
drivers/net/wireless/mwl8k.c:3055:20: warning: incorrect type in assignment (different base types)
drivers/net/wireless/mwl8k.c:3055:20:    expected restricted __le16 [usertype] ht_caps
drivers/net/wireless/mwl8k.c:3055:20:    got unsigned short [unsigned] [usertype] cap

At least the last one looks like a real bug...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
13 years agowireless: remove unnecessary reg_same_country_ie_hint
John W. Linville [Tue, 20 Jul 2010 19:12:04 +0000 (15:12 -0400)]
wireless: remove unnecessary reg_same_country_ie_hint

"Might as well remove  reg_same_country_ie_hint() completely since we
already dealt with suspend/resume through the regulatory hint
disconnect." -- Luis

Reported-by: Luis R. Rodriguez <mcgrof@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agort2x00: correct sparse warning in rt2x00debug.c
John W. Linville [Tue, 20 Jul 2010 18:21:48 +0000 (14:21 -0400)]
rt2x00: correct sparse warning in rt2x00debug.c

  CHECK   drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless/rt2x00/rt2x00debug.c:193:28: warning: incorrect type in assignment (different base types)
drivers/net/wireless/rt2x00/rt2x00debug.c:193:28:    expected restricted __le32 [usertype] chip_rev
drivers/net/wireless/rt2x00/rt2x00debug.c:193:28:    got restricted __le16 [usertype] <noident>

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
13 years agolibipw: correct sparse warnings and mark some variables static
John W. Linville [Tue, 20 Jul 2010 18:14:03 +0000 (14:14 -0400)]
libipw: correct sparse warnings and mark some variables static

  CHECK   drivers/net/wireless/ipw2x00/libipw_module.c
drivers/net/wireless/ipw2x00/libipw_module.c:65:21: warning: symbol 'libipw_config_ops' was not declared. Should it be static?
drivers/net/wireless/ipw2x00/libipw_module.c:66:6: warning: symbol 'libipw_wiphy_privid' was not declared. Should it be static?
  CHECK   drivers/net/wireless/ipw2x00/libipw_wx.c
drivers/net/wireless/ipw2x00/libipw_wx.c:415:17: warning: symbol 'ssid' shadows an earlier one
drivers/net/wireless/ipw2x00/libipw_wx.c:324:9: originally declared here

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoipw2100: mark ipw2100_pm_qos_req static
John W. Linville [Tue, 20 Jul 2010 18:11:51 +0000 (14:11 -0400)]
ipw2100: mark ipw2100_pm_qos_req static

  CHECK   drivers/net/wireless/ipw2x00/ipw2100.c
drivers/net/wireless/ipw2x00/ipw2100.c:177:28: warning: symbol 'ipw2100_pm_qos_req' was not declared. Should it be static?

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoath9k: correct sparse identified endian bug in ath_paprd_calibrate
John W. Linville [Tue, 20 Jul 2010 17:15:31 +0000 (13:15 -0400)]
ath9k: correct sparse identified endian bug in ath_paprd_calibrate

drivers/net/wireless/ath/ath9k/main.c:282:26: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath9k/main.c:282:26:    expected restricted __le16 [usertype] duration_id
drivers/net/wireless/ath/ath9k/main.c:282:26:    got int

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowireless: mark cfg80211_is_all_idle as static
John W. Linville [Tue, 20 Jul 2010 16:32:52 +0000 (12:32 -0400)]
wireless: mark cfg80211_is_all_idle as static

  CHECK   net/wireless/sme.c
net/wireless/sme.c:38:6: warning: symbol 'cfg80211_is_all_idle' was not declared. Should it be static?

It is not used elsewhere, so mark it static.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowireless: correct sparse warning in generated regdb.c
John W. Linville [Tue, 20 Jul 2010 16:29:14 +0000 (12:29 -0400)]
wireless: correct sparse warning in generated regdb.c

  CHECK   net/wireless/regdb.c
net/wireless/regdb.c:8:34: warning: symbol 'reg_regdb' was not declared.  Should it be static?
net/wireless/regdb.c:11:5: warning: symbol 'reg_regdb_size' was not declared. Should it be static?

Simply include the also generated regdb.h.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowireless: correct sparse warning in wext-compat.c
John W. Linville [Tue, 20 Jul 2010 16:22:40 +0000 (12:22 -0400)]
wireless: correct sparse warning in wext-compat.c

  CHECK   net/wireless/wext-compat.c
net/wireless/wext-compat.c:1434:5: warning: symbol 'cfg80211_wext_siwpmksa' was not declared. Should it be static?

Add declaration in cfg80211.h.  Also add an EXPORT_SYMBOL_GPL, since all
the peer functions have it.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowireless: correct sparse warning in lib80211_crypt_tkip.c
John W. Linville [Tue, 20 Jul 2010 16:09:11 +0000 (12:09 -0400)]
wireless: correct sparse warning in lib80211_crypt_tkip.c

  CHECK   net/wireless/lib80211_crypt_tkip.c
net/wireless/lib80211_crypt_tkip.c:581:27: warning: cast to restricted __le16

Caused by dereferencing a "u8 *" and passing it to le16_to_cpu...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agowireless: only use alpha2 regulatory information from country IE
John W. Linville [Thu, 15 Jul 2010 18:57:33 +0000 (14:57 -0400)]
wireless: only use alpha2 regulatory information from country IE

The meaning and/or usage of the country IE is somewhat poorly defined.
In practice, this means that regulatory rulesets in a country IE are
often incomplete and might be untrustworthy.  This removes the code
associated with interpreting those rulesets while preserving respect
for country "alpha2" codes also contained in the country IE.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agodrop_monitor: convert some kfree_skb call sites to consume_skb
Neil Horman [Tue, 20 Jul 2010 06:45:56 +0000 (06:45 +0000)]
drop_monitor: convert some kfree_skb call sites to consume_skb

Convert a few calls from kfree_skb to consume_skb

Noticed while I was working on dropwatch that I was detecting lots of internal
skb drops in several places.  While some are legitimate, several were not,
freeing skbs that were at the end of their life, rather than being discarded due
to an error.  This patch converts those calls sites from using kfree_skb to
consume_skb, which quiets the in-kernel drop_monitor code from detecting them as
drops.  Tested successfully by myself

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrop_monitor: Add error code to detect duplicate state changes
Neil Horman [Tue, 20 Jul 2010 04:52:09 +0000 (04:52 +0000)]
drop_monitor: Add error code to detect duplicate state changes

Patch to add -EAGAIN error to dropwatch netlink message handling code.
-EAGAIN will be returned anytime userspace attempts to transition the state of
the drop monitor service to a state that its already in.  That allows user space
to detect this condition, so it doesn't wait for a success ACK that will never
arrive.  Tested successfully by me

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>