cascardo/linux.git
8 years agoMerge ath-next from ath.git
Kalle Valo [Sun, 6 Mar 2016 12:41:51 +0000 (14:41 +0200)]
Merge ath-next from ath.git

ath.git patches for 4.6. Major changes:

ath10k

* dt: add bindings for ipq4019 wifi block
* start adding support for qca4019 chip

ath9k

* add device ID for Toshiba WLM-20U2/GN-1080
* allow more than one interface on DFS channels

8 years agoath9k: clear bb filter calibration power threshold
Miaoqing Pan [Thu, 18 Feb 2016 09:20:02 +0000 (17:20 +0800)]
ath9k: clear bb filter calibration power threshold

JP WiFi certification for bandwidth of channel 14 failed, the OBW
is lower than the requirement. Clear the bb filter calibration power
threshold to increase OBW(+2). The fix only for qca9531 chip now.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: reduce stack usage in ar9003_aic_cal_post_process
Arnd Bergmann [Fri, 12 Feb 2016 11:55:21 +0000 (12:55 +0100)]
ath9k: reduce stack usage in ar9003_aic_cal_post_process

In some configurations, this function uses more than the warning limit
of 1024 bytes:

drivers/net/wireless/ath/ath9k/ar9003_aic.c: In function 'ar9003_aic_cal_post_process':
drivers/net/wireless/ath/ath9k/ar9003_aic.c:434:1: error: the frame size of 1040 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

It turns out that there are two large arrays on the stack here, but
almost all the data in them is never used outside of the loop in
which it gets written, so we can replace the array with a single
instance.

The .valid flag is used later, so I'm replacing the array of structures
with an array of bools. An obvious follow-up optimization would be
to replace it with a bitmask and set_bit()/find_first_bit()/
find_last_bit()/... operations. However, I have not tested this patch,
so I sticked to the simpler transformation that does the job of
reducing the stack usage to a harmless level.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: make NF load complete quickly and reliably
Miaoqing Pan [Fri, 5 Feb 2016 01:45:50 +0000 (09:45 +0800)]
ath9k: make NF load complete quickly and reliably

Make NF load complete quickly and reliably. NF load execution
is delayed by HW to end of frame if frame Rx or Tx is ongoing.
Increasing timeout to max frame duration. If NF cal is ongoing
before NF load, stop it before load, and restart it afterwards.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix sanity check on enabling btcoex via debugfs
Mohammed Shafi Shajakhan [Tue, 23 Feb 2016 07:28:36 +0000 (12:58 +0530)]
ath10k: fix sanity check on enabling btcoex via debugfs

First check for the device state before enabling / disabling
btcoex, also return a proper error value. Enabling / disabling
btcoex ideally does a f/w + ath10k_core_restart so the checks
that are applicable for 'simulate_fw_crash' shall be applicable
for this as well

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: reduce number of peers to support peer stats feature
Anilkumar Kolli [Tue, 23 Feb 2016 06:49:57 +0000 (12:19 +0530)]
ath10k: reduce number of peers to support peer stats feature

To enable per peer stats feature we are reducing the number of peers.
Firmware has introduced tx stats feature. We have memory limitation in
firmware to add these additional bytes.

These are the new variables introduced in the firmware.
======== =======================
Variable        Bytes required/per rate
======== =======================
TX success packets  1
TX failed packets 1
Retry packets 1
Success bytes 2
TX failed bytes 2
Retry bytes 2
Tx duration 4
Rate 1
Bw and AMPDU flags 1
Total 16 (because of allocation in word pattern)

Firmware sends these tx_stats in pktlog.
If we consider 4 feedbacks at a time, Frimware need about ~1K memory for coding
and 8192 bytes required / per rate [ 4*16*128(peers)].
To accommodate this firmware needs to reduce 10 peers.

This fixes a firmware crash with firmware-5.bin_10.2.4.70.22-2.

Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: process htt rx indication as batch mode
Rajkumar Manoharan [Fri, 12 Feb 2016 06:10:59 +0000 (11:40 +0530)]
ath10k: process htt rx indication as batch mode

On multicore systems, it is possible that txrx tasket can run
in parallel with pci tasklet (i.e smp affinity of ath10k irq is
assigned to multiple CPUs). Feeding and consuming from the same
rx completion list leads to txrx tasklet runs for longer period.
Prevent this by processing a snapshot of rx queue by moving list
into temporary list. Consecutive received frames will be processed
in next batch.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: reduce rx_lock contention for htt rx indication
Rajkumar Manoharan [Fri, 12 Feb 2016 06:10:58 +0000 (11:40 +0530)]
ath10k: reduce rx_lock contention for htt rx indication

Received frame indications are queued into a skb list and latest
processed by txrx tasklet. This skb queue is protected by htt rx lock.
Since the entire rx processing till delivering frame to mac80211 and
replenish tasks are processed under rx_lock protection, there might be
some delay in queuing newly received rx frame into that list on
multicore systems. Optimize this by using skb list lock while accessing
rx completion queue instead of htt rx lock.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix erroneous return value
Anton Protopopov [Wed, 10 Feb 2016 16:58:55 +0000 (11:58 -0500)]
ath10k: fix erroneous return value

The ath10k_pci_hif_exchange_bmi_msg() function may return the positive
value EIO instead of -EIO in case of error.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add hw_rev to trace events to support pktlog
Ashok Raj Nagarajan [Fri, 5 Feb 2016 15:42:49 +0000 (21:12 +0530)]
ath10k: add hw_rev to trace events to support pktlog

pktlog data is different between firmware variants (eg. 10.2 vs 10.4). To
have a unified user space script to decode pktlog trace events generated,
it is desirable to know which firmware variant has provided the events and
thereby decode the pktlogs appropriately. Hardware revision (hw_rev) helps
to determine the firmware variant sending these trace events. So add hw_rev
to trace events.

Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix pktlog in QCA99X0
Ashok Raj Nagarajan [Fri, 5 Feb 2016 15:42:48 +0000 (21:12 +0530)]
ath10k: fix pktlog in QCA99X0

Currently, we are providing wrong payload data of pktlog to trace points.
Data we receive from FW through copy engine 8 contains pktlog data alone.
We don't need to parse anything in driver before handing it to trace
points.

