platform/kernel/linux-rpi.git
4 years agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Thu, 2 Jul 2020 00:41:56 +0000 (17:41 -0700)]
Merge branch '40GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2020-07-01

This series contains updates to all Intel drivers, but a majority of the
changes are to the i40e driver.

Jeff converts 'fall through' comments to the 'fallthrough;' keyword for
all Intel drivers. Removed unnecessary delay in the ixgbe ethtool
diagnostics test.

Arkadiusz implements Total Port Shutdown for i40e. This is the revised
patch based on Jakub's feedback from an earlier submission of this
patch, where additional code comments and description was needed to
describe the functionality.

Wei Yongjun fixes return error code for iavf_init_get_resources().

Magnus optimizes XDP code in i40e; starting with AF_XDP zero-copy
transmit completion path. Then by only executing a division when
necessary in the napi_poll data path. Move the check for transmit ring
full outside the send loop to increase performance.

Ciara add XDP ring statistics to i40e and the ability to dump these
statistics and descriptors.

Tony fixes reporting iavf statistics.

Radoslaw adds support for 2.5 and 5 Gbps by implementing the newer ethtool
ksettings API in ixgbe.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Thu, 2 Jul 2020 00:25:00 +0000 (17:25 -0700)]
Merge branch '100GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Tony Nguyen says:

====================
100GbE Intel Wired LAN Driver Updates 2020-07-01

This series contains updates to the ice driver only.

Jacob implements a devlink region for device capabilities.

Bruce removes structs containing only one-element arrays that are either
unused or only used for indexing. Instead, use pointer arithmetic or
other indexing to access the elements. Converts "C struct hack"
variable-length types to the preferred C99 flexible array member.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: replace single-element array used for C struct hack
Bruce Allan [Tue, 30 Jun 2020 00:27:46 +0000 (17:27 -0700)]
ice: replace single-element array used for C struct hack

Convert the pre-C90-extension "C struct hack" method (using a single-
element array at the end of a structure for implementing variable-length
types) to the preferred use of C99 flexible array member.

Additional code cleanups were done near areas affected by this change.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoice: avoid unnecessary single-member variable-length structs
Bruce Allan [Tue, 30 Jun 2020 00:27:45 +0000 (17:27 -0700)]
ice: avoid unnecessary single-member variable-length structs

There are a number of structures that consist of a one-element array as the
only struct member.  Some of those are unused so remove them. Others are
used to index into a buffer/array consisting of a variable number of a
different data or structure type.  Those are unnecessary since we can use
simple pointer arithmetic or index directly into the buffer to access
individual elements of the buffer/array.

Additional code cleanups were done near areas affected by this change.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agobonding: allow xfrm offload setup post-module-load
Jarod Wilson [Tue, 30 Jun 2020 18:49:41 +0000 (14:49 -0400)]
bonding: allow xfrm offload setup post-module-load

At the moment, bonding xfrm crypto offload can only be set up if the bonding
module is loaded with active-backup mode already set. We need to be able to
make this work with bonds set to AB after the bonding driver has already
been loaded.

So what's done here is:

1) move #define BOND_XFRM_FEATURES to net/bonding.h so it can be used
by both bond_main.c and bond_options.c
2) set BOND_XFRM_FEATURES in bond_dev->hw_features universally, rather than
only when loading in AB mode
3) wire up xfrmdev_ops universally too
4) disable BOND_XFRM_FEATURES in bond_dev->features if not AB
5) exit early (non-AB case) from bond_ipsec_offload_ok, to prevent a
performance hit from traversing into the underlying drivers
5) toggle BOND_XFRM_FEATURES in bond_dev->wanted_features and call
netdev_change_features() from bond_option_mode_set()

In my local testing, I can change bonding modes back and forth on the fly,
have hardware offload work when I'm in AB, and see no performance penalty
to non-AB software encryption, despite having xfrm bits all wired up for
all modes now.

Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves")
Reported-by: Huy Nguyen <huyn@mellanox.com>
CC: Saeed Mahameed <saeedm@mellanox.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Steffen Klassert <steffen.klassert@secunet.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: netdev@vger.kernel.org
CC: intel-wired-lan@lists.osuosl.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: implement snapshot for device capabilities
Jacob Keller [Thu, 18 Jun 2020 18:46:11 +0000 (11:46 -0700)]
ice: implement snapshot for device capabilities

Add a new devlink region used for capturing a snapshot of the device
capabilities buffer which is reported by the firmware over the AdminQ.
This information can useful in debugging driver and firmware
interactions.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoMerge branch 'net-ipa-endpoint-configuration-updates'
David S. Miller [Wed, 1 Jul 2020 22:30:34 +0000 (15:30 -0700)]
Merge branch 'net-ipa-endpoint-configuration-updates'

Alex Elder says:

====================
net: ipa: endpoint configuration updates

This series updates code that configures IPA endpoints.  The changes
made mainly affect access to registers that are valid only for RX, or
only for TX endpoints.

The first three patches avoid writing endpoint registers if they are
not defined to be valid.  The fourth patch slightly modifies the
parameters for the offset macros used for these endpoint registers,
to make it explicit when only some endpoints are valid.

The last patch just tweaks one line of code so it uses a convention
used everywhere else in the driver.

Version 2 of this series eliminates some of the "assert()" comments
that Jakub inquired about.  The ones removed will actually go away
in an upcoming (not-yet-posted) patch series anyway.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: HOL_BLOCK_EN_FMASK is a 1-bit mask
Alex Elder [Tue, 30 Jun 2020 13:33:04 +0000 (08:33 -0500)]
net: ipa: HOL_BLOCK_EN_FMASK is a 1-bit mask

The convention throughout the IPA driver is to directly use
single-bit field mask values, rather than using (for example)
u32_encode_bits() to set or clear them.

Fix the one place that doesn't follow that convention, which sets
HOL_BLOCK_EN_FMASK in ipa_endpoint_init_hol_block_enable().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: clarify endpoint register macro constraints
Alex Elder [Tue, 30 Jun 2020 13:33:03 +0000 (08:33 -0500)]
net: ipa: clarify endpoint register macro constraints

