pandora-kernel.git
15 years agoath9k: Move TX completion routine to xmit.c
Sujith [Tue, 18 Nov 2008 03:39:30 +0000 (09:09 +0530)]
ath9k: Move TX completion routine to xmit.c

Also, use a helper function to setup RC status data
when processing completed TX descriptors.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Use helpers
Sujith [Tue, 18 Nov 2008 03:38:33 +0000 (09:08 +0530)]
ath9k: Use helpers

Break down huge functions, use helper functions or
macros instead.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: General code scrub
Sujith [Tue, 18 Nov 2008 03:38:13 +0000 (09:08 +0530)]
ath9k: General code scrub

Replace TRUE/FALSE macros with VALID/INVALID macros.
Follow a consistent variable convention.
Remove unnecessary comments.
Add all RC phy macros into a single enum.
Merge functions into reasonably sized entities.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove ath9k_rate_table
Sujith [Tue, 18 Nov 2008 03:37:53 +0000 (09:07 +0530)]
ath9k: Remove ath9k_rate_table

Maintaining two sets of rate tables is redundant, remove one
and use struct ath_rate_table exclusively.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Use rate_driver_data
Sujith [Tue, 18 Nov 2008 03:37:30 +0000 (09:07 +0530)]
ath9k: Use rate_driver_data

Remove the hack using vif, and use rate_driver_data within
skb->cb to hold driver specific rate information.
Setup the rate series in the skb's tx control area and remove
all references to ath9k specific rate series ( using struct ath_rc_series ).

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove ath_rate_softc
Sujith [Tue, 18 Nov 2008 03:37:06 +0000 (09:07 +0530)]
ath9k: Remove ath_rate_softc

Move the hw rate tables to ath_softc, and access them directly.
tx_triglevel_max is global, move it to ath_rate_node.
Now that ath_rate_softc is gone, rate control attach becomes simpler.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove rate control reference in VAP
Sujith [Tue, 18 Nov 2008 03:36:44 +0000 (09:06 +0530)]
ath9k: Remove rate control reference in VAP

Rate control init is now confined to itself, using the
HT capabilites of the STA from rate_init().

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: We don't support non-HT devices, so remove superfluous code.
Sujith [Tue, 18 Nov 2008 03:36:18 +0000 (09:06 +0530)]
ath9k: We don't support non-HT devices, so remove superfluous code.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Revamp RX handling
Sujith [Tue, 18 Nov 2008 03:35:55 +0000 (09:05 +0530)]
ath9k: Revamp RX handling

Remove a lot of old, crufty code and make
RX status reporting a bit sane and clean.

Do not do anything to the RX skb before unmapping.
So in ath_rx_tasklet(), move the skb_put() after PCI unmap.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Nuke fixed rate handling in driver
Sujith [Tue, 18 Nov 2008 03:35:35 +0000 (09:05 +0530)]
ath9k: Nuke fixed rate handling in driver

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove half/quarter rate tables
Sujith [Tue, 18 Nov 2008 03:35:13 +0000 (09:05 +0530)]
ath9k: Remove half/quarter rate tables

Half/Quarter rate tables are needed only for legacy chipsets.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove ath_rate_newassoc()
Sujith [Tue, 18 Nov 2008 03:34:21 +0000 (09:04 +0530)]
ath9k: Remove ath_rate_newassoc()

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Remove ath_setup_rates
Sujith [Tue, 18 Nov 2008 03:34:00 +0000 (09:04 +0530)]
ath9k: Remove ath_setup_rates

Setup legacy rates in ath_rate_init() itself.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Simplify RC alloc/free functions
Sujith [Tue, 18 Nov 2008 03:33:36 +0000 (09:03 +0530)]
ath9k: Simplify RC alloc/free functions

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Merge struct ath_tx_ratectrl with ath_rate_node
Sujith [Tue, 18 Nov 2008 03:33:12 +0000 (09:03 +0530)]
ath9k: Merge struct ath_tx_ratectrl with ath_rate_node