Fixes: afb0bf7f530b ("ath10k: add support for pktlog in QCA99X0")
Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix pointless update of peer stats list
Mohammed Shafi Shajakhan [Wed, 3 Feb 2016 15:37:43 +0000 (21:07 +0530)]
ath10k: fix pointless update of peer stats list

We periodically receive f/w stats event for updating
the rx duration and there is no reason to keep on appending
the f/w stats peer list, as this gets completely cleaned up when
the user polls for f/w stats {pdev, vdev, peer stats}. Only don't
print the warning message in the case PEER_STATS service is enabled

Fixes: 856e7c3 ("ath10k: add debugfs support for Per STA total rx duration")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix updating peer stats rx duration
Mohammed Shafi Shajakhan [Wed, 3 Feb 2016 15:37:42 +0000 (21:07 +0530)]
ath10k: fix updating peer stats rx duration

We are not updating peer stats rx_duration periodically
unless the user one polls for fw_stats, this is because
we discard the update event since pdev list is empty. Fix
this by updating rx duration periodically irrepective of checks
for pdev list (irrespective of ping-pong response)

Fixes: 856e7c3 ("ath10k: add debugfs support for Per STA total rx duration")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove impossible code
Sudip Mukherjee [Tue, 2 Feb 2016 07:14:40 +0000 (12:44 +0530)]
ath10k: remove impossible code

len has been initialized with a value of 0 and buf_len with 4096. There
is no way that this condition (len > buf_len) can be true now.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agortlwifi: rtl8821ae: Convert driver to use common 5G channel table
Larry Finger [Thu, 11 Feb 2016 16:53:12 +0000 (10:53 -0600)]
rtlwifi: rtl8821ae: Convert driver to use common 5G channel table

There are several copies of the 5G channel tables in this driver. These
are removed so that the tables in the core will be used. This change
also removes a useless message of "Channel 163 in Group not found".

The number of possible 5G channels was reduced from 54 to a better
value of 49 during the conversion.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: rtl8192ee: Convert driver to use new 5G channel tables
Larry Finger [Thu, 11 Feb 2016 16:53:11 +0000 (10:53 -0600)]
rtlwifi: rtl8192ee: Convert driver to use new 5G channel tables

The driver defines its own set of channel tables for the 5G band. With
this change, it will use those of the core.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: rtl8192de: Convert driver to use common 5G channels
Larry Finger [Thu, 11 Feb 2016 16:53:10 +0000 (10:53 -0600)]
rtlwifi: rtl8192de: Convert driver to use common 5G channels

This driver defines its owh copy of the 5G channels. Change it to use
the common definitions.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: Prepare for reworking 5G channels
Larry Finger [Thu, 11 Feb 2016 16:53:09 +0000 (10:53 -0600)]
rtlwifi: Prepare for reworking 5G channels

There are 3 drivers in this family that have 5G radios. Each of them
defines local copies of the available channels. This patch adds the
two arrays to the core driver.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix an indenting mistake
Dan Carpenter [Tue, 9 Feb 2016 11:15:36 +0000 (14:15 +0300)]
mwifiex: fix an indenting mistake

We recently added an indent level here but missed this line.  It needs
another tab.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: Remove unnecessary synchronize_irq() before free_irq()
Lars-Peter Clausen [Mon, 8 Feb 2016 20:41:13 +0000 (21:41 +0100)]
rtlwifi: Remove unnecessary synchronize_irq() before free_irq()

Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way), before any state associated with the IRQ is freed.

Patch was generated using the following semantic patch:
// <smpl>
@@
expression irq;
@@
-synchronize_irq(irq);
 free_irq(irq, ...);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agob43: Remove unnecessary synchronize_irq() before free_irq()
Lars-Peter Clausen [Mon, 8 Feb 2016 20:41:12 +0000 (21:41 +0100)]
b43: Remove unnecessary synchronize_irq() before free_irq()

Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way), before any state associated with the IRQ is freed.

Patch was generated using the following semantic patch:
// <smpl>
@@
expression irq;
@@
-synchronize_irq(irq);
 free_irq(irq, ...);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Increase nr of supported flowrings.
Hante Meuleman [Sun, 7 Feb 2016 23:00:30 +0000 (00:00 +0100)]
brcmfmac: Increase nr of supported flowrings.

