openwrt/staging/blogic.git
8 years agortl8xxxu: Fix OOPS if user tries to add device via /sys
Jes Sorensen [Thu, 14 Apr 2016 20:37:18 +0000 (16:37 -0400)]
rtl8xxxu: Fix OOPS if user tries to add device via /sys

This driver relies on driver_info in struct usb_device_id, so allowing
adding a device via /sys/bus/usb/drivers/rtl8xxxu/new_id will cause a
NULL pointer dereference.

Set .no_dynamic_id = 1 to disable hot add of USB IDs.

Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix 8188RU support
Jes Sorensen [Thu, 14 Apr 2016 20:37:17 +0000 (16:37 -0400)]
rtl8xxxu: Fix 8188RU support

The 8188RU does not like PAPE to be enabled, while all the other gen1
parts seem to require it.

This makes the RTL8188RU able to associate for me.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add TX power base values for gen1 parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:16 +0000 (16:37 -0400)]
rtl8xxxu: Add TX power base values for gen1 parts

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set register 0xfe10 on rtl8192cu based parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:15 +0000 (16:37 -0400)]
rtl8xxxu: Set register 0xfe10 on rtl8192cu based parts

This register is undocumented in the vendor code, but it is set
unconditionally for all 8192cu/8188cu/8188ru parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Update copyright statement to include 2016
Jes Sorensen [Thu, 14 Apr 2016 20:37:14 +0000 (16:37 -0400)]
rtl8xxxu: Update copyright statement to include 2016

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Unregister from mac80211 before shutting down the device
Jes Sorensen [Thu, 14 Apr 2016 20:37:13 +0000 (16:37 -0400)]
rtl8xxxu: Unregister from mac80211 before shutting down the device

This fixes a long standing bug where mac80211 would send disconnect
packets to the device, after we had shut down the device.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Match 8723bu power down sequence to vendor driver
Jes Sorensen [Thu, 14 Apr 2016 20:37:12 +0000 (16:37 -0400)]
rtl8xxxu: Match 8723bu power down sequence to vendor driver

In particular set APS_FSMCO_WLON_RESET in the right register, and do
not overwrite too much of REG_CR.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use rtl_chip == RTL8188R to identify high PA parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:11 +0000 (16:37 -0400)]
rtl8xxxu: Use rtl_chip == RTL8188R to identify high PA parts

This is simpler than checking for RTL8188C && hi_pa.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Apply 8188RU workaround for UMC B cut parts correctly
Jes Sorensen [Thu, 14 Apr 2016 20:37:10 +0000 (16:37 -0400)]
rtl8xxxu: Apply 8188RU workaround for UMC B cut parts correctly

This patch was being missed since rtl_chip will never match RTL8188C
if hi_pa is true.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: For devices with external PA (8188RU), limit CCK TX power
Jes Sorensen [Thu, 14 Apr 2016 20:37:09 +0000 (16:37 -0400)]
rtl8xxxu: For devices with external PA (8188RU), limit CCK TX power

Per the vendor driver, devices with an external PA needs limiting it's
TX power to 0x20.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Move PHY RF init into device specific functions
Jes Sorensen [Thu, 14 Apr 2016 20:37:08 +0000 (16:37 -0400)]
rtl8xxxu: Move PHY RF init into device specific functions

Load the RF table in init_phy_rf(), which allows for applying device
specific RF hacks in the same place. Getting rid of more ugly if ()
clutter.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: fix uninitialized return value in ret
Colin Ian King [Thu, 14 Apr 2016 20:37:07 +0000 (16:37 -0400)]
rtl8xxxu: fix uninitialized return value in ret

several functions are not initializing a return status in ret
resulting in garbage to be returned instead of 0 for success.
Currently, the calls to these functions are not checking the
return, however, it seems prudent to return the correct status
in case they are to be checked at a later date.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Mark 0x050d:0x1004 as tested
Jes Sorensen [Thu, 14 Apr 2016 20:37:06 +0000 (16:37 -0400)]
rtl8xxxu: Mark 0x050d:0x1004 as tested

This dongle was tested successfully by Andrea Merello

Reported-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoRe-enable 8192eu support
Jes Sorensen [Thu, 14 Apr 2016 18:59:07 +0000 (14:59 -0400)]
Re-enable 8192eu support

Revert "rtl8xxxu: Temporarily disable 8192eu device init"

This reverts commit ccfe1e85322090649d2fae599e55300c1512bf15.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 8192eu Fix bug in LDPC RX hang fix
Jes Sorensen [Thu, 14 Apr 2016 18:59:06 +0000 (14:59 -0400)]
rtl8xxxu: 8192eu Fix bug in LDPC RX hang fix

