platform/kernel/linux-rpi.git
7 years agorsi: use separate mutex lock for receive thread
Karun Eagalapati [Thu, 6 Jul 2017 14:37:23 +0000 (20:07 +0530)]
rsi: use separate mutex lock for receive thread

Deadlock issue is observed during our stress tests. The root
cause for the issue is same lock is used between tx and rx threads.

This patch adds a separate mutex lock for rx thread to resolve
the problem.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: SDIO Rx packet processing enhancement
Karun Eagalapati [Thu, 6 Jul 2017 14:37:22 +0000 (20:07 +0530)]
rsi: SDIO Rx packet processing enhancement

Newer firmware sends information about number of blocks through
interrupt only. We don't need to read extra register for this.
This patch adds needed driver changes for this enhancment. The
change here is backward compatible

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Optimise sdio claim and release host
Karun Eagalapati [Thu, 6 Jul 2017 14:37:21 +0000 (20:07 +0530)]
rsi: Optimise sdio claim and release host

SDIO host is already claimed in our interrupt handler. Some lower
level APIs claims host while performing SDIO read or write operations.
Let's use sdio_irq_task variable to check if we are in interrupt
context and claim/release the host accordingly.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: rename variable in_sdio_litefi_irq
Karun Eagalapati [Thu, 6 Jul 2017 14:37:20 +0000 (20:07 +0530)]
rsi: rename variable in_sdio_litefi_irq

The variable in_sdio_litefi_irq is renamed to sdio_irq_task,
as it is more relevant here.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: separate function for data packet descriptor
Pavani Muthyala [Thu, 6 Jul 2017 14:37:19 +0000 (20:07 +0530)]
rsi: separate function for data packet descriptor

Data packet descriptor preparation code is moved a separate
function.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: data packet descriptor enhancements
Pavani Muthyala [Thu, 6 Jul 2017 14:37:18 +0000 (20:07 +0530)]
rsi: data packet descriptor enhancements

This patch covers some enhancements in data packet descriptor
preparation especially for EAPOL, multicast/broadcast packets.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: data packet descriptor code cleanup
Pavani Muthyala [Thu, 6 Jul 2017 14:37:17 +0000 (20:07 +0530)]
rsi: data packet descriptor code cleanup

Currently this descriptor is prepared with the help of __le16
pointer. This patch makes use of a structure to prepare the
descriptor in a cleaner way.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: separate function for management packet descriptor
Prameela Rani Garnepudi [Thu, 6 Jul 2017 14:37:16 +0000 (20:07 +0530)]
rsi: separate function for management packet descriptor

Management descriptor preparation is move to a separate function
as it will be called from a different context in upcoming patches.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: management frame descriptor preparation cleanup
Pavani Muthyala [Thu, 6 Jul 2017 14:37:15 +0000 (20:07 +0530)]
rsi: management frame descriptor preparation cleanup

Currently this descriptor is prepared with the help of __le16
pointer. This patch makes use of a structure to prepare the
descriptor in a cleaner way.

Signed-off-by: Pavani Muthyala <pavani.muthyala@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: set immediate wakeup bit
Karun Eagalapati [Thu, 6 Jul 2017 14:37:14 +0000 (20:07 +0530)]
rsi: set immediate wakeup bit

immediate wakeup bit is set while sending internal management
frame to the firmware.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: choose correct endpoint based on queue.
Karun Eagalapati [Thu, 6 Jul 2017 14:37:13 +0000 (20:07 +0530)]
rsi: choose correct endpoint based on queue.

Till now only management packets were handled. Let's enhance
the logic for choosing endpoint to accommodate other packets.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: rename USB endpoint macros
Karun Eagalapati [Thu, 6 Jul 2017 14:37:12 +0000 (20:07 +0530)]
rsi: rename USB endpoint macros

These endpoints are for WLAN and BT protocols.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: correct the logic of deriving queue number
Amitkumar Karwar [Thu, 6 Jul 2017 14:37:11 +0000 (20:07 +0530)]
rsi: correct the logic of deriving queue number

Maximum valid queue number is 0x5. So anding with 0x7 should be
ok here.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: USB tx headroom cleanup
Karun Eagalapati [Thu, 6 Jul 2017 14:37:10 +0000 (20:07 +0530)]
rsi: USB tx headroom cleanup

USB headroom is added while submitting the data to URB as per
firmware's requirement. This logic is moved to rsi_usb_card_write() so
that caller need not worry about it.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: card reset for USB interface
Karun Eagalapati [Thu, 6 Jul 2017 14:37:09 +0000 (20:07 +0530)]
rsi: card reset for USB interface

We need to reset the chip in teardown path so that it can work
next time when driver is loaded. This patch adds support for this
reset configuration for USB.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: correct SDIO disconnect path handling
Karun Eagalapati [Thu, 6 Jul 2017 14:37:08 +0000 (20:07 +0530)]
rsi: correct SDIO disconnect path handling

Sometimes it's observed that we get interrupt/Rx frame when device is
already detached from mac80211. In this case couple of error messages
are displayed in dmesg log. This patch corrects the order so that
disconnection will happen cleanly

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: chip reset for SDIO interface
Karun Eagalapati [Thu, 6 Jul 2017 14:37:07 +0000 (20:07 +0530)]
rsi: chip reset for SDIO interface

We need to reset the chip in teardown path so that it can work
next time when driver is loaded. This patch adds support for
this reset configuration for SDIO.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: fix sdio card reset problem
Karun Eagalapati [Thu, 6 Jul 2017 14:37:06 +0000 (20:07 +0530)]
rsi: fix sdio card reset problem

card reset is not working with recent kernels. Using
host->card->ocr instead of host->ocr_avail solved the problem.

Signed-off-by: Karun Eagalapati <karun256@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: changes in eeprom read frame
Prameela Rani Garnepudi [Thu, 6 Jul 2017 14:37:05 +0000 (20:07 +0530)]
rsi: changes in eeprom read frame

