platform/kernel/linux-rpi.git
12 years agoNFC: LLCP connect must wait for a CC frame
Samuel Ortiz [Mon, 7 May 2012 10:31:19 +0000 (12:31 +0200)]
NFC: LLCP connect must wait for a CC frame

Blocking sockets should sleep on a CC (Connection Complete) reception
from the connect() call.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Remove unneeded pn533 dev NULL check
Dan Carpenter [Mon, 7 May 2012 10:31:18 +0000 (12:31 +0200)]
NFC: Remove unneeded pn533 dev NULL check

container_of() works by subtracting the offset of the member.  The math
can't really return a zero here.  Sometimes people check it when they
actually meant to check something else but in this case we can just
remove the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Update Documentation/nfc-hci.txt
Eric Lapuyade [Mon, 7 May 2012 10:31:17 +0000 (12:31 +0200)]
NFC: Update Documentation/nfc-hci.txt

Document the new HCI ops and fix a few typos and spelling mistakes.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Add HCI/SHDLC support to let driver check for tag presence
Eric Lapuyade [Mon, 7 May 2012 10:31:16 +0000 (12:31 +0200)]
NFC: Add HCI/SHDLC support to let driver check for tag presence

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Specify usage for targets found and target lost events
Eric Lapuyade [Mon, 7 May 2012 10:31:15 +0000 (12:31 +0200)]
NFC: Specify usage for targets found and target lost events

It is now specified that nfc_target_found() and nfc_target_lost() core
functions must not be called from an atomic context. This allow us to
serialize calls and protect the targets table using the nfc device lock
instead of a spinlock.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Remove useless HCI private nfc target table
Eric Lapuyade [Mon, 7 May 2012 10:31:14 +0000 (12:31 +0200)]
NFC: Remove useless HCI private nfc target table

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Cache the core NFC active target pointer instead of its index
Eric Lapuyade [Mon, 7 May 2012 10:31:13 +0000 (12:31 +0200)]
NFC: Cache the core NFC active target pointer instead of its index

The NFC Core now caches the active nfc target pointer, thereby avoiding
the need to lookup the target table for each invocation of a driver ops.
Consequently, pn533, HCI and NCI now directly receive an nfc_target
pointer instead of a target index.

Cc: Ilan Elias <ilane@ti.com>
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agonl80211: fix typos in comments
Zefir Kurtisi [Mon, 7 May 2012 09:21:59 +0000 (11:21 +0200)]
nl80211: fix typos in comments

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agob43legacy: Fix error due to MMIO access with SSB unpowered
Larry Finger [Sun, 6 May 2012 21:01:05 +0000 (16:01 -0500)]
b43legacy: Fix error due to MMIO access with SSB unpowered

There is a dummy read of a PCI MMIO register that occurs before the SSB bus
has been powered, which is an error. This bug has not been seen earlier,
but was apparently exposed when udev was updated to version 182.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: replace brcmf_sdioh_card_regread with brcmf_sdio_regrl
Franky Lin [Sat, 5 May 2012 01:27:38 +0000 (18:27 -0700)]
brcmfmac: replace brcmf_sdioh_card_regread with brcmf_sdio_regrl

Use the newly introduced brcmf_sdio_regrl to replace
brcmf_sdioh_card_regread as part of the SDIO WiFi dongle register
access interface clean up.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: remove function brcmf_sdcard_regfail
Franky Lin [Sat, 5 May 2012 01:27:37 +0000 (18:27 -0700)]
brcmfmac: remove function brcmf_sdcard_regfail

The new interface brcmf_sdio_regr/w provides result of access
attempts. It is no longer necessary to use dedicated variable
and function to provide enquiry for failure.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: remove redundant retries for SDIO core register access
Franky Lin [Sat, 5 May 2012 01:27:36 +0000 (18:27 -0700)]
brcmfmac: remove redundant retries for SDIO core register access

The new brcmf_sdio_regrl/regwl interface has already performed
retries on failed attempts. It is no longer necessary to have the
retry mechanism in r_sdreg32/w_sdreg32.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: replace brcmf_sdcard_reg_write with brcmf_sdio_regwl
Franky Lin [Sat, 5 May 2012 01:27:35 +0000 (18:27 -0700)]
brcmfmac: replace brcmf_sdcard_reg_write with brcmf_sdio_regwl

Use the newly introduced brcmf_sdio_regwl to replace
brcmf_sdcard_reg_write as part of the SDIO WiFi dongle register
access interface clean up.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: replace brcmf_sdcard_reg_read with brcmf_sdio_regrl
Franky Lin [Sat, 5 May 2012 01:27:34 +0000 (18:27 -0700)]
brcmfmac: replace brcmf_sdcard_reg_read with brcmf_sdio_regrl

Use the newly introduced brcmf_sdio_regrl to replace
brcmf_sdcard_reg_read as part of the SDIO WiFi dongle register
access interface clean up.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: replace brcmf_sdcard_cfg_write with brcmf_sdio_regwb
Franky Lin [Sat, 5 May 2012 01:27:33 +0000 (18:27 -0700)]
brcmfmac: replace brcmf_sdcard_cfg_write with brcmf_sdio_regwb

Use the newly introduced brcmf_sdio_regwb to replace
brcmf_sdcard_cfg_write as part of the SDIO WiFi dongle register
access interface clean up.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: replace brcmf_sdcard_cfg_read with brcmf_sdio_regrb
Franky Lin [Sat, 5 May 2012 01:27:32 +0000 (18:27 -0700)]
brcmfmac: replace brcmf_sdcard_cfg_read with brcmf_sdio_regrb

Use the newly introduced brcmf_sdio_regrb to replace
brcmf_sdcard_cfg_read as part of the SDIO WiFi dongle register
access interface clean up.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: introduce unified register access interface for SDIO
Franky Lin [Sat, 5 May 2012 01:27:31 +0000 (18:27 -0700)]
brcmfmac: introduce unified register access interface for SDIO