Write the adjusted value back to the correct register

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unneeded 8192eu hack
Jes Sorensen [Thu, 14 Apr 2016 18:59:05 +0000 (14:59 -0400)]
rtl8xxxu: Remove unneeded 8192eu hack

This removes an unneeded hack for 8192eu, and allows for initializing
REG_FPGA0_XAB_RF_SW_CTRL at the same point as it is done for all other
parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Split USB quirks into gen1 and gen2 quirks
Jes Sorensen [Thu, 14 Apr 2016 18:59:04 +0000 (14:59 -0400)]
rtl8xxxu: Split USB quirks into gen1 and gen2 quirks

This removes a bunch of if () spaghetti and re-applies the USB bus
quirks for 8188/8192 that had gotten lost.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Make PBP tuning a fileops parameter
Jes Sorensen [Thu, 14 Apr 2016 18:59:03 +0000 (14:59 -0400)]
rtl8xxxu: Make PBP tuning a fileops parameter

Rather than scattering the code with #ifdefs, use the fileops
structure to hold device specific PBP values.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not backup RF_MODE_AG when it's never being used
Jes Sorensen [Thu, 14 Apr 2016 18:59:02 +0000 (14:59 -0400)]
rtl8xxxu: Do not backup RF_MODE_AG when it's never being used

This was expired by the vendor driver, but we never ended up using the
backed up value.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Store device specific TRXFF boundary in the fileops
Jes Sorensen [Thu, 14 Apr 2016 18:59:01 +0000 (14:59 -0400)]
rtl8xxxu: Store device specific TRXFF boundary in the fileops

This removes another case of ugly if () clutter

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: REG_LDOA15_CTRL is only used on gen1 parts
Jes Sorensen [Thu, 14 Apr 2016 18:59:00 +0000 (14:59 -0400)]
rtl8xxxu: REG_LDOA15_CTRL is only used on gen1 parts

Move setting it to rtl8723au_init_phy_bb()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Move loading of AGC table to device specific function
Jes Sorensen [Thu, 14 Apr 2016 18:58:59 +0000 (14:58 -0400)]
rtl8xxxu: Move loading of AGC table to device specific function

This moves the loading of the AGC table into init_phy_bb() and reduces
the if() clutter.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Load AGC table before patching for 1T2R parts
Jes Sorensen [Thu, 14 Apr 2016 18:58:58 +0000 (14:58 -0400)]
rtl8xxxu: Load AGC table before patching for 1T2R parts

This should get the order right and avoid patching something that is
later overwritten.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Split rtl8xxxu_init_phy_bb() into device specific functions
Jes Sorensen [Thu, 14 Apr 2016 18:58:57 +0000 (14:58 -0400)]
rtl8xxxu: Split rtl8xxxu_init_phy_bb() into device specific functions

This reduces the if () clutter. Longer term it probably makes sense to
split this between gen1 (8723au/8188cu/8192cu) and gen2
(8192eu/8723bu) devices.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use descriptive bits for setting RX paths for 1T2R parts
Jes Sorensen [Thu, 14 Apr 2016 18:58:56 +0000 (14:58 -0400)]
rtl8xxxu: Use descriptive bits for setting RX paths for 1T2R parts

This reduce the use of magic values a little.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Correctly mask what was read from REG_CCK0_AFE_SETTING
Jes Sorensen [Thu, 14 Apr 2016 18:58:55 +0000 (14:58 -0400)]
rtl8xxxu: Correctly mask what was read from REG_CCK0_AFE_SETTING

The old code incorrectly wiped out bits 0-23 by mistake when setting
the RX path for 1T parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused 8723bu path B IQ calibration code
Jes Sorensen [Thu, 14 Apr 2016 18:58:54 +0000 (14:58 -0400)]
rtl8xxxu: Remove unused 8723bu path B IQ calibration code

The 8723bu is a combo WiFi/BT dongle, and path B is not used for WiFi,
so no point in calibrating it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove misleading warning from rtl8192eu_phy_iqcalibrate()
Jes Sorensen [Thu, 14 Apr 2016 18:58:53 +0000 (14:58 -0400)]
rtl8xxxu: Remove misleading warning from rtl8192eu_phy_iqcalibrate()