EEPROM read frame is sent during device initialization to read mac address.
The format of the frame is modified in firmware to include eeprom length
and offset. This frame does not return firmware version now. Also same
frame is sent again to read rf type and band information.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: use BUILD_BUG_ON check for fsm_state
Amitkumar Karwar [Thu, 6 Jul 2017 14:37:04 +0000 (20:07 +0530)]
rsi: use BUILD_BUG_ON check for fsm_state

Whenever new fsm_state enum element is added, fsm_state array
also needs to be updated. If this change is missed, we may end
up doing invalid access in array. BUILD_BUG_ON check will help
to avoid this problem.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Fri, 28 Jul 2017 12:11:34 +0000 (15:11 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.14. Major changes:

ath10k

* preparation for wcn3990 support

7 years agowl1251: add a missing spin_lock_init()
Cong Wang [Thu, 6 Jul 2017 22:00:37 +0000 (15:00 -0700)]
wl1251: add a missing spin_lock_init()

This fixes the following kernel warning:

  [ 5668.771453] BUG: spinlock bad magic on CPU#0, kworker/u2:3/9745
  [ 5668.771850]  lock: 0xce63ef20, .magic: 00000000, .owner: <none>/-1,
  .owner_cpu: 0
  [ 5668.772277] CPU: 0 PID: 9745 Comm: kworker/u2:3 Tainted: G        W
  4.12.0-03002-gec979a4-dirty #40
  [ 5668.772796] Hardware name: Nokia RX-51 board
  [ 5668.773071] Workqueue: phy1 wl1251_irq_work
  [ 5668.773345] [<c010c9e4>] (unwind_backtrace) from [<c010a274>]
  (show_stack+0x10/0x14)
  [ 5668.773803] [<c010a274>] (show_stack) from [<c01545a4>]
  (do_raw_spin_lock+0x6c/0xa0)
  [ 5668.774230] [<c01545a4>] (do_raw_spin_lock) from [<c06ca578>]
  (_raw_spin_lock_irqsave+0x10/0x18)
  [ 5668.774658] [<c06ca578>] (_raw_spin_lock_irqsave) from [<c048c010>]
  (wl1251_op_tx+0x38/0x5c)
  [ 5668.775115] [<c048c010>] (wl1251_op_tx) from [<c06a12e8>]
  (ieee80211_tx_frags+0x188/0x1c0)
  [ 5668.775543] [<c06a12e8>] (ieee80211_tx_frags) from [<c06a138c>]
  (__ieee80211_tx+0x6c/0x130)
  [ 5668.775970] [<c06a138c>] (__ieee80211_tx) from [<c06a3dbc>]
  (ieee80211_tx+0xdc/0x104)
  [ 5668.776367] [<c06a3dbc>] (ieee80211_tx) from [<c06a4af0>]
  (__ieee80211_subif_start_xmit+0x454/0x8c8)
  [ 5668.776824] [<c06a4af0>] (__ieee80211_subif_start_xmit) from
  [<c06a4f94>] (ieee80211_subif_start_xmit+0x30/0x2fc)
  [ 5668.777343] [<c06a4f94>] (ieee80211_subif_start_xmit) from
  [<c0578848>] (dev_hard_start_xmit+0x80/0x118)
  ...

by adding the missing spin_lock_init().

Reported-by: Pavel Machek <pavel@ucw.cz>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: gpio: Correct number of GPIOs for BCM53573
Florian Fainelli [Fri, 30 Jun 2017 19:02:57 +0000 (12:02 -0700)]
bcma: gpio: Correct number of GPIOs for BCM53573

Broadcom BCM53573 SoCs actually have 32 GPIOs, and not 16.

Fixes: 3f37ec79dd21 ("bcma: support BCM53573 series of wireless SoCs")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: kfree entry until after entry->bssid has been accessed
Colin Ian King [Fri, 30 Jun 2017 10:08:43 +0000 (11:08 +0100)]
rtlwifi: kfree entry until after entry->bssid has been accessed

The current code kfree's entry and then dereferences it by accessing
entry->bssid.  Avoid the dereference-after-free by moving the kfree
after the access to entry->bssid.

Detected by CoverityScan, CID#1448600 ("Read from pointer after free")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: correct channel stat buffer overflows
Brian Norris [Fri, 30 Jun 2017 01:23:54 +0000 (18:23 -0700)]
mwifiex: correct channel stat buffer overflows

mwifiex records information about various channels as it receives scan
information. It does this by appending to a buffer that was sized
to the max number of supported channels on any band, but there are
numerous problems:

(a) scans can return info from more than one band (e.g., both 2.4 and 5
    GHz), so the determined "max" is not large enough
(b) some firmware appears to return multiple results for a given
    channel, so the max *really* isn't large enough
(c) there is no bounds checking when stashing these stats, so problems
    (a) and (b) can easily lead to buffer overflows

Let's patch this by setting a slightly-more-correct max (that accounts
for a combination of both 2.4G and 5G bands) and adding a bounds check
when writing to our statistics buffer.

Due to problem (b), we still might not properly report all known survey
information (e.g., with "iw <dev> survey dump"), since duplicate results
(or otherwise "larger than expected" results) will cause some
truncation. But that's a problem for a future bugfix.

(And because of this known deficiency, only log the excess at the WARN
level, since that isn't visible by default in this driver and would
otherwise be a bit too noisy.)

Fixes: bf35443314ac ("mwifiex: channel statistics support for mwifiex")
Cc: <stable@vger.kernel.org>
Cc: Avinash Patil <patila@marvell.com>
Cc: Xinming Hu <huxm@marvell.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge branch 'qed-next'
David S. Miller [Thu, 27 Jul 2017 07:05:23 +0000 (00:05 -0700)]
Merge branch 'qed-next'