Avoid casting of ath_tx_ratctrl and access the elements directly.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Fix panic while unregistering rfkill
Vasanthakumar Thiagarajan [Mon, 17 Nov 2008 19:49:56 +0000 (01:19 +0530)]
ath9k: Fix panic while unregistering rfkill

 [ 6133.670329] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
 [ 6133.672802] IP: [<ffffffffa030fcf6>] ieee80211_stop_queues+0x26/0x40 [mac80211]
 [ 6133.672802] PGD 759dc067 PUD 74f1d067 PMD 0
 [ 6133.672802] Oops: 0002 [#1] PREEMPT SMP
 [ 6133.672802] last sysfs file: /sys/class/backlight/acpi_video0/brightness
 [ 6133.672802] CPU 0
 [ 6133.672802] Modules linked in: ath9k(-) mac80211 pciehp pci_hotplug arc4 ecb joydev pcmcia ppdev lp ppp_generic psmouse sg pcspkr s]
 [ 6133.735830] Pid: 4445, comm: rmmod Tainted: G        W  2.6.28-rc5-wl #1
 [ 6133.735830] RIP: 0010:[<ffffffffa030fcf6>]  [<ffffffffa030fcf6>] ieee80211_stop_queues+0x26/0x40 [mac80211]
 [ 6133.735830] RSP: 0018:ffff88007d1efd10  EFLAGS: 00010246
 [ 6133.735830] RAX: 0000000000000000 RBX: ffff880074f41aa0 RCX: 0000000000000000
 [ 6133.735830] RDX: 0000000000000010 RSI: 0000000000000000 RDI: ffff880074f40340
 [ 6133.735830] RBP: ffff880074990000 R08: 0000000000000000 R09: 000000000000224d
 [ 6133.735830] R10: 0000000000000000 R11: ffffffff8031dc70 R12: 0000000000000000
 [ 6133.735830] R13: 0000000000000001 R14: ffff880074f46c9c R15: 0000000000000000
 [ 6133.735830] FS:  00007f1e2e0bc6f0(0000) GS:ffffffff805e0b80(0000) knlGS:0000000000000000
 [ 6133.735830] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 [ 6133.735830] CR2: 0000000000000010 CR3: 0000000075593000 CR4: 00000000000006e0
 [ 6133.735830] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 [ 6133.735830] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 [ 6133.735830] Process rmmod (pid: 4445, threadinfo ffff88007d1ee000, task ffff88007c0c8000)
 [ 6133.735830] Stack:
 [ 6133.735830]  ffffffffa034d583 ffff88007c7d9410 ffff88007c7d9410 ffff88007c7d9410
 [ 6133.735830]  ffffffff80481dab ffff880074f41aa0 00000000fffffff0 0000000000000000
 [ 6133.735830]  0000000000000001 0000000000000001 ffffffffa034d8a5 ffff88007c7d9400
 [ 6133.735830] Call Trace:
 [ 6133.735830]  [<ffffffffa034d583>] ? ath_radio_disable+0x33/0x150 [ath9k]
 [ 6133.735830]  [<ffffffff80481dab>] ? __mutex_lock_slowpath+0x20b/0x2a0
 [ 6133.735830]  [<ffffffffa034d8a5>] ? ath_sw_toggle_radio+0x65/0xa0 [ath9k]
 [ 6133.735830]  [<ffffffffa019d1f4>] ? rfkill_toggle_radio+0x74/0x140 [rfkill]
 [ 6133.735830]  [<ffffffffa019d597>] ? rfkill_remove_switch+0x67/0x80 [rfkill]
 [ 6133.735830]  [<ffffffffa019d955>] ? rfkill_unregister+0x25/0x50 [rfkill]
 [ 6133.735830]  [<ffffffffa034bf75>] ? ath_detach+0xf5/0x140 [ath9k]
 [ 6133.735830]  [<ffffffffa034bfe9>] ? ath_pci_remove+0x29/0x80 [ath9k]
 [ 6133.735830]  [<ffffffff8035263c>] ? pci_device_remove+0x2c/0x60
 [ 6133.735830]  [<ffffffff803c3829>] ? __device_release_driver+0x99/0x100
 [ 6133.735830]  [<ffffffff803c3950>] ? driver_detach+0xc0/0xd0
 [ 6133.735830]  [<ffffffff803c296e>] ? bus_remove_driver+0x8e/0xd0
 [ 6133.735830]  [<ffffffff80352916>] ? pci_unregister_driver+0x36/0xa0
 [ 6133.735830]  [<ffffffffa0356ad4>] ? exit_ath_pci+0x10/0x29 [ath9k]
 [ 6133.735830]  [<ffffffff8026bb1b>] ? sys_delete_module+0x1cb/0x2d0
 [ 6133.735830]  [<ffffffff802960d9>] ? do_munmap+0x349/0x390
 [ 6133.735830]  [<ffffffff80342d01>] ? __up_write+0x21/0x150
 [ 6133.735830]  [<ffffffff8020c45b>] ? system_call_fastpath+0x16/0x1b
 [ 6133.735830] Code: c3 0f 1f 40 00 0f b7 57 5e 0f b7 47 5c 01 c2 74 30 31 c9 66 90 48 8b 57 78 0f b7 c1 48 c1 e0 07 48 03 82 00 03 00
 [ 6133.735830] RIP  [<ffffffffa030fcf6>] ieee80211_stop_queues+0x26/0x40 [mac80211]

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: Fix transmission count sent to mac80211
Larry Finger [Mon, 17 Nov 2008 15:08:21 +0000 (09:08 -0600)]
rtl8187: Fix transmission count sent to mac80211

In the commit entitled "mac80211/drivers: rewrite the rate control
API", the meaning of the packet transmit count was changed from the
number of retries to the total number.  In driver rtl8187, this change
was missed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Fix pid rate-setting algorithm to allow rate changes
Larry Finger [Sun, 16 Nov 2008 23:09:25 +0000 (17:09 -0600)]
mac80211: Fix pid rate-setting algorithm to allow rate changes

In commit 9ea2c74 named "mac80211/drivers: rewrite the rate control API",
the meaning of status.rates[i].count was changed from number of retries
to total number of tries. As a result, the pid rate-setting algorithm fails
because every packet appears to have needed a retransmit.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort2x00: Don't switch off LED on initialization
Ivo van Doorn [Sat, 15 Nov 2008 23:08:50 +0000 (00:08 +0100)]
rt2x00: Don't switch off LED on initialization

When we switch off the LEDS during initialization
we kill rt73usb from proper functioning. The immediate
result after the first LED command are MCU failures
and a complete breakdown of TX/RX.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoorinoco: indicate it is using dBm in wireless_stats and spy
Andrey Borzenkov [Sat, 15 Nov 2008 14:15:09 +0000 (17:15 +0300)]
orinoco: indicate it is using dBm in wireless_stats and spy

Since WE7 /proc/net/wireless checks whether level and noise  are in dBm
and shows them accordingly. Indicate that we return signal and noice
levels in dBm.

Before:
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
  eth1: 0000   65.  219.  165.       0      0    148     41      0        0

After:
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
  eth1: 0000   65.  -37.  -91.       0      0      0      0      0        0

While at it, replace raw numbers with appropriate macro.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: make Minstrel the default rate control algorithm
Luis R. Rodriguez [Sat, 15 Nov 2008 01:44:53 +0000 (17:44 -0800)]
mac80211: make Minstrel the default rate control algorithm

This makes minstrel the default rate control algorithm
for mac80211. For more information see:

http://wireless.kernel.org/en/developers/Documentation/mac80211/RateControl/minstrel

If someone can come up with a better algorithm they get a prize
(undisclosed).

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: don't assume driver has been attached on registration
Luis R. Rodriguez [Fri, 14 Nov 2008 22:44:22 +0000 (14:44 -0800)]
mac80211: don't assume driver has been attached on registration

mac80211's ieee80211_register_hw() is often called within the
probe path so it cannot assume the device's driver structure
has been attached yet so to create a workqueue instead of
using driver->name use the wiphy's phy%d name. The name doesn't
really matter anyway.

This should fix sporadic oopses found when we race to beat the
driver pointer setting. Not even sure how this was working properly.

http://www.kerneloops.org/search.php?search=ieee80211_register_hw

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Configure AR_PHY_SWITCH_COM with apropriate antenna control
Vasanthakumar Thiagarajan [Fri, 14 Nov 2008 19:19:49 +0000 (00:49 +0530)]
ath9k: Configure AR_PHY_SWITCH_COM with apropriate antenna control

This fixes the poor wireless connection which happens even
if we are very well in the range.

Signed-off-by: Don.breslin@atheros.com
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: honour bss_info_changed's basic_rates and other settings
Christian Lamparter [Fri, 14 Nov 2008 18:42:39 +0000 (19:42 +0100)]
p54: honour bss_info_changed's basic_rates and other settings