No actual code flow change, but no need to warn about something that
isn't a prioblem.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Name RX descriptor types rxdesc16/rxdesc24
Jes Sorensen [Thu, 14 Apr 2016 18:58:52 +0000 (14:58 -0400)]
rtl8xxxu: Name RX descriptor types rxdesc16/rxdesc24

This caught a bug where too little memory was allocated for RX urbs
for parts using 24 byte RX descriptors

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: byteswap the entire RX descriptor for 24 byte RX descriptors
Jes Sorensen [Thu, 14 Apr 2016 18:58:51 +0000 (14:58 -0400)]
rtl8xxxu: byteswap the entire RX descriptor for 24 byte RX descriptors

This shouldn't affect little endian system, but may have prevented the
driver working on big endian systems for devices with the larger 24
byte RX descriptors.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use has_s0s1 for REG_S0S1 issues only
Jes Sorensen [Thu, 14 Apr 2016 18:58:50 +0000 (14:58 -0400)]
rtl8xxxu: Use has_s0s1 for REG_S0S1 issues only

Instead use tx_desc_size() to distinguish between gen1
(8723a/8192c/8188c) and gen2 (8723b/8192e) parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implment rtl8192e_set_tx_power()
Jes Sorensen [Thu, 14 Apr 2016 18:58:49 +0000 (14:58 -0400)]
rtl8xxxu: Implment rtl8192e_set_tx_power()

8192eu is a 2T part, so setting TX power for path A only, as done by
rtl8723bu_set_tx_power() is not sufficient.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not try to set REG_LEDCFG2 on 8192eu
Jes Sorensen [Thu, 14 Apr 2016 18:58:48 +0000 (14:58 -0400)]
rtl8xxxu: Do not try to set REG_LEDCFG2 on 8192eu

Presumably 8192eu devices do not have leds, so do not enable them.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not init FPGA0_TX_INFO on 8192eu
Jes Sorensen [Thu, 14 Apr 2016 18:58:47 +0000 (14:58 -0400)]
rtl8xxxu: Do not init FPGA0_TX_INFO on 8192eu

Like the 8723bu, the vendor driver does not set FPGA0_TX_INFO for
8192eu in the init sequence.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not set REG_PBP on 8192eu
Jes Sorensen [Thu, 14 Apr 2016 18:58:46 +0000 (14:58 -0400)]
rtl8xxxu: Do not set REG_PBP on 8192eu

The vendor driver does not set REG_PBP on 8192eu. Whether this is due
to the device not supporting it or simply an oversight in the vendor
driver is not clear.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Reorder chip quirks to follow flow of 8192eu driver
Jes Sorensen [Thu, 14 Apr 2016 18:58:45 +0000 (14:58 -0400)]
rtl8xxxu: Reorder chip quirks to follow flow of 8192eu driver

Another flow order change to match the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement generic init_queue_reserved_page() function
Jes Sorensen [Thu, 14 Apr 2016 18:58:44 +0000 (14:58 -0400)]
rtl8xxxu: Implement generic init_queue_reserved_page() function

Longer term we should switch all the chips over to use this function
instead of the random chip specific ifdef hacks.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Reorg more code to match the flow of the 8192eu vendor driver
Jes Sorensen [Thu, 14 Apr 2016 18:58:43 +0000 (14:58 -0400)]
rtl8xxxu: Reorg more code to match the flow of the 8192eu vendor driver

This further reorganizes the init code flow to match that of the
8192eu vendor driver. This helps diffing the register write log
against that of the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Reorder parts of init code to match the 8192eu vendor code flow
Jes Sorensen [Thu, 14 Apr 2016 18:58:42 +0000 (14:58 -0400)]
rtl8xxxu: Reorder parts of init code to match the 8192eu vendor code flow

In order to debug 8192eu support, reorder some init code to match the
flow of the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: make mwifiex_insert_cmd_to_free_q local static
Andreas Fenkart [Thu, 10 Mar 2016 08:44:11 +0000 (09:44 +0100)]
mwifiex: make mwifiex_insert_cmd_to_free_q local static

after factoring out mwifiex_cancel_pending_scan_cmd
the function is not called outside of cmdevt file
moved function to head of file to avoid forward declaration,
also moved mwifiex_recycle_cmd_node since they are very similar

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: factor out mwifiex_cancel_pending_scan_cmd
Andreas Fenkart [Thu, 10 Mar 2016 08:44:10 +0000 (09:44 +0100)]
mwifiex: factor out mwifiex_cancel_pending_scan_cmd