Manish Chopra says:

====================
qed/qede: Enhancements

This patch series adds these below features support in qed/qede

1) Ntuple filter configuration [via ethtool -n/N]
2) EEE (energy efficient ethernet) support [ethtool --set-eee/show-eee]
3) Coalescing configuration support for VFs [via ethtool -c/C]

Please consider applying this to "net-next"

V1->V2:
* Fixes below Kbuild test robot warning.

drivers/net//ethernet/qlogic/qed/qed_l2.c:
In function 'qed_get_queue_coalesce':
drivers/net//ethernet/qlogic/qed/qed_l2.c:2137:8: error:
implicit declaration of function 'qed_vf_pf_get_coalesce'
[-Werror=implicit-function-declaration]
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: enhanced per queue max coalesce value.
Rahul Verma [Wed, 26 Jul 2017 13:07:15 +0000 (06:07 -0700)]
qed: enhanced per queue max coalesce value.

Maximum coalesce per Rx/Tx queue is extended from
255 to 511.

Signed-off-by: Rahul Verma <rahul.verma@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Read per queue coalesce from hardware
Rahul Verma [Wed, 26 Jul 2017 13:07:14 +0000 (06:07 -0700)]
qed: Read per queue coalesce from hardware

Retrieve the actual coalesce value from hardware for every Rx/Tx
queue, instead of Rx/Tx coalesce value cached during set coalesce.

Signed-off-by: Rahul Verma <Rahul.Verma@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Add support for vf coalesce configuration.
Rahul Verma [Wed, 26 Jul 2017 13:07:13 +0000 (06:07 -0700)]
qed: Add support for vf coalesce configuration.

This patch add the ethtool support to set RX/Tx coalesce
value to the VF associated Rx/Tx queues.

Signed-off-by: Rahul Verma <Rahul.Verma@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqede: Add ethtool support for Energy efficient ethernet.
Sudarsana Reddy Kalluru [Wed, 26 Jul 2017 13:07:12 +0000 (06:07 -0700)]
qede: Add ethtool support for Energy efficient ethernet.

The patch adds ethtool callback implementations for querying/configuring
the Energy Efficient Ethernet (EEE) parameters.

Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Add support for Energy efficient ethernet.
Sudarsana Reddy Kalluru [Wed, 26 Jul 2017 13:07:11 +0000 (06:07 -0700)]
qed: Add support for Energy efficient ethernet.

The patch adds required driver support for reading/configuring the
Energy Efficient Ethernet (EEE) parameters.

Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed/qede: Add setter APIs support for RX flow classification
Chopra, Manish [Wed, 26 Jul 2017 13:07:10 +0000 (06:07 -0700)]
qed/qede: Add setter APIs support for RX flow classification

This patch adds support for adding and deleting rx flow
classification rules. Using this user can classify RX flow
constituting of TCP/UDP 4-tuples [src_ip/dst_ip and src_port/dst_port]
to be steered on a given RX queue

Signed-off-by: Manish Chopra <manish.chopra@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqede: Add getter APIs support for RX flow classification
Chopra, Manish [Wed, 26 Jul 2017 13:07:09 +0000 (06:07 -0700)]
qede: Add getter APIs support for RX flow classification

This patch adds support for ethtool getter APIs to query
RX flow classification rules.

Signed-off-by: Manish Chopra <manish.chopra@cavium.com>
Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Wed, 26 Jul 2017 23:58:45 +0000 (16:58 -0700)]
Merge branch '40GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
40GbE Intel Wired LAN Driver Updates 2017-07-25

This series contains updates to i40e and i40evf only.

Gustavo Silva fixes a variable assignment, where the incorrect variable
was being used to store the error parameter.

Carolyn provides a fix for a problem found in systems when entering S4
state, by ensuring that the misc vector's IRQ is disabled as well.

Jake removes the single-threaded restriction on the module workqueue,
which was causing issues with events such as CORER.  Does some future
proofing, by changing how the driver displays the UDP tunnel type.

Paul adds a retry in releasing resources if the admin queue times out
during the first attempt to release the resources.

Jesse fixes up references to 32bit timspec, since there are a small set
of errors on 32 bit, so we need to be using the right calls for dealing
with timespec64 variables.  Cleaned up code indentation and corrected
an "if" conditional check, as well as making the code flow more clear.
Cast or changed the types to remove warnings for comparing signed and
unsigned types.  Adds missing includes in i40evf, which were being used
but were not being directly included.

Daniel Borkmann fixes i40e to fill the XDP prog_id with the id just like
other XDP enabled drivers, so that on dump we can retrieve the attached
program based on the id and dump BPF insns, opcodes, etc back to user
space.

Tushar Dave adds le32_to_cpu while evaluating the hardware descriptor
fields, since they are in little-endian format.  Also removed
unnecessary "__packed" to a couple of i40evf structures.

Stefan Assmann fixes an issue when an administratively set MAC was set
and should now be switched back to 00:00:00:00:00:00, the pf_set_mac
flag is not being toggled back to false.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Wed, 26 Jul 2017 23:36:29 +0000 (16:36 -0700)]
Merge branch '10GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
10GbE Intel Wired LAN Driver Updates 2017-07-25

This series contains updates to ixgbe only.

Tony provides all of the changes in the series, starting with adding a
check to ensure that adding a MAC filter was successful, before setting the
MACVLAN.  In order to receive notifications of link configurations of the
external PHY and support the configuration of the internal iXFI link on
X552 devices, Tony enables LASI interrupts.  Update the iXFI driver code
flow, since the MAC register NW_MNG_IF_SEL fields have been redefined for
X553 devices, so add MAC checks for iXFI flows.  Added additional checks
for flow control autonegotiation, since it is not support for X553 fiber
 and XFI devices.

v2: removed unnecessary parens noticed by David Miller in patch 6 of the
    series.