New generation devices have firmware which has more than 256 flowrings.
E.g. following debugging message comes from 14e4:4365 BCM4366:
[  194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264

At various code places (related to flowrings) we were using u8 which
could lead to storing wrong number or infinite loops when indexing with
this type. This issue was quite easy to spot in brcmf_flowring_detach
where it led to infinite loop e.g. on failed initialization.

This patch switches code to proper types and increases the maximum
number of supported flowrings to 512.

Originally this change was sent in September 2015, but back it was
causing a regression on BCM43602 resulting in:
Unable to handle kernel NULL pointer dereference at virtual address ...

The reason for this regression was missing update (s/u8/u16) of struct
brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
bug in flowring management."). Starting with that it's safe to apply
this original patch as it doesn't cause a regression anymore.

This patch fixes an infinite loop on BCM4366 which is supported since
4.4 so it makes sense to apply it to stable 4.4+.

Cc: <stable@vger.kernel.org> # 4.4+
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add missing bit define for REG_APS_FSMCO
Jes Sorensen [Wed, 3 Feb 2016 18:40:02 +0000 (13:40 -0500)]
rtl8xxxu: Add missing bit define for REG_APS_FSMCO

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Make device_init kludge 8723au only
Jes Sorensen [Wed, 3 Feb 2016 18:40:01 +0000 (13:40 -0500)]
rtl8xxxu: Make device_init kludge 8723au only

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not mask RF registers to 6 bits
Jes Sorensen [Wed, 3 Feb 2016 18:40:00 +0000 (13:40 -0500)]
rtl8xxxu: Do not mask RF registers to 6 bits

Newer chips have RF registers beyond the original 0x3f address.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused len/cnt variables from rtl8xxxu_rx_complete()
Jes Sorensen [Wed, 3 Feb 2016 18:39:59 +0000 (13:39 -0500)]
rtl8xxxu: Remove unused len/cnt variables from rtl8xxxu_rx_complete()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused mgmt variable from rtl8xxxu_rx_complete()
Jes Sorensen [Wed, 3 Feb 2016 18:39:58 +0000 (13:39 -0500)]
rtl8xxxu: Remove unused mgmt variable from rtl8xxxu_rx_complete()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set correct bit to reset MCU IO wrapper
Jes Sorensen [Wed, 3 Feb 2016 18:39:57 +0000 (13:39 -0500)]
rtl8xxxu: Set correct bit to reset MCU IO wrapper

All chips, except for 8812 require BIT(0) for resetting the MCU IO
wrapper. 8723b requires a more complicated reset sequence, so it will
need a custom reset function.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8xxxu_set_linktype(): Be consistent aboutregister size REG_MSR
Jes Sorensen [Wed, 3 Feb 2016 18:39:56 +0000 (13:39 -0500)]
rtl8xxxu: rtl8xxxu_set_linktype(): Be consistent aboutregister size REG_MSR

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Enable data frame reception in rtl8xxxu_start
Bruno Randolf [Wed, 3 Feb 2016 18:39:55 +0000 (13:39 -0500)]
rtl8xxxu: Enable data frame reception in rtl8xxxu_start

mac80211 documentation says, the ieee80211_ops.start callback "must turn on
frame reception (for possibly enabled monitor interfaces.)". If not a single
monitor interface does not receive data frames.

Similarly we should not change the data reception based on the association
state.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix 80 character per line issue
Jes Sorensen [Wed, 3 Feb 2016 18:39:54 +0000 (13:39 -0500)]
rtl8xxxu: Fix 80 character per line issue

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove duplicate USB ID
Jes Sorensen [Wed, 3 Feb 2016 18:39:53 +0000 (13:39 -0500)]
rtl8xxxu: Remove duplicate USB ID

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: Document REG_RXFLTMAP registers
Bruno Randolf [Wed, 3 Feb 2016 18:39:52 +0000 (13:39 -0500)]
rtl8xxxu: Document REG_RXFLTMAP registers

Add comments describing how REG_RXFLTMAP0, REG_RXFLTMAP1 and REG_RXFLTMAP2
work.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Enable monitor mode by handling filters
Bruno Randolf [Wed, 3 Feb 2016 18:39:51 +0000 (13:39 -0500)]
rtl8xxxu: Enable monitor mode by handling filters

Monitor mode is enabled by handling the filter flags we get from mac80211 in
rtl8xxxu_configure_filter() and writing them to the RCR register.

By handling the filters, we can also stop setting the BSSID filters in the
association event.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix cosmetics to quiet down checkpatch police
Jes Sorensen [Wed, 3 Feb 2016 18:39:50 +0000 (13:39 -0500)]
rtl8xxxu: Fix cosmetics to quiet down checkpatch police

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use REG_EFUSE_TEST register only on multifunctional devices
Jakub Sitnicki [Wed, 3 Feb 2016 18:39:49 +0000 (13:39 -0500)]
rtl8xxxu: Use REG_EFUSE_TEST register only on multifunctional devices

rtl8192cu driver doesn't read/write the REG_EFUSE_TEST register.
Neither does the rtl8188eu driver.  Do it only for multifunc devices
RTL8723AU/RTL8723BU.

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused clutter for handling recursive calls to rtl8xxxu_init_device()
Jes Sorensen [Wed, 3 Feb 2016 18:39:48 +0000 (13:39 -0500)]
rtl8xxxu: Remove unused clutter for handling recursive calls to rtl8xxxu_init_device()

This was a leftover from the vendor driver that was never utilized.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add REG_OFDM0_RX_D_SYNC_PATH definitions
Jes Sorensen [Wed, 3 Feb 2016 18:39:47 +0000 (13:39 -0500)]
rtl8xxxu: Add REG_OFDM0_RX_D_SYNC_PATH definitions

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add mbox extension register definitions for 8723B
Jes Sorensen [Wed, 3 Feb 2016 18:39:46 +0000 (13:39 -0500)]
rtl8xxxu: Add mbox extension register definitions for 8723B

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add definitions for antenna selection registers for 8723BU
Jes Sorensen [Wed, 3 Feb 2016 18:39:45 +0000 (13:39 -0500)]
rtl8xxxu: Add definitions for antenna selection registers for 8723BU

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement rtl8xxxu_reset_8051()
Jes Sorensen [Wed, 3 Feb 2016 18:39:44 +0000 (13:39 -0500)]
rtl8xxxu: Implement rtl8xxxu_reset_8051()

We need to reset the 8051 in order for it to launch the fw on the
rtl8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Check return value of kmemdup()
Tobias Klauser [Wed, 3 Feb 2016 18:39:43 +0000 (13:39 -0500)]
rtl8xxxu: Check return value of kmemdup()

In rtl8xxxu_load_firmware() check the return value of kmemdup() and
error out with -ENOMEM in case of NULL to prevent a NULL pointer
dereference.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix typo in Kconfig help text
Tobias Klauser [Wed, 3 Feb 2016 18:39:42 +0000 (13:39 -0500)]
rtl8xxxu: Fix typo in Kconfig help text

Fix spelling of "benefits".

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add more RCR bits
Jes Sorensen [Wed, 3 Feb 2016 18:39:41 +0000 (13:39 -0500)]
rtl8xxxu: Add more RCR bits

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add REG_TX_REPORT_* defines
Jes Sorensen [Wed, 3 Feb 2016 18:39:40 +0000 (13:39 -0500)]
rtl8xxxu: Add REG_TX_REPORT_* defines

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Define SYS_CFG_SW_OFFLOAD_EN
Jes Sorensen [Wed, 3 Feb 2016 18:39:39 +0000 (13:39 -0500)]
rtl8xxxu: Define SYS_CFG_SW_OFFLOAD_EN

This is needed for chips with IOL support.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add RQPN_[NE]PQ_SHIFT values
Jes Sorensen [Wed, 3 Feb 2016 18:39:38 +0000 (13:39 -0500)]
rtl8xxxu: Add RQPN_[NE]PQ_SHIFT values

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: If fw running in RAM, reset the 8051 before trying to download a new one
Jes Sorensen [Wed, 3 Feb 2016 18:39:37 +0000 (13:39 -0500)]
rtl8xxxu: If fw running in RAM, reset the 8051 before trying to download a new one

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8xxxu_download_firmware(): Cosmetic cleanups
Jes Sorensen [Wed, 3 Feb 2016 18:39:36 +0000 (13:39 -0500)]
rtl8xxxu: rtl8xxxu_download_firmware(): Cosmetic cleanups

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Minor cleanup to rtl8xxxu_download_firmware()
Jes Sorensen [Wed, 3 Feb 2016 18:39:35 +0000 (13:39 -0500)]
rtl8xxxu: Minor cleanup to rtl8xxxu_download_firmware()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Fri, 19 Feb 2016 04:47:04 +0000 (23:47 -0500)]
Merge branch '40GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
40GbE Intel Wired LAN Driver Updates 2016-02-18