Releasing the scan_pending lock in mwifiex_check_next_scan_command
introduces a short window where pending scan commands can be removed
or added before removing them all in mwifiex_cancel_pending_scan_cmd.
I think this is safe, since the worst thing to happen is that a
pending scan cmd is removed by the command handler. Adding new scan
commands is not possible while one is pending, see scan_processing flag.
Since all commands are removed from the queue anyway, we don't care if
some commands are removed by a different code path earlier, the final
state remains the same.
I assume, that the critical section needed for the check has been
extended over clearing the pending scan queue out of convenience. The
lock was already held and releasing it and grab it again was just
more work. It doesn't seem to be necessary because of concurrency.

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: replace pointer arithmetic with array access
Andreas Fenkart [Thu, 10 Mar 2016 08:44:09 +0000 (09:44 +0100)]
mwifiex: scan: replace pointer arithmetic with array access

improves readability

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: factor out dbg_security_flags
Andreas Fenkart [Thu, 10 Mar 2016 08:44:08 +0000 (09:44 +0100)]
mwifiex: scan: factor out dbg_security_flags

merge copy/paste code

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: simplify ternary operators using gnu extension
Andreas Fenkart [Thu, 10 Mar 2016 08:44:07 +0000 (09:44 +0100)]
mwifiex: scan: simplify ternary operators using gnu extension

"x ? x : y" can be simplified as "x ? : y"
https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html#Conditionals

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: factor out has_ieee_hdr/has_vendor_hdr
Andreas Fenkart [Thu, 10 Mar 2016 08:44:06 +0000 (09:44 +0100)]
mwifiex: scan: factor out has_ieee_hdr/has_vendor_hdr

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: simplify dereference of bss_desc fields
Andreas Fenkart [Thu, 10 Mar 2016 08:44:05 +0000 (09:44 +0100)]
mwifiex: scan: simplify dereference of bss_desc fields

given this structure:
struct foo {
  struct bar {
     int baz;
  }
}

these accesses are equivalent:
(*(foo->bar)).baz
foo->bar->baz

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix the incorrect WARN_ON during suspend
Vishal Thanki [Thu, 7 Apr 2016 21:37:12 +0000 (23:37 +0200)]
mwifiex: fix the incorrect WARN_ON during suspend

During system suspend, there is a kernel WARNING issued if there
is a pending command present. By marking the wait queue disabled
after calling the command completion routine fixes it.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix incorrect ht capability problem
Amitkumar Karwar [Mon, 11 Apr 2016 14:52:41 +0000 (07:52 -0700)]
mwifiex: fix incorrect ht capability problem

IEEE80211_CHAN_NO_HT40PLUS and IEEE80211_CHAN_NO_HT40PLUS channel
flags tell if HT40 operation is allowed on a channel or not.

This patch ensures ht_capability information is modified
accordingly so that we don't end up creating a HT40 connection
when it's not allowed for current regulatory domain.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: do not wait on semaphore during card removal
Xinming Hu [Mon, 11 Apr 2016 14:52:40 +0000 (07:52 -0700)]
mwifiex: do not wait on semaphore during card removal

Host hang is observed if card is removed before firmware download
gets completed. In this case, firmware will be failed to download and
adapter structure gets freed.

In other thread, mwifiex_remove_card() waits on semaphore until the
firmware download fails. This wait is not necessary and may result in
invalid adapter access.

This patch uses down_trylock to return immediately so that hang issue
won't occur.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: add default setting for pcie firmware download
Shengzhen Li [Mon, 11 Apr 2016 14:52:39 +0000 (07:52 -0700)]
mwifiex: add default setting for pcie firmware download

This patch adds default setting for pcie firmware download name in
case that there are newer chipset version.

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: add pcie usb/uart firmware download support
Shengzhen Li [Mon, 11 Apr 2016 14:52:38 +0000 (07:52 -0700)]
mwifiex: add pcie usb/uart firmware download support

This patch adds support for downloading usb/uart firmware for
8997 chipset by reading the chip version.

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: missing break statement
Amitkumar Karwar [Mon, 11 Apr 2016 14:52:37 +0000 (07:52 -0700)]
mwifiex: missing break statement

This patch adds missing break statement at the end of
PCIE_DEVICE_ID_MARVELL_88W8897 switch section.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: create common function for handling brcmf_proto_hdrpull()
Arend van Spriel [Mon, 11 Apr 2016 09:35:28 +0000 (11:35 +0200)]
brcmfmac: create common function for handling brcmf_proto_hdrpull()