v3: dropped patch 6 of the original series, while we work out a more
    generic solution for malicious driver detection (MDD) support.
v4: updated patch 1 of the series with the comments from Joe Perches which
    were:
      - switched logic to return on error
      - return 0 on success
      - declare retval as an integer
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: install libbpf headers on 'make install'
Jakub Kicinski [Tue, 25 Jul 2017 18:17:11 +0000 (11:17 -0700)]
bpf: install libbpf headers on 'make install'

Add a new target to install the bpf.h header to $(prefix)/include/bpf/
directory.  This is necessary to build standalone applications using
libbpf, without the need to clone the kernel sources and point to them.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agohamradio: dmascc: avoid -Wformat-overflow warning
Arnd Bergmann [Wed, 26 Jul 2017 07:55:33 +0000 (09:55 +0200)]
hamradio: dmascc: avoid -Wformat-overflow warning

gcc warns that the device name might overflow:

drivers/net/hamradio/dmascc.c: In function 'dmascc_init':
drivers/net/hamradio/dmascc.c:584:22: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
   sprintf(dev->name, "dmascc%i", 2 * n + i);
drivers/net/hamradio/dmascc.c:584:3: note: 'sprintf' output between 8 and 17 bytes into a destination of size 16
   sprintf(dev->name, "dmascc%i", 2 * n + i);

>From the static data in this file, I can tell that the index is
strictly limited to 16, so it won't overflow. This simply changes
the sprintf() to snprintf(), which is a good idea in general,
and shuts up this warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoi40e: handle setting administratively set MAC address back to zero
Stefan Assmann [Fri, 23 Jun 2017 07:46:24 +0000 (09:46 +0200)]
i40e: handle setting administratively set MAC address back to zero

When an administratively set MAC was previously set and should now be
switched back to 00:00:00:00:00:00 the pf_set_mac flag did not get
toggled back to false.
As a result VFs were still treated as if an administratively set MAC was
present.

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40evf: remove unnecessary __packed
Tushar Dave [Thu, 22 Jun 2017 17:12:11 +0000 (10:12 -0700)]
i40evf: remove unnecessary __packed

This is similar to 'commit 9588397d24eec ("i40e: remove unnecessary
__packed")' to avoid unaligned access.

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40evf: Use le32_to_cpu before evaluating HW desc fields
Tushar Dave [Thu, 22 Jun 2017 16:44:32 +0000 (09:44 -0700)]
i40evf: Use le32_to_cpu before evaluating HW desc fields

i40e hardware descriptor fields are in little-endian format. Driver
must use le32_to_cpu while evaluating these fields otherwise on
big-endian arch we end up evaluating incorrect values, cause errors
like:
i40evf 0000:03:0a.0: Expected response 24 from PF, received 402653184
i40evf 0000:03:0a.1: Expected response 7 from PF, received 117440512

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: report BPF prog id during XDP_QUERY_PROG
Daniel Borkmann [Sat, 24 Jun 2017 19:13:52 +0000 (21:13 +0200)]
i40e: report BPF prog id during XDP_QUERY_PROG

Fill the XDP prog_id with the id just like we do in other XDP enabled
drivers such as ixgbe. This is needed so that on dump we can retrieve
the attached program based on the id, and dump BPF insns, opcodes, etc
back to user space. Only XDP driver missing this is currently i40e.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40evf: add some missing includes
Jesse Brandeburg [Tue, 20 Jun 2017 22:17:01 +0000 (15:17 -0700)]
i40evf: add some missing includes

These includes were all being used in the driver, but weren't
being directly included.

Since the current advised method is to directly include anything
that you need, this implements that.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: display correct UDP tunnel type name
Jacob Keller [Tue, 20 Jun 2017 22:17:00 +0000 (15:17 -0700)]
i40e: display correct UDP tunnel type name

The i40e driver attempts to display the UDP tunnel name by doing a check
against the type, where for non-zero types we use "vxlan" and for zero
type we use "geneve". This is not future proof, because if new tunnel
types get added, we'll incorrectly label them. It also depends on the
value of UDP_TUNNEL_TYPE_GENEVE == 0, which is brittle.

Instead, replace this with a function that can return a constant string
depending on the type. For now we'll use "unknown" for types we don't
know about, and we can expand this in the future if new types get added.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e/i40evf: remove mismatched type warnings
Jesse Brandeburg [Tue, 20 Jun 2017 22:16:59 +0000 (15:16 -0700)]
i40e/i40evf: remove mismatched type warnings

Compiler reported several places where driver compared
signed and unsigned types.  Cast or change the types to remove
the warnings.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e/i40evf: make IPv6 ATR code clearer
Jesse Brandeburg [Tue, 20 Jun 2017 22:16:58 +0000 (15:16 -0700)]
i40e/i40evf: make IPv6 ATR code clearer

This just reorders some local vars and makes the code flow
clearer.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: fix odd formatting and indent
Jesse Brandeburg [Tue, 20 Jun 2017 22:16:57 +0000 (15:16 -0700)]
i40e: fix odd formatting and indent

The compiler warned on an oddly indented bit of code, and when
investigating that, noted that the functions themselves had
an odd flow. The if condition was checked, and would exclude
a call to AQ, but then the aq_ret would be checked unconditionally
which just looks really weird, and is likely to cause objections.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: fix up 32 bit timespec references
Jesse Brandeburg [Tue, 20 Jun 2017 22:16:56 +0000 (15:16 -0700)]
i40e: fix up 32 bit timespec references

As it turns out there was only a small set of errors
on 32 bit, and we just needed to be using the right calls
for dealing with timespec64 variables.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: Handle admin Q timeout when releasing NVM
Paul M Stillwell Jr [Tue, 20 Jun 2017 22:16:55 +0000 (15:16 -0700)]
i40e: Handle admin Q timeout when releasing NVM