A handful of registers are valid only for RX endpoints, and some
others are valid only for TX endpoints.  For these endpoints, add
a comment above their defined offset macro that indicates the
endpoints to which they apply.

Extend the endpoint parameter naming convention as well, to make
these constraints more explicit.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: mode register is TX only
Alex Elder [Tue, 30 Jun 2020 13:33:02 +0000 (08:33 -0500)]
net: ipa: mode register is TX only

The INIT_MODE endpoint configuration register is only valid for TX
endpoints.  Rather than writing a zero to that register for RX
endpoints, avoid writing the register at all.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: metadata_mask register is RX only
Alex Elder [Tue, 30 Jun 2020 13:33:01 +0000 (08:33 -0500)]
net: ipa: metadata_mask register is RX only

The INIT_HDR_METADATA_MASK endpoint configuration register is only
valid for RX endpoints.  Rather than writing a zero to that register
for TX endpoints, avoid writing the register at all.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: head-of-line block registers are RX only
Alex Elder [Tue, 30 Jun 2020 13:33:00 +0000 (08:33 -0500)]
net: ipa: head-of-line block registers are RX only

The INIT_HOL_BLOCK_EN and INIT_HOL_BLOCK_TIMER endpoint registers
are only valid for RX endpoints.

Have ipa_endpoint_modem_hol_block_clear_all() skip writing these
registers for TX endpoints.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-small-improvements'
David S. Miller [Wed, 1 Jul 2020 22:29:07 +0000 (15:29 -0700)]
Merge branch 'net-ipa-small-improvements'

Alex Elder says:

====================
net: ipa: small improvements

This series contains two patches that improve the error output
that's reported when an error occurs while changing the state of a
GSI channel or event ring.  The first ensures all such error
conditions report an error, and the second simplifies the messages a
little and ensures they are all consistent.

A third (independent) patch gets rid of an unused symbol in the
microcontroller code.

Version 2 fixes two alignment problems pointed out by checkpatch.pl,
as requested by Jakub Kicinski.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: kill IPA_MEM_UC_OFFSET
Alex Elder [Tue, 30 Jun 2020 12:58:46 +0000 (07:58 -0500)]
net: ipa: kill IPA_MEM_UC_OFFSET

The microcontroller shared memory area is at the beginning of the
IPA resident memory.  IPA_MEM_UC_OFFSET was defined as the offset
within that region where it's found, but it's 0, and it's never
actually used.  Just get rid of the definition, and move some of the
description it had to be above the definition of the ipa_uc_mem_area
structure.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: standarize more GSI error messages
Alex Elder [Tue, 30 Jun 2020 12:58:45 +0000 (07:58 -0500)]
net: ipa: standarize more GSI error messages

Make minor updates to error messages reported in "gsi.c":
  - Use local variables to reduce multi-line function calls
  - Don't use parentheses in messages
  - Do some slight rewording in a few cases

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: always report GSI state errors
Alex Elder [Tue, 30 Jun 2020 12:58:44 +0000 (07:58 -0500)]
net: ipa: always report GSI state errors

We check the state of an event ring or channel both before and after
any GSI command issued that will change that state.  In most--but
not all--cases, if the state is something different than expected we
report an error message.

Add error messages where missing, so that all unexpected states
provide information about what went wrong.  Drop the parentheses
around the state value shown in all cases.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-simple-refactorizations'
David S. Miller [Wed, 1 Jul 2020 22:27:09 +0000 (15:27 -0700)]
Merge branch 'net-ipa-simple-refactorizations'

Alex Elder says:

====================
net: ipa: simple refactorizations

This series makes three small changes to some endpoint configuration
code.  The first uses a constant to represent the frequency of an
internal clock used for timers in the IPA.  The second modifies a
limit used so it matches Qualcomm's internal code.  And the third
reworks a few lines of code, eliminating a multi-line function call.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: reuse a local variable in ipa_endpoint_init_aggr()
Alex Elder [Mon, 29 Jun 2020 21:55:23 +0000 (16:55 -0500)]
net: ipa: reuse a local variable in ipa_endpoint_init_aggr()

Reuse the "limit" local variable in ipa_endpoint_init_aggr() when
setting the aggregation size limit.  Simple cleanup.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: reduce aggregation time limit
Alex Elder [Mon, 29 Jun 2020 21:55:22 +0000 (16:55 -0500)]
net: ipa: reduce aggregation time limit

Halve the time limit used when aggregation is enabled on an RX
endpoint, to half a millisecond.

Use DIV_ROUND_CLOSEST() to compute the value that represents the
time period, to get better accuracy in the event the time limit is
not an even multiple of the granularity.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: rework ipa_aggr_granularity_val()
Alex Elder [Mon, 29 Jun 2020 21:55:21 +0000 (16:55 -0500)]
net: ipa: rework ipa_aggr_granularity_val()

The timer used for aggregation makes use of an internal 32 KHz clock.
The granularity of the timer is programmed by a field whose value is
computed by ipa_aggr_granularity_val().  Redefine the way that value
is computed by using a new TIMER_FREQUENCY constant representing the
underlying clock frequency.

Add two BUILD_BUG_ON() calls to ensure the value used is valid.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'add-XDP-support-to-xen-netfront'
David S. Miller [Wed, 1 Jul 2020 22:25:14 +0000 (15:25 -0700)]
Merge branch 'add-XDP-support-to-xen-netfront'

Denis Kirjanov says:

====================
xen networking: add XDP support to xen-netfront

The first patch adds a new extra type to enable proper synchronization
between an RX request/response pair.
The second patch implements BFP interface for xen-netfront.
The third patch enables extra space for XDP processing.

v14:
- fixed compilation warnings

v13:
- fixed compilation due to previous rename

v12:
- xen-netback: rename netfront_xdp_headroom to xdp_headroom

v11:
- add the new headroom constant to netif.h
- xenbus_scanf check
- lock a bulk of puckets in xennet_xdp_xmit()

v10:
- add a new xen_netif_extra_info type to enable proper synchronization
 between an RX request/response pair.
- order local variable declarations

v9:
- assign an xdp program before switching to Reconfiguring
- minor cleanups
- address checkpatch issues

