platform/kernel/linux-starfive.git
6 years agoMerge branch 'ethtool-fec'
David S. Miller [Sun, 30 Jul 2017 06:23:45 +0000 (23:23 -0700)]
Merge branch 'ethtool-fec'

Roopa Prabhu says:

====================
ethtool: support for forward error correction mode setting on a link

Forward Error Correction (FEC) modes i.e Base-R
and Reed-Solomon modes are introduced in 25G/40G/100G standards
for providing good BER at high speeds. Various networking devices
which support 25G/40G/100G provides ability to manage supported FEC
modes and the lack of FEC encoding control and reporting today is a
source for interoperability issues for many vendors.
FEC capability as well as specific FEC mode i.e. Base-R
or RS modes can be requested or advertised through bits D44:47 of base link
codeword.

This patch set intends to provide option under ethtool to manage and
report FEC encoding settings for networking devices as per IEEE 802.3
bj, bm and by specs.

v2 :
        - minor patch format fixes and typos pointed out by Andrew
        - there was a pending discussion on the use of 'auto' vs
          'automatic' for fec settings. I have left it as 'auto'
          because in most cases today auto is used in place of
          automatic to represent automatically generated values.
          We use it in other networking config too. I would prefer
          leaving it as auto.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: ethtool forward error correction management support
Casey Leedom [Thu, 27 Jul 2017 23:47:28 +0000 (16:47 -0700)]
cxgb4: ethtool forward error correction management support

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agocxgb4: core hardware/firmware support for Forward Error Correction on a link
Casey Leedom [Thu, 27 Jul 2017 23:47:27 +0000 (16:47 -0700)]
cxgb4: core hardware/firmware support for Forward Error Correction on a link

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: ethtool: add support for forward error correction modes
Vidya Sagar Ravipati [Thu, 27 Jul 2017 23:47:26 +0000 (16:47 -0700)]
net: ethtool: add support for forward error correction modes

Forward Error Correction (FEC) modes i.e Base-R
and Reed-Solomon modes are introduced in 25G/40G/100G standards
for providing good BER at high speeds. Various networking devices
which support 25G/40G/100G provides ability to manage supported FEC
modes and the lack of FEC encoding control and reporting today is a
source for interoperability issues for many vendors.
FEC capability as well as specific FEC mode i.e. Base-R
or RS modes can be requested or advertised through bits D44:47 of
base link codeword.

This patch set intends to provide option under ethtool to manage
and report FEC encoding settings for networking devices as per
IEEE 802.3 bj, bm and by specs.

set-fec/show-fec option(s) are designed to provide control and
report the FEC encoding on the link.

SET FEC option:
root@tor: ethtool --set-fec  swp1 encoding [off | RS | BaseR | auto]

Encoding: Types of encoding
Off    :  Turning off any encoding
RS     :  enforcing RS-FEC encoding on supported speeds
BaseR  :  enforcing Base R encoding on supported speeds
Auto   :  IEEE defaults for the speed/medium combination

Here are a few examples of what we would expect if encoding=auto:
- if autoneg is on, we are  expecting FEC to be negotiated as on or off
  as long as protocol supports it
- if the hardware is capable of detecting the FEC encoding on it's
      receiver it will reconfigure its encoder to match
- in absence of the above, the configuration would be set to IEEE
  defaults.

>From our  understanding , this is essentially what most hardware/driver
combinations are doing today in the absence of a way for users to
control the behavior.

SHOW FEC option:
root@tor: ethtool --show-fec  swp1
FEC parameters for swp1:
Active FEC encodings: RS
Configured FEC encodings:  RS | BaseR

ETHTOOL DEVNAME output modification:

ethtool devname output:
root@tor:~# ethtool swp1
Settings for swp1:
root@hpe-7712-03:~# ethtool swp18
Settings for swp18:
    Supported ports: [ FIBRE ]
    Supported link modes:   40000baseCR4/Full
                            40000baseSR4/Full
                            40000baseLR4/Full
                            100000baseSR4/Full
                            100000baseCR4/Full
                            100000baseLR4_ER4/Full
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: [RS | BaseR | None | Not reported]
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Advertised FEC modes: [RS | BaseR | None | Not reported]
<<<< One or more FEC modes
    Speed: 100000Mb/s
    Duplex: Full
    Port: FIBRE
    PHYAD: 106
    Transceiver: internal
    Auto-negotiation: off
    Link detected: yes

This patch includes following changes
a) New ETHTOOL_SFECPARAM/SFECPARAM API, handled by
  the new get_fecparam/set_fecparam callbacks, provides support
  for configuration of forward error correction modes.