This series contains updates to i40e and i40evf only.

Alex Duyck provides all the patches in the series to update and fix the
drivers.  Fixed the driver to drop the outer checksum offload on UDP
tunnels, since the issue is that the upper levels of the stack never
requested such an offload and it results in possible errors.  Updates the
TSO function to just use u64 values, so we do not have to end up casting
u32 values.  In the TSO path, factored out the L4 header offsets allowing
us to ignore the L4 header offsets when dealing with the L3 checksum and
length update.  Consolidates all of the spots where we were updating
either the TCP or IP checksums in the TSO and checksum path into the TSO
function.  Fixed two issues by adding support for IPv4 encapsulated in
IPv6, first issue was the fact that iphdr(skb)->protocol was being used to
test for the outer transport protocol which breaks IPv6 support.  The second
was that we cleared the flag for v4 going to v6, but we did not take care
of txflags going the other way.  Added support for IPv6 extension headers
in setting up the Tx checksum.  Added exception handling to the Tx
checksum path so that we can handle cases of TSO where the frame is bad,
or Tx checksum where we did not recognize a protocol.  Fixed a number of
issues to make certain that we are using the correct protocols when
parsing both the inner and outer headers of a frame that is mixed between
IPv4 and IPv6 for inner and outer.  Updated the feature flags to reflect
the newly enabled/added features.

Sorry, no witty patch descriptions this time around, probably should
let Mitch help in writing patch descriptions for Alex. :-)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobnx2x: Add missing HSI for big-endian machines
Yuval Mintz [Wed, 17 Feb 2016 11:15:14 +0000 (13:15 +0200)]
bnx2x: Add missing HSI for big-endian machines

Commit e5d3a51cefbb ("bnx2x: extend DCBx support") was missing HSI
changes for big-endian machine, breaking compilation on such
platforms.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoi40e: Add support for ATR w/ IPv6 extension headers
Alexander Duyck [Tue, 26 Jan 2016 03:32:54 +0000 (19:32 -0800)]
i40e: Add support for ATR w/ IPv6 extension headers

This patch updates the code for determining the L4 protocol and L3 header
length so that when IPv6 extension headers are being used we can determine
the offset and type of the L4 protocol.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40evf: Update feature flags to reflect newly enabled features
Alexander Duyck [Mon, 25 Jan 2016 05:17:57 +0000 (21:17 -0800)]
i40evf: Update feature flags to reflect newly enabled features

Recent changes should have enabled support for IPv6 based tunnels and
support for TSO with outer UDP checksums.  As such we can update the
feature flags to reflect that.

In addition we can clean-up the flags that aren't needed such as SCTP and
RXCSUM since having the bits there doesn't add any value.

I also found one spot where we were setting the same flag twice.  It looks
like it was probably a git merge error that resulted in the line being
duplicated.  As such I have dropped it in this patch.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e: Update feature flags to reflect newly enabled features
Alexander Duyck [Mon, 25 Jan 2016 05:17:50 +0000 (21:17 -0800)]
i40e: Update feature flags to reflect newly enabled features

Recent changes should have enabled support for IPv6 based tunnels and
support for TSO with outer UDP checksums.  As such we can update the
feature flags to reflect that.

In addition we can clean-up the flags that aren't needed such as SCTP and
RXCSUM since having the bits there doesn't add any value.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e: Do not drop support for IPv6 VXLAN or GENEVE tunnels
Alexander Duyck [Mon, 25 Jan 2016 05:17:43 +0000 (21:17 -0800)]
i40e: Do not drop support for IPv6 VXLAN or GENEVE tunnels

All of the documentation in the datasheets for the XL710 do not call out
any reason to exclude support for IPv6 based tunnels.  As such I am
dropping the code that was excluding these tunnel types from having their
port numbers recognized.  This way we can take advantage of things such as
checksum offload for inner headers over IPv6 based VXLAN or GENEVE
tunnels.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e: Fix ATR in relation to tunnels
Alexander Duyck [Mon, 25 Jan 2016 05:17:36 +0000 (21:17 -0800)]
i40e: Fix ATR in relation to tunnels

This patch contains a number of fixes to make certain that we are using
the correct protocols when parsing both the inner and outer headers of a
frame that is mixed between IPv4 and IPv6 for inner and outer.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Kiran Patil <kiran.patil@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Enable support for SKB_GSO_UDP_TUNNEL_CSUM
Alexander Duyck [Mon, 25 Jan 2016 05:17:29 +0000 (21:17 -0800)]
i40e/i40evf: Enable support for SKB_GSO_UDP_TUNNEL_CSUM

The XL722 has support for providing the outer UDP tunnel checksum on
transmits.  Make use of this feature to support segmenting UDP tunnels with
outer checksums enabled.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Clean-up Rx packet checksum handling
Alexander Duyck [Mon, 25 Jan 2016 05:17:22 +0000 (21:17 -0800)]
i40e/i40evf: Clean-up Rx packet checksum handling

This is mostly a minor clean-up for the Rx checksum path in order to avoid
some of the unnecessary conditional checks that were being applied.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoMerge branch 'qed-vlan-filtering'
David S. Miller [Thu, 18 Feb 2016 21:07:45 +0000 (16:07 -0500)]
Merge branch 'qed-vlan-filtering'

Yuval Mintz says:

====================
qed{,e}: Add vlan filtering offload

This series adds vlan filtering offload to qede.
First patch introduces small additional infrastructure needed in
qed to support it, while second contains the main bulk of driver changes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoqede: Add vlan filtering offload support
Sudarsana Reddy Kalluru [Thu, 18 Feb 2016 15:00:40 +0000 (17:00 +0200)]
qede: Add vlan filtering offload support