v8:
- add PAGE_POOL config dependency
- keep the state of XDP processing in netfront_xdp_enabled
- fixed allocator type in xdp_rxq_info_reg_mem_model()
- minor cleanups in xen-netback

v7:
- use page_pool_dev_alloc_pages() on page allocation
- remove the leftover break statement from netback_changed

v6:
- added the missing SOB line
- fixed subject

v5:
- split netfront/netback changes
- added a sync point between backend/frontend on switching to XDP
- added pagepool API

v4:
- added verbose patch descriprion
- don't expose the XDP headroom offset to the domU guest
- add a modparam to netback to toggle XDP offset
- don't process jumbo frames for now

v3:
- added XDP_TX support (tested with xdping echoserver)
- added XDP_REDIRECT support (tested with modified xdp_redirect_kern)
- moved xdp negotiation to xen-netback

v2:
- avoid data copying while passing to XDP
- tell xen-netback that we need the headroom space
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoxen networking: add XDP offset adjustment to xen-netback
Denis Kirjanov [Mon, 29 Jun 2020 13:13:29 +0000 (16:13 +0300)]
xen networking: add XDP offset adjustment to xen-netback

the patch basically adds the offset adjustment and netfront
state reading to make XDP work on netfront side.

Reviewed-by: Paul Durrant <paul@xen.org>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoxen networking: add basic XDP support for xen-netfront
Denis Kirjanov [Mon, 29 Jun 2020 13:13:28 +0000 (16:13 +0300)]
xen networking: add basic XDP support for xen-netfront

The patch adds a basic XDP processing to xen-netfront driver.

We ran an XDP program for an RX response received from netback
driver. Also we request xen-netback to adjust data offset for
bpf_xdp_adjust_head() header space for custom headers.

synchronization between frontend and backend parts is done
by using xenbus state switching:
Reconfiguring -> Reconfigured- > Connected

UDP packets drop rate using xdp program is around 310 kpps
using ./pktgen_sample04_many_flows.sh and 160 kpps without the patch.

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoxen: netif.h: add a new extra type for XDP
Denis Kirjanov [Mon, 29 Jun 2020 13:13:27 +0000 (16:13 +0300)]
xen: netif.h: add a new extra type for XDP

The patch adds a new extra type to be able to diffirentiate
between RX responses on xen-netfront side with the adjusted offset
required for XDP processing.

The offset value from a guest is passed via xenstore.

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoixgbe: Add ethtool support to enable 2.5 and 5.0 Gbps support
Radoslaw Tyl [Fri, 26 Jun 2020 13:28:14 +0000 (15:28 +0200)]
ixgbe: Add ethtool support to enable 2.5 and 5.0 Gbps support

Added full support for new version Ethtool API. New API allow use
2500Gbase-T and 5000base-T supported and advertised link speed modes.

Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoixgbe: Cleanup unneeded delay in ethtool test
Jeff Kirsher [Fri, 26 Jun 2020 05:21:41 +0000 (22:21 -0700)]
ixgbe: Cleanup unneeded delay in ethtool test

There is a 4 seconds delay in ixgbe_diag_test() that is holding up other
ioctls such as SIOCGIFCONF that Oracle database applications use.
One of Oracle's product runs "ethtool -t ethX online" periodically for
system monitoring and that is impacting database applications that use
SIOCGIFCONF at that same time.

This 4 second delay was needed in out early 1GbE parts to give the PHY
time to recover from a reset.  This code was carried forward to the 10 GbE
driver even it was not needed for the supported PHYs in the ixgbe driver.

CC: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
CC: Jack Vogel <jack.vogel@oracle.com>
Reported-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoiavf: Fix updating statistics
Tony Nguyen [Wed, 24 Jun 2020 16:04:22 +0000 (09:04 -0700)]
iavf: Fix updating statistics

Commit bac8486116b0 ("iavf: Refactor the watchdog state machine") inverted
the logic for when to update statistics. Statistics should be updated when
no other commands are pending, instead they were only requested when a
command was processed. iavf_request_stats() would see a pending request
and not request statistics to be updated. This caused statistics to never
be updated; fix the logic.

Fixes: bac8486116b0 ("iavf: Refactor the watchdog state machine")
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
4 years agoi40e: introduce new dump desc XDP command
Ciara Loftus [Tue, 23 Jun 2020 13:06:57 +0000 (13:06 +0000)]
i40e: introduce new dump desc XDP command

Interfaces already exist for dumping Rx and Tx descriptor information.
Introduce another for doing the same for XDP descriptors.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoi40e: add XDP ring statistics to dump VSI debug output
Ciara Loftus [Tue, 23 Jun 2020 13:06:56 +0000 (13:06 +0000)]
i40e: add XDP ring statistics to dump VSI debug output

Prior to this, only the Rx and Tx ring statistics were dumped. The XDP
ring statistics are now dumped as well.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoi40e: add XDP ring statistics to VSI stats
Ciara Loftus [Tue, 23 Jun 2020 13:06:55 +0000 (13:06 +0000)]
i40e: add XDP ring statistics to VSI stats

Prior to this, only Rx and Tx ring statistics were accounted for.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoi40e: move check of full Tx ring to outside of send loop
Magnus Karlsson [Tue, 23 Jun 2020 09:44:18 +0000 (11:44 +0200)]
i40e: move check of full Tx ring to outside of send loop

Move the check if the HW Tx ring is full to outside the send
loop. Currently it is checked for every single descriptor that we
send. Instead, tell the send loop to only process a maximum number of
packets equal to the number of available slots in the Tx ring. This
way, we can remove the check inside the send loop to and gain some
performance.

Suggested-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoi40e: eliminate division in napi_poll data path
Magnus Karlsson [Tue, 23 Jun 2020 09:44:17 +0000 (11:44 +0200)]
i40e: eliminate division in napi_poll data path

Eliminate a division in the napi_poll data path. This division is
executed even though it is only needed in the rare case when there are
not enough interrupt lines so they have to be shared between queue
pairs. Instead, just test for this case and only execute the division
if needed. The code has been lifted from the ice driver.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoi40e: optimize AF_XDP Tx completion path
Magnus Karlsson [Tue, 23 Jun 2020 09:44:16 +0000 (11:44 +0200)]
i40e: optimize AF_XDP Tx completion path