As was pointed out in "p54: honour bss_info_changed's short slot time settings",
bss_info_changed provides more useful settings that can be used by the driver.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54pci: cache firmware for suspend/resume
Christian Lamparter [Sun, 16 Nov 2008 11:20:32 +0000 (12:20 +0100)]
p54pci: cache firmware for suspend/resume

Johannes pointed out that the driver has cache the firmware for
suspend/resume cycles.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: minor fixes
Christian Lamparter [Fri, 14 Nov 2008 18:41:22 +0000 (19:41 +0100)]
p54: minor fixes

This patch contains only contains a one-liner fixes and enhancements

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agop54: enable Mesh Point support
Christian Lamparter [Sat, 15 Nov 2008 16:02:31 +0000 (17:02 +0100)]
p54: enable Mesh Point support

This patch enables Mesh Point operation for any p54 device.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agomac80211: Use the HT capabilities from the IE instead of the station's caps.
Sujith [Fri, 14 Nov 2008 10:57:53 +0000 (16:27 +0530)]
mac80211: Use the HT capabilities from the IE instead of the station's caps.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: make DMA memory consistent
Luis R. Rodriguez [Fri, 14 Nov 2008 03:11:57 +0000 (19:11 -0800)]
ath9k: make DMA memory consistent

Make the DMAable mameory consistent with pci_set_consistent_dma_mask().
The DMA-mapping.txt Documentation recommends this but for PCI-X
considerations and on strange architecture like SGI SN2, not sure
why it would fix an issue but lets see if it does, just in case.

Before this, this driver was tested with x86_64 with about
7 GB of RAM, not sure if this is really needed.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Clarify we only want 32-bit DMA
Luis R. Rodriguez [Fri, 14 Nov 2008 03:11:56 +0000 (19:11 -0800)]
ath9k: Clarify we only want 32-bit DMA

Use DMA_32BIT_MASK to clarify we only want 32-bit DMA
memory. What was there before is also 32-bit but this makes it
clearer

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort2x00: Detect USB BULK in/out endpoints
Ivo van Doorn [Thu, 13 Nov 2008 22:07:33 +0000 (23:07 +0100)]
rt2x00: Detect USB BULK in/out endpoints

Instead of hardcoding the used in/out endpoints
we should detect them by walking through all
available endpoints.

rt2800usb will gain the most out of this, because
the legacy drivers indicate that there are multiple
endpoints available.
However this code might benefit at least rt73usb as
well for the MIMO queues, and if we are really lucky
rt2500usb will benefit because for the TX and PRIO
queues.

Even if rt2500usb and rt73usb do not get better performance
after this patch, the endpoint detection still belongs to
rt2x00usb, and it shouldn't hurt to always try to detect
the available endpoints.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: Remove module warning and dependence on CONFIG_EXPERIMENTAL
Larry Finger [Thu, 13 Nov 2008 18:30:41 +0000 (12:30 -0600)]
rtl8187: Remove module warning and dependence on CONFIG_EXPERIMENTAL

After considerable testing, the initial fears that the driver might damage
some flavors of RTL8187B hardware seem to be groundless. Accordingly, the
logged warning is removed. In addition, Kconfig is changed to remove the
dependence on EXPERIMENTAL.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger>
Acked-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: feedback transmitted packets using tx close descriptor for 8187B
Herton Ronaldo Krzesinski [Thu, 13 Nov 2008 15:39:16 +0000 (10:39 -0500)]
rtl8187: feedback transmitted packets using tx close descriptor for 8187B

Realtek 8187B has a receive command queue to feedback beacon interrupt
and transmitted packet status. Use it to feedback mac80211 about status
of transmitted packets. Unfortunately in the course of testing I found
that the sequence number reported by hardware includes entire sequence
control in a 12 bit only field, so a workaround is done to check only
lowest bits.

Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: implement conf_tx callback to configure tx queues
Herton Ronaldo Krzesinski [Thu, 13 Nov 2008 15:39:15 +0000 (10:39 -0500)]
rtl8187: implement conf_tx callback to configure tx queues

Add conf_tx callback and use it to configure tx queues of 8187L/8187B.

Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agortl8187: fix 8187B throughput regression
Herton Ronaldo Krzesinski [Thu, 13 Nov 2008 15:39:14 +0000 (10:39 -0500)]
rtl8187: fix 8187B throughput regression

Hin-Tak Leung reported that after the change "rtl8187: add short slot
handling for 8187B" his RTL8187B started to give low throughput on
network transfers. Turns out that the SIFS setting used isn't ok, it
doesn't look to be the real aSIFSTime, using the "magical" 0x22 value
like on other 818x variants as the vendor does too fixes the issue.

Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Race condition in accessing TX and RX buffers.
Senthil Balasubramanian [Thu, 13 Nov 2008 12:31:08 +0000 (18:01 +0530)]
ath9k: Race condition in accessing TX and RX buffers.

Race condition causes RX buffers to be accessed even before it is
initialized. The RX and TX buffers are initialized immediately after
the hardware is registered with mac80211. The mac80211 start callback
is ready to be fired once the device is registered for a case when the
wpa_supplicant is also running at the same time.

The same race condition is also possible for RKFILL registration
as RFKILL init happens after the device registration with mac80211
and it is possible that rfkill_register would be called even before
it is initialized.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: IRQ should be disabled before calling free_irq()
Senthil Balasubramanian [Thu, 13 Nov 2008 12:30:37 +0000 (18:00 +0530)]
ath9k: IRQ should be disabled before calling free_irq()

ath9k frees irq even before IRQs are disabled and existing IRQs
are flushed when rfkill_register() fails.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: Build RFKILL feature even when RFKILL subsystem is a MODULE
Senthil Balasubramanian [Thu, 13 Nov 2008 12:30:02 +0000 (18:00 +0530)]
ath9k: Build RFKILL feature even when RFKILL subsystem is a MODULE

Currently, ath9k builds RFKILL feature only when the RFKILL subsystem
is built part of the kernel. Build RFKILL feature regardless of whether
RFKILL subsystem is built as a MODULE or part of the kernel.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: incorrect noise floor threshold values.
Senthil Balasubramanian [Thu, 13 Nov 2008 12:29:36 +0000 (17:59 +0530)]
ath9k: incorrect noise floor threshold values.

This patch fixes incorrect noise floor threshold values.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath9k: INI update for atheros chipets.
Senthil Balasubramanian [Thu, 13 Nov 2008 12:28:41 +0000 (17:58 +0530)]
ath9k: INI update for atheros chipets.

init values update for various atheros chipsets.

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: enable custom fw regulatory solution
Luis R. Rodriguez [Wed, 12 Nov 2008 22:22:04 +0000 (14:22 -0800)]
iwlwifi: enable custom fw regulatory solution