In receive path brcmf_proto_hdrpull() needs to be called and handled
similar in brcmf_rx_frame() and brcmf_rx_event(). Move that duplicated
code in separate function.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: revise handling events in receive path
Arend van Spriel [Mon, 11 Apr 2016 09:35:27 +0000 (11:35 +0200)]
brcmfmac: revise handling events in receive path

Move event handling out of brcmf_netif_rx() avoiding the need
to pass a flag. This flag is only ever true for USB hosts as
other interface use separate brcmf_rx_event() function.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: cleanup ampdu-rx host reorder code
Arend van Spriel [Mon, 11 Apr 2016 09:35:26 +0000 (11:35 +0200)]
brcmfmac: cleanup ampdu-rx host reorder code

The code for ampdu-rx host reorder is related to the firmware signalling
supported in BCDC protocol. This change moves the code to fwsignal module.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: screening firmware event packet
Franky Lin [Mon, 11 Apr 2016 09:35:25 +0000 (11:35 +0200)]
brcmfmac: screening firmware event packet

Firmware uses asynchronized events as a communication method to the
host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
SDIO and PCIe bus, this kind of packets are delivered through virtual
event channel not data channel. This patch adds a screening logic to
make sure the event handler only processes the events coming from the
correct channel.

Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: fix p2p scan abort null pointer exception
Hante Meuleman [Mon, 11 Apr 2016 09:35:24 +0000 (11:35 +0200)]
brcmfmac: fix p2p scan abort null pointer exception

When p2p connection setup is performed without having ever done an
escan a null pointer exception can occur. This is because the ifp
to abort scanning is taken from escan struct while it was never
initialized. Fix this by using the primary ifp for scan abort. The
abort should still be performed and all scan related commands are
performed on primary ifp.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: insert default boardrev in nvram data if missing
Hante Meuleman [Mon, 11 Apr 2016 09:35:23 +0000 (11:35 +0200)]
brcmfmac: insert default boardrev in nvram data if missing

Some nvram files/stores come without the boardrev information,
but firmware requires this to be set. When not found in nvram then
add a default boardrev string to the nvram data.

Reported-by: Rafal Milecki <zajec5@gmail.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: fix clearing wowl wake indicators
Hante Meuleman [Mon, 11 Apr 2016 09:35:22 +0000 (11:35 +0200)]
brcmfmac: fix clearing wowl wake indicators

Newer firmwares require the usage of the wowl wakeind struct as size
for the iovar to clear the wake indicators. Older firmwares do not
care, so change the used size.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: clear eventmask array before using it
Hante Meuleman [Mon, 11 Apr 2016 09:35:21 +0000 (11:35 +0200)]
brcmfmac: clear eventmask array before using it

When the event_msgs iovar is set an array is used to configure the
enabled events. This arrays needs to nulled before configuring
otherwise unhandled events will be enabled. This solves a problem
where in case of wowl the host got woken by an incorrectly enabled
event.

Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Adjust AFE crystal value on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:33 +0000 (14:19 -0400)]
rtl8xxxu: Adjust AFE crystal value on 8192eu

Adjust AFE before enabling PLL on 8192eu, probably also needed for
8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement IQK calibration for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:32 +0000 (14:19 -0400)]
rtl8xxxu: Implement IQK calibration for 8192eu

8192eu has it's own IQK calibration procedure, and notably uses
undocumented RF register 0x56 in the process.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use proper register name for REG_PAD_CTRL1
Jes Sorensen [Thu, 7 Apr 2016 18:19:31 +0000 (14:19 -0400)]
rtl8xxxu: Use proper register name for REG_PAD_CTRL1

Fixup another case where the hard coded register value was used
instead of the name.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement 8192eu device specific quirks
Jes Sorensen [Thu, 7 Apr 2016 18:19:30 +0000 (14:19 -0400)]
rtl8xxxu: Implement 8192eu device specific quirks

Set REG_QUEUE_CTRL and REG_ACLK_MON for 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix LDPC RX hang issue on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:29 +0000 (14:19 -0400)]
rtl8xxxu: Fix LDPC RX hang issue on 8192eu

Implement workaround for LDPC RX hands on 8192eu. This was inspired by
workaround found in the 8192eu vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set REG_USB_HRPWM for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:28 +0000 (14:19 -0400)]
rtl8xxxu: Set REG_USB_HRPWM for 8192eu

The vendor driver set register 0xfe58 REG_USB_HWPWM in it's init
sequence for 8192eu. Do the same here.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set correct interrupt masking registers on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:27 +0000 (14:19 -0400)]
rtl8xxxu: Set correct interrupt masking registers on 8192eu