Improve the performance of the AF_XDP zero-copy Tx completion
path. When there are no XDP buffers being sent using XDP_TX or
XDP_REDIRECT, we do not have go through the SW ring to clean up any
entries since the AF_XDP path does not use these. In these cases, just
fast forward the next-to-use counter and skip going through the SW
ring. The limit on the maximum number of entries to complete is also
removed since the algorithm is now O(1). To simplify the code path, the
maximum number of entries to complete for the XDP path is therefore
also increased from 256 to 512 (the default number of Tx HW
descriptors). This should be fine since the completion in the XDP path
is faster than in the SKB path that has 256 as the maximum number.

This patch provides around 4% throughput improvement for the l2fwd
application in xdpsock on my machine.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoiavf: fix error return code in iavf_init_get_resources()
Wei Yongjun [Thu, 18 Jun 2020 14:19:53 +0000 (14:19 +0000)]
iavf: fix error return code in iavf_init_get_resources()

Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: b66c7bc1cd4d ("iavf: Refactor init state machine")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoi40e: Add support for a new feature Total Port Shutdown
Arkadiusz Kubalewski [Wed, 17 Jun 2020 00:05:55 +0000 (00:05 +0000)]
i40e: Add support for a new feature Total Port Shutdown

After OS requests to down a link on a physical network port, the
traffic is no longer being processed but the physical link with
a link partner is still established.

Currently there is a feature (Link down on close) which allows
to physically bring the link down (after OS request).

With this patch new feature with similar capability is introduced:
TOTAL_PORT_SHUTDOWN
Allows to physically disable the link on the NIC's port.
If enabled, (after link down request from the OS)
no link, traffic or led activity is possible on that port.

If I40E_FLAG_TOTAL_PORT_SHUTDOWN is enabled, the
I40E_FLAG_LINK_DOWN_ON_CLOSE_ENABLED must be explicitly forced to
true and cannot be disabled at that time.
The functionalities are exclusive in terms of configuration, but
they also have similar behavior (allowing to disable physical link
of the port), with following differences:
- LINK_DOWN_ON_CLOSE_ENABLED is configurable at host OS run-time
  and is supported by whole family of 7xx Intel Ethernet Controllers
- TOTAL_PORT_SHUTDOWN may be enabled only before OS loads (in BIOS)
  only if motherboard's BIOS and NIC's FW has support of it
- when LINK_DOWN_ON_CLOSE_ENABLED is used, the link is being brought
  down by sending phy_type=0 to NIC's FW
- when TOTAL_PORT_SHUTDOWN is used, phy_type is not altered, instead
  the link is being brought down by clearing bit
  (I40E_AQ_PHY_ENABLE_LINK) in abilities field of
  i40e_aq_set_phy_config structure

Introduced changes:
- new private flag I40E_FLAG_TOTAL_PORT_SHUTDOWN for handling the
  feature
- probe of NVM if the feature was enabled at driver's port
  initialization
- special handling on link-down procedure to let FW physically
  shutdown the port if the feature was enabled

Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoethernet/intel: Convert fallthrough code comments
Jeff Kirsher [Thu, 4 Jun 2020 03:07:26 +0000 (20:07 -0700)]
ethernet/intel: Convert fallthrough code comments

Convert all the remaining 'fall through" code comments to the newer
'fallthrough;' keyword.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoMerge branch 'net-ethernet-use-generic-power-management'
David S. Miller [Wed, 1 Jul 2020 19:58:34 +0000 (12:58 -0700)]
Merge branch 'net-ethernet-use-generic-power-management'

Vaibhav Gupta says:

====================
net: ethernet: use generic power management

Linux Kernel Mentee: Remove Legacy Power Management.

The purpose of this patch series is to remove legacy power management callbacks
from net ethernet drivers.

The callbacks performing suspend() and resume() operations are still calling
pci_save_state(), pci_set_power_state(), etc. and handling the power management
themselves, which is not recommended.

The conversion requires the removal of the those function calls and change the
callback definition accordingly and make use of dev_pm_ops structure.

All patches are compile-tested only.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonatsemi: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:57 +0000 (22:20 +0530)]
natsemi: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Thus, there is no need to call the PCI helper functions like
pci_enable_device, which is not recommended. Hence, removed.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovxge: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:56 +0000 (22:20 +0530)]
vxge: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Use "struct dev_pm_ops" variable to bind the callbacks.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoksz884x: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:55 +0000 (22:20 +0530)]
ksz884x: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Thus, there is no need to call the PCI helper functions like
pci_enable_wake(), pci_save/restore_sate() and
pci_set_power_state().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlx4: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:54 +0000 (22:20 +0530)]
mlx4: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Use "struct dev_pm_ops" variable to bind the callbacks.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobenet: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:53 +0000 (22:20 +0530)]
benet: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Thus, there is no need to call the PCI helper functions like
pci_enable/disable_device(), pci_save/restore_sate() and
pci_set_power_state().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosundance: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:52 +0000 (22:20 +0530)]
sundance: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Thus, there is no need to call the PCI helper functions like
pci_enable/disable_device(), pci_save/restore_sate() and
pci_set_power_state().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoliquidio: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:51 +0000 (22:20 +0530)]
liquidio: use generic power management

Drivers should not use legacy power management as they have to manage power
states and related operations, for the device, themselves. This driver was
handling them with the help of PCI helper functions.

With generic PM, all essentials will be handled by the PCI core. Driver
needs to do only device-specific operations.

The driver defined empty-body .suspend() and .resume() callbacks earlier.
They can now be define NULL and bind with "struct dev_pm_ops" variable.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoena_netdev: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:50 +0000 (22:20 +0530)]
ena_netdev: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agostarfire: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:49 +0000 (22:20 +0530)]
starfire: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Thus, there is no need to call the PCI helper functions like
pci_save/restore_sate() and pci_set_power_state().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agone2k-pci: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:48 +0000 (22:20 +0530)]
ne2k-pci: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