Both brcmf_sdcard_cfg_read/write and brcmf_sdcard_reg_read/write
are used as interface functions for register access of SDIO WiFi
dongle. A unified interface brcmf_sdio_regr/w is introduced in
this patch in order to simplify the interface and keep the
complexity within the lower layer.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: decouple set_sbaddr_window from register write interface
Franky Lin [Sat, 5 May 2012 01:27:30 +0000 (18:27 -0700)]
brcmfmac: decouple set_sbaddr_window from register write interface

brcmf_sdcard_set_sbaddr_window configures 3 registers on SDIO
function misc bank to change current silicon backplane programming
window. This patch makes it call brcmf_sdioh_request_byte directly
in order to prepare for the write register interface unification.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: remove unused parameter of brcmf_sdcard_reg_write
Franky Lin [Sat, 5 May 2012 01:27:29 +0000 (18:27 -0700)]
brcmfmac: remove unused parameter of brcmf_sdcard_reg_write

The size parameter for brcmf_sdcard_reg_write is always 4. Remove it
to make the code cleaner.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: remove unused parameter of brcmf_sdcard_reg_read
Franky Lin [Sat, 5 May 2012 01:27:28 +0000 (18:27 -0700)]
brcmfmac: remove unused parameter of brcmf_sdcard_reg_read

The size parameter for brcmf_sdcard_reg_read is always 4. Remove it
to make the code neat.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoath9k_hw: Fix RTT calibration
Sujith Manoharan [Fri, 4 May 2012 07:53:59 +0000 (13:23 +0530)]
ath9k_hw: Fix RTT calibration

This patch fixes multiple issues with the current RTT
implementation in ath9k.

* The data that is obtained from the RTT interface registers
  are stored in 31:5 - mask out the extra bits when reading them.

* A history buffer is maintained which is not needed at all.
  Remove this array and just store the baseband data for each
  chain (or bank).

* A 'num_readings' variable was being used to handle the
  last entry. But it was being used in an improper manner, with
  the result that the RTT values were never being written
  to the RTT Interface registers. Fix this by using a simple
  flag.

* Stop baseband operations before programming the calibration values
  to the HW.

* Do not restore RX gain settings as part of RTT.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: fix the increment of unicast/multicast counters for forwarded PREQ
Chun-Yeow Yeoh [Fri, 4 May 2012 06:57:50 +0000 (14:57 +0800)]
mac80211: fix the increment of unicast/multicast counters for forwarded PREQ

Forwarded PREQ is either unicast or multicast. The appropriate counters
should be incremented accordingly.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: send peer candidate event for new sta only
Thomas Pedersen [Thu, 3 May 2012 22:06:09 +0000 (15:06 -0700)]
mac80211: send peer candidate event for new sta only

Only send a cfg80211 new peer candidate notification if userspace has
yet to allocate this station entry.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: don't disable AGG queues that are not enabled
Emmanuel Grumbach [Thu, 3 May 2012 21:22:06 +0000 (14:22 -0700)]
iwlwifi: don't disable AGG queues that are not enabled

If the BA session is torn down before we had a chance to start it
we shouldn't disable the AGG tx queues that weren't enabled.
This can happen in two cases:

1) We get a delBA before we drained our Tx queues in agg start flow
2) We didn't get the (successfull) addBA response on time

Reported-by: Daniel Chyan <dchyan@princeton.edu>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: don't flood logs when HT debug flag is set
Emmanuel Grumbach [Thu, 3 May 2012 21:22:05 +0000 (14:22 -0700)]
iwlwifi: don't flood logs when HT debug flag is set

We have TX_REPLY for that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: fix power index handling
Amit Beka [Thu, 3 May 2012 21:22:04 +0000 (14:22 -0700)]
iwlwifi: fix power index handling

The power index that the user gives as module parameter
in in range 1-5, but we need to decrease it in order
to create an array index out of it (0-4) for the power
table command.

Signed-off-by: Amit Beka <amit.beka@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: make sure reduced tx power bit is valid
Wey-Yi Guy [Thu, 3 May 2012 21:22:03 +0000 (14:22 -0700)]
iwlwifi: make sure reduced tx power bit is valid

Once driver decide to change reduced tx power behavior,
make sure the reduce tx power valid bit is set

Change-Id: I3afae96319292d8cb347a812a948085c5db7ad91
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/1948
Tested-by: Jenkins
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: add documentation for bt reduced tx power
Wey-Yi Guy [Thu, 3 May 2012 21:22:02 +0000 (14:22 -0700)]
iwlwifi: add documentation for bt reduced tx power

Change-Id: Ia6294d651dcffdcaf8b62e67bcef52bd8c158dea
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/1947
Tested-by: Jenkins
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: include rssi as part of decision making for reduce txpower
Wey-Yi Guy [Thu, 3 May 2012 21:22:01 +0000 (14:22 -0700)]
iwlwifi: include rssi as part of decision making for reduce txpower

In bt coex, consider the average rssi as part of decision making process

Change-Id: I8d11d7f177a6875e2a9d08f7539d42253226fd7a
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/1945
Tested-by: Jenkins
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoNFC: Select CRC_CCITT for SHDLC link layer of HCI based drivers
Marcel Holtmann [Thu, 3 May 2012 05:12:48 +0000 (07:12 +0200)]
NFC: Select CRC_CCITT for SHDLC link layer of HCI based drivers

The SHDLC link layer of HCI based drivers uses CRC-CCITT and thus
needs to select that kernel option.

Otherwise it ends up with this linking error:

net/built-in.o: In function `nfc_shdlc_add_len_crc':
net/nfc/hci/shdlc.c:113: undefined reference to `crc_ccitt'

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: fix coding style issue in mwifiex_deauthenticate
Bing Zhao [Wed, 2 May 2012 02:53:51 +0000 (19:53 -0700)]
mwifiex: fix coding style issue in mwifiex_deauthenticate

Documentation/CodingStyle says
"Do not unnecessarily use braces where a single statement will do."

Use "switch/case", instead of "if/else_if/else", so that more cases
can be added later.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211_hwsim: Fix rate control by correctly reporting transmission counts
Javier Cardona [Tue, 1 May 2012 10:01:28 +0000 (03:01 -0700)]
mac80211_hwsim: Fix rate control by correctly reporting transmission counts