There are some rare cases where the release resource call will return an
admin Q timeout. In these cases the code needs to try to release the
resource again until it succeeds or it times out.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: remove WQ_UNBOUND and the task limit of our workqueue
Jacob Keller [Tue, 20 Jun 2017 22:16:54 +0000 (15:16 -0700)]
i40e: remove WQ_UNBOUND and the task limit of our workqueue

During certain events such as a CORER, multiple devices will run a work
task to handle some cleanup. This can cause issues due to
a single-threaded workqueue which can mean that a device doesn't cleanup
in time. Prevent this by removing the single-threaded restriction on the
module workqueue. This avoids the need to add more complex yielding
logic in our service task routine. This is also similar to what other
drivers such as fm10k do.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: Fix for trace found with S4 state
Carolyn Wyborny [Tue, 20 Jun 2017 22:16:53 +0000 (15:16 -0700)]
i40e: Fix for trace found with S4 state

This patch fixes a problem found in systems when entering
S4 state.  This patch fixes the problem by ensuring that
the misc vector's IRQ is disabled as well.  Without this
patch a stack trace can be seen upon entering S4 state.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoi40e: fix incorrect variable assignment
Gustavo A R Silva [Thu, 15 Jun 2017 02:38:26 +0000 (21:38 -0500)]
i40e: fix incorrect variable assignment

Fix incorrect variable assignment.
Based on line 1511: aq_ret = I40_ERR_PARAM; the correct variable to be
used in this instance is aq_ret instead of ret. Also, variable ret is
updated at line 1602 just before return, so assigning a value to this
variable in this code block is useless.

Addresses-Coverity-ID: 1397693
Signed-off-by: Gustavo A R Silva <garsilva@embeddedor.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agovirtio-net: mark PM functions as __maybe_unused
Arnd Bergmann [Tue, 25 Jul 2017 15:35:50 +0000 (17:35 +0200)]
virtio-net: mark PM functions as __maybe_unused

After removing the reset function, the freeze and restore functions
are now unused when CONFIG_PM_SLEEP is disabled:

drivers/net/virtio_net.c:1881:12: error: 'virtnet_restore_up' defined but not used [-Werror=unused-function]
 static int virtnet_restore_up(struct virtio_device *vdev)
drivers/net/virtio_net.c:1859:13: error: 'virtnet_freeze_down' defined but not used [-Werror=unused-function]
 static void virtnet_freeze_down(struct virtio_device *vdev)

A more robust way to do this is to remove the #ifdef around the callers
and instead mark them as __maybe_unused. The compiler will now just
silently drop the unused code.

Fixes: 4941d472bf95 ("virtio-net: do not reset during XDP set")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoixgbe: Disable flow control for XFI
Tony Nguyen [Wed, 7 Jun 2017 21:36:21 +0000 (14:36 -0700)]
ixgbe: Disable flow control for XFI

Flow control autonegotiation is not supported for XFI.  Make sure that
ixgbe_device_supports_autoneg_fc() returns false and
hw->fc.disable_fc_autoneg is set to true to avoid running the fc_autoneg
function for that device.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoixgbe: Do not support flow control autonegotiation for X553
Tony Nguyen [Wed, 7 Jun 2017 21:36:20 +0000 (14:36 -0700)]
ixgbe: Do not support flow control autonegotiation for X553

Flow control autonegotiation is not supported for fiber on X553.  Add
device ID checks in ixgbe_device_supports_autoneg_fc() to return the
appropriate value.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoixgbe: Update NW_MNG_IF_SEL support for X553
Tony Nguyen [Wed, 7 Jun 2017 21:36:19 +0000 (14:36 -0700)]
ixgbe: Update NW_MNG_IF_SEL support for X553

The MAC register NW_MNG_IF_SEL fields have been redefined for
X553. These changes impact the iXFI driver code flow. Since iXFI is
only supported in X552, add MAC checks for iXFI flows.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoixgbe: Enable LASI interrupts for X552 devices
Tony Nguyen [Wed, 7 Jun 2017 21:36:18 +0000 (14:36 -0700)]
ixgbe: Enable LASI interrupts for X552 devices

Enable LASI interrupts on X552 devices in order to receive notifications of
link configurations of the external PHY and support the configuration of
the internal iXFI link since iXFI does not support auto-negotiation.  This
is not required for X553 devices; add a check to avoid enabling LASI
interrupts for X553 devices.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoixgbe: Ensure MAC filter was added before setting MACVLAN
Tony Nguyen [Wed, 19 Jul 2017 22:00:26 +0000 (15:00 -0700)]
ixgbe: Ensure MAC filter was added before setting MACVLAN

This patch adds a check to ensure that adding the MAC filter was
successful before setting the MACVLAN.  If it was unsuccessful, propagate
the error.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
7 years agoMerge branch 'bnxt_en-Fix-kbuild-errors-and-rename-phys_port_name'
David S. Miller [Tue, 25 Jul 2017 19:48:20 +0000 (12:48 -0700)]
Merge branch 'bnxt_en-Fix-kbuild-errors-and-rename-phys_port_name'

Michael Chan says:

====================
bnxt_en: Fix kbuild errors and rename phys_port_name.

Fix 2 more kbuild errors (the first one already fixed by DaveM), and rename
the physical port name.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: fix switchdev port naming for external-port-rep and vf-reps
Sathya Perla [Tue, 25 Jul 2017 17:28:41 +0000 (13:28 -0400)]
bnxt_en: fix switchdev port naming for external-port-rep and vf-reps

Fix the phys_port_name for the external physical port to be in
"pA" format and that of VF-rep to be in "pCvfD" format as
suggested by Jakub Kicinski.