Device would start receiving only vlan-tagged traffic with tags matching
that of one of the configured vlan IDs, unless:
  - Device is expliicly placed in PROMISC mode.
  - Device exhausts its vlan filter credits.

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: Lay infrastructure for vlan filtering offload
Yuval Mintz [Thu, 18 Feb 2016 15:00:39 +0000 (17:00 +0200)]
qed: Lay infrastructure for vlan filtering offload

Today, interfaces are working in vlan-promisc mode; But once
vlan filtering offloaded would be supported, we'll need a method to
control it directly [e.g., when setting device to PROMISC, or when
running out of vlan credits].

This adds the necessary API for L2 client to manually choose whether to
accept all vlans or only those for which filters were configured.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: phy: dp83848: Fix sysfs naming collision warning
Andrew F. Davis [Thu, 18 Feb 2016 00:10:00 +0000 (18:10 -0600)]
net: phy: dp83848: Fix sysfs naming collision warning

Files in sysfs are created using the name from the phy_driver struct,
when two names are the same we may get a duplicate filename warning,
fix this.

Reported-by: kernel test robot <ying.huang@linux.intel.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: Optimize local checksum offload
Alexander Duyck [Wed, 17 Feb 2016 19:23:55 +0000 (11:23 -0800)]
net: Optimize local checksum offload

This patch takes advantage of several assumptions we can make about the
headers of the frame in order to reduce overall processing overhead for
computing the outer header checksum.

First we can assume the entire header is in the region pointed to by
skb->head as this is what csum_start is based on.

Second, as a result of our first assumption, we can just call csum_partial
instead of making a call to skb_checksum which would end up having to
configure things so that we could walk through the frags list.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoipv6: Annotate change of locking mechanism for np->opt
Benjamin Poirier [Thu, 18 Feb 2016 00:20:33 +0000 (16:20 -0800)]
ipv6: Annotate change of locking mechanism for np->opt