This enables the custom firmware regulatory solution option
on iwlwifi drivers. These devices are uncapable of mapping their
EEPROM regulatory domain to a specific ISO / IEC alpha2.
Although the new 11n devices (>= iwl 5000) have only
3 regultaory SKUs -- MOW, ABG (no N) and BG -- the older
devices (3945 and 4965) have a more complex SKU arrangement
and therefore its not practical to move this to the driver.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: add support for custom firmware regulatory solutions
Luis R. Rodriguez [Wed, 12 Nov 2008 22:22:03 +0000 (14:22 -0800)]
cfg80211: add support for custom firmware regulatory solutions

This adds API to cfg80211 to allow wireless drivers to inform
us if their firmware can handle regulatory considerations *and*
they cannot map these regulatory domains to an ISO / IEC 3166
alpha2. In these cases we skip the first regulatory hint instead
of expecting the driver to build their own regulatory structure,
providing us with an alpha2, or using the reg_notifier().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211/mac80211: Add 802.11d support
Luis R. Rodriguez [Wed, 12 Nov 2008 22:22:02 +0000 (14:22 -0800)]
cfg80211/mac80211: Add 802.11d support

This adds country IE parsing to mac80211 and enables its usage
within the new regulatory infrastructure in cfg80211. We parse
the country IEs only on management beacons for the BSSID you are
associated to and disregard the IEs when the country and environment
(indoor, outdoor, any) matches the already processed country IE.

To avoid following misinformed or outdated APs we build and use
a regulatory domain out of the intersection between what the AP
provides us on the country IE and what CRDA is aware is allowed
on the same country.

A secondary device is allowed to follow only the same country IE
as it make no sense for two devices on a system to be in two
different countries.

In the case the AP is using country IEs for an incorrect country
the user may help compliance further by setting the regulatory
domain before or after the IE is parsed and in that case another
intersection will be performed.

CONFIG_WIRELESS_OLD_REGULATORY is supported but requires CRDA
present.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: mark regdomains with > NL80211_MAX_SUPP_REG_RULES invalid
Luis R. Rodriguez [Wed, 12 Nov 2008 22:22:01 +0000 (14:22 -0800)]
cfg80211: mark regdomains with > NL80211_MAX_SUPP_REG_RULES invalid

Lets remain consistent and mark rds with > NL80211_MAX_SUPP_REG_RULES
number of reg rules as invalid in is_valid_rd().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: call_crda() won't tell us if CRDA was present
Luis R. Rodriguez [Wed, 12 Nov 2008 22:22:00 +0000 (14:22 -0800)]
cfg80211: call_crda() won't tell us if CRDA was present

kobject_uevent_env() can return an error but it just tells us
if the uvent was built/sent or not, it doesn't tell us anything
about what happened in userspace, whether the udev rule was present
nor does it tell us if CRDA was present or not. So remove
the informative complaint about it assuming it will tell us
such things.

Note that you can determine if CRDA is present after loading cfg80211
by using:

is_old_static_regdom(cfg80211_regdomain)

but this doesn't account for possible user install after initial
boot, and also for when the user uses the static EU regulatory
domain.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: expect different rd in cfg80211 when intersecting
Luis R. Rodriguez [Wed, 12 Nov 2008 22:21:59 +0000 (14:21 -0800)]
cfg80211: expect different rd in cfg80211 when intersecting

When intersecting it is possible that set_regdom() was called
with a regulatory domain which we'll only use as an aid to
build a final regulatory domain.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: separate intersection section in __set_regdom()
Luis R. Rodriguez [Wed, 12 Nov 2008 22:21:58 +0000 (14:21 -0800)]
cfg80211: separate intersection section in __set_regdom()

So far the __set_regdom() code is pretty generic as the
intersection case is fairly straight forward; this will however
change when 802.11d support is added so lets separate intersection
code for now in preparation for 802.11d support.

This patch only has slight functional changes.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: remove switch from __set_regdom()
Luis R. Rodriguez [Wed, 12 Nov 2008 22:21:57 +0000 (14:21 -0800)]
cfg80211: remove switch from __set_regdom()

We have control over the REGDOM_SET_BY_* macros passed
so remove the switch.

This patch has no functional changes.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: remove switch from __regulatory_hint()
Luis R. Rodriguez [Wed, 12 Nov 2008 22:21:56 +0000 (14:21 -0800)]
cfg80211: remove switch from __regulatory_hint()

We have complete control over REGDOM_SET_BY_* enum passed
down to __regulatory_hint() as such there is no need to
account for unexpected REGDOM_SET_BY_*'s, lets just remove
the switch statement as this code does not change and
won't change even when we add 802.11d support.

This patch has no functional changes.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agocfg80211: mark negative frequencies as invalid
Luis R. Rodriguez [Wed, 12 Nov 2008 22:21:55 +0000 (14:21 -0800)]
cfg80211: mark negative frequencies as invalid

Regulatory rules with negative frequencies are now
marked as invalid in is_valid_reg_rule().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: iwl-fh.h cleanup
Tomas Winkler [Wed, 12 Nov 2008 21:14:11 +0000 (13:14 -0800)]
iwlwifi: iwl-fh.h cleanup

This patch fix value of upper FH register bound plus
it reorders and groups registers in more readable way

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: some fh document fix and cleanup
Zhu, Yi [Wed, 12 Nov 2008 21:14:10 +0000 (13:14 -0800)]
iwlwifi: some fh document fix and cleanup

This patch cleans up some flow handler related document. It also
removes some blank lines.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: configure_filter rewrite
Zhu, Yi [Wed, 12 Nov 2008 21:14:09 +0000 (13:14 -0800)]
iwlwifi: configure_filter rewrite

The patch rewrites the mac80211 configure_filter handler to better mapping
mac80211 filter flags to iwlwifi hardware filter flags. We now can support
5 mac80211 filter flags: FIF_OTHER_BSS, FIF_ALLMULTI, FIF_PROMISC_IN_BSS,
FIF_BCN_PRBRESP_PROMISC and FIF_CONTROL. This patch also avoids reconnecting
if the filter flags are changed when the STA is associated. Because rx_assoc
is used when full rxon is not necessary.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi : fix checkpatch.pl errors
Abhijeet Kolekar [Wed, 12 Nov 2008 21:14:08 +0000 (13:14 -0800)]
iwlwifi : fix checkpatch.pl errors