Drivers need to report the number of transmission attempts for each rate
as well as to terminate the rate array with -1.  The in-kernel datapath
of hwsim simulates a perfect medium, therefore the driver only needs to
report that the first transmission attempt was sucessfully completed at
the most favorable rate.

Rate control is working again for this driver.  Tested mesh mode with
minstrel.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: fix-up some merge damage from commit 0d6c4a2
John W. Linville [Wed, 9 May 2012 02:18:09 +0000 (22:18 -0400)]
iwlwifi: fix-up some merge damage from commit 0d6c4a2

Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years ago{nl,cfg,mac}80211: Allow user to see/configure HT protection mode
Ashok Nagarajan [Mon, 30 Apr 2012 21:20:32 +0000 (14:20 -0700)]
{nl,cfg,mac}80211: Allow user to see/configure HT protection mode

This patch introduces a new mesh configuration parameter "ht_opmode" and will
allow user to check the current HT protection mode selected. Users could
configure the protection mode by the command "iw mesh_iface set mesh_param
mesh_ht_protection_mode=2". The default protection mode of mesh is set to
non-HT mixed mode.

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
Reviewed-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: Allow nonHT/HT peering in mesh
Ashok Nagarajan [Mon, 30 Apr 2012 21:20:31 +0000 (14:20 -0700)]
mac80211: Allow nonHT/HT peering in mesh

Now that we have protection enabled, allow non-HT and HT20 stations to peer
with HT40+/- stations. Peering is still disallowed for HT40+/- mismatch.

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
Reviewed-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: Implement HT mixed protection mode
Ashok Nagarajan [Mon, 30 Apr 2012 21:20:30 +0000 (14:20 -0700)]
mac80211: Implement HT mixed protection mode

Section 9.23.3.5 of IEEE 80211s standard describes the protection rules for
HT mesh STA in a MBSS. Three HT protection modes are supported for now:

non-HT mixed mode - is selected if any non-HT peers are present in our MBSS.
20MHz-protection mode - is selected if all peers in our 20/40MHz MBSS support
HT and atleast one HT20 peer is present.
no-protection mode - is selected otherwise.

This is a limited implementation of 9.23.3.5, which only considers mesh peers
when determining the HT protection mode. Station's channel_type needs to be
maintained.

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
Reviewed-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: Advertise HT protection mode in IEs
Ashok Nagarajan [Mon, 30 Apr 2012 21:20:29 +0000 (14:20 -0700)]
mac80211: Advertise HT protection mode in IEs

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
Reviewed-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agocfg80211: fix BSS comparison
Emmanuel Grumbach [Mon, 30 Apr 2012 07:23:36 +0000 (10:23 +0300)]
cfg80211: fix BSS comparison

Since the BSS table is organized in a RB tree, the BSSs need to be
comparable. This means that we must define a < and > operator to
the BSS object.
compare_ethr_addr isn't enough since it returns only a binary value.

Since Felix's

cfg80211: use compare_ether_addr on MAC addresses instead of memcmp

    Because of the constant size and guaranteed 16 bit alignment, the inline
    compare_ether_addr function is much cheaper than calling memcmp.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
The BSS table is corrupted: rb_find_bss can't find the bss.
As a result BSSes are duplicated in the BSS table, and we get stuck
while probing an AP before associating (in STA mode).

Change-Id: I85928756f4328028230832c1565ece7f412f3843
CC: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: add out of band interrupt support
Franky Lin [Sat, 28 Apr 2012 01:56:59 +0000 (18:56 -0700)]
brcmfmac: add out of band interrupt support

Some sdio host controllers do not support real in band interrupt.
Software polling mode as a replacement is not fast enough for
high throughput and new features. Also some in band interrupts
do not support host wake up on embedded platform even when they
are real physical interrupts. Therefore out of band (oob)
interrupt mechanism is implemented for these scenarios.

To provide oob irq number and flags used for irq registration in
brcmfmac, a platform device contains irq resource must be
registered in board specific code.

Here is an example of platform device structure:
struct resource brcmf_sdio_res[] = {
{
.start = GPIO_BRCMF_SDIO_OOB_NUM,
.end = GPIO_BRCMF_SDIO_OOB_NUM,
.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
}
};
struct platform_device brcmf_sdio_device = {
.name = "brcmf_sdio_pd",
.id = -1,
.num_resources = ARRAY_SIZE(brcmf_sdio_res),
.resource = brcmf_sdio_res,
};

Reviewed-by: pieter-paul giesberts <pieterpg@broadcom.com>
Reviewed-by: arend van spriel <arend@broadcom.com>
Signed-off-by: franky lin <frankyl@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: postpone interrupt register function
Franky Lin [Sat, 28 Apr 2012 01:56:58 +0000 (18:56 -0700)]
brcmfmac: postpone interrupt register function

For out of band interrupt which is going to be introduced shortly,
the interrupt register function must be called after firmware is
downloaded. This patch moves it from brcmf_sdbrcm_probe to
brcmf_sdbrcm_bus_init.

Reviewed-by: pieter-paul giesberts <pieterpg@broadcom.com>
Reviewed-by: arend van spriel <arend@broadcom.com>
Signed-off-by: franky lin <frankyl@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: check bus state for status
Franky Lin [Sat, 28 Apr 2012 01:56:57 +0000 (18:56 -0700)]
brcmfmac: check bus state for status

Bus state should be the correct flag for bus status. Use it instead
of result from previous function call for backplane clock switch.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agobrcmfmac: stop releasing sdio host in irq handler
Franky Lin [Sat, 28 Apr 2012 01:56:56 +0000 (18:56 -0700)]
brcmfmac: stop releasing sdio host in irq handler

brcmf_sdbrcm_isr doesn't access to the dongle through SDIO bus.
Stop releasing and claiming host in irq handler to eliminate
any potential risk.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: Add more ethtools stats: survey, rates, etc
Ben Greear [Mon, 23 Apr 2012 19:50:32 +0000 (12:50 -0700)]
mac80211: Add more ethtools stats: survey, rates, etc