follows up commit 45f6fad84cc3 ("ipv6: add complete rcu protection around
np->opt") which added mixed rcu/refcount protection to np->opt.

Given the current implementation of rcu_pointer_handoff(), this has no
effect at runtime.

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'iptunnel-pkt-scrub-consolidate'
David S. Miller [Thu, 18 Feb 2016 19:35:02 +0000 (14:35 -0500)]
Merge branch 'iptunnel-pkt-scrub-consolidate'

Jiri Benc says:

====================
iptunnel: scrub packet in iptunnel_pull_header

As every IP tunnel has to scrub skb on decapsulation, iptunnel_pull_header
tried to do that and open coded part of skb_scrub_packet. Various tunneling
protocols (VXLAN, Geneve) then called full skb_scrub_packet on their own,
duplicating part of the scrubbing already done.

Consolidate the code, calling skb_scrub_packet from iptunnel_pull_header.
This will allow additional cleanups in VXLAN code, as the packet is scrubbed
early during rx processing after this patchset and VXLAN can start filling
out skb fields earlier.

The full picture of vxlan cleanup patches can be seen at:
https://github.com/jbenc/linux-vxlan/commits/master
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoiptunnel: scrub packet in iptunnel_pull_header
Jiri Benc [Thu, 18 Feb 2016 10:22:52 +0000 (11:22 +0100)]
iptunnel: scrub packet in iptunnel_pull_header

Part of skb_scrub_packet was open coded in iptunnel_pull_header. Let it call
skb_scrub_packet directly instead.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agovxlan: move vxlan device lookup before iptunnel_pull_header
Jiri Benc [Thu, 18 Feb 2016 10:22:51 +0000 (11:22 +0100)]
vxlan: move vxlan device lookup before iptunnel_pull_header

This is in preparation for iptunnel_pull_header calling skb_scrub_packet.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agogeneve: move geneve device lookup before iptunnel_pull_header
Jiri Benc [Thu, 18 Feb 2016 10:22:50 +0000 (11:22 +0100)]
geneve: move geneve device lookup before iptunnel_pull_header

This is in preparation for iptunnel_pull_header calling skb_scrub_packet.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agogeneve: implement geneve_get_sk_family helper
Jiri Benc [Thu, 18 Feb 2016 10:22:49 +0000 (11:22 +0100)]
geneve: implement geneve_get_sk_family helper

Similarly to the existing vxlan_get_sk_family.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: bridge: log port STP state on change
Vivien Didelot [Tue, 16 Feb 2016 15:09:51 +0000 (10:09 -0500)]
net: bridge: log port STP state on change

Remove the shared br_log_state function and print the info directly in
br_set_state, where the net_bridge_port state is actually changed.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'cxgb4-addr-sync'
David S. Miller [Thu, 18 Feb 2016 19:16:13 +0000 (14:16 -0500)]
Merge branch 'cxgb4-addr-sync'

Hariprasad Shenai says:

====================
cxgb4: Use __dev_[um]c_[un]sync for MAC address syncing

This patch series adds support to use __dev_uc_sync/__dev_mc_sync to add
MAC address and __dev_uc_unsync/__dev_mc_unsync to delete MAC address.

This patch series has been created against net-next tree and includes
patches on cxgb4 and cxgb4vf driver.

We have included all the maintainers of respective drivers. Kindly review
the change and let us know in case of any review comments.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4vf: Use __dev_uc_sync/__dev_mc_sync to sync MAC address
Hariprasad Shenai [Tue, 16 Feb 2016 04:37:10 +0000 (10:07 +0530)]
cxgb4vf: Use __dev_uc_sync/__dev_mc_sync to sync MAC address

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Use __dev_uc_sync/__dev_mc_sync to sync MAC address
Hariprasad Shenai [Tue, 16 Feb 2016 04:37:09 +0000 (10:07 +0530)]
cxgb4: Use __dev_uc_sync/__dev_mc_sync to sync MAC address

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoi40e/i40evf: Add exception handling for Tx checksum
Alexander Duyck [Mon, 25 Jan 2016 05:17:10 +0000 (21:17 -0800)]
i40e/i40evf: Add exception handling for Tx checksum

Add exception handling to the Tx checksum path so that we can handle cases
of TSO where the frame is bad, or Tx checksum where we didn't recognize a
protocol

Drop I40E_TX_FLAGS_CSUM as it is unused, move the CHECKSUM_PARTIAL check
into the function itself so that we can decrease indent.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Do not write to descriptor unless we complete
Alexander Duyck [Mon, 25 Jan 2016 05:17:01 +0000 (21:17 -0800)]
i40e/i40evf: Do not write to descriptor unless we complete

This patch defers writing to the Tx descriptor bits until we know we have
successfully completed a given operation.  So for example we defer updating
the tunnelling portion of the context descriptor until we have fully
identified the type.

The advantage to this approach is that we can assemble values as we go
instead of having to try and kludge everything together all at once.  As a
result we can significantly clean up the tunneling configuration for
instance as we can just do a pointer walk and do the math for the distance
between each set of points.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agovxlan: tun_id is 64bit, not 32bit
Jiri Benc [Thu, 18 Feb 2016 18:19:29 +0000 (19:19 +0100)]
vxlan: tun_id is 64bit, not 32bit

The tun_id field in struct ip_tunnel_key is __be64, not __be32. We need to
convert the vni to tun_id correctly.

Fixes: 54bfd872bf16 ("vxlan: keep flags and vni in network byte order")
Reported-by: Paolo Abeni <pabeni@redhat.com>
Tested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoi40e/i40evf: Handle IPv6 extension headers in checksum offload
Alexander Duyck [Mon, 25 Jan 2016 05:16:54 +0000 (21:16 -0800)]
i40e/i40evf: Handle IPv6 extension headers in checksum offload

This patch adds support for IPv6 extension headers in setting up the Tx
checksum.  Without this patch extension headers would cause IPv6 traffic to
fail as the transport protocol could not be identified.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Add support for IPv4 encapsulated in IPv6
Alexander Duyck [Mon, 25 Jan 2016 05:16:48 +0000 (21:16 -0800)]
i40e/i40evf: Add support for IPv4 encapsulated in IPv6

This patch fixes two issues.  First was the fact that iphdr(skb)->protocl
was being used to test for the outer transport protocol.  This completely
breaks IPv6 support.  Second was the fact that we cleared the flag for v4
going to v6, but we didn't take care of txflags going the other way.  As
such we would have the v6 flag still set even if the inner header was v4.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Replace header pointers with unions of pointers in Tx checksum path
Alexander Duyck [Mon, 25 Jan 2016 05:16:42 +0000 (21:16 -0800)]
i40e/i40evf: Replace header pointers with unions of pointers in Tx checksum path

The Tx checksum path was maintaining a set of 3 pointers and two lengths in
order to prepare the packet for being checksummed.  The thing is we only
really needed 2 pointers, and the lengths that were being maintained can
easily be computed.

As such we can replace the IPv4 and IPv6 header pointers with one single
union that represents both, or a generic pointer to the start of the
network header.  For the L4 headers we can do the same with TCP and a
generic pointer to the start of the transport header.  The length of the
TCP header is obtained by simply multiplying doff by 4, and the network
header length can be obtained by subtracting the network header pointer
from the transport header pointer.

While I was at it I renamed l4_hdr to l4_proto to make it a bit more clear
and less likely to be confused with l4.hdr which is the transport header
pointer.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Consolidate all header changes into TSO function
Alexander Duyck [Mon, 25 Jan 2016 05:16:35 +0000 (21:16 -0800)]
i40e/i40evf: Consolidate all header changes into TSO function

This patch goes through and pulls all of the spots where we were updating
either the TCP or IP checksums in the TSO and checksum path into the TSO
function.  The general idea here is that we should only be updating the
header after we verify we have completed a skb_cow_head check to verify the
head is writable.

One other advantage to doing this is that it makes things much more
obvious.  For example, in the case of IPv6 there was one spot where the
offset of the IPv4 header checksum was being updated which is obviously
incorrect.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Factor out L4 header and checksum from L3 bits in TSO path
Alexander Duyck [Mon, 25 Jan 2016 05:16:28 +0000 (21:16 -0800)]
i40e/i40evf: Factor out L4 header and checksum from L3 bits in TSO path

This patch makes it so that the L4 header offsets and such can be ignored
when dealing with the L3 checksum and length update.  This is done making
use of two things.

First we can just use the offset from the L4 header to the start of the
packet to determine the L4 offset, and from that we can then make use of
the data offset to determine the full length of the headers.

As far as adjusting the checksum to remove the length we can simply add the
inverse of the length instead of having to recompute the entire
pseudo-header without the length.  In the case of an IPv6 header this
should be significantly cheaper since we can make use of a value we already
needed instead of having to read the source and destination address out of
the packet.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Use u64 values instead of casting them in TSO function
Alexander Duyck [Mon, 25 Jan 2016 05:16:20 +0000 (21:16 -0800)]
i40e/i40evf: Use u64 values instead of casting them in TSO function

Instead of casing u32 values to u64 it makes more sense to just start out
with u64 values in the first place.  This way we don't need to create a
mess with all of the casts needed to populate a 64b value.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e/i40evf: Drop outer checksum offload that was not requested
Alexander Duyck [Mon, 25 Jan 2016 05:16:13 +0000 (21:16 -0800)]
i40e/i40evf: Drop outer checksum offload that was not requested

The i40e and i40evf drivers contained code for inserting an outer checksum
on UDP tunnels.  The issue however is that the upper levels of the stack
never requested such an offload and it results in possible errors.

In addition the same logic was being applied to the Rx side where it was
attempting to validate the outer checksum, but the logic there was
incorrect in that it was testing for the resultant sum to be equal to the
header checksum instead of being equal to 0.

Since this code is so massively flawed, and doing things that we didn't ask
for it to do I am just dropping it, and will bring it back later to use as
an offload for SKB_GSO_UDP_TUNNEL_CSUM which can make use of such a
feature.

As far as the Rx feature I am dropping it completely since it would need to
be massively expanded and applied to IPv4 and IPv6 checksums for all parts,
not just the one that supports Tx checksum offload for the outer.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoMerge branch 'netlink-mmap-remove'
David S. Miller [Thu, 18 Feb 2016 16:42:41 +0000 (11:42 -0500)]
Merge branch 'netlink-mmap-remove'

Florian Westphal says:

====================
netlink: remove mmapped netlink support

As discussed during netconf 2016 in Seville, this series removes
CONFIG_NETLINK_MMAP.

Close to three years after it was merged it has retained several problems
that do not appear to be fixable.

No official netfilter libmnl release contains support for mmap backed netlink
sockets. No openvswitch release makes use of it either.

To use the mmap interface, userspace not only has to probe for mmap netlink
support, it also has to implement a recv/socket receive path in order to
handle messages that exceed the size of an rx ring element (NL_MMAP_STATUS_COPY).

So if there are odd programs out there that attempt to use MMAP netlink
they should continue to work as they already need a socket based code path
to work properly.

The actual revert (first patch) has a list of problems.
The followup patches remove a couple of helpers that are no longer needed
after the revert.

I did a few tests with mmap vs. socket based interface on a 4.4 based
kernel on an i7-4790 box and there are no performance advantages:

loopback, single nfqueue, queueing in -t filter INPUT:
traffic generated by 8 * ping -q -f localhost:
socket backend:
real    0m27.325s
user    0m3.993s
sys     0m23.292s

with mmap ring backend:
real    0m29.054s
user    0m4.924s
sys     0m24.127s

with single tcp stream, unidirectional, loopback mtu set at 1500
(nc localhost discard < /dev/zero > /dev/null):

socket interface:
time nfqdump -b $((8 * 1024 * 1024 * 1024)) -w /dev/null
real    0m15.960s
user    0m1.756s
sys     0m11.143s

mmap ring:
real    0m16.441s
user    0m3.040s
sys     0m13.687s

socket interface nfqdump[1] with --gso option (i.e. MTU is exceeded,
no kernel-side segmentation and checksum fixups) completes in about 5s.

I also tested dumping a conntrack table with 1m entries.
On my box this takes about 2.4 seconds for both mmap and socket backend:

time LD_PRELOAD=../../src/.libs/libmnl.so ./nfct-dump-sk > /dev/null
mnl_cb_run: Success
messages: 1000000
real    0m2.485s
user    0m1.085s
sys     0m1.400s

time LD_PRELOAD=../../src/.libs/libmnl.so ./nfct-dump-mmap > /dev/null
messages: 1000000
real    0m2.451s
user    0m1.124s
sys     0m1.328s

[1] https://git.breakpoint.cc/cgit/fw/nfqdump.git/
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonfnetlink: Revert "nfnetlink: add support for memory mapped netlink"
Florian Westphal [Thu, 18 Feb 2016 14:03:28 +0000 (15:03 +0100)]
nfnetlink: Revert "nfnetlink: add support for memory mapped netlink"

reverts commit 3ab1f683bf8b ("nfnetlink: add support for memory mapped
netlink")'

Like previous commits in the series, remove wrappers that are not needed
after mmapped netlink removal.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonfnetlink: remove nfnetlink_alloc_skb
Florian Westphal [Thu, 18 Feb 2016 14:03:27 +0000 (15:03 +0100)]
nfnetlink: remove nfnetlink_alloc_skb

Following mmapped netlink removal this code can be simplified by
removing the alloc wrapper.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoRevert "genl: Add genlmsg_new_unicast() for unicast message allocation"
Florian Westphal [Thu, 18 Feb 2016 14:03:26 +0000 (15:03 +0100)]
Revert "genl: Add genlmsg_new_unicast() for unicast message allocation"

This reverts commit bb9b18fb55b0 ("genl: Add genlmsg_new_unicast() for
unicast message allocation")'.

Nothing wrong with it; its no longer needed since this was only for
mmapped netlink support.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoopenvswitch: Revert: "Enable memory mapped Netlink i/o"
Florian Westphal [Thu, 18 Feb 2016 14:03:25 +0000 (15:03 +0100)]
openvswitch: Revert: "Enable memory mapped Netlink i/o"

revert commit 795449d8b846 ("openvswitch: Enable memory mapped Netlink i/o").
Following the mmaped netlink removal this code can be removed.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonetlink: remove mmapped netlink support
Florian Westphal [Thu, 18 Feb 2016 14:03:24 +0000 (15:03 +0100)]
netlink: remove mmapped netlink support

mmapped netlink has a number of unresolved issues:

- TX zerocopy support had to be disabled more than a year ago via
  commit 4682a0358639b29cf ("netlink: Always copy on mmap TX.")
  because the content of the mmapped area can change after netlink
  attribute validation but before message processing.

- RX support was implemented mainly to speed up nfqueue dumping packet
  payload to userspace.  However, since commit ae08ce0021087a5d812d2
  ("netfilter: nfnetlink_queue: zero copy support") we avoid one copy
  with the socket-based interface too (via the skb_zerocopy helper).

The other problem is that skbs attached to mmaped netlink socket
behave different from normal skbs:

- they don't have a shinfo area, so all functions that use skb_shinfo()
(e.g. skb_clone) cannot be used.

- reserving headroom prevents userspace from seeing the content as
it expects message to start at skb->head.
See for instance
commit aa3a022094fa ("netlink: not trim skb for mmaped socket when dump").

- skbs handed e.g. to netlink_ack must have non-NULL skb->sk, else we
crash because it needs the sk to check if a tx ring is attached.

Also not obvious, leads to non-intuitive bug fixes such as 7c7bdf359
("netfilter: nfnetlink: use original skbuff when acking batches").

mmaped netlink also didn't play nicely with the skb_zerocopy helper
used by nfqueue and openvswitch.  Daniel Borkmann fixed this via
commit 6bb0fef489f6 ("netlink, mmap: fix edge-case leakages in nf queue
zero-copy")' but at the cost of also needing to provide remaining
length to the allocation function.

nfqueue also has problems when used with mmaped rx netlink:
- mmaped netlink doesn't allow use of nfqueue batch verdict messages.
  Problem is that in the mmap case, the allocation time also determines
  the ordering in which the frame will be seen by userspace (A
  allocating before B means that A is located in earlier ring slot,
  but this also means that B might get a lower sequence number then A
  since seqno is decided later.  To fix this we would need to extend the
  spinlocked region to also cover the allocation and message setup which
  isn't desirable.
- nfqueue can now be configured to queue large (GSO) skbs to userspace.
  Queing GSO packets is faster than having to force a software segmentation
  in the kernel, so this is a desirable option.  However, with a mmap based
  ring one has to use 64kb per ring slot element, else mmap has to fall back
  to the socket path (NL_MMAP_STATUS_COPY) for all large packets.

To use the mmap interface, userspace not only has to probe for mmap netlink
support, it also has to implement a recv/socket receive path in order to
handle messages that exceed the size of an rx ring element.

Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet_sched: Improve readability of filter processing
Jamal Hadi Salim [Thu, 18 Feb 2016 13:04:43 +0000 (08:04 -0500)]
net_sched: Improve readability of filter processing

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge: switchdev: Offload VLAN flags to hardware bridge
Ido Schimmel [Thu, 18 Feb 2016 13:01:46 +0000 (14:01 +0100)]
bridge: switchdev: Offload VLAN flags to hardware bridge

When VLANs are created / destroyed on a VLAN filtering bridge (MASTER
flag set), the configuration is passed down to the hardware. However,
when only the flags (e.g. PVID) are toggled, the configuration is done
in the software bridge alone.

While it is possible to pass these flags to hardware when invoked with
the SELF flag set, this creates inconsistency with regards to the way
the VLANs are initially configured.

Pass the flags down to the hardware even when the VLAN already exists
and only the flags are toggled.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: phy: Add SGMII support for Marvell 88E1510/1512/1514/1518
Stefan Roese [Thu, 18 Feb 2016 09:59:07 +0000 (10:59 +0100)]
net: phy: Add SGMII support for Marvell 88E1510/1512/1514/1518

Add code to select SGMII-to-copper mode upon SGMII interface selection.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoisdn: divamnt: use y2038-safe ktime_get_ts64() for trace data timestamps
Alison Schofield [Thu, 18 Feb 2016 06:35:11 +0000 (22:35 -0800)]
isdn: divamnt: use y2038-safe ktime_get_ts64() for trace data timestamps

divamnt stores a start_time at module init and uses it to calculate
elapsed time. The elapsed time, stored in secs and usecs, is part of
the trace data the driver maintains for the DIVA Server ISDN cards.
No change to the format of that time data is required.

To avoid overflow on 32-bit systems use ktime_get_ts64() to return
the elapsed monotonic time since system boot.

This is a change from real to monotonic time. Since the driver only
stores elapsed time, monotonic time is sufficient and more robust
against real time clock changes. These new monotonic values can be
more useful for debugging because they can be easily compared to
other monotonic timestamps.

Note elaspsed time values will now start at system boot time rather
than module load time, so they will differ slightly from previously
reported values.

Remove declaration and init of previously unused time constants:
start_sec, start_usec.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Thu, 18 Feb 2016 15:32:18 +0000 (10:32 -0500)]
Merge branch '40GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
40GbE Intel Wired LAN Driver Updates 2016-02-17

This series contains updates to i40e/i40evf once again.

Mitch updates the use of a define instead of a magic number.  Adds support
for packet split receive on VFs, which is disabled by default.  Expands on
a code comment which was not verbose or really helpful.  Fixes an issue
where if a reset fails to complete and was not properly setting the
adapter state, which would cause a panic on rmmod, so set the adpater
state to DOWN to avoid a panic.

Jesse cleans up a "dump" in debugfs that never panned out to be useful.

Anjali adds a workaround for cases where we might have interrupts that get
lost but wright-back (WB) happened.  Fixes an issue by falling back to
enabling unicast, multicast and broadcast promiscuous mode when the driver
must disable it's use of "default port" (defport mode) due to internal
incompatibility with Multiple Function per Port (MFP).  Fixes an issue
where queues should never be enabled/disabled in the interrupt handler.

Kiran cleans up th code which used hard coded base VEB SEID since it was
removed from the specification.

Shannon adds a few bits for better debug messages.  Fixes an obscure corner
case, where it was possible to clear the NVM update wait flag when no
update_done message was actually received.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet-sysfs: remove unused fmt_long_hex
Colin Ian King [Mon, 15 Feb 2016 22:54:47 +0000 (22:54 +0000)]
net-sysfs: remove unused fmt_long_hex

Ever since commit 04ed3e741d0f133e02bed7fa5c98edba128f90e7
("net: change netdev->features to u32") the format string
fmt_long_hex has not been used, so we may as well remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoi40e/i40evf: Bump i40e to 1.4.15 and i40evf to 1.4.11.
Catherine Sullivan [Fri, 15 Jan 2016 22:33:22 +0000 (14:33 -0800)]
i40e/i40evf: Bump i40e to 1.4.15 and i40evf to 1.4.11.

Bump.

Change-ID: Ie280dc67e37a1cf667c3469499a4fb90f4177b75
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e: When in promisc mode apply promisc mode to Tx Traffic as well
Anjali Singhai Jain [Fri, 15 Jan 2016 22:33:21 +0000 (14:33 -0800)]
i40e: When in promisc mode apply promisc mode to Tx Traffic as well

In MFP mode particularly when we were setting the PF VSI in limited
promiscuous, the HW switch was still mirroring the outgoing packets
from other VSIs (VF/VMdq) onto the PF VSI.

With this new bit set, the mirroring doesn't happen any more and so
we are in limited promiscuous on the PF VSI in MFP which is similar
to defport.

An API check is not required, since this bit is reserved for FW API
version < 1.5

Also update copyright year in file headers.

Change-ID: I9840cb95f11dde733d943cb03ce84f68b9611bc8
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40e: clean event descriptor before use
Shannon Nelson [Fri, 15 Jan 2016 22:33:20 +0000 (14:33 -0800)]
i40e: clean event descriptor before use

In one obscure corner case, it was possible to clear the NVM update wait
flag when no update_done message was actually received.  This patch
cleans the event descriptor before use, and moves the opcode check to
where it won't get done if there was no event to clean.

Also update copyright year in file headers.

Change-ID: I68bbc41965e93f4adf07cbe98b9dfd63d41509a4
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
8 years agoi40evf: set adapter state on reset failure
Mitch Williams [Fri, 15 Jan 2016 22:33:19 +0000 (14:33 -0800)]
i40evf: set adapter state on reset failure

If a reset fails to complete, the driver gets its affairs in order and
awaits the cold solace of rmmod. Unfortunately, it was not properly
setting the adapter state, which would cause a panic on rmmod, instead
of the desired surcease.

Set the adapter state to DOWN in this case, and avoid a panic.

Change-ID: I6fdd9906da52e023f8dc744f7da44b5d95278ca9
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>