Patch fixes checkpatch.pl errors for iwlwifi.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: replace magic constants with define
Chatre, Reinette [Wed, 12 Nov 2008 21:14:07 +0000 (13:14 -0800)]
iwlwifi: replace magic constants with define

use IWL_CCK_RATES_MASK and IWL_OFDM_RATES_MASK instead of
their values directly.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
cc: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: rs: remove fc variable and other cleanups
Tomas Winkler [Wed, 12 Nov 2008 21:14:06 +0000 (13:14 -0800)]
iwlwifi: rs: remove fc variable and other cleanups

This patch
1. Removes use once use only fc variables, they are useless after refactoring
ieee80211 frame control handlers
2. Other trivial cleanups

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwlwifi: consolidate station management code
Tomas Winkler [Wed, 12 Nov 2008 21:14:05 +0000 (13:14 -0800)]
iwlwifi: consolidate station management code

This patch moves code around and group most of the station
management code into iwl-sta.c

No functional changes (yet)

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoiwl3945 : Simplify iwl3945_pci_probe
Kolekar, Abhijeet [Wed, 12 Nov 2008 21:14:04 +0000 (13:14 -0800)]
iwl3945 : Simplify iwl3945_pci_probe

Patch aligns iwl3945_pci_probe with iwlwifi's iwl_pci_probe.
Added few comments and code simplified to make readable.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort2x00: Fix TX failure path
Ivo van Doorn [Tue, 11 Nov 2008 23:01:37 +0000 (00:01 +0100)]
rt2x00: Fix TX failure path

The callback function write_tx_data() can only fail
when our ENTRY_OWNER_DEVICE_DATA flag on a queue entry
failed to determine the entry was not available and
it is in fact still owned by the hardware.
This means that if that function fails the queue
must be stopped in mac80211.

When rt2x00queue_get_queue() returns NULL in the TX
path, it means mac80211 has passed us an invalid queue,
although this should be impossible, it shouldn't hurt
if we send mac80211 a signal to stop the queue either.

Both issues can simply be resolved by removing their
manual failure handler and making them use the failure path
provided in rt2x00mac_tx().

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort2x00: Move rt73usb register access wrappers into rt2x00usb
Ivo van Doorn [Mon, 10 Nov 2008 18:42:18 +0000 (19:42 +0100)]
rt2x00: Move rt73usb register access wrappers into rt2x00usb

rt2500usb and rt73usb have different register word sizes,
for that reason the register access wrappers were never
moved into rt2x00usb.
With rt2800usb on its way, we should favor the 32bit
register access and move those wrappers into rt2x00usb.
That saves duplicate code, since only rt2500usb will
need the special 16bit wrappers.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agort2x00: Cleanup indirect register access
Ivo van Doorn [Mon, 10 Nov 2008 18:41:40 +0000 (19:41 +0100)]
rt2x00: Cleanup indirect register access

All code which accessed indirect registers was similar
in respect to the for-loop, the given timeout, etc.
Move it into a seperate function, which for PCI drivers
can be moved into rt2x00pci.

This allows us to cleanup the cleanup the code further
by removing the goto statementsand making the codepath
look a bit nicer.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoath5k: name pci driver "ath5k" too
Johannes Berg [Mon, 10 Nov 2008 17:56:59 +0000 (18:56 +0100)]
ath5k: name pci driver "ath5k" too

Call the ath5k pci driver struct "ath5k" too to be less
confusing in sysfs.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
15 years agoRevert "hso: Fix crashes on close."
David S. Miller [Tue, 25 Nov 2008 11:53:09 +0000 (03:53 -0800)]
Revert "hso: Fix crashes on close."

This reverts commit 4a3e818181e1baf970e9232ca8b747e233176b87.

On request from Alan Cox.

Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoRevert "hso: Fix free of mutexes still in use."
David S. Miller [Tue, 25 Nov 2008 11:52:46 +0000 (03:52 -0800)]
Revert "hso: Fix free of mutexes still in use."

This reverts commit 52429eb216385fdc6969c0112ba8b46cffefaaef.

On request from Alan Cox.

Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoRevert "hso: Add TIOCM ioctl handling."
David S. Miller [Tue, 25 Nov 2008 11:52:17 +0000 (03:52 -0800)]
Revert "hso: Add TIOCM ioctl handling."

This reverts commit 7ea3a9ad9bf360f746a7ad6fa72511a5c359490d.

On request from Alan Cox.

Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoxfrm: remove useless forward declarations
Alexey Dobriyan [Tue, 25 Nov 2008 09:05:54 +0000 (01:05 -0800)]
xfrm: remove useless forward declarations

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoah4/ah6: remove useless NULL assignments
Alexey Dobriyan [Tue, 25 Nov 2008 09:05:09 +0000 (01:05 -0800)]
ah4/ah6: remove useless NULL assignments

struct will be kfreed in a moment, so...

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoigb: loopback bits not correctly cleared from RCTL register
Alexander Duyck [Tue, 25 Nov 2008 09:04:03 +0000 (01:04 -0800)]
igb: loopback bits not correctly cleared from RCTL register

This change forces the bits to 0 by using an &= operation with an inverted
mask of all options instead of using an |= with a value of 0.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoigb: remove unneeded bit refrence when enabling jumbo frames
Alexander Duyck [Tue, 25 Nov 2008 09:03:26 +0000 (01:03 -0800)]
igb: remove unneeded bit refrence when enabling jumbo frames

There is a reference to a Buffer Size extention bit that is unneded by
82575/82576 hardware.  Since it is not needed it should be removed from the
code.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoDCB: fix kconfig option
Jeff Kirsher [Tue, 25 Nov 2008 09:02:08 +0000 (01:02 -0800)]
DCB: fix kconfig option

Since the netlink option for DCB is necessary to actually be useful,
simplified the Kconfig option.  In addition, added useful help text for the
Kconfig option.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoaoe: remove private mac address format function
Harvey Harrison [Tue, 25 Nov 2008 08:40:37 +0000 (00:40 -0800)]
aoe: remove private mac address format function

Add %pm to omit the colons when printing a mac address.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agohso: Hook up ->reset_resume
Denis Joseph Barrow [Tue, 25 Nov 2008 08:36:10 +0000 (00:36 -0800)]
hso: Hook up ->reset_resume

Made usb_drivers reset_resume function point to hso_resume this
fixes problems a usb reset is done when the network interface
is left idle for a few minutes. Possibly reset_resume should
initialise hardware more but this works in the common case.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agohso: Add TIOCM ioctl handling.
Denis Joseph Barrow [Tue, 25 Nov 2008 08:35:26 +0000 (00:35 -0800)]
hso: Add TIOCM ioctl handling.