The signal and noise are forced to be positive since ethtool
deals in unsigned 64-bit values and this number should be human
readable.  This gives easy access to some of the data formerly
exposed in the deprecated /proc/net/wireless file.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: Framework to get wifi-driver stats via ethtool.
Ben Greear [Mon, 23 Apr 2012 19:50:31 +0000 (12:50 -0700)]
mac80211: Framework to get wifi-driver stats via ethtool.

This adds hooks to call into the driver to get additional
stats for the ethtool API.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: Support getting sta_info stats via ethtool.
Ben Greear [Mon, 23 Apr 2012 19:50:30 +0000 (12:50 -0700)]
mac80211: Support getting sta_info stats via ethtool.

This lets ethtool print out stats related to stations
connected to the interface.  Does not yet get stats
from the underlying driver.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agocfg80211: Add framework to support ethtool stats.
Ben Greear [Mon, 23 Apr 2012 19:50:29 +0000 (12:50 -0700)]
cfg80211: Add framework to support ethtool stats.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: use 6000G2B for 6030 device series
Wey-Yi Guy [Wed, 25 Apr 2012 15:10:08 +0000 (08:10 -0700)]
iwlwifi: use 6000G2B for 6030 device series

"iwlwifi: use correct released ucode version" change
the ucode api ok from 6000G2 to 6000G2B, but it shall belong
to 6030 device series, not the 6005 device series. Fix it

Cc: stable@vger.kernel.org #3.3+
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: use correct released ucode version
Meenakshi Venkataraman [Sun, 22 Apr 2012 14:55:27 +0000 (07:55 -0700)]
iwlwifi: use correct released ucode version

Report correctly the latest released version
of the iwlwifi firmware for all
iwlwifi-supported devices.

Cc: stable@vger.kernel.org #3.3+
Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoipw2100: Fix order of device registration
Ben Hutchings [Sun, 22 Jan 2012 03:11:12 +0000 (03:11 +0000)]
ipw2100: Fix order of device registration

Currently cfg80211 fails to create a "phy80211" symlink in sysfs from
the net device to the wiphy device.  The latter needs to be registered
first.

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoipw2200: Fix order of device registration
Ben Hutchings [Sun, 22 Jan 2012 03:09:35 +0000 (03:09 +0000)]
ipw2200: Fix order of device registration

Currently cfg80211 fails to create a "phy80211" symlink in sysfs from
the net device to the wiphy device.  The latter needs to be registered
first.

Compile-tested only.

Reported-by: Cesare Leonardi <celeonar@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agort2x00: Add debugfs access for rfcsr register
Anisse Astier [Thu, 19 Apr 2012 13:53:10 +0000 (15:53 +0200)]
rt2x00: Add debugfs access for rfcsr register

RFCSR is only used in rt2800. For other chipsets, the debug struct
for rfcsr should be zeroed, which isn't be an issue, since the code
can now cope with that.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agort2x00: debugfs support - allow a register to be empty
Anisse Astier [Thu, 19 Apr 2012 13:04:52 +0000 (15:04 +0200)]
rt2x00: debugfs support - allow a register to be empty

Allow a register to be unspecified, therefore not creating its debugfs
file entry.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agonet/wireless: ipw2200: Fix WARN_ON occurring in wiphy_register called by ipw_pci_probe
Stanislav Yakovlev [Mon, 16 Apr 2012 10:38:30 +0000 (06:38 -0400)]
net/wireless: ipw2200: Fix WARN_ON occurring in wiphy_register called by ipw_pci_probe

The problem was found by Stefan Lippers-Hollmann
http://marc.info/?l=linux-wireless&m=132720334512946&w=2

WARNING: at /tmp/buildd/linux-aptosid-3.2/debian/build/source_i386_none/net/wireless/core.c:562 wiphy_register+0x45/0x38d [cfg80211]()
Hardware name: TravelMate 290 \xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff
Modules linked in: ipw2200(+) iTCO_wdt libipw joydev drm snd_seq snd_timer snd_seq_device iTCO_vendor_support yenta_socket snd intel_agp i2c_i801 pcmcia_rsrc cfg80211 soundcore parport_pc psmouse parport rng_core snd_page_alloc serio_raw pcspkr i2c_algo_bit intel_gtt pcmcia_core evdev irda crc_ccitt rfkill lib80211 processor container ac battery shpchp pci_hotplug button ext4 mbcache jbd2 crc16 dm_mod sd_mod sr_mod crc_t10dif cdrom ata_generic pata_acpi ata_piix libata scsi_mod firewire_ohci firewire_core crc_itu_t 8139too 8139cp mii uhci_hcd ehci_hcd usbcore usb_common [last unloaded: scsi_wait_scan]
Pid: 328, comm: modprobe Not tainted 3.2-1.slh.4-aptosid-686 #1
Call Trace:
[<c012eaf4>] ? warn_slowpath_common+0x7c/0x8f
[<e0ff0b3e>] ? wiphy_register+0x45/0x38d [cfg80211]
[<e0ff0b3e>] ? wiphy_register+0x45/0x38d [cfg80211]
[<c012eb22>] ? warn_slowpath_null+0x1b/0x1f
[<e0ff0b3e>] ? wiphy_register+0x45/0x38d [cfg80211]
[<c01f89d7>] ? internal_create_group+0xf5/0xff
[<e0a2de1c>] ? ipw_pci_probe+0xa9a/0xbd0 [ipw2200]
[<c01519f4>] ? arch_local_irq_save+0xf/0x14
[<c0252986>] ? pci_device_probe+0x53/0x9a
[<c02c2820>] ? driver_probe_device+0x94/0x124
[<c0252871>] ? pci_match_id+0x15/0x34
[<c02c28f0>] ? __driver_attach+0x40/0x5b
[<c02c1d81>] ? bus_for_each_dev+0x37/0x60
[<c02c25aa>] ? driver_attach+0x17/0x1a
[<c02c28b0>] ? driver_probe_device+0x124/0x124
[<c02c22c4>] ? bus_add_driver+0x92/0x1d1
[<e099d000>] ? 0xe099cfff
[<c02c2cb8>] ? driver_register+0x7d/0xd4
[<c017cd50>] ? jump_label_module_notify+0xec/0x167
[<e099d000>] ? 0xe099cfff
[<c0253017>] ? __pci_register_driver+0x32/0x87
[<e099d000>] ? 0xe099cfff
[<e099d02e>] ? ipw_init+0x2e/0x72 [ipw2200]
[<c0101173>] ? do_one_initcall+0x7d/0x132
[<c0145016>] ? __blocking_notifier_call_chain+0x47/0x4f
[<c0154a73>] ? sys_init_module+0x13a4/0x159c
[<c03a639f>] ? sysenter_do_call+0x12/0x28