b) Link mode bits for FEC modes i.e. None (No FEC mode), RS, BaseR/FC
  are defined so that users can configure these fec modes for supported
  and advertising fields as part of link autonegotiation.

Signed-off-by: Vidya Sagar Ravipati <vidya.chowdary@gmail.com>
Signed-off-by: Dustin Byford <dustin@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'netvsc-minor-fixes-and-optimization'
David S. Miller [Sat, 29 Jul 2017 22:25:44 +0000 (15:25 -0700)]
Merge branch 'netvsc-minor-fixes-and-optimization'

Stephen Hemminger says:

====================
netvsc: minor fixes and optimization

This is a subset of earlier submission with a few more fixes
found during testing. The are two small optimizations, one is to
better manage the receive completion ring, and the other is removing
one unneeded level of indirection.

Will submit the improved VF support and buffer sizing in a later
patch so they get more review.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: signal host if receive ring is emptied
stephen hemminger [Fri, 28 Jul 2017 15:59:47 +0000 (08:59 -0700)]
netvsc: signal host if receive ring is emptied

Latency improvement related to NAPI conversion.
If all packets are processed from receive ring then need
to signal host.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: fix error unwind on device setup failure
stephen hemminger [Fri, 28 Jul 2017 15:59:46 +0000 (08:59 -0700)]
netvsc: fix error unwind on device setup failure

If setting receive buffer fails, the error unwind would cause
kernel panic because it was not correctly doing RCU and NAPI
unwind.  RCU'd pointer needs to be reset to NULL, and NAPI needs
to be disabled not deleted.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: optimize receive completions
stephen hemminger [Fri, 28 Jul 2017 15:59:45 +0000 (08:59 -0700)]
netvsc: optimize receive completions

Optimize how receive completion ring are managed.
   * Allocate only as many slots as needed for all buffers from host
   * Allocate before setting up sub channel for better error detection
   * Don't need to keep copy of initial receive section message
   * Precompute the watermark for when receive flushing is needed
   * Replace division with conditional test
   * Replace atomic per-device variable with per-channel check.
   * Handle corner case where receive completion send
     fails if ring buffer to host is full.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: remove unnecessary indirection of page_buffer
stephen hemminger [Fri, 28 Jul 2017 15:59:44 +0000 (08:59 -0700)]
netvsc: remove unnecessary indirection of page_buffer

The internal API was passing struct hv_page_buffer **
when only simple struct hv_page_buffer * was necessary
for passing an array.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: don't print pointer value in error message
stephen hemminger [Fri, 28 Jul 2017 15:59:43 +0000 (08:59 -0700)]
netvsc: don't print pointer value in error message

Using %p to print pointer to packet meta-data doesn't give any
good info, and exposes kernel memory offsets.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: fix warnings reported by lockdep
stephen hemminger [Fri, 28 Jul 2017 15:59:42 +0000 (08:59 -0700)]
netvsc: fix warnings reported by lockdep

This includes a bunch of fixups for issues reported by
lockdep.
   * ethtool routines can assume RTNL
   * send is done with RCU lock (and BH disable)
   * avoid refetching internal device struct (netvsc)
     instead pass it as a parameter.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetvsc: fix return value for set_channels
stephen hemminger [Fri, 28 Jul 2017 15:59:41 +0000 (08:59 -0700)]
netvsc: fix return value for set_channels

The error and normal case got swapped.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: bump up driver version to match newer NIC firmware
Felix Manlunas [Thu, 27 Jul 2017 19:32:28 +0000 (12:32 -0700)]
liquidio: bump up driver version to match newer NIC firmware

Bump up driver version to match newer NIC firmware.  Also update
nic_rx_stats (a struct common to host driver and firmware) by adding a new
field:  fw_total_fwd_bytes.

Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobnxt_re: add MAY_USE_DEVLINK dependency
Sathya Perla [Thu, 27 Jul 2017 10:29:51 +0000 (06:29 -0400)]
bnxt_re: add MAY_USE_DEVLINK dependency

bnxt_en depends on MAY_USE_DEVLINK; this is used to force bnxt_en
to be =m when DEVLINK is =m.

Now, bnxt_re selects bnxt_en. Unless bnxt_re also explicitly calls
out dependency on MAY_USE_DEVLINK, Kconfig does not force bnxt_re
to be =m when DEVLINK is =m, causing the following error:

drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.o: In function
`bnxt_dl_register':
bnxt_vfr.c:(.text+0x1440): undefined reference to `devlink_alloc'
bnxt_vfr.c:(.text+0x14c0): undefined reference to `devlink_register'
bnxt_vfr.c:(.text+0x14e0): undefined reference to `devlink_free'
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.o: In function
`bnxt_dl_unregister':
bnxt_vfr.c:(.text+0x1534): undefined reference to `devlink_unregister'
bnxt_vfr.c:(.text+0x153c): undefined reference to `devlink_free'

Fix this by adding MAY_USE_DEVLINK dependency in bnxt_re.

Fixes: 4ab0c6a8ffd7 ("bnxt_en: add support to enable VF-representors")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agobpf: testing: fix devmap tests
John Fastabend [Thu, 27 Jul 2017 00:32:07 +0000 (17:32 -0700)]
bpf: testing: fix devmap tests

Apparently through one of my revisions of the initial patches
series I lost the devmap test. We can add more testing later but
for now lets fix the simple one we have.

Fixes: 546ac1ffb70d "bpf: add devmap, a map for storing net device references"
Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'moxa-Fix-style-issues'
David S. Miller [Sat, 29 Jul 2017 21:02:07 +0000 (14:02 -0700)]
Merge branch 'moxa-Fix-style-issues'

SZ Lin says:

====================
net: moxa: Fix style issues

This patch set fixs the WARNINGs found by the checkpatch.pl tool
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: moxa: Add spaces preferred around that '{+,-}'
SZ Lin [Sat, 29 Jul 2017 10:42:39 +0000 (18:42 +0800)]
net: moxa: Add spaces preferred around that '{+,-}'

This patch fixes all checkpatch occurences of
"CHECK: spaces preferred around that '{+,-}' (ctx:VxV)"
in moxart_ether code.

Signed-off-by: SZ Lin <sz.lin@moxa.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: moxa: Fix for typo in comment to function moxart_mac_setup_desc_ring()
SZ Lin [Sat, 29 Jul 2017 10:42:38 +0000 (18:42 +0800)]
net: moxa: Fix for typo in comment to function moxart_mac_setup_desc_ring()

Signed-off-by: SZ Lin <sz.lin@moxa.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: moxa: Remove extra space after a cast
SZ Lin [Sat, 29 Jul 2017 10:42:37 +0000 (18:42 +0800)]
net: moxa: Remove extra space after a cast

No space is necessary after a cast
This warning is found using checkpatch.pl

Signed-off-by: SZ Lin <sz.lin@moxa.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: moxa: Fix comparison to NULL could be written with !
SZ Lin [Sat, 29 Jul 2017 10:42:36 +0000 (18:42 +0800)]
net: moxa: Fix comparison to NULL could be written with !

Fixed coding style for null comparisons in moxart_ether driver
to be more consistent with the rest of the kernel coding style

Signed-off-by: SZ Lin <sz.lin@moxa.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: moxa: Prefer 'unsigned int' to bare use of 'unsigned'
SZ Lin [Sat, 29 Jul 2017 10:42:35 +0000 (18:42 +0800)]
net: moxa: Prefer 'unsigned int' to bare use of 'unsigned'

Use 'unsigned int' instead of 'unsigned'
This warning is found using checkpatch.pl

Signed-off-by: SZ Lin <sz.lin@moxa.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: moxa: Remove braces from single-line body
SZ Lin [Sat, 29 Jul 2017 10:42:34 +0000 (18:42 +0800)]
net: moxa: Remove braces from single-line body

Remove unnecessary braces from single-line if statement
This warning is found using checkpatch.pl

Signed-off-by: SZ Lin <sz.lin@moxa.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'smc-get-rid-of-unsafe_global_rkey'
David S. Miller [Sat, 29 Jul 2017 18:22:58 +0000 (11:22 -0700)]
Merge branch 'smc-get-rid-of-unsafe_global_rkey'

Ursula Braun says:

====================
net/smc: get rid of unsafe_global_rkey

The smc code uses the unsafe_global_rkey, exposing all memory for
remote reads and writes once a connection is established.
Here is now a patch series to get rid of unsafe_global_rkey usage.
Main idea is to switch to SG-logic and separate memory regions for RMBs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: synchronize buffer usage with device
Ursula Braun [Fri, 28 Jul 2017 11:56:22 +0000 (13:56 +0200)]
net/smc: synchronize buffer usage with device

Usage of send buffer "sndbuf" is synced
(a) before filling sndbuf for cpu access
(b) after filling sndbuf for device access

Usage of receive buffer "RMB" is synced
(a) before reading RMB content for cpu access
(b) after reading RMB content for device access

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: cleanup function __smc_buf_create()
Ursula Braun [Fri, 28 Jul 2017 11:56:21 +0000 (13:56 +0200)]
net/smc: cleanup function __smc_buf_create()

Split function __smc_buf_create() for better readability.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: common functions for RMBs and send buffers
Ursula Braun [Fri, 28 Jul 2017 11:56:20 +0000 (13:56 +0200)]
net/smc: common functions for RMBs and send buffers

Creation and deletion of SMC receive and send buffers shares a high
amount of common code . This patch introduces common functions to get
rid of duplicate code.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: introduce sg-logic for send buffers
Ursula Braun [Fri, 28 Jul 2017 11:56:19 +0000 (13:56 +0200)]
net/smc: introduce sg-logic for send buffers

SMC send buffers are processed the same way as RMBs. Since RMBs have
been converted to sg-logic, do the same for send buffers.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: remove Kconfig warning
Ursula Braun [Fri, 28 Jul 2017 11:56:18 +0000 (13:56 +0200)]
net/smc: remove Kconfig warning

Now separate memory regions are created and registered for separate
RMBs. The unsafe_global_rkey of the protection domain is no longer
used. Thus the exposing memory warning can be removed.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: register RMB-related memory region
Ursula Braun [Fri, 28 Jul 2017 11:56:17 +0000 (13:56 +0200)]
net/smc: register RMB-related memory region

A memory region created for a new RMB must be registered explicitly,
before the peer can make use of it for remote DMA transfer.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: use separate memory regions for RMBs
Ursula Braun [Fri, 28 Jul 2017 11:56:16 +0000 (13:56 +0200)]
net/smc: use separate memory regions for RMBs

SMC currently uses the unsafe_global_rkey of the protection domain,
which exposes all memory for remote reads and writes once a connection
is established. This patch introduces separate memory regions with
separate rkeys for every RMB. Now the unsafe_global_rkey of the
protection domain is no longer needed.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: introduce sg-logic for RMBs
Ursula Braun [Fri, 28 Jul 2017 11:56:15 +0000 (13:56 +0200)]
net/smc: introduce sg-logic for RMBs

The follow-on patch makes use of ib_map_mr_sg() when introducing
separate memory regions for RMBs. This function is based on
scatterlists; thus this patch introduces scatterlists for RMBs.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: shorten local bufsize variables
Ursula Braun [Fri, 28 Jul 2017 11:56:14 +0000 (13:56 +0200)]
net/smc: shorten local bufsize variables

Initiate the coming rework of SMC buffer handling with this
small code cleanup. No functional changes here.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet/smc: serialize connection creation in all cases
Ursula Braun [Fri, 28 Jul 2017 11:56:13 +0000 (13:56 +0200)]
net/smc: serialize connection creation in all cases

If a link group for a new server connection exists already, the mutex
serializing the determination of link groups is given up early.
The coming registration of memory regions benefits from the serialization
as well, if the mutex is held till connection creation is finished.
This patch postpones the unlocking of the link group creation mutex.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'inet6_protocol-const'
David S. Miller [Sat, 29 Jul 2017 01:52:57 +0000 (18:52 -0700)]
Merge branch 'inet6_protocol-const'

Julia Lawall says:

====================
constify inet6_protocol structures

The inet6_protocol structure is only passed as the first argument to
inet6_add_protocol or inet6_del_protocol, both of which are declared as
const.  Thus the inet6_protocol structure itself can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@

static struct inet6_protocol i@p = { ... };

@ok1@
identifier r.i;
expression e1;
position p;
@@

 \(inet6_add_protocol\|inet6_del_protocol\)(&i@p,...)

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct inet6_protocol e;
@@

e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@

static
+const
 struct inet6_protocol i = { ... };
// </smpl>
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agol2tp: constify inet6_protocol structures
Julia Lawall [Fri, 28 Jul 2017 20:18:58 +0000 (22:18 +0200)]
l2tp: constify inet6_protocol structures

The inet6_protocol structure is only passed as the first argument to
inet6_add_protocol or inet6_del_protocol, both of which are declared as
const.  Thus the inet6_protocol structure itself can be const.

Also drop __read_mostly on the newly const structure.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: constify inet6_protocol structures
Julia Lawall [Fri, 28 Jul 2017 20:18:57 +0000 (22:18 +0200)]
ipv6: constify inet6_protocol structures

The inet6_protocol structure is only passed as the first argument to
inet6_add_protocol or inet6_del_protocol, both of which are declared as
const.  Thus the inet6_protocol structure itself can be const.

Also drop __read_mostly where present on the newly const structures.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'liquidio-standardization-and-cleanup'
David S. Miller [Fri, 28 Jul 2017 00:29:35 +0000 (17:29 -0700)]
Merge branch 'liquidio-standardization-and-cleanup'

Rick Farrington says:

====================
liquidio: standardization and cleanup

This patchset corrects some non-standard macro usage.

1. Replaced custom MIN macro with use of standard 'min_t'.
2. Removed cryptic and misleading macro 'CAST_ULL'.

change log:
V1 -> V2:
  1. Add driver cleanup of macro 'CAST_ULL'.
V2 -> V3:
  1. Remove extra parentheses from previous usage of macro 'CAST_ULL'.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: cleanup: removed cryptic and misleading macro
Rick Farrington [Wed, 26 Jul 2017 19:11:09 +0000 (12:11 -0700)]
liquidio: cleanup: removed cryptic and misleading macro

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoliquidio: standardization: use min_t instead of custom macro
Rick Farrington [Wed, 26 Jul 2017 19:10:48 +0000 (12:10 -0700)]
liquidio: standardization: use min_t instead of custom macro

Signed-off-by: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: Remove stale comments referencing timer
Florian Fainelli [Wed, 26 Jul 2017 19:05:38 +0000 (12:05 -0700)]
net: phy: Remove stale comments referencing timer

Since commit a390d1f379cf ("phylib: convert state_queue work to
delayed_work"), the PHYLIB state machine was converted to use delayed
workqueues, yet some functions were still referencing the PHY library
timer in their comments, fix that and remove the now unused
linux/timer.h include.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'nfp-extend-firmware-request-logic'
David S. Miller [Fri, 28 Jul 2017 00:26:26 +0000 (17:26 -0700)]
Merge branch 'nfp-extend-firmware-request-logic'

Jakub Kicinski says:

====================
nfp: extend firmware request logic

We have been pondering for some time how to support loading different
application firmwares onto NFP.  We want to support both users selecting
one of the firmware images provided by Netronome (which are optimized
for different use cases each) as well as firmware images created  by
users themselves or other companies.

In the end we decided to go with the simplest solution - depending on
the right firmware image being placed in /lib/firmware.  This vastly
simplifies driver logic and also doesn't require any new API.

Different NICs on one system may want to run different applications
therefore we first try to load firmware specific to the device (by
serial number of PCI slot) and if not present try the device model
based name we have been using so far.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: only use direct firmware requests
Jakub Kicinski [Wed, 26 Jul 2017 18:09:48 +0000 (11:09 -0700)]
nfp: only use direct firmware requests

request_firmware() will fallback to user space helper and may cause
long delays when driver is loaded if udev doesn't correctly handle
FW requests.  Since we never really made use of the user space
helper functionality switch to the simpler request_firmware_direct()
call.  The side effect of this change is that no warning will be
printed when the FW image does not exists.  To help users figure
out which FW file is missing print a info message when we request
each file.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: look for firmware image by device serial number and PCI name
Jakub Kicinski [Wed, 26 Jul 2017 18:09:47 +0000 (11:09 -0700)]
nfp: look for firmware image by device serial number and PCI name

We generally look up firmware by card type, but that doesn't allow
users who have more than one card of the same type in their system
to select firmware per adapter.

Unfortunately user space firmware helper seems fraught with
difficulties and to be on its way out.  In particular support for
handling firmware uevents have been dropped from systemd and most
distributions don't enable the FW fallback by default any more.

To allow users selecting firmware for a particular device look up
firmware names by serial and pci_name().  Use the direct lookup to
disable generating uevents when enabled in Kconfig and not print
any warnings to logs if adapter-specific files are missing.  Users
can place in /lib/firmware/netronome files named:

pci-${pci_name}.nffw
serial-${serial}.nffw

to target a specific card.  E.g.:

pci-0000:04:00.0.nffw
pci-0000:82:00.0.nffw
serial-00-aa-bb-11-22-33-10-ff.nffw

We use the full serial number including the interface id, as it
appears in lspci output (bytes separated by '-').

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonfp: remove the probe deferral when FW not present
Jakub Kicinski [Wed, 26 Jul 2017 18:09:46 +0000 (11:09 -0700)]
nfp: remove the probe deferral when FW not present

We use a hack to defer probe when firmware was not pre-loaded
or found on disk.  This helps in case users forgot to include
firmware in initramfs, the driver will most likely get another
shot at probing after real root is mounted.

This is not for what EPROBE_DEFER is supposed to be used, and
when FW is completely missing every time new device is probed
NFP will reprobe spamming kernel logs.

Remove this hack, users will now have to make sure the right
firmware image is present in initramfs if nfp.ko is placed
there or built in.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>