Set HIMR[01] on 8192eu instead of HISR/HIMR. It's not obvious this
really matters for USB devices, but this matches the register writes
performed by the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle XTAL value setting on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:26 +0000 (14:19 -0400)]
rtl8xxxu: Handle XTAL value setting on 8192eu

Set REG_AFE_XTAL_CTRL on 8192eu to the vendor driver value, and do not
skip setting REG_MAX_AGGR_NUM on 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Provide special handling when writing RF regs on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:25 +0000 (14:19 -0400)]
rtl8xxxu: Provide special handling when writing RF regs on 8192eu

The 8192eu requires clearing/restoring bit 17 in REG_FPGA0_POWER_SAVE
before/after writing RF registers.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle BB init for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:24 +0000 (14:19 -0400)]
rtl8xxxu: Handle BB init for 8192eu

The 8192eu does not use REG_AFE_PLL_CTRL in it's BB init sequence, so
provide device specific handling.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Correctly parse 8192eu efuse
Jes Sorensen [Thu, 7 Apr 2016 18:19:23 +0000 (14:19 -0400)]
rtl8xxxu: Correctly parse 8192eu efuse

The 8192eu efuse only has power data for path A and B. It follows the
same layout as 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Pick PHY init table based on chip version first
Jes Sorensen [Thu, 7 Apr 2016 18:19:22 +0000 (14:19 -0400)]
rtl8xxxu: Pick PHY init table based on chip version first

Pick PHY init table based on device before distinguishing between
1T/2T/high PA tables. The latter is only currently used for
8188cu/8192cu/8188ru.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add 8192eu PHY init table
Jes Sorensen [Thu, 7 Apr 2016 18:19:21 +0000 (14:19 -0400)]
rtl8xxxu: Add 8192eu PHY init table

The 8192eu also requires it's own PHY init table.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add 8192eu AGC tables
Jes Sorensen [Thu, 7 Apr 2016 18:19:20 +0000 (14:19 -0400)]
rtl8xxxu: Add 8192eu AGC tables

A device specific AGC table is required for the 8192eu as well.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add radio init tables for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:19 +0000 (14:19 -0400)]
rtl8xxxu: Add radio init tables for 8192eu

Add the required radio init tables for 8192eu devices.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set TX page boundaries for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:18 +0000 (14:19 -0400)]
rtl8xxxu: Set TX page boundaries for 8192eu

The 8192eu also has it's own TRXFF boundary value to set.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not mess with AFE_XTAL_CTRL on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:17 +0000 (14:19 -0400)]
rtl8xxxu: Do not mess with AFE_XTAL_CTRL on 8192eu

To match the vendor driver, do not mess with AFE_XTAL_CTRL on 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add MAC init table for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:16 +0000 (14:19 -0400)]
rtl8xxxu: Add MAC init table for 8192eu

The 8192eu requires a different MAC init table. Add the missing table
and specify the table to use in the fileops structure.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agogre: eliminate holes in ip_tunnel
stephen hemminger [Thu, 14 Apr 2016 00:02:21 +0000 (17:02 -0700)]
gre: eliminate holes in ip_tunnel

The structure can be packed denser by doing minor rearrangement
of existing elements.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoravb: make ravb_ptp_interrupt() *void*
Sergei Shtylyov [Sun, 10 Apr 2016 20:55:15 +0000 (23:55 +0300)]
ravb: make ravb_ptp_interrupt() *void*

When we have the ISS.CGIS bit set, we already know that gPTP interrupt has
happened, so an extra GIS register check at the end of ravb_ptp_interrupt()
seems superfluous.  We can model the gPTP interrupt  handler like all other
dedicated interrupt handlers in the driver and make it *void*.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'qed-ethtool-rss'
David S. Miller [Thu, 14 Apr 2016 04:43:21 +0000 (00:43 -0400)]
Merge branch 'qed-ethtool-rss'

Yuval Mintz says:

====================
qed*: [mostly] Ethtool RSS configuration

Most of the content [code-wise] in this series is for allowing various
RSS-related configuration via ethtool.

In addition, this also removed an unnecessary versioning scheme between
the drivers and bump the driver version.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed* - bump driver versions to 8.7.1.20
Yuval Mintz [Sun, 10 Apr 2016 09:43:02 +0000 (12:43 +0300)]
qed* - bump driver versions to 8.7.1.20

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqede: add Rx flow hash/indirection support.
Sudarsana Reddy Kalluru [Sun, 10 Apr 2016 09:43:01 +0000 (12:43 +0300)]
qede: add Rx flow hash/indirection support.