This warning appears only if we apply Ben Hutchings' fix
http://marc.info/?l=linux-wireless&m=132720195012653&w=2
for the bug reported by Cesare Leonardi
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656813
with cfg80211 warning during device registration
("cfg80211: failed to add phy80211 symlink to netdev!").

We separate device bring up and registration with network stack
to avoid the problem.

After that Ben Hutchings' fix can be applied to fix the bug.

Cc: stable@kernel.org
Signed-off-by: Stanislav Yakovlev <stas.yakovlev@gmail.com>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: remove the iwl_shared reference
Wey-Yi Guy [Tue, 24 Apr 2012 14:42:21 +0000 (07:42 -0700)]
iwlwifi: remove the iwl_shared reference

Change-Id: I10e42e0cc7dd91047f093ea2c5a55d65c004ada6
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/1939
Tested-by: Jenkins
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
12 years agoiwlwifi: modify #ifdef to avoid sparse complain
Wey-Yi Guy [Fri, 27 Apr 2012 23:18:47 +0000 (16:18 -0700)]
iwlwifi: modify #ifdef to avoid sparse complain

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agomac80211: don't transmit 40MHz frames to 20MHz peer
Thomas Pedersen [Thu, 26 Apr 2012 22:01:07 +0000 (15:01 -0700)]
mac80211: don't transmit 40MHz frames to 20MHz peer

If a mesh peer indicates it is operating as 20MHz-only in its HT
operation IE, have the rate control algorithm respect this by disabling
the equivalent bit in the ieee80211_sta HT capabilities.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: insert mesh peer after init
Thomas Pedersen [Thu, 26 Apr 2012 22:01:06 +0000 (15:01 -0700)]
mac80211: insert mesh peer after init

Drivers need the station rate info when inserting a new sta_info. The
patch "mac80211: refactor mesh peer initialization" wrongly assumed the
rate info could be applied after insertion. After further review, this
is clearly not the case.

This fixes a regression where HT parameters were not applied before
inserting the sta_info, causing performance degradation.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: fix static checker warnings
Amitkumar Karwar [Thu, 26 Apr 2012 20:02:57 +0000 (13:02 -0700)]
mwifiex: fix static checker warnings

"oui_type" in structure "ieee_types_vendor_header" is not used separately,
so include it in "oui" array. Now complete oui will be compared fixing
following warnings.

drivers/net/wireless/mwifiex/sta_ioctl.c:1410 mwifiex_set_gen_ie_helper()
        error: memcmp() 'pvendor_ie->oui' too small (3 vs 4)
drivers/net/wireless/mwifiex/sta_ioctl.c:1435 mwifiex_set_gen_ie_helper()
        error: memcmp() 'pvendor_ie->oui' too small (3 vs 4)
drivers/net/wireless/mwifiex/scan.c:1177 mwifiex_update_bss_desc_with_ie()
        error: memcmp() 'vendor_ie->vend_hdr.oui' too small (3 vs 4)
drivers/net/wireless/mwifiex/scan.c:1185 mwifiex_update_bss_desc_with_ie()
        error: memcmp() 'vendor_ie->vend_hdr.oui' too small (3 vs 4)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomac80211: fix rate control update on 2040 bss change
Rajkumar Manoharan [Wed, 25 Apr 2012 14:54:24 +0000 (20:24 +0530)]
mac80211: fix rate control update on 2040 bss change

The rate control updation never be called on 2040 BSS change.
The station should update its rate control on receiving beacon
with different HT mode in the HT operation IE. Not doing so,
leads to sending frames with higher(ht40) rates whereas AP is
operating in lower mode (ht20).

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agomwifiex: add support for SD8786 sdio
WarheadsSE [Tue, 24 Apr 2012 19:57:21 +0000 (15:57 -0400)]
mwifiex: add support for SD8786 sdio

modified:   drivers/net/wireless/mwifiex/Kconfig
- notate additional chipset
modified:   drivers/net/wireless/mwifiex/sdio.c
- add definition of id (0x9116)
- add to switch for firmware load
- add MODULE_FIRMWARE
modified:   drivers/net/wireless/mwifiex/sdio.h
- add definition of default firmware name

Signed-off-by: Jason Plum <max@warheads.net>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agowireless: at76c50x: allocating too much data
Dan Carpenter [Sat, 21 Apr 2012 12:23:44 +0000 (15:23 +0300)]
wireless: at76c50x: allocating too much data

This is a cut and paste mistake, sizeof(struct mib_local) was intended
instead of sizeof(struct mib_phy).  The call to at76_get_mib() uses
sizeof(struct mib_local) correctly, although I changed that to
sizeof(*m) for style reasons after discussion with some of the wireless
maintainers.

The current code works fine because mib_phy structs are larger than
mib_local structs.  But we may as well clean it up.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoiwlwifi: don't init trans->reg_lock from the op_mode
Emmanuel Grumbach [Mon, 23 Apr 2012 22:03:06 +0000 (15:03 -0700)]
iwlwifi: don't init trans->reg_lock from the op_mode

This doesn't make any sense. Init it from the transport instead.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: add option to disable 5GHz band
Stanislaw Gruszka [Thu, 19 Apr 2012 16:51:24 +0000 (09:51 -0700)]
iwlwifi: add option to disable 5GHz band