Thus, there is no need to call the PCI helper functions like
pci_enable/disable_device(), pci_save/restore_sate() and
pci_set_power_state().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotyphoon: use generic power management
Vaibhav Gupta [Wed, 1 Jul 2020 16:50:47 +0000 (22:20 +0530)]
typhoon: use generic power management

With legacy PM, drivers themselves were responsible for managing the
device's power states and takes care of register states. And they use PCI
helper functions to do it.

After upgrading to the generic structure, PCI core will take care of
required tasks and drivers should do only device-specific operations.

In this driver:
typhoon_resume() calls typhoon_wakeup() which then calls PCI helper
functions pci_set_power_state() and pci_restore_state(). The only other
function, using typhoon_wakeup() is typhoon_open().

Thus remove the pci_*() calls from tyhpoon_wakeup() and place them in
typhoon_open(), maintaining the order, to retain the normal behavior of
the function

Now, typhoon_suspend() calls typhoon_sleep() which then calls PCI helper
functions pci_enable_wake(), pci_disable_device() and
pci_set_power_state(). Other functions:
 - typhoon_open()
 - typhoon_close()
 - typhoon_init_one()
are also invoking typhoon_sleep(). Thus, in this case, cannot simply
move PCI helper functions call.

Hence, define a new function typhoon_sleep_early() which will do all the
operations, which typhoon_sleep() was doing before calling PCI helper
functions. Now typhoon_sleep() will call typhoon_sleep_early() to do
those tasks, hence, the behavior for _open(), _close and _init_one() remain
unchanged. And typhon_suspend() only requires typhoon_sleep_early().

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqed: Make symbol 'qed_hw_err_type_descr' static
Hulk Robot [Wed, 1 Jul 2020 15:38:03 +0000 (23:38 +0800)]
qed: Make symbol 'qed_hw_err_type_descr' static

Fix sparse build warning:

drivers/net/ethernet/qlogic/qed/qed_main.c:2480:6: warning:
 symbol 'qed_hw_err_type_descr' was not declared. Should it be static?

Signed-off-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/packet: remove redundant initialization of variable err
Colin Ian King [Wed, 1 Jul 2020 15:04:33 +0000 (16:04 +0100)]
net/packet: remove redundant initialization of variable err

The variable err is being initialized with a value that is never read
and it is being updated later with a new value.  The initialization is
redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'cxgb4-add-mirror-action-support-for-TC-MATCHALL'
David S. Miller [Wed, 1 Jul 2020 01:34:34 +0000 (18:34 -0700)]
Merge branch 'cxgb4-add-mirror-action-support-for-TC-MATCHALL'

Rahul Lakkireddy says:

====================
cxgb4: add mirror action support for TC-MATCHALL

This series of patches add support to mirror all ingress traffic
for TC-MATCHALL ingress offload.

Patch 1 adds support to dynamically create a mirror Virtual Interface
(VI) that accepts all mirror ingress traffic when mirror action is
set in TC-MATCHALL offload.

Patch 2 adds support to allocate mirror Rxqs and setup RSS for the
mirror VI.

Patch 3 adds support to replicate all the main VI configuration to
mirror VI. This includes replicating MTU, promiscuous mode,
all-multicast mode, and enabled netdev Rx feature offloads.

v3:
- Replace mirror VI refcount_t with normal u32 variable in all patches.
- Add back calling cxgb4_port_mirror_start() in cxgb_open(), which
  was there in v1, but got missed in v2 during refactoring, in patch
  3.

v2:
- Add mutex to protect all mirror VI data, instead of just
  mirror Rxqs, in patch 1 and 2.
- Remove the un-needed mirror Rxq mutex in patch 2.
- Simplify the replication code by refactoring t4_set_rxmode()
  to handle mirror VI, instead of duplicating the t4_set_rxmode()
  calls in multiple places in patch 3.
====================

Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4: add main VI to mirror VI config replication
Rahul Lakkireddy [Tue, 30 Jun 2020 13:11:30 +0000 (18:41 +0530)]
cxgb4: add main VI to mirror VI config replication

When mirror VI is enabled, replicate various VI config params
enabled on main VI to mirror VI. These include replicating MTU,
promiscuous mode, all-multicast mode, and enabled netdev Rx
feature offloads.

v3:
- Replace mirror VI refcount_t with normal u32 variable.
- Add back calling cxgb4_port_mirror_start() in cxgb_open(), which
  was there in v1, but got missed in v2 during refactoring.

v2:
- Simplify the replication code by refactoring t4_set_rxmode()
  to handle mirror VI, instead of duplicating the t4_set_rxmode()
  calls in multiple places.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4: add support for mirror Rxqs
Rahul Lakkireddy [Tue, 30 Jun 2020 13:11:29 +0000 (18:41 +0530)]
cxgb4: add support for mirror Rxqs

When mirror VI is enabled, allocate the mirror Rxqs and setup the
mirror VI RSS table. The mirror Rxqs are allocated/freed when
the mirror VI is created/destroyed or when underlying port is
brought up/down, respectively.

v3:
- Replace mirror VI refcount_t with normal u32 variable.

v2:
- Use mutex to protect all mirror VI data, instead of just
  mirror Rxqs.
- Remove the un-needed mirror Rxq mutex.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4: add mirror action to TC-MATCHALL offload
Rahul Lakkireddy [Tue, 30 Jun 2020 13:11:28 +0000 (18:41 +0530)]
cxgb4: add mirror action to TC-MATCHALL offload

Add mirror Virtual Interface (VI) support to receive all ingress
mirror traffic from the underlying device. The mirror VI is
created dynamically, if the TC-MATCHALL rule has a corresponding
mirror action. Also request MSI-X vectors needed for the mirror VI
Rxqs. If no vectors are available, then disable mirror VI support.

v3:
- Replace mirror VI refcount_t with normal u32 variable.

v2:
- Add mutex to protect all mirror VI data, instead of just
  mirror Rxqs.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agopcnet32: Mark PM functions as __maybe_unused
Nathan Chancellor [Tue, 30 Jun 2020 21:00:34 +0000 (14:00 -0700)]
pcnet32: Mark PM functions as __maybe_unused