Adds support for the following via ethtool:
  - UDP configuration of RSS based on 2-tuple/4-tuple.
  - RSS hash key.
  - RSS indirection table.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed: add Rx flow hash/indirection support.
Sudarsana Reddy Kalluru [Sun, 10 Apr 2016 09:43:00 +0000 (12:43 +0300)]
qed: add Rx flow hash/indirection support.

Adds the required API for passing RSS-related configuration from qede.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqed*: remove version dependency
Rahul Verma [Sun, 10 Apr 2016 09:42:59 +0000 (12:42 +0300)]
qed*: remove version dependency

Inbox drivers don't need versioning scheme in order to guarantee
compatibility, as both qed and qede are compiled from same codebase.

Signed-off-by: Rahul Verma <rahul.verma@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
David S. Miller [Thu, 14 Apr 2016 04:39:15 +0000 (00:39 -0400)]
Merge branch 'for-davem' of git://git./linux/kernel/git/viro/vfs

8 years agonet: remove netdevice gso_min_segs
Eric Dumazet [Sat, 9 Apr 2016 18:29:58 +0000 (11:29 -0700)]
net: remove netdevice gso_min_segs

After introduction of ndo_features_check(), we believe that very
specific checks for rare features should not be done in core
networking stack.

No driver uses gso_min_segs yet, so we revert this feature and save
few instructions per tx packet in fast path.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqdisc: constify meta_type_ops structures
Julia Lawall [Sat, 9 Apr 2016 08:49:22 +0000 (10:49 +0200)]
qdisc: constify meta_type_ops structures

The meta_type_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: bcmgenet: add BQL support
Petri Gynther [Sat, 9 Apr 2016 07:20:36 +0000 (00:20 -0700)]
net: bcmgenet: add BQL support

Add Byte Queue Limits (BQL) support to bcmgenet driver.

Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: bcmgenet: use __napi_schedule_irqoff()
Florian Fainelli [Sat, 9 Apr 2016 05:30:56 +0000 (22:30 -0700)]
net: bcmgenet: use __napi_schedule_irqoff()

bcmgenet_isr1() and bcmgenet_isr0() run in hard irq context,
we do not need to block irq again.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Petri Gynther <pgynther@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: bcmgenet: use napi_complete_done()
Eric Dumazet [Sat, 9 Apr 2016 05:06:40 +0000 (22:06 -0700)]
net: bcmgenet: use napi_complete_done()

By using napi_complete_done(), we allow fine tuning
of /sys/class/net/ethX/gro_flush_timeout for higher GRO aggregation
efficiency for a Gbit NIC.

Check commit 24d2e4a50737 ("tg3: use napi_complete_done()") for details.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Petri Gynther <pgynther@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Petri Gynther <pgynther@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'sctp-delayed-wakeups'
David S. Miller [Thu, 14 Apr 2016 03:04:44 +0000 (23:04 -0400)]
Merge branch 'sctp-delayed-wakeups'

Marcelo Ricardo Leitner says:

====================
sctp: delay calls to sk_data_ready() as much as possible

1st patch is a preparation for the 2nd. The idea is to not call
->sk_data_ready() for every data chunk processed while processing
packets but only once before releasing the socket.

v2: patchset re-checked, small changelog fixes
v3: on patch 2, make use of local vars to make it more readable
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosctp: delay calls to sk_data_ready() as much as possible
Marcelo Ricardo Leitner [Fri, 8 Apr 2016 19:41:28 +0000 (16:41 -0300)]
sctp: delay calls to sk_data_ready() as much as possible

Currently processing of multiple chunks in a single SCTP packet leads to
multiple calls to sk_data_ready, causing multiple wake up signals which
are costy and doesn't make it wake up any faster.

With this patch it will note that the wake up is pending and will do it
before leaving the state machine interpreter, latest place possible to
do it realiably and cleanly.

Note that sk_data_ready events are not dependent on asocs, unlike waking
up writers.

v2: series re-checked
v3: use local vars to cleanup the code, suggested by Jakub Sitnicki
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosctp: compress bit-wide flags to a bitfield on sctp_sock
Marcelo Ricardo Leitner [Fri, 8 Apr 2016 19:41:27 +0000 (16:41 -0300)]
sctp: compress bit-wide flags to a bitfield on sctp_sock

It wastes space and gets worse as we add new flags, so convert bit-wide
flags to a bitfield.

Currently it already saves 4 bytes in sctp_sock, which are left as holes
in it for now. The whole struct needs packing, which should be done in
another patch.