Fixes: c124a62ff2dd ("bnxt_en: add support for port_attr_get and get_phys_port_name")
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: use SWITCHDEV_SET_OPS() for setting vf_rep_switchdev_ops
Sathya Perla [Tue, 25 Jul 2017 17:28:40 +0000 (13:28 -0400)]
bnxt_en: use SWITCHDEV_SET_OPS() for setting vf_rep_switchdev_ops

This fixes the build error:
‘struct net_device’ has no member named ‘switchdev_ops’

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: c124a62ff2dd ("bnxt_en: add support for port_attr_get and and get_phys_port_name")
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: include bnxt_vfr.c code under CONFIG_BNXT_SRIOV switch
Sathya Perla [Tue, 25 Jul 2017 17:28:39 +0000 (13:28 -0400)]
bnxt_en: include bnxt_vfr.c code under CONFIG_BNXT_SRIOV switch

And define empty functions in bnxt_vfr.h when CONFIG_BNXT_SRIOV is not
defined.

This fixes build error when CONFIG_BNXT_SRIOV is switched off:
>> drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:165:16: error: 'struct
>> bnxt' has no member named 'sriov_lock'

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: 4ab0c6a8ffd7 ("bnxt_en: add support to enable VF-representors")
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-warnings'
David S. Miller [Tue, 25 Jul 2017 19:31:38 +0000 (12:31 -0700)]
Merge branch 'net-warnings'

Stephen Hemminger says:

====================
network related warning fixes

Various fixes for warnings in network code and drivers.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years ago6lowpan: fix set not used warning
stephen hemminger [Mon, 24 Jul 2017 17:25:23 +0000 (10:25 -0700)]
6lowpan: fix set not used warning

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Acked-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosocket: fix set not used warning
stephen hemminger [Mon, 24 Jul 2017 17:25:22 +0000 (10:25 -0700)]
socket: fix set not used warning

The variable owned_by_user is always set, but only used
when kernel is configured with LOCKDEP enabled.

Get rid of the warning by moving the code to put the call
to owned_by_user into the the rcu_protected call.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetfilter: remove unused variable
stephen hemminger [Mon, 24 Jul 2017 17:25:21 +0000 (10:25 -0700)]
netfilter: remove unused variable

warning: ‘recent_old_fops’ defined but not used

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobenet: fix set but not used warning
stephen hemminger [Mon, 24 Jul 2017 17:25:20 +0000 (10:25 -0700)]
benet: fix set but not used warning

warning: variable ‘netdev’ set but not used

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt: fix unused variable warnings
stephen hemminger [Mon, 24 Jul 2017 17:25:19 +0000 (10:25 -0700)]
bnxt: fix unused variable warnings

Fix a couple of warnings where variable ‘txq’ set but not used

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>v, i);
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt: fix unsigned comparsion with 0
stephen hemminger [Mon, 24 Jul 2017 17:25:18 +0000 (10:25 -0700)]
bnxt: fix unsigned comparsion with 0

Fixes warning because location is u32 and can never be netative
warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: set config bit (ifup/ifdown) on netdev open/close
Dirk van der Merwe [Tue, 25 Jul 2017 07:51:08 +0000 (00:51 -0700)]
nfp: set config bit (ifup/ifdown) on netdev open/close

When a netdev (PF netdev or representor) is opened or closed, set the
physical port config bit appropriately - which powers UP/DOWN the PHY
module for the physical interface.

The PHY is powered first in the HW/FW configuration step when opening
the netdev and again last in the HW/FW configuration step when closing
the netdev.

This is only applicable when there is a physical port associated with
the netdev and if the NSP support this. Otherwise we silently ignore
this step.

The 'nfp_eth_set_configured' can actually return positive values -
updated the function documentation appropriately.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agodrivers/net: Fix ptr_ret.cocci warnings.
Tonghao Zhang [Tue, 25 Jul 2017 07:00:26 +0000 (00:00 -0700)]
drivers/net: Fix ptr_ret.cocci warnings.

we can use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
1. drivers/net/appletalk/ipddp.c
2. drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Use SWITCHDEV_SET_OPS().
David S. Miller [Tue, 25 Jul 2017 04:20:16 +0000 (21:20 -0700)]
bnxt_en: Use SWITCHDEV_SET_OPS().

Suggested by Jakub Kicinski.

Fixes: c124a62ff2dd ("bnxt_en: add support for port_attr_get and and get_phys_port_name")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoibmvnic: Check for transport event on driver resume
John Allen [Mon, 24 Jul 2017 18:26:06 +0000 (13:26 -0500)]
ibmvnic: Check for transport event on driver resume

On resume, the ibmvnic driver will fail to resume normal operation.
The main crq gets closed on suspend by the vnic server and doesn't get
reopened again as the interrupt for the transport event that would reset
the main crq comes in after the driver has been suspended.

This patch resolves the issue by removing the calls to kick the receive
interrupts handlers and instead directly invoking the main crq interrupt
handler. This will ensure that we see the transport event necessary to
properly resume the driver.

Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'netvsc-minor-fixes'
David S. Miller [Tue, 25 Jul 2017 00:39:29 +0000 (17:39 -0700)]
Merge branch 'netvsc-minor-fixes'

Stephen Hemminger says:

====================
netvsc: minor fixes

This fixes fallout from previous patch related to RTNL and RCU
annotaiton. Also one patch sent to wrong list.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: remove no longer used max_num_rss queues
stephen hemminger [Mon, 24 Jul 2017 17:57:30 +0000 (10:57 -0700)]
netvsc: remove no longer used max_num_rss queues

This value has been calculated in rndis_device_attach since 4.11.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: include rtnetlink.h
stephen hemminger [Mon, 24 Jul 2017 17:57:29 +0000 (10:57 -0700)]
netvsc: include rtnetlink.h

Since these files use rtnl_derefernce make sure and include rtnetlink.h

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: fix netvsc_set_channels
stephen hemminger [Mon, 24 Jul 2017 17:57:28 +0000 (10:57 -0700)]
netvsc: fix netvsc_set_channels

