linux-2.6-block.git
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>
8 years agobridge: simplify the forward_delay_store by calling store_bridge_parm
Xin Long [Fri, 8 Apr 2016 16:03:29 +0000 (00:03 +0800)]
bridge: simplify the forward_delay_store by calling store_bridge_parm

There are some repetitive codes in forward_delay_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>
8 years agobridge: simplify the flush_store by calling store_bridge_parm
Xin Long [Fri, 8 Apr 2016 16:03:28 +0000 (00:03 +0800)]
bridge: simplify the flush_store by calling store_bridge_parm

There are some repetitive codes in flush_store, we can remove
them by calling store_bridge_parm, also, it would send rtnl notification
after we add it in store_bridge_parm in the following patches.

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 agonet: force inlining of netif_tx_start/stop_queue, sock_hold, __sock_put
Denys Vlasenko [Fri, 8 Apr 2016 15:51:54 +0000 (17:51 +0200)]
net: force inlining of netif_tx_start/stop_queue, sock_hold, __sock_put

Sometimes gcc mysteriously doesn't inline
very small functions we expect to be inlined. See
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66122
Arguably, gcc should do better, but gcc people aren't willing
to invest time into it, asking to use __always_inline instead.

With this .config:
http://busybox.net/~vda/kernel_config_OPTIMIZE_INLINING_and_Os,
the following functions get deinlined many times.

netif_tx_stop_queue: 207 copies, 590 calls:
55                      push   %rbp
48 89 e5                mov    %rsp,%rbp
f0 80 8f e0 01 00 00 01 lock orb $0x1,0x1e0(%rdi)
5d                      pop    %rbp
c3                      retq

netif_tx_start_queue: 47 copies, 111 calls
55                      push   %rbp
48 89 e5                mov    %rsp,%rbp
f0 80 a7 e0 01 00 00 fe lock andb $0xfe,0x1e0(%rdi)
5d                      pop    %rbp
c3                      retq

sock_hold: 39 copies, 124 calls
55                      push   %rbp
48 89 e5                mov    %rsp,%rbp
f0 ff 87 80 00 00 00    lock incl 0x80(%rdi)
5d                      pop    %rbp
c3                      retq

__sock_put: 6 copies, 13 calls
55                      push   %rbp
48 89 e5                mov    %rsp,%rbp
f0 ff 8f 80 00 00 00    lock decl 0x80(%rdi)
5d                      pop    %rbp
c3                      retq

This patch fixes this via s/inline/__always_inline/.

Code size decrease after the patch is ~2.5k:

    text      data      bss       dec     hex filename
56719876  56364551 36196352 149280779 8e5d80b vmlinux_before
56717440  56364551 36196352 149278343 8e5ce87 vmlinux

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
CC: netfilter-devel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoDoc: networking: Fix typo in dsa
Masanari Iida [Fri, 8 Apr 2016 15:00:25 +0000 (00:00 +0900)]
Doc: networking: Fix typo in dsa

This patch fix typos in Documentation/networking/dsa.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv6, token: allow for clearing the current device token
Daniel Borkmann [Fri, 8 Apr 2016 13:55:00 +0000 (15:55 +0200)]
ipv6, token: allow for clearing the current device token

The original tokenized iid support implemented via f53adae4eae5 ("net: ipv6:
add tokenized interface identifier support") didn't allow for clearing a
device token as it was intended that this addressing mode was the only one
active for globally scoped IPv6 addresses. Later we relaxed that restriction
via 617fe29d45bd ("net: ipv6: only invalidate previously tokenized addresses"),
and we should also allow for clearing tokens as there's no good reason why
it shouldn't be allowed.

Fixes: 617fe29d45bd ("net: ipv6: only invalidate previously tokenized addresses")
Reported-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosock: tigthen lockdep checks for sock_owned_by_user
Hannes Frederic Sowa [Fri, 8 Apr 2016 13:11:27 +0000 (15:11 +0200)]
sock: tigthen lockdep checks for sock_owned_by_user

sock_owned_by_user should not be used without socket lock held. It seems
to be a common practice to check .owned before lock reclassification, so
provide a little help to abstract this check away.

Cc: linux-cifs@vger.kernel.org
Cc: linux-bluetooth@vger.kernel.org
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: ethernet: stmmac: GMAC4.xx: Fix TX descriptor preparation
Alexandre TORGUE [Fri, 8 Apr 2016 09:18:03 +0000 (11:18 +0200)]
net: ethernet: stmmac: GMAC4.xx: Fix TX descriptor preparation

On GMAC4.xx each descriptor contains 2 buffers of 16KB (each).
Initially, those 2 buffers was filled in dwmac4_rd_prepare_tx_desc but
it is actually not needed. Indeed, stmmac driver supports frame up to
9000 bytes (jumbo). So only one buffer is needed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'udp-hdrs-fixes'
David S. Miller [Thu, 14 Apr 2016 02:24:52 +0000 (22:24 -0400)]
Merge branch 'udp-hdrs-fixes'

Willem de Bruijn says:

====================
fix two more udp pull header issues

Follow up patches to the fixes to RxRPC and SunRPC. A scan of the
code showed two other interfaces that expect UDP packets to have
a udphdr when queued: read packet length with ioctl SIOCINQ and
receive payload checksum with socket option IP_CHECKSUM.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoudp: do not expect udp headers in recv cmsg IP_CMSG_CHECKSUM
Willem de Bruijn [Thu, 7 Apr 2016 22:12:59 +0000 (18:12 -0400)]
udp: do not expect udp headers in recv cmsg IP_CMSG_CHECKSUM

On udp sockets, recv cmsg IP_CMSG_CHECKSUM returns a checksum over
the packet payload. Since commit e6afc8ace6dd pulled the headers,
taking skb->data as the start of transport header is incorrect. Use
the transport header pointer.

Also, when peeking at an offset from the start of the packet, only
return a checksum from the start of the peeked data. Note that the
cmsg does not subtract a tail checkum when reading truncated data.

Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoudp: do not expect udp headers on ioctl SIOCINQ
Willem de Bruijn [Thu, 7 Apr 2016 22:12:58 +0000 (18:12 -0400)]
udp: do not expect udp headers on ioctl SIOCINQ

On udp sockets, ioctl SIOCINQ returns the payload size of the first
packet. Since commit e6afc8ace6dd pulled the headers, the result is
incorrect when subtracting header length. Remove that operation.

Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing")

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'dsa-refactoring-set-1'
David S. Miller [Wed, 13 Apr 2016 22:15:24 +0000 (18:15 -0400)]
Merge branch 'dsa-refactoring-set-1'

Andrew Lunn says:

====================
DSA refactoring: set 1

There has been a long running effort to refractor DSA probing to make
the switches true linux devices. Here are a small collection of
patches moving in this direction. Most have been seen before.

We take a little step forward by passing the dsa device point to the
driver, thus allowing it to perform resource allocations using the
normal mechanisms. This device structure will later be replaced by the
devices own device structure.

Future patches will add a true driver probe function, so we rename the
current probe function, cleaning up the namespace.

phys_port_mask continually confuses me, thinking it is about PHYs. But
it is actually about ports enabled to the outside world. So rename it to
enabled_port_mask.

Lots more patches yet to follow, this is just doing some ground work.

v2:
  enabled_port_mask instread of user_port_masks
  Added Tested-by's and Reviewed-by.
====================

Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>