Makes TIOCM ioctls for Data Carrier Detect & related functions
work like /drivers/serial/serial-core.c potentially needed
for pppd & similar user programs.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agohso: Fix free of mutexes still in use.
Denis Joseph Barrow [Tue, 25 Nov 2008 08:33:13 +0000 (00:33 -0800)]
hso: Fix free of mutexes still in use.

A new structure hso_mutex_table had to be declared statically
& used as as hso_device mutex_lock(&serial->parent->mutex) etc
is freed in hso_serial_open & hso_serial_close by kref_put while
the mutex is still in use.

This is a substantial change but should make the driver much stabler.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agohso: Fix URB submission -EINVAL.
Denis Joseph Barrow [Tue, 25 Nov 2008 08:30:48 +0000 (00:30 -0800)]
hso: Fix URB submission -EINVAL.

Added check for IFF_UP in hso_resume, this should eliminate -EINVAL (-22)
errors caused from urb's being submitted twice, once by hso_resume
& once in hso_net_open, if suspend/resume USB power saving  mode is enabled

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agohso: Fix crashes on close.
Denis Joseph Barrow [Tue, 25 Nov 2008 08:27:50 +0000 (00:27 -0800)]
hso: Fix crashes on close.

Moved serial_open_count in hso_serial_open to
prevent crashes owing to the serial structure being made NULL
when hso_serial_close is called even though hso_serial_open
returned -ENODEV, Alan Cox pointed out this happens,
also put in sanity check in hso_serial_close
to check for a valid serial structure which should prevent
the most reproducable crash in the driver when the hso device
is disconnected while in use.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agohso: Add new usb device id's.
Denis Joseph Barrow [Tue, 25 Nov 2008 08:26:12 +0000 (00:26 -0800)]
hso: Add new usb device id's.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonetdev: add HAVE_NET_DEVICE_OPS
Stephen Hemminger [Tue, 25 Nov 2008 08:20:43 +0000 (00:20 -0800)]
netdev: add HAVE_NET_DEVICE_OPS

As a concession to vendors who have to deal with one source for different
kernel versions, add a HAVE_NET_DEVICE_OPS so they don't end up hard
coding ifdef against kernel version.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: handle shift/merge of cloned skbs too
Ilpo Järvinen [Tue, 25 Nov 2008 05:30:21 +0000 (21:30 -0800)]
tcp: handle shift/merge of cloned skbs too

This caused me to get repeatably:

  tcpdump: pcap_loop: recvfrom: Bad address

Happens occassionally when I tcpdump my for-looped test xfers:
  while [ : ]; do echo -n "$(date '+%s.%N') "; ./sendfile; sleep 20; done

Rest of the relevant commands:
  ethtool -K eth0 tso off
  tc qdisc add dev eth0 root netem drop 4%
  tcpdump -n -s0 -i eth0 -w sacklog.all

Running net-next under kvm, connection goes to the same host
(basically just out of kvm). The connection itself works ok
and data gets sent without corruption even with a large
number of tests while tcpdump fails usually within less than
5 tests.

Whether it only happens because of this change or not, I
don't know for sure but it's the only thing with which
I've seen that error. The non-cloned variant works w/o it
for much longer time. I'm yet to debug where the error
actually comes from.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: add some mibs to track collapsing
Ilpo Järvinen [Tue, 25 Nov 2008 05:27:22 +0000 (21:27 -0800)]
tcp: add some mibs to track collapsing

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: Make shifting not clear the hints
Ilpo Järvinen [Tue, 25 Nov 2008 05:26:56 +0000 (21:26 -0800)]
tcp: Make shifting not clear the hints

The earlier version was just very basic one which is "playing
safe" by always clearing the hints. However, clearing of a hint
is extremely costly operation with large windows, so it must be
avoided at all cost whenever possible, there is a way with
shifting too achieve not-clearing.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: Try to restore large SKBs while SACK processing
Ilpo Järvinen [Tue, 25 Nov 2008 05:20:15 +0000 (21:20 -0800)]
tcp: Try to restore large SKBs while SACK processing

During SACK processing, most of the benefits of TSO are eaten by
the SACK blocks that one-by-one fragment SKBs to MSS sized chunks.
Then we're in problems when cleanup work for them has to be done
when a large cumulative ACK comes. Try to return back to pre-split
state already while more and more SACK info gets discovered by
combining newly discovered SACK areas with the previous skb if
that's SACKed as well.

This approach has a number of benefits:

1) The processing overhead is spread more equally over the RTT
2) Write queue has less skbs to process (affect everything
   which has to walk in the queue past the sacked areas)
3) Write queue is consistent whole the time, so no other parts
   of TCP has to be aware of this (this was not the case with
   some other approach that was, well, quite intrusive all
   around).
4) Clean_rtx_queue can release most of the pages using single
   put_page instead of previous PAGE_SIZE/mss+1 calls

In case a hole is fully filled by the new SACK block, we attempt
to combine the next skb too which allows construction of skbs
that are even larger than what tso split them to and it handles
hole per on every nth patterns that often occur during slow start
overshoot pretty nicely. Though this to be really useful also
a retransmission would have to get lost since cumulative ACKs
advance one hole at a time in the most typical case.

TODO: handle upwards only merging. That should be rather easy
when segment is fully sacked but I'm leaving that as future
work item (it won't make very large difference anyway since
this current approach already covers quite a lot of normal
cases).

I was earlier thinking of some sophisticated way of tracking
timestamps of the first and the last segment but later on
realized that it won't be that necessary at all to store the
timestamp of the last segment. The cases that can occur are
basically either:
  1) ambiguous => no sensible measurement can be taken anyway
  2) non-ambiguous is due to reordering => having the timestamp
     of the last segment there is just skewing things more off
     than does some good since the ack got triggered by one of
     the holes (besides some substle issues that would make
     determining right hole/skb even harder problem). Anyway,
     it has nothing to do with this change then.

I choose to route some abnormal looking cases with goto noop,
some could be handled differently (eg., by stopping the
walking at that skb but again). In general, they either
shouldn't happen at all or are rare enough to make no difference
in practice.

In theory this change (as whole) could cause some macroscale
regression (global) because of cache misses that are taken over
the round-trip time but it gets very likely better because of much
less (local) cache misses per other write queue walkers and the
big recovery clearing cumulative ack.