The number of channels returned by rndis_filter_device_add maybe
less than the number requested. Therefore set correct real
number of queues.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: prefetch the first incoming ring element
stephen hemminger [Mon, 24 Jul 2017 17:57:27 +0000 (10:57 -0700)]
netvsc: prefetch the first incoming ring element

In interrupt handler, prefetch the first incoming ring element
so that it is in cache by the time NAPI poll gets to it.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: Remove redundant use of ipv6_hdr()
Mohammed Gamal [Mon, 24 Jul 2017 17:57:26 +0000 (10:57 -0700)]
netvsc: Remove redundant use of ipv6_hdr()

This condition already uses an object of type ipv6hdr in the line above.
Use the object directly instead of calling ipv6_hdr

Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: remove bogus rtnl_unlock
stephen hemminger [Mon, 24 Jul 2017 17:57:25 +0000 (10:57 -0700)]
netvsc: remove bogus rtnl_unlock

Remove accidental rtnl_unlock from earlier testing.

Fixes: 3962981f4822 ("netvsc: add rtnl annotations in rndis")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'bnxt_en-updates'
David S. Miller [Tue, 25 Jul 2017 00:29:58 +0000 (17:29 -0700)]
Merge branch 'bnxt_en-updates'

Michael Chan says:

====================
bnxt_en: Updates for net-next.

This series includes updating the firmware interface, adding
methods to get and set VEPA/VEB bridge modes, some minor DCBX and ETS
refinements, and 3 patches from Sathya Perla to implement initial
VF representors for SRIOV switching.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: add support for port_attr_get and and get_phys_port_name
Sathya Perla [Mon, 24 Jul 2017 16:34:29 +0000 (12:34 -0400)]
bnxt_en: add support for port_attr_get and and get_phys_port_name

This patch adds support for the switchdev_port_attr_get() and
ndo_get_phys_port_name() methods for the PF and the VF-reps.
Using this support a user application can deduce that the PF
(when in the ESWITCH_SWDEV mode) and it's VF-reps form a switch.

Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: add vf-rep RX/TX and netdev implementation
Sathya Perla [Mon, 24 Jul 2017 16:34:28 +0000 (12:34 -0400)]
bnxt_en: add vf-rep RX/TX and netdev implementation

This patch introduces the RX/TX and a simple netdev implementation
for VF-reps. The VF-reps use the RX/TX rings of the PF. For each VF-rep
the PF driver issues a VFR_ALLOC FW cmd that returns "cfa_code"
and "cfa_action" values. The FW sets up the filter tables in such
a way that VF traffic by default (in absence of other rules)
gets punted to the parent PF. The cfa_code value in the RX-compl
informs the driver of the source VF. For traffic being transmitted
from the VF-rep, the TX BD is tagged with a cfa_action value that
informs the HW to punt it to the corresponding VF.

Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: add support to enable VF-representors
Sathya Perla [Mon, 24 Jul 2017 16:34:27 +0000 (12:34 -0400)]
bnxt_en: add support to enable VF-representors

This patch is a part of a patch-set that introduces support for
VF-reps in the bnxt_en driver. The driver registers eswitch mode
get/set methods with the devlink interface that allow a user to
enable SRIOV switchdev mode. When enabled, the driver registers
a VF-rep netdev object for each VF with the stack. This can
essentially bring the VFs unders the management perview of the
hypervisor and applications such as OVS.

The next patch in the series, adds the RX/TX routines and a slim
netdev implementation for the VF-reps.

Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Set ETS min_bw parameter for older firmware.
Michael Chan [Mon, 24 Jul 2017 16:34:26 +0000 (12:34 -0400)]
bnxt_en: Set ETS min_bw parameter for older firmware.

In addition to the ETS weight, older firmware also requires the min_bw
parameter to be set for it to work properly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Report firmware DCBX agent.
Michael Chan [Mon, 24 Jul 2017 16:34:25 +0000 (12:34 -0400)]
bnxt_en: Report firmware DCBX agent.

Report DCB_CAP_DCBX_LLD_MANAGED only if the firmware DCBX agent is enabled
and running for PF or VF.  Otherwise, if both LLDP and DCBX agents are
disabled in firmware, we report DCB_CAP_DCBX_LLD_HOST and allow host
IEEE DCB settings.  This patch refines the current logic in the driver.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Allow the user to set ethtool stats-block-usecs to 0.
Michael Chan [Mon, 24 Jul 2017 16:34:24 +0000 (12:34 -0400)]
bnxt_en: Allow the user to set ethtool stats-block-usecs to 0.

For debugging purpose, it is sometimes useful to disable periodic
port statistics updates, so that the firmware logs will not be
filled with statistics update messages.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Add bnxt_get_num_stats() to centrally get the number of ethtool stats.
Michael Chan [Mon, 24 Jul 2017 16:34:23 +0000 (12:34 -0400)]
bnxt_en: Add bnxt_get_num_stats() to centrally get the number of ethtool stats.

Instead of duplicating the logic multiple times.  Also, it is unnecessary
to zero the buffer in .get_ethtool_stats() because it is already zeroed
by the caller.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Implement ndo_bridge_{get|set}link methods.
Michael Chan [Mon, 24 Jul 2017 16:34:22 +0000 (12:34 -0400)]
bnxt_en: Implement ndo_bridge_{get|set}link methods.

To allow users to set the hardware bridging mode to VEB or VEPA.  Only
single function PF can change the bridging mode.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Retrieve the hardware bridge mode from the firmware.
Michael Chan [Mon, 24 Jul 2017 16:34:21 +0000 (12:34 -0400)]
bnxt_en: Retrieve the hardware bridge mode from the firmware.