There are various problems happened on 5GHz band not observed on
2.4 GHz (microcode errors, queue stuck, etc... ) . Also roaming
between 5GHz AP and 2GHz does not work very well. To workaround
the problems add option to disable 5GHz support. This will help
on environments where APs are dual-band, and devices will not try
to associate on band where issues happen.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: use IWL_* instead of dev_printk when possible
Emmanuel Grumbach [Thu, 19 Apr 2012 07:29:58 +0000 (10:29 +0300)]
iwlwifi: use IWL_* instead of dev_printk when possible

Also remove a debug print when allocation error occurred.
The kernel will complain anyway.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: add loose coex lut
Wey-Yi Guy [Thu, 19 Apr 2012 16:50:42 +0000 (09:50 -0700)]
iwlwifi: add loose coex lut

Add the Loose coex LUT and will use later for better bt coex tpt

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: change kill mask based on reduce power state
Wey-Yi Guy [Thu, 19 Apr 2012 16:50:06 +0000 (09:50 -0700)]
iwlwifi: change kill mask based on reduce power state

In bt coex, consider reduce tx power as part of ack/cts kill mask

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: send reduce tx power info in command
Wey-Yi Guy [Thu, 19 Apr 2012 16:49:44 +0000 (09:49 -0700)]
iwlwifi: send reduce tx power info in command

Add the reduce tx power information in bt coex host command

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: small define change
Wey-Yi Guy [Thu, 19 Apr 2012 16:49:03 +0000 (09:49 -0700)]
iwlwifi: small define change

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: add reduced tx power threshold define
Wey-Yi Guy [Thu, 19 Apr 2012 16:48:34 +0000 (09:48 -0700)]
iwlwifi: add reduced tx power threshold define

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: add checking for the condition to reduce tx power
Wey-Yi Guy [Thu, 19 Apr 2012 16:48:01 +0000 (09:48 -0700)]
iwlwifi: add checking for the condition to reduce tx power

When bluetooth coex is active and certain condition matched,
driver need to decide should the tx power been reduce or not.
Adding the logic to manage it.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: add BT reduced tx power flag
Wey-Yi Guy [Thu, 19 Apr 2012 16:47:30 +0000 (09:47 -0700)]
iwlwifi: add BT reduced tx power flag

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agoiwlwifi: remove unused macros
Wey-Yi Guy [Thu, 19 Apr 2012 16:46:56 +0000 (09:46 -0700)]
iwlwifi: remove unused macros

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
12 years agolibertas: include sched.h on firmware.c
Luis R. Rodriguez [Tue, 24 Apr 2012 02:55:48 +0000 (19:55 -0700)]
libertas: include sched.h on firmware.c

Do not assume we have our subsystem including this for us,
at least for older kernels this is not true. Lets just be
explicit about this requirement for the usage of wake_up().

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 years agoMerge branch 'master' of git://1984.lsi.us.es/net-next
David S. Miller [Tue, 8 May 2012 18:40:21 +0000 (14:40 -0400)]
Merge branch 'master' of git://1984.lsi.us.es/net-next

12 years agonetfilter: remove ip_queue support
Pablo Neira Ayuso [Tue, 8 May 2012 17:45:28 +0000 (19:45 +0200)]
netfilter: remove ip_queue support

This patch removes ip_queue support which was marked as obsolete
years ago. The nfnetlink_queue modules provides more advanced
user-space packet queueing mechanism.

This patch also removes capability code included in SELinux that
refers to ip_queue. Otherwise, we break compilation.

Several warning has been sent regarding this to the mailing list
in the past month without anyone rising the hand to stop this
with some strong argument.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonetfilter: nf_conntrack: fix explicit helper attachment and NAT
Pablo Neira Ayuso [Thu, 3 May 2012 02:17:45 +0000 (02:17 +0000)]
netfilter: nf_conntrack: fix explicit helper attachment and NAT

Explicit helper attachment via the CT target is broken with NAT
if non-standard ports are used. This problem was hidden behind
the automatic helper assignment routine. Thus, it becomes more
noticeable now that we can disable the automatic helper assignment
with Eric Leblond's:

9e8ac5a netfilter: nf_ct_helper: allow to disable automatic helper assignment

Basically, nf_conntrack_alter_reply asks for looking up the helper
up if NAT is enabled. Unfortunately, we don't have the conntrack
template at that point anymore.

Since we don't want to rely on the automatic helper assignment,
we can skip the second look-up and stick to the helper that was
attached by iptables. With the CT target, the user is in full
control of helper attachment, thus, the policy is to trust what
the user explicitly configures via iptables (no automatic magic
anymore).

Interestingly, this bug was hidden by the automatic helper look-up
code. But it can be easily trigger if you attach the helper in
a non-standard port, eg.

iptables -I PREROUTING -t raw -p tcp --dport 8888 \
-j CT --helper ftp

And you disabled the automatic helper assignment.

I added the IPS_HELPER_BIT that allows us to differenciate between
a helper that has been explicitly attached and those that have been
automatically assigned. I didn't come up with a better solution
(having backward compatibility in mind).

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonetfilter: nf_ct_expect: partially implement ctnetlink_change_expect
Kelvie Wong [Wed, 2 May 2012 14:39:24 +0000 (14:39 +0000)]
netfilter: nf_ct_expect: partially implement ctnetlink_change_expect

This refreshes the "timeout" attribute in existing expectations if one is
given.

The use case for this would be for userspace helpers to extend the lifetime
of the expectation when requested, as this is not possible right now
without deleting/recreating the expectation.

I use this specifically for forwarding DCERPC traffic through:

DCERPC has a port mapper daemon that chooses a (seemingly) random port for
future traffic to go to. We expect this traffic (with a reasonable
timeout), but sometimes the port mapper will tell the client to continue
using the same port. This allows us to extend the expectation accordingly.

Signed-off-by: Kelvie Wong <kelvie@ieee.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonet: export sysctl_[r|w]mem_max symbols needed by ip_vs_sync
Hans Schillstrom [Mon, 30 Apr 2012 06:13:50 +0000 (08:13 +0200)]
net: export sysctl_[r|w]mem_max symbols needed by ip_vs_sync