In certain configurations without power management support, the
following warnings happen:

../drivers/net/ethernet/amd/pcnet32.c:2928:12: warning:
'pcnet32_pm_resume' defined but not used [-Wunused-function]
 2928 | static int pcnet32_pm_resume(struct device *device_d)
      |            ^~~~~~~~~~~~~~~~~
../drivers/net/ethernet/amd/pcnet32.c:2916:12: warning:
'pcnet32_pm_suspend' defined but not used [-Wunused-function]
 2916 | static int pcnet32_pm_suspend(struct device *device_d)
      |            ^~~~~~~~~~~~~~~~~~

Mark these functions as __maybe_unused to make it clear to the compiler
that this is going to happen based on the configuration, which is the
standard for these types of functions.

Fixes: a86688fbef1b ("pcnet32: Convert to generic power management")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoamd8111e: Mark PM functions as __maybe_unused
Nathan Chancellor [Tue, 30 Jun 2020 21:00:33 +0000 (14:00 -0700)]
amd8111e: Mark PM functions as __maybe_unused

In certain configurations without power management support, the
following warnings happen:

../drivers/net/ethernet/amd/amd8111e.c:1623:12: warning:
'amd8111e_resume' defined but not used [-Wunused-function]
 1623 | static int amd8111e_resume(struct device *dev_d)
      |            ^~~~~~~~~~~~~~~
../drivers/net/ethernet/amd/amd8111e.c:1584:12: warning:
'amd8111e_suspend' defined but not used [-Wunused-function]
 1584 | static int amd8111e_suspend(struct device *dev_d)
      |            ^~~~~~~~~~~~~~~~

Mark these functions as __maybe_unused to make it clear to the compiler
that this is going to happen based on the configuration, which is the
standard for these types of functions.

Fixes: 2caf751fe080 ("amd8111e: Convert to generic power management")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-improve-devres-helpers'
David S. Miller [Tue, 30 Jun 2020 22:57:34 +0000 (15:57 -0700)]
Merge branch 'net-improve-devres-helpers'

Bartosz Golaszewski says:

====================
net: improve devres helpers

So it seems like there's no support for relaxing certain networking devres
helpers to not require previously allocated structures to also be managed.
However the way mdio devres variants are implemented is still wrong and I
modified my series to address it while keeping the functions strict.

First two patches modify the ixgbe driver to get rid of the last user of
devm_mdiobus_free().

Patches 3, 4, 5 and 6 are mostly cosmetic.

Patch 7 fixes the way devm_mdiobus_register() is implemented.

Patches 8 & 9 provide a managed variant of of_mdiobus_register() and
last patch uses it in mtk-star-emac driver.

v1 -> v2:
- drop the patch relaxing devm_register_netdev()
- require struct mii_bus to be managed in devm_mdiobus_register() and
  devm_of_mdiobus_register() but don't store that information in the
  structure itself: use devres_find() instead
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: mtk-star-emac: use devm_of_mdiobus_register()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:46 +0000 (14:03 +0200)]
net: ethernet: mtk-star-emac: use devm_of_mdiobus_register()

Shrink the code by using the managed variant of of_mdiobus_register().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoof: mdio: provide devm_of_mdiobus_register()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:45 +0000 (14:03 +0200)]
of: mdio: provide devm_of_mdiobus_register()

Implement a managed variant of of_mdiobus_register(). We need to make
mdio_devres into its own module because otherwise we'd hit circular
sumbol dependencies between phylib and of_mdio.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoof: mdio: remove the 'extern' keyword from function declarations
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:44 +0000 (14:03 +0200)]
of: mdio: remove the 'extern' keyword from function declarations

The 'extern' keyword in headers doesn't have any benefit. Remove them
all from the of_mdio.h header.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: don't abuse devres in devm_mdiobus_register()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:43 +0000 (14:03 +0200)]
net: phy: don't abuse devres in devm_mdiobus_register()

We currently have two managed helpers for mdiobus - devm_mdiobus_alloc()
and devm_mdiobus_register(). The idea behind devres is that the release
callback releases whatever resource the devm function allocates. In the
mdiobus case however there's no devres associated with the device by
devm_mdiobus_register(). Instead the release callback for
devm_mdiobus_alloc(): _devm_mdiobus_free() unregisters the device if
it is marked as managed.

This all seems wrong. The managed structure shouldn't need to know or
care about whether it's managed or not - and this is the case now for
struct mii_bus. The devres wrapper should be opaque to the managed
resource.

This changeset makes devm_mdiobus_alloc() and devm_mdiobus_register()
conform to common devres standards: devm_mdiobus_alloc() allocates a
devres structure and registers a callback that will call mdiobus_free().
__devm_mdiobus_register() allocated another devres and registers a
callback that will unregister the bus.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agophy: mdio: add kerneldoc for __devm_mdiobus_register()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:42 +0000 (14:03 +0200)]
phy: mdio: add kerneldoc for __devm_mdiobus_register()

This function is not documented. Add a short kerneldoc description.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agophy: un-inline devm_mdiobus_register()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:41 +0000 (14:03 +0200)]
phy: un-inline devm_mdiobus_register()

Functions should only be static inline if they're very short. This
devres helper is already over 10 lines and it will grow soon as we'll
be improving upon its approach. Pull it into mdio_devres.c.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoDocumentation: devres: add missing mdio helper
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:40 +0000 (14:03 +0200)]
Documentation: devres: add missing mdio helper

We have a devres variant of mdiobus_register() but it's not listed in
devres.rst. Add it under other mdio devm functions.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: devres: rename the release callback of devm_register_netdev()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:39 +0000 (14:03 +0200)]
net: devres: rename the release callback of devm_register_netdev()

Make it an explicit counterpart to devm_register_netdev() just like we
do with devm_free_netdev() for better clarity.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ixgbe: don't call devm_mdiobus_free()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:38 +0000 (14:03 +0200)]
net: ethernet: ixgbe: don't call devm_mdiobus_free()

The idea behind devres is that the release callbacks are called if
probe fails. As we now check the return value of ixgbe_mii_bus_init(),
we can drop the call devm_mdiobus_free() in error path as the release
callback will be called automatically.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()
Bartosz Golaszewski [Mon, 29 Jun 2020 12:03:37 +0000 (14:03 +0200)]
net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init()