Retrieve and store the hardware bridge mode, so that we can implement
ndo_bridge_{get|set)link methods in the next patch.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobnxt_en: Update firmware interface spec to 1.8.0.
Michael Chan [Mon, 24 Jul 2017 16:34:20 +0000 (12:34 -0400)]
bnxt_en: Update firmware interface spec to 1.8.0.

VF representors and PTP are added features in the new firmware spec.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agotcp: remove redundant argument from tcp_rcv_established()
Matvejchikov Ilya [Mon, 24 Jul 2017 12:02:12 +0000 (16:02 +0400)]
tcp: remove redundant argument from tcp_rcv_established()

The last (4th) argument of tcp_rcv_established() is redundant as it
always equals to skb->len and the skb itself is always passed as 2th
agrument. There is no reason to have it.

Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlx4_en: remove unnecessary error check
Zhu Yanjun [Mon, 24 Jul 2017 08:22:44 +0000 (04:22 -0400)]
mlx4_en: remove unnecessary error check

The function mlx4_en_get_profile always return zero. So it is not
necessary to check its return value.

CC: Joe Jin <joe.jin@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum_router: Fix build when IPv6 isn't enabled
Ido Schimmel [Mon, 24 Jul 2017 07:56:00 +0000 (09:56 +0200)]
mlxsw: spectrum_router: Fix build when IPv6 isn't enabled

When IPv6 isn't enabled the following error is generated:

ERROR: "nd_tbl" [drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko]
undefined!

Fix it by replacing 'arp_tbl' and 'nd_tbl' with 'tbl->family' wherever
possible and reference 'nd_tbl' only when IPV6 is enabled.

Fixes: d5eb89cf68d6 ("mlxsw: spectrum_router: Reflect IPv6 neighbours to the device")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlx4_en: remove unnecessary returned value
Zhu Yanjun [Mon, 24 Jul 2017 03:02:53 +0000 (23:02 -0400)]
mlx4_en: remove unnecessary returned value

The function mlx4_en_arm_cq always returns zero. So change the
return type of the function mlx4_en_arm_cq to void.

CC: Joe Jin <joe.jin@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoof_mdio: kill useless variable in of_phy_register_fixed_link()
Sergei Shtylyov [Sun, 23 Jul 2017 18:45:47 +0000 (21:45 +0300)]
of_mdio: kill useless variable in of_phy_register_fixed_link()

of_phy_register_fixed_link() declares the 'err' variable to hold the result
of of_property_read_string() but only uses it once after that, while that
function can be called directly from the *if* statement...

Remove that variable and move/regroup 'link_gpio' and 'len' variables in
order to sort the declarations in the reverse Xmas tree order -- to please
DaveM. ;-)

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoskbuff: re-add check for NULL skb->head in kfree_skb path
Florian Westphal [Sun, 23 Jul 2017 17:54:47 +0000 (19:54 +0200)]
skbuff: re-add check for NULL skb->head in kfree_skb path

A null check is needed after all.  netlink skbs can have skb->head be
backed by vmalloc.  The netlink destructor vfree()s head, then sets it to
NULL.  We then panic in skb_release_data with a NULL dereference.

Re-add such a test.

Alternative would be to switch to kvfree to free skb->head memory
and remove the special handling in netlink destructor.

Reported-by: kernel test robot <fengguang.wu@intel.com>
Fixes: 06dc75ab06943 ("net: Revert "net: add function to allocate sk_buff head without data area")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: fix implicit irq include causing build failures
Paul Gortmaker [Sun, 23 Jul 2017 14:44:52 +0000 (10:44 -0400)]
liquidio: fix implicit irq include causing build failures

To fix

In file included from drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c:24:0:
drivers/net/ethernet/cavium/liquidio/octeon_device.h:216:2: error: expected specifier-qualifier-list before ‘irqreturn_t’
  irqreturn_t (*process_interrupt_regs)(void *);
  ^

as seen on arm64 allmodconfig builds.

Cc: Derek Chickles <derek.chickles@caviumnetworks.com>
Cc: Satanand Burla <satananda.burla@caviumnetworks.com>
Cc: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Cc: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: dev_map_alloc() shouldn't return NULL
Dan Carpenter [Sat, 22 Jul 2017 07:40:04 +0000 (10:40 +0300)]
bpf: dev_map_alloc() shouldn't return NULL

We forgot to set the error code on two error paths which means that we
return ERR_PTR(0) which is NULL.  The caller, find_and_alloc_map(), is
not expecting that and will have a NULL dereference.

Fixes: 546ac1ffb70d ("bpf: add devmap, a map for storing net device references")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: fix ptr_ret.cocci warnings
Wu Fengguang [Fri, 21 Jul 2017 18:54:43 +0000 (02:54 +0800)]
netvsc: fix ptr_ret.cocci warnings

drivers/net/hyperv/netvsc_drv.c:737:8-14: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 9749fed5d43d ("netvsc: use ERR_PTR to avoid dereference issues")
CC: stephen hemminger <stephen@networkplumber.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge tag 'rxrpc-rewrite-20170721' of git://git.kernel.org/pub/scm/linux/kernel/git...
David S. Miller [Mon, 24 Jul 2017 23:17:10 +0000 (16:17 -0700)]
Merge tag 'rxrpc-rewrite-20170721' of git://git./linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
rxrpc: Rearrange headers

Here's a pair of patches that rearrange some of the AF_RXRPC header files
that are outside of the net/rxrpc/ directory:

 (1) The bits userspace need are moved to uapi/linux/rxrpc.h.  [Should this
     be af_rxrpc.h instead, I wonder - but there doesn't seem to be
     precedent for that in the other net UAPI headers.]

 (2) For the most part, the contents of rxrpc/packet.h are no longer used
     outside of the AF_RXRPC module, so move them to net/rxrpc/protocol.h
     with the exception of the standard abort codes which are exposed to
     userspace when an abort occurs and the security index values which are
     needed when constructing keys.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>