To build ip_vs as a module sysctl_rmem_max and sysctl_wmem_max
needs to be exported.

The dependency was added by "ipvs: wakeup master thread" patch.

Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoipvs: ip_vs_proto: local functions should not be exposed globally
H Hartley Sweeten [Thu, 26 Apr 2012 18:26:15 +0000 (11:26 -0700)]
ipvs: ip_vs_proto: local functions should not be exposed globally

Functions not referenced outside of a source file should be marked
static to prevent it from being exposed globally.

This quiets the sparse warnings:

warning: symbol '__ipvs_proto_data_get' was not declared. Should it be static?

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: ip_vs_ftp: local functions should not be exposed globally
H Hartley Sweeten [Thu, 26 Apr 2012 18:17:28 +0000 (11:17 -0700)]
ipvs: ip_vs_ftp: local functions should not be exposed globally

Functions not referenced outside of a source file should be marked
static to prevent it from being exposed globally.

This quiets the sparse warnings:

warning: symbol 'ip_vs_ftp_init' was not declared. Should it be static?

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: optimize the use of flags in ip_vs_bind_dest
Pablo Neira Ayuso [Tue, 8 May 2012 07:28:19 +0000 (09:28 +0200)]
ipvs: optimize the use of flags in ip_vs_bind_dest

cp->flags is marked volatile but ip_vs_bind_dest
can safely modify the flags, so save some CPU cycles by
using temp variable.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: add support for sync threads
Pablo Neira Ayuso [Tue, 8 May 2012 17:40:30 +0000 (19:40 +0200)]
ipvs: add support for sync threads

Allow master and backup servers to use many threads
for sync traffic. Add sysctl var "sync_ports" to define the
number of threads. Every thread will use single UDP port,
thread 0 will use the default port 8848 while last thread
will use port 8848+sync_ports-1.

The sync traffic for connections is scheduled to many
master threads based on the cp address but one connection is
always assigned to same thread to avoid reordering of the
sync messages.

Remove ip_vs_sync_switch_mode because this check
for sync mode change is still risky. Instead, check for mode
change under sync_buff_lock.

Make sure the backup socks do not block on reading.

Special thanks to Aleksey Chudov for helping in all tests.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Tested-by: Aleksey Chudov <aleksey.chudov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: reduce sync rate with time thresholds
Julian Anastasov [Tue, 24 Apr 2012 20:46:40 +0000 (23:46 +0300)]
ipvs: reduce sync rate with time thresholds

Add two new sysctl vars to control the sync rate with the
main idea to reduce the rate for connection templates because
currently it depends on the packet rate for controlled connections.
This mechanism should be useful also for normal connections
with high traffic.

sync_refresh_period: in seconds, difference in reported connection
timer that triggers new sync message. It can be used to
avoid sync messages for the specified period (or half of
the connection timeout if it is lower) if connection state
is not changed from last sync.

sync_retries: integer, 0..3, defines sync retries with period of
sync_refresh_period/8. Useful to protect against loss of
sync messages.

Allow sysctl_sync_threshold to be used with
sysctl_sync_period=0, so that only single sync message is sent
if sync_refresh_period is also 0.

Add new field "sync_endtime" in connection structure to
hold the reported time when connection expires. The 2 lowest
bits will represent the retry count.

As the sysctl_sync_period now can be 0 use ACCESS_ONCE to
avoid division by zero.

Special thanks to Aleksey Chudov for being patient with me,
for his extensive reports and helping in all tests.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Tested-by: Aleksey Chudov <aleksey.chudov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: wakeup master thread
Pablo Neira Ayuso [Tue, 8 May 2012 17:39:49 +0000 (19:39 +0200)]
ipvs: wakeup master thread

High rate of sync messages in master can lead to
overflowing the socket buffer and dropping the messages.
Fixed sleep of 1 second without wakeup events is not suitable
for loaded masters,

Use delayed_work to schedule sending for queued messages
and limit the delay to IPVS_SYNC_SEND_DELAY (20ms). This will
reduce the rate of wakeups but to avoid sending long bursts we
wakeup the master thread after IPVS_SYNC_WAKEUP_RATE (8) messages.

Add hard limit for the queued messages before sending
by using "sync_qlen_max" sysctl var. It defaults to 1/32 of
the memory pages but actually represents number of messages.
It will protect us from allocating large parts of memory
when the sending rate is lower than the queuing rate.

As suggested by Pablo, add new sysctl var
"sync_sock_size" to configure the SNDBUF (master) or
RCVBUF (slave) socket limit. Default value is 0 (preserve
system defaults).

Change the master thread to detect and block on
SNDBUF overflow, so that we do not drop messages when
the socket limit is low but the sync_qlen_max limit is
not reached. On ENOBUFS or other errors just drop the
messages.

Change master thread to enter TASK_INTERRUPTIBLE
state early, so that we do not miss wakeups due to messages or
kthread_should_stop event.

Thanks to Pablo Neira Ayuso for his valuable feedback!

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: always update some of the flags bits in backup
Julian Anastasov [Tue, 24 Apr 2012 20:46:38 +0000 (23:46 +0300)]
ipvs: always update some of the flags bits in backup

As the goal is to mirror the inactconns/activeconns
counters in the backup server, make sure the cp->flags are
updated even if cp is still not bound to dest. If cp->flags
are not updated ip_vs_bind_dest will rely only on the initial
flags when updating the counters. To avoid mistakes and
complicated checks for protocol state rely only on the
IP_VS_CONN_F_INACTIVE bit when updating the counters.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Tested-by: Aleksey Chudov <aleksey.chudov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: fix ip_vs_try_bind_dest to rebind app and transmitter
Julian Anastasov [Tue, 24 Apr 2012 20:46:37 +0000 (23:46 +0300)]
ipvs: fix ip_vs_try_bind_dest to rebind app and transmitter

Initially, when the synced connection is created we
use the forwarding method provided by master but once we
bind to destination it can be changed. As result, we must
update the application and the transmitter.