This function may fail. Check its return value and propagate the error
code.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocxgb4vf: configure ports accessible by the VF
Nirranjan Kirubaharan [Mon, 29 Jun 2020 11:55:13 +0000 (17:25 +0530)]
cxgb4vf: configure ports accessible by the VF

Find ports accessible by the VF, based on the index of the
mac address stored for the VF in the adapter. If no mac address
is stored for the VF, use the port mask provided by firmware.

Signed-off-by: Nirranjan Kirubaharan <nirranjan@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-qed-qede-license-cleanup'
David S. Miller [Tue, 30 Jun 2020 22:51:40 +0000 (15:51 -0700)]
Merge branch 'net-qed-qede-license-cleanup'

Alexander Lobakin says:

====================
net: qed/qede: license cleanup

QLogic QED drivers source code is dual licensed under
GPL-2.0/BSD-3-Clause.

Correct already existing but wrong SPDX tags to match the actual
license.
Remove the license boilerplates and replace them with the correct
SPDX tag.
Update copyright years in all source files.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qede: update copyright years
Alexander Lobakin [Mon, 29 Jun 2020 11:05:12 +0000 (14:05 +0300)]
net: qede: update copyright years

Set the actual copyright holder and years in all qede source files.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qede: convert to SPDX License Identifiers
Alexander Lobakin [Mon, 29 Jun 2020 11:05:11 +0000 (14:05 +0300)]
net: qede: convert to SPDX License Identifiers

QLogic QED drivers source code is dual licensed under
GPL-2.0/BSD-3-Clause.
Remove all the boilerplates in the existing code and replace it with the
correct SPDX tag.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qede: correct existing SPDX tags
Alexander Lobakin [Mon, 29 Jun 2020 11:05:10 +0000 (14:05 +0300)]
net: qede: correct existing SPDX tags

QLogic QED drivers source code is dual licensed under
GPL-2.0/BSD-3-Clause.
Correct already existing but wrong SPDX tags to match the actual
license.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qed: update copyright years
Alexander Lobakin [Mon, 29 Jun 2020 11:05:09 +0000 (14:05 +0300)]
net: qed: update copyright years

Set the actual copyright holder and years in all qed source files.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qed: convert to SPDX License Identifiers
Alexander Lobakin [Mon, 29 Jun 2020 11:05:08 +0000 (14:05 +0300)]
net: qed: convert to SPDX License Identifiers

QLogic QED drivers source code is dual licensed under
GPL-2.0/BSD-3-Clause.
Remove all the boilerplates in the existing code and replace it with the
correct SPDX tag.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: qed: correct existing SPDX tags
Alexander Lobakin [Mon, 29 Jun 2020 11:05:07 +0000 (14:05 +0300)]
net: qed: correct existing SPDX tags

QLogic QED drivers source code is dual licensed under
GPL-2.0/BSD-3-Clause.
Correct already existing but wrong SPDX tags to match the actual
license.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: call tcp_ack_tstamp() when not fully acked
Yousuk Seung [Tue, 30 Jun 2020 16:49:33 +0000 (09:49 -0700)]
tcp: call tcp_ack_tstamp() when not fully acked

When skb is coalesced tcp_ack_tstamp() still needs to be called when not
fully acked in tcp_clean_rtx_queue(), otherwise SCM_TSTAMP_ACK
timestamps may never be fired. Since the original patch series had
dependent commits, this patch fixes the issue instead of reverting by
restoring calls to tcp_ack_tstamp() when skb is not fully acked.

Fixes: fdb7eb21ddd3 ("tcp: stamp SCM_TSTAMP_ACK later in tcp_clean_rtx_queue()")
Signed-off-by: Yousuk Seung <ysseung@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/mlx5e: fix memory leak of tls
Colin Ian King [Tue, 30 Jun 2020 15:16:46 +0000 (16:16 +0100)]
net/mlx5e: fix memory leak of tls

The error return path when create_singlethread_workqueue fails currently
does not kfree tls and leads to a memory leak. Fix this by kfree'ing
tls before returning -ENOMEM.