Worth to note that these benefits would be very easy to get also
without TSO/GSO being on as long as the data is in pages so that
we can merge them. Currently I won't let that happen because
DSACK splitting at fragment that would mess up pcounts due to
sk_can_gso in tcp_set_skb_tso_segs. Once DSACKs fragments gets
avoided, we have some conditions that can be made less strict.

TODO: I will probably have to convert the excessive pointer
passing to struct sacktag_state... :-)

My testing revealed that considerable amount of skbs couldn't
be shifted because they were cloned (most likely still awaiting
tx reclaim)...

[The rest is considering future work instead since I got
repeatably EFAULT to tcpdump's recvfrom when I added
pskb_expand_head to deal with clones, so I separated that
into another, later patch]

...To counter that, I gave up on the fifth advantage:

5) When growing previous SACK block, less allocs for new skbs
   are done, basically a new alloc is needed only when new hole
   is detected and when the previous skb runs out of frags space

...which now only happens of if reclaim is fast enough to dispose
the clone before the SACK block comes in (the window is RTT long),
otherwise we'll have to alloc some.

With clones being handled I got these numbers (will be somewhat
worse without that), taken with fine-grained mibs:

                  TCPSackShifted 398
                   TCPSackMerged 877
            TCPSackShiftFallback 320
      TCPSACKCOLLAPSEFALLBACKGSO 0
  TCPSACKCOLLAPSEFALLBACKSKBBITS 0
  TCPSACKCOLLAPSEFALLBACKSKBDATA 0
    TCPSACKCOLLAPSEFALLBACKBELOW 0
    TCPSACKCOLLAPSEFALLBACKFIRST 1
 TCPSACKCOLLAPSEFALLBACKPREVBITS 318
      TCPSACKCOLLAPSEFALLBACKMSS 1
   TCPSACKCOLLAPSEFALLBACKNOHEAD 0
    TCPSACKCOLLAPSEFALLBACKSHIFT 0
          TCPSACKCOLLAPSENOOPSEQ 0
  TCPSACKCOLLAPSENOOPSMALLPCOUNT 0
     TCPSACKCOLLAPSENOOPSMALLLEN 0
             TCPSACKCOLLAPSEHOLE 12

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: make tcp_sacktag_one able to handle partial skb too
Ilpo Järvinen [Tue, 25 Nov 2008 05:14:43 +0000 (21:14 -0800)]
tcp: make tcp_sacktag_one able to handle partial skb too

This is preparatory work for SACK combiner patch which may
have to count TCP state changes for only a part of the skb
because it will intentionally avoids splitting skb to SACKed
and not sacked parts.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: Make SACK code to split only at mss boundaries
Ilpo Järvinen [Tue, 25 Nov 2008 05:13:50 +0000 (21:13 -0800)]
tcp: Make SACK code to split only at mss boundaries

Sadly enough, this adds possible divide though we try to avoid
it by checking one mss as common case.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: more aggressive skipping
Ilpo Järvinen [Tue, 25 Nov 2008 05:12:28 +0000 (21:12 -0800)]
tcp: more aggressive skipping

I knew already when rewriting the sacktag that this condition
was too conservative, change it now since it prevent lot of
useless work (especially in the sack shifter decision code
that is being added by a later patch). This shouldn't change
anything really, just save some processing regardless of the
shifter.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: move tcp_simple_retransmit to tcp_input
Ilpo Järvinen [Tue, 25 Nov 2008 05:11:55 +0000 (21:11 -0800)]
tcp: move tcp_simple_retransmit to tcp_input

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotcp: collapse more than two on retransmission
Ilpo Järvinen [Tue, 25 Nov 2008 05:03:43 +0000 (21:03 -0800)]
tcp: collapse more than two on retransmission

I always had thought that collapsing up to two at a time was
intentional decision to avoid excessive processing if 1 byte
sized skbs are to be combined for a full mtu, and consecutive
retransmissions would make the size of the retransmittee
double each round anyway, but some recent discussion made me
to understand that was not the case. Thus make collapse work
more and wait less.

It would be possible to take advantage of the shifting
machinery (added in the later patch) in the case of paged
data but that can be implemented on top of this change.

tcp_skb_is_last check is now provided by the loop.

I tested a bit (ss-after-idle-off, fill 4096x4096B xfer,
10s sleep + 4096 x 1byte writes while dropping them for
some a while with netem):

16774097:16775545(1448) ack 1 win 46
16775545:16776993(1448) ack 1 win 46
. ack 16759617 win 2399
16776993:16777217(224) ack 1 win 46
. ack 16762513 win 2399
. ack 16765409 win 2399
. ack 16768305 win 2399
. ack 16771201 win 2399
. ack 16774097 win 2399
. ack 16776993 win 2399
. ack 16777217 win 2399
16777217:16777257(40) ack 1 win 46
. ack 16777257 win 2399
16777257:16778705(1448) ack 1 win 46
16778705:16780153(1448) ack 1 win 46
FP 16780153:16781313(1160) ack 1 win 46
. ack 16778705 win 2399
. ack 16780153 win 2399
F 1:1(0) ack 16781314 win 2399

While without drop-all period I get this:

16773585:16775033(1448) ack 1 win 46
. ack 16764897 win 9367
. ack 16767793 win 9367
. ack 16770689 win 9367
. ack 16773585 win 9367
16775033:16776481(1448) ack 1 win 46
16776481:16777217(736) ack 1 win 46
. ack 16776481 win 9367
. ack 16777217 win 9367
16777217:16777218(1) ack 1 win 46
16777218:16777219(1) ack 1 win 46
16777219:16777220(1) ack 1 win 46
  ...
16777247:16777248(1) ack 1 win 46
. ack 16777218 win 9367
. ack 16777219 win 9367
  ...
. ack 16777233 win 9367
. ack 16777248 win 9367
16777248:16778696(1448) ack 1 win 46
16778696:16780144(1448) ack 1 win 46
FP 16780144:16781313(1169) ack 1 win 46
. ack 16780144 win 9367
F 1:1(0) ack 16781314 win 9367

The window seems to be 30-40 segments, which were successfully
combined into: P 16777217:16777257(40) ack 1 win 46

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: avoid a pair of dst_hold()/dst_release() in ip_push_pending_frames()
Eric Dumazet [Tue, 25 Nov 2008 00:07:50 +0000 (16:07 -0800)]
net: avoid a pair of dst_hold()/dst_release() in ip_push_pending_frames()

We can reduce pressure on dst entry refcount that slowdown UDP transmit
path on SMP machines. This pressure is visible on RTP servers when
delivering content to mediagateways, especially big ones, handling
thousand of streams. Several cpus send UDP frames to the same
destination, hence use the same dst entry.