Note that do_auto_asconf cannot be merged, as explained in the comment
before it.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodrivers/net/ethernet/jme.c: Deinline jme_reset_mac_processor, save 2816 bytes
Denys Vlasenko [Fri, 8 Apr 2016 18:39:47 +0000 (20:39 +0200)]
drivers/net/ethernet/jme.c: Deinline jme_reset_mac_processor, save 2816 bytes

This function compiles to 895 bytes of machine code.

Clearly, this isn't a time-critical function.
For one, it has a number of udelay(1) calls.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: David S. Miller <davem@davemloft.net>
CC: linux-kernel@vger.kernel.org
CC: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'bridge-sysfs-rtnl-notifications'
David S. Miller [Thu, 14 Apr 2016 02:42:33 +0000 (22:42 -0400)]
Merge branch 'bridge-sysfs-rtnl-notifications'

Xin Long says:

====================
bridge: support sending rntl info when we set attributes through sysfs/ioctl

This patchset is used to support sending rntl info to user in some places,
and ensure that whenever those attributes change internally or from sysfs,
that a netlink notification is sent out to listeners.

It also make some adjustment in bridge sysfs so that we can implement this
easily.

I've done some tests on this patchset, like:
[br_sysfs]
  1. change all the attribute values of br or brif:
  $ echo $value > /sys/class/net/br0/bridge/{*}
  $ echo $value > /sys/class/net/br0/brif/eth1/{*}

  2. meanwhile, on another terminal to observe the msg:
  $ bridge monitor

[br_ioctl]
  1. in bridge-utils package, do some changes in br_set, let brctl command
  use ioctl to set attribute:
         if ((ret = set_sysfs(path, value)) < 0) { -->
         if (1) {

  $ brctl set*

  2. meanwhile, on another terminal to observe the msg:
  $ bridge monitor

This test covers all the attributes that brctl and sysfs support to set.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: a netlink notification should be sent when those attributes are changed by...
Xin Long [Fri, 8 Apr 2016 16:03:33 +0000 (00:03 +0800)]
bridge: a netlink notification should be sent when those attributes are changed by ioctl

Now when we change the attributes of bridge or br_port by netlink,
a relevant netlink notification will be sent, but if we change them
by ioctl or sysfs, no notification will be sent.

We should ensure that whenever those attributes change internally or from
sysfs/ioctl, that a netlink notification is sent out to listeners.

Also, NetworkManager will use this in the future to listen for out-of-band
bridge master attribute updates and incorporate them into the runtime
configuration.

This patch is used for ioctl.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: a netlink notification should be sent when those attributes are changed by...
Xin Long [Fri, 8 Apr 2016 16:03:32 +0000 (00:03 +0800)]
bridge: a netlink notification should be sent when those attributes are changed by br_sysfs_if

Now when we change the attributes of bridge or br_port by netlink,
a relevant netlink notification will be sent, but if we change them
by ioctl or sysfs, no notification will be sent.

We should ensure that whenever those attributes change internally or from
sysfs/ioctl, that a netlink notification is sent out to listeners.

Also, NetworkManager will use this in the future to listen for out-of-band
bridge master attribute updates and incorporate them into the runtime
configuration.

This patch is used for br_sysfs_if, and we also move br_ifinfo_notify out
of store_flag.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: a netlink notification should be sent when those attributes are changed by...
Xin Long [Fri, 8 Apr 2016 16:03:31 +0000 (00:03 +0800)]
bridge: a netlink notification should be sent when those attributes are changed by br_sysfs_br

Now when we change the attributes of bridge or br_port by netlink,
a relevant netlink notification will be sent, but if we change them
by ioctl or sysfs, no notification will be sent.

We should ensure that whenever those attributes change internally or from
sysfs/ioctl, that a netlink notification is sent out to listeners.

Also, NetworkManager will use this in the future to listen for out-of-band
bridge master attribute updates and incorporate them into the runtime
configuration.

This patch is used for br_sysfs_br. and we also need to remove some
rtnl_trylock in old functions so that we can call it in a common one.

For group_addr_store, we cannot make it use store_bridge_parm, because
it's not a string-to-long convert, we will add notification on it
individually.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: simplify the stp_state_store by calling store_bridge_parm
Xin Long [Fri, 8 Apr 2016 16:03:30 +0000 (00:03 +0800)]
bridge: simplify the stp_state_store by calling store_bridge_parm

There are some repetitive codes in stp_state_store, we can remove
them by calling store_bridge_parm.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>