Addresses-Coverity: ("Resource leak")
Fixes: 1182f3659357 ("net/mlx5e: kTLS, Add kTLS RX HW offload support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomptcp: do nonce initialization at subflow creation time
Paolo Abeni [Tue, 30 Jun 2020 14:38:26 +0000 (16:38 +0200)]
mptcp: do nonce initialization at subflow creation time

This clean-up the code a bit, reduces the number of
used hooks and indirect call requested, and allow
better error reporting from __mptcp_subflow_connect()

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/tls: fix sign extension issue when left shifting u16 value
Colin Ian King [Tue, 30 Jun 2020 14:27:46 +0000 (15:27 +0100)]
net/tls: fix sign extension issue when left shifting u16 value

Left shifting the u16 value promotes it to a int and then it
gets sign extended to a u64.  If len << 16 is greater than 0x7fffffff
then the upper bits get set to 1 because of the implicit sign extension.
Fix this by casting len to u64 before shifting it.

Addresses-Coverity: ("integer handling issues")
Fixes: ed9b7646b06a ("net/tls: Add asynchronous resync")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'sfc-prerequisites-for-EF100-driver-part-2'
David S. Miller [Tue, 30 Jun 2020 20:09:10 +0000 (13:09 -0700)]
Merge branch 'sfc-prerequisites-for-EF100-driver-part-2'

Edward Cree says:

====================
sfc: prerequisites for EF100 driver, part 2

Continuing on from [1], this series further prepares the sfc codebase
 for the introduction of the EF100 driver.

[1]: https://lore.kernel.org/netdev/20200629.173812.1532344417590172093.davem@davemloft.net/T/
====================

Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: don't call tx_remove if there isn't one
Edward Cree [Tue, 30 Jun 2020 12:15:34 +0000 (13:15 +0100)]
sfc: don't call tx_remove if there isn't one

EF100 won't have an efx->type->tx_remove method, because there's
 nothing for it to do.  So make the call conditional.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise initialisation of efx->vport_id
Edward Cree [Tue, 30 Jun 2020 12:15:10 +0000 (13:15 +0100)]
sfc: commonise initialisation of efx->vport_id

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise efx->[rt]xq_entries initialisation
Edward Cree [Tue, 30 Jun 2020 12:14:45 +0000 (13:14 +0100)]
sfc: commonise efx->[rt]xq_entries initialisation

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: initialise max_[tx_]channels in efx_init_channels()
Edward Cree [Tue, 30 Jun 2020 12:14:13 +0000 (13:14 +0100)]
sfc: initialise max_[tx_]channels in efx_init_channels()

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move definition of EFX_MC_STATS_GENERATION_INVALID
Edward Cree [Tue, 30 Jun 2020 12:13:47 +0000 (13:13 +0100)]
sfc: move definition of EFX_MC_STATS_GENERATION_INVALID

Saves a whole #include from nic.c.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: factor out efx_tx_tso_header_length() and understand encapsulation
Edward Cree [Tue, 30 Jun 2020 12:13:15 +0000 (13:13 +0100)]
sfc: factor out efx_tx_tso_header_length() and understand encapsulation

ef100 will need to check this against NIC limits.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: remove duplicate declaration of efx_enqueue_skb_tso()
Edward Cree [Tue, 30 Jun 2020 12:12:49 +0000 (13:12 +0100)]
sfc: remove duplicate declaration of efx_enqueue_skb_tso()

Define it in nic_common.h, even though the ef100 driver will have a
 different implementation backing it (actually a WARN_ON_ONCE as it
 should never get called by ef100.  But it needs to still exist because
 common TX path code references it).

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise TSO fallback code
Edward Cree [Tue, 30 Jun 2020 12:12:17 +0000 (13:12 +0100)]
sfc: commonise TSO fallback code

ef100 will need this if it gets GSO skbs it can't handle (e.g. too long
 header length).

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise efx_sync_rx_buffer()
Edward Cree [Tue, 30 Jun 2020 12:11:52 +0000 (13:11 +0100)]
sfc: commonise efx_sync_rx_buffer()

The ef100 RX path will also need to DMA-sync RX buffers.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise some MAC configuration code
Edward Cree [Tue, 30 Jun 2020 12:11:35 +0000 (13:11 +0100)]
sfc: commonise some MAC configuration code

Refactor it a little as we go, and introduce efx_mcdi_set_mtu() which we
 will later use for ef100 to change MTU without touching other MAC settings.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise miscellaneous efx functions
Edward Cree [Tue, 30 Jun 2020 12:03:47 +0000 (13:03 +0100)]
sfc: commonise miscellaneous efx functions

Various left-over bits and pieces from efx.c that are needed by ef100.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: add missing licence info to mcdi_filters.c
Edward Cree [Tue, 30 Jun 2020 12:03:21 +0000 (13:03 +0100)]
sfc: add missing licence info to mcdi_filters.c

Both the licence notice and the SPDX tag were missing from this file.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: commonise MCDI MAC stats handling
Edward Cree [Tue, 30 Jun 2020 12:02:56 +0000 (13:02 +0100)]
sfc: commonise MCDI MAC stats handling

Most of it was already declared in mcdi_port_common.h, so just move the
 implementations to mcdi_port_common.c.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move NIC-specific mcdi_port declarations out of common header
Edward Cree [Tue, 30 Jun 2020 12:02:24 +0000 (13:02 +0100)]
sfc: move NIC-specific mcdi_port declarations out of common header

These functions are implemented in mcdi_port.c, which will not be linked
 into the EF100 driver; thus their prototypes should not be visible in
 common header files.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Convert-Broadcom-SF2-to-mac_link_up-resolved-state'
David S. Miller [Tue, 30 Jun 2020 20:05:10 +0000 (13:05 -0700)]
Merge branch 'Convert-Broadcom-SF2-to-mac_link_up-resolved-state'

Russell King says:

====================
Convert Broadcom SF2 to mac_link_up() resolved state

Convert Broadcom SF2 DSA support to use the newly provided resolved
link state via mac_link_up() rather than using the state in
mac_config().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa/bcm_sf2: move pause mode setting into mac_link_up()
Russell King [Tue, 30 Jun 2020 10:28:18 +0000 (11:28 +0100)]
net: dsa/bcm_sf2: move pause mode setting into mac_link_up()

bcm_sf2 only appears to support pause modes on RGMII interfaces (the
enable bits are in the RGMII control register.)  Setup the pause modes
for RGMII connections.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa/bcm_sf2: move speed/duplex forcing to mac_link_up()
Russell King [Tue, 30 Jun 2020 10:28:13 +0000 (11:28 +0100)]
net: dsa/bcm_sf2: move speed/duplex forcing to mac_link_up()

Convert the bcm_sf2 to use the finalised speed and duplex in its
mac_link_up() call rather than the parameters in mac_config().

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa/bcm_sf2: fix incorrect usage of state->link
Russell King [Tue, 30 Jun 2020 10:28:08 +0000 (11:28 +0100)]
net: dsa/bcm_sf2: fix incorrect usage of state->link

state->link has never been valid in mac_config() implementations -
while it may be correct in some calls, it is not true that it can be
relied upon.

Fix bcm_sf2 to use the correct method of handling forced link status.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Convert-Broadcom-B53-to-mac_link_up-resolved-state'
David S. Miller [Tue, 30 Jun 2020 20:03:27 +0000 (13:03 -0700)]
Merge branch 'Convert-Broadcom-B53-to-mac_link_up-resolved-state'

Russell King says:

====================
Convert Broadcom B53 to mac_link_up() resolved state

These two patches update the Broadcom B53 DSA support to use the newly
provided resolved link state via mac_link_up() rather than using the
state in mac_config().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa/b53: use resolved link config in mac_link_up()
Russell King [Tue, 30 Jun 2020 10:25:06 +0000 (11:25 +0100)]
net: dsa/b53: use resolved link config in mac_link_up()

Convert the B53 driver to use the finalised link parameters in
mac_link_up() rather than the parameters in mac_config(). This is
just a matter of moving the call to b53_force_port_config().

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>