This patch makes ip_push_pending_frames() steal the refcount its
callers had to take when filling inet->cork.dst.

This doesnt avoid all refcounting, but still gives speedups on SMP,
on UDP/RAW transmit path.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: avoid a pair of dst_hold()/dst_release() in ip_append_data()
Eric Dumazet [Mon, 24 Nov 2008 23:52:46 +0000 (15:52 -0800)]
net: avoid a pair of dst_hold()/dst_release() in ip_append_data()

We can reduce pressure on dst entry refcount that slowdown UDP transmit
path on SMP machines. This pressure is visible on RTP servers when
delivering content to mediagateways, especially big ones, handling
thousand of streams. Several cpus send UDP frames to the same
destination, hence use the same dst entry.

This patch makes ip_append_data() eventually steal the refcount its
callers had to take on the dst entry.

This doesnt avoid all refcounting, but still gives speedups on SMP,
on UDP/RAW transmit path

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: gen_estimator: Fix gen_kill_estimator() lookups
Jarek Poplawski [Mon, 24 Nov 2008 23:48:05 +0000 (15:48 -0800)]
net: gen_estimator: Fix gen_kill_estimator() lookups

gen_kill_estimator() linear lists lookups are very slow, and e.g. while
deleting a large number of HTB classes soft lockups were reported. Here
is another try to fix this problem: this time internally, with rbtree,
so similarly to Jamal's hashing idea IIRC. (Looking for next hits could
be still optimized, but it's really fast as it is.)

Reported-by: Badalian Vyacheslav <slavon@bigtelecom.ru>
Reported-by: Denys Fedoryshchenko <denys@visp.net.lb>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agopkt_sched: sch_drr: fix drr_dequeue loop()
Patrick McHardy [Mon, 24 Nov 2008 23:46:08 +0000 (15:46 -0800)]
pkt_sched: sch_drr: fix drr_dequeue loop()

Jarek Poplawski points out:

If all child qdiscs of sch_drr are non-work-conserving (e.g. sch_tbf)
drr_dequeue() will busy-loop waiting for skbs instead of leaving the
job for a watchdog. Checking for list_empty() in each loop isn't
necessary either, because this can never be true except the first time.

Using non-work-conserving qdiscs as children of DRR makes no sense,
simply bail out in that case.

Reported-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoinfiniband: Kill directly reference of netdev->priv
Wang Chen [Mon, 24 Nov 2008 23:34:00 +0000 (15:34 -0800)]
infiniband: Kill directly reference of netdev->priv

This use of netdev->priv is wrong.
The right way is:
alloc_netdev() with no memory for private data.
make netdev->ml_priv to point to c2_dev.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Acked-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonetdevice sbni: Convert directly reference of netdev->priv
Wang Chen [Mon, 24 Nov 2008 22:52:16 +0000 (14:52 -0800)]
netdevice sbni: Convert directly reference of netdev->priv

1. convert netdev->priv to netdev_priv().
2. make sbni_pci_probe() be static.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotokenring/3c359.c: Prevent possible mem leak when open failed
Jirka Pirko [Mon, 24 Nov 2008 22:49:11 +0000 (14:49 -0800)]
tokenring/3c359.c: Prevent possible mem leak when open failed

Freeing previously allocated buffers in case of error.

Signed-off-by: Jirka Pirko <jirka@pirko.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotokenring/3c359.c: Fix error message when allocating tx_ring
Jirka Pirko [Mon, 24 Nov 2008 22:48:25 +0000 (14:48 -0800)]
tokenring/3c359.c: Fix error message when allocating tx_ring

Pointed out by Joe Perches. Error message after tx_ring allocation check was
wrong.

Signed-off-by: Jirka Pirko <jirka@jirka.pirko.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agotokenring/3c359.c: fix allocation null check
Jirka Pirko [Mon, 24 Nov 2008 22:47:53 +0000 (14:47 -0800)]
tokenring/3c359.c: fix allocation null check

Fixed typo when allocating rx_ring, tx_ring was checked for null instead.

Signed-off-by: Jirka Pirko <jirka@pirko.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years ago8139too: use err.h macros
Stephen Hemminger [Mon, 24 Nov 2008 22:47:01 +0000 (14:47 -0800)]
8139too: use err.h macros

Instead of using call by reference use the PTR_ERR macros to handle
return value with error case. Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: Make sure BHs are disabled in sock_prot_inuse_add()
Eric Dumazet [Mon, 24 Nov 2008 22:05:22 +0000 (14:05 -0800)]
net: Make sure BHs are disabled in sock_prot_inuse_add()

There is still a call to sock_prot_inuse_add() in af_netlink
while in a preemptable section. Add explicit BH disable around
this call.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agonet: Make sure BHs are disabled in sock_prot_inuse_add()
Eric Dumazet [Mon, 24 Nov 2008 08:09:29 +0000 (00:09 -0800)]
net: Make sure BHs are disabled in sock_prot_inuse_add()

The rule of calling sock_prot_inuse_add() is that BHs must
be disabled.  Some new calls were added where this was not
true and this tiggers warnings as reported by Ilpo.

Fix this by adding explicit BH disabling around those call sites,
or moving sock_prot_inuse_add() call inside an existing BH disabled
section.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoeth: Declare an optimized compare_ether_addr_64bits() function
Eric Dumazet [Mon, 24 Nov 2008 07:24:32 +0000 (23:24 -0800)]
eth: Declare an optimized compare_ether_addr_64bits() function

Linus mentioned we could try to perform long word operations, even
on potentially unaligned addresses, on x86 at least. David mentioned
the HAVE_EFFICIENT_UNALIGNED_ACCESS test to handle this on all
arches that have efficient unailgned accesses.

I tried this idea and got nice assembly on 32 bits:

158:   33 82 38 01 00 00       xor    0x138(%edx),%eax
15e:   33 8a 34 01 00 00       xor    0x134(%edx),%ecx
164:   c1 e0 10                shl    $0x10,%eax
167:   09 c1                   or     %eax,%ecx
169:   74 0b                   je     176 <eth_type_trans+0x87>

And very nice assembly on 64 bits of course (one xor, one shl)

Nice oprofile improvement in eth_type_trans(), 0.17 % instead of 0.41 %,
expected since we remove 8 instructions on a fast path.

This patch implements a compare_ether_addr_64bits() function, that
uses the CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS ifdef to efficiently
perform the 6 bytes comparison on all capable arches.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>