As ip_vs_try_bind_dest is called always for connections
that require dest binding, there is no need to validate the
cp and dest pointers.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: remove check for IP_VS_CONN_F_SYNC from ip_vs_bind_dest
Julian Anastasov [Tue, 24 Apr 2012 20:46:36 +0000 (23:46 +0300)]
ipvs: remove check for IP_VS_CONN_F_SYNC from ip_vs_bind_dest

As the IP_VS_CONN_F_INACTIVE bit is properly set
in cp->flags for all kind of connections we do not need to
add special checks for synced connections when updating
the activeconns/inactconns counters for first time. Now
logic will look just like in ip_vs_unbind_dest.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: ignore IP_VS_CONN_F_NOOUTPUT in backup server
Julian Anastasov [Tue, 24 Apr 2012 20:46:35 +0000 (23:46 +0300)]
ipvs: ignore IP_VS_CONN_F_NOOUTPUT in backup server

As IP_VS_CONN_F_NOOUTPUT is derived from the
forwarding method we should get it from conn_flags just
like we do it for IP_VS_CONN_F_FWD_MASK bits when binding
to real server.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: use GFP_KERNEL allocation where possible
Sasha Levin [Sat, 14 Apr 2012 16:37:47 +0000 (12:37 -0400)]
ipvs: use GFP_KERNEL allocation where possible

Use GFP_KERNEL instead of GFP_ATOMIC when registering an ipvs protocol.

This is safe since it will always run from a process context.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoipvs: SH scheduler does not need GFP_ATOMIC allocation
Julian Anastasov [Fri, 13 Apr 2012 13:49:38 +0000 (16:49 +0300)]
ipvs: SH scheduler does not need GFP_ATOMIC allocation

        Schedulers are initialized and bound to services only
on commands.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: LBLCR scheduler does not need GFP_ATOMIC allocation on init
Julian Anastasov [Fri, 13 Apr 2012 13:49:41 +0000 (16:49 +0300)]
ipvs: LBLCR scheduler does not need GFP_ATOMIC allocation on init

Schedulers are initialized and bound to services only
on commands.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: WRR scheduler does not need GFP_ATOMIC allocation
Julian Anastasov [Fri, 13 Apr 2012 13:49:42 +0000 (16:49 +0300)]
ipvs: WRR scheduler does not need GFP_ATOMIC allocation

Schedulers are initialized and bound to services only
on commands.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: DH scheduler does not need GFP_ATOMIC allocation
Julian Anastasov [Fri, 13 Apr 2012 13:49:39 +0000 (16:49 +0300)]
ipvs: DH scheduler does not need GFP_ATOMIC allocation

Schedulers are initialized and bound to services only
on commands.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: LBLC scheduler does not need GFP_ATOMIC allocation on init
Julian Anastasov [Fri, 13 Apr 2012 13:49:40 +0000 (16:49 +0300)]
ipvs: LBLC scheduler does not need GFP_ATOMIC allocation on init

Schedulers are initialized and bound to services only
on commands.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agoipvs: timeout tables do not need GFP_ATOMIC allocation
Julian Anastasov [Fri, 13 Apr 2012 13:49:37 +0000 (16:49 +0300)]
ipvs: timeout tables do not need GFP_ATOMIC allocation

They are called only on initialization.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
12 years agonetfilter: bridge: optionally set indev to vlan
Pablo Neira Ayuso [Tue, 8 May 2012 17:36:44 +0000 (19:36 +0200)]
netfilter: bridge: optionally set indev to vlan

if net.bridge.bridge-nf-filter-vlan-tagged sysctl is enabled, bridge
netfilter removes the vlan header temporarily and then feeds the packet
to ip(6)tables.

When the new "bridge-nf-pass-vlan-input-device" sysctl is on
(default off), then bridge netfilter will also set the
in-interface to the vlan interface; if such an interface exists.

This is needed to make iptables REDIRECT target work with
"vlan-on-top-of-bridge" setups and to allow use of "iptables -i" to
match the vlan device name.

Also update Documentation with current brnf default settings.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Bart De Schuymer <bdschuym@pandora.be>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonetfilter: nf_conntrack: use this_cpu_inc()
Eric Dumazet [Wed, 18 Apr 2012 04:36:40 +0000 (06:36 +0200)]
netfilter: nf_conntrack: use this_cpu_inc()

this_cpu_inc() is IRQ safe and faster than
local_bh_disable()/__this_cpu_inc()/local_bh_enable(), at least on x86.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonetfilter: nf_ct_helper: allow to disable automatic helper assignment
Eric Leblond [Wed, 18 Apr 2012 09:20:41 +0000 (11:20 +0200)]
netfilter: nf_ct_helper: allow to disable automatic helper assignment

This patch allows you to disable automatic conntrack helper
lookup based on TCP/UDP ports, eg.

echo 0 > /proc/sys/net/netfilter/nf_conntrack_helper

[ Note: flows that already got a helper will keep using it even
  if automatic helper assignment has been disabled ]

Once this behaviour has been disabled, you have to explicitly
use the iptables CT target to attach helper to flows.

There are good reasons to stop supporting automatic helper
assignment, for further information, please read:

http://www.netfilter.org/news.html#2012-04-03

This patch also adds one message to inform that automatic helper
assignment is deprecated and it will be removed soon (this is
spotted only once, with the first flow that gets a helper attached
to make it as less annoying as possible).

Signed-off-by: Eric Leblond <eric@regit.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agonetfilter: nf_ct_ecache: refactor notifier registration
Tony Zelenoff [Thu, 8 Mar 2012 23:35:39 +0000 (23:35 +0000)]
netfilter: nf_ct_ecache: refactor notifier registration

* ret variable initialization removed as useless
* similar code strings concatenated and functions code
  flow became more plain

Signed-off-by: Tony Zelenoff <antonz@parallels.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
12 years agoetherdev.h: Convert int is_<foo>_ether_addr to bool
Joe Perches [Tue, 8 May 2012 06:44:40 +0000 (06:44 +0000)]
etherdev.h: Convert int is_<foo>_ether_addr to bool

Make the return value explicitly true or false.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>