OSDN Git Service

uclinux-h8/linux.git
4 years agonet: hns3: remove two unused macros in hclgevf_cmd.c
Huazhong Tan [Sat, 30 May 2020 01:08:29 +0000 (09:08 +0800)]
net: hns3: remove two unused macros in hclgevf_cmd.c

Macro hclgevf_ring_to_dma_dir and hclgevf_is_csq defined in
hclgevf_cmd.c, but not used, so remove them.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove an unused macro hclge_is_csq
Huazhong Tan [Sat, 30 May 2020 01:08:28 +0000 (09:08 +0800)]
net: hns3: remove an unused macro hclge_is_csq

Macro hclge_is_csq defined in hcgle_cmd.c has not been used,
so remove it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: fix a print format issue in hclge_mac_mdio_config()
Huazhong Tan [Sat, 30 May 2020 01:08:27 +0000 (09:08 +0800)]
net: hns3: fix a print format issue in hclge_mac_mdio_config()

Use %d to print int variable 'ret' in hclge_mac_mdio_config().

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: tcp_init_buffer_space can be static
Florian Westphal [Thu, 28 May 2020 22:01:52 +0000 (00:01 +0200)]
tcp: tcp_init_buffer_space can be static

As of commit 98fa6271cfcb
("tcp: refactor setting the initial congestion window") this is called
only from tcp_input.c, so it can be static.

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethtool: cabletest: Make ethnl_act_cable_test_tdr_cfg static
Andrew Lunn [Thu, 28 May 2020 21:43:24 +0000 (23:43 +0200)]
net: ethtool: cabletest: Make ethnl_act_cable_test_tdr_cfg static

kbuild test robot is reporting:
net/ethtool/cabletest.c:230:5: warning: no previous prototype for

Mark the function as static.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: flower: fix incorrect flag assignment
Louis Peens [Thu, 28 May 2020 14:18:46 +0000 (16:18 +0200)]
nfp: flower: fix incorrect flag assignment

A previous refactoring missed some locations the flags were renamed
but not moved from the previous flower_ext_feats to the new flower_en_feats
variable. This lead to the FLOW_MERGE and LAG features not being enabled.

Fixes: e09303d3c4d9 ("nfp: flower: renaming of feature bits")
Signed-off-by: Louis Peens <louis.peens@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-bindings: net: rename the bindings document for MediaTek STAR EMAC
Bartosz Golaszewski [Thu, 28 May 2020 13:59:02 +0000 (15:59 +0200)]
dt-bindings: net: rename the bindings document for MediaTek STAR EMAC

The driver itself was renamed before getting merged into mainline, but
the binding document kept the old name. This makes both names consistent.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ethernet-dwmac-add-ethernet-glue-logic-for-NXP-imx8-chip'
David S. Miller [Sat, 30 May 2020 00:01:26 +0000 (17:01 -0700)]
Merge branch 'net-ethernet-dwmac-add-ethernet-glue-logic-for-NXP-imx8-chip'

Fugang Duan says:

====================
net: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip

NXP imx8 family like imx8mp/imx8dxl chips support Synopsys
MAC 5.10a IP, the patch set is to add ethernet DWMAC glue
layer including clocks, dwmac address width, phy interface
mode selection and rgmii txclk rate adjustment in runtime.

v1 -> v2:
- suggested by Andrew: add the "snps,dwmac-5.10a" compatible
  string into NXP binding documentation.
- suggested by David: adjust code sequences in order to have
  reverse christmas tree local variable ordering.

Thanks Andrew and David for the review.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodt-bindings: net: imx-dwmac: Add NXP imx8 DWMAC glue layer
Fugang Duan [Thu, 28 May 2020 08:26:25 +0000 (16:26 +0800)]
dt-bindings: net: imx-dwmac: Add NXP imx8 DWMAC glue layer

Add description for NXP imx8 families like imx8mp/imx8dxl
that integrate the Synopsys gmac IP version 5.10a.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip
Fugang Duan [Thu, 28 May 2020 08:26:24 +0000 (16:26 +0800)]
net: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip

NXP imx8 family like imx8mp/imx8dxl chips support Synopsys MAC 5.10a IP.
This patch adds settings for NXP imx8 glue layer:
- clocks
- dwmac address width
- phy interface mode selection
- adjust rgmii txclk rate

v2:
- adjust code sequences in order to have reverse christmas
  tree local variable ordering.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agostmmac: platform: add "snps, dwmac-5.10a" IP compatible string
Fugang Duan [Thu, 28 May 2020 08:26:23 +0000 (16:26 +0800)]
stmmac: platform: add "snps, dwmac-5.10a" IP compatible string

Add "snps,dwmac-5.10a" compatible string for 5.10a version that can
avoid to define some plat data in glue layer.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotipc: remove set but not used variable 'prev'
YueHaibing [Thu, 28 May 2020 07:43:59 +0000 (07:43 +0000)]
tipc: remove set but not used variable 'prev'

Fixes gcc '-Wunused-but-set-variable' warning:

net/tipc/msg.c: In function 'tipc_msg_append':
net/tipc/msg.c:215:24: warning:
 variable 'prev' set but not used [-Wunused-but-set-variable]

commit 0a3e060f340d ("tipc: add test for Nagle algorithm effectiveness")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: sja1105: avoid invalid state in sja1105_vlan_filtering
Vladimir Oltean [Wed, 27 May 2020 17:20:38 +0000 (20:20 +0300)]
net: dsa: sja1105: avoid invalid state in sja1105_vlan_filtering

Be there 2 switches spi/spi2.0 and spi/spi2.1 in a cross-chip setup,
both under the same VLAN-filtering bridge, both in the
SJA1105_VLAN_BEST_EFFORT state.

If we try to change the VLAN state of one of the switches (to
SJA1105_VLAN_FILTERING_FULL) we get the following error:

devlink dev param set spi/spi2.1 name best_effort_vlan_filtering value
false cmode runtime
[   38.325683] sja1105 spi2.1: Not allowed to overcommit frame memory.
               L2 memory partitions and VL memory partitions share the
               same space. The sum of all 16 memory partitions is not
               allowed to be larger than 929 128-byte blocks (or 910
               with retagging). Please adjust
               l2-forwarding-parameters-table.part_spc and/or
               vl-forwarding-parameters-table.partspc.
[   38.356803] sja1105 spi2.1: Invalid config, cannot upload

This is because the spi/spi2.1 switch doesn't support tagging anymore in
the SJA1105_VLAN_FILTERING_FULL state, so it doesn't need to have any
retagging rules defined. Great, so it can use more frame memory
(retagging consumes extra memory).

But the built-in low-level static config checker from the sja1105 driver
says "not so fast, you've increased the frame memory to non-retagging
values, but you still kept the retagging rules in the static config".

So we need to rebuild the VLAN table immediately before re-uploading the
static config, operation which will take care, based on the new VLAN
state, of removing the retagging rules.

Fixes: 3f01c91aab92 ("net: dsa: sja1105: implement VLAN retagging for dsa_8021q sub-VLANs")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: tag_8021q: stop restoring VLANs from bridge
Vladimir Oltean [Wed, 27 May 2020 16:41:34 +0000 (19:41 +0300)]
net: dsa: tag_8021q: stop restoring VLANs from bridge

Right now, our only tag_8021q user, sja1105, has the ability to restore
bridge VLANs on its own, so this logic is unnecessary.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'remove-kernel_setsockopt-v4'
David S. Miller [Fri, 29 May 2020 20:10:39 +0000 (13:10 -0700)]
Merge branch 'remove-kernel_setsockopt-v4'

Christoph Hellwig says:

====================
remove kernel_setsockopt v4

now that only the dlm calls to sctp are left for kernel_setsockopt,
while we haven't really made much progress with the sctp setsockopt
refactoring, how about this small series that splits out a
sctp_setsockopt_bindx_kernel that takes a kernel space address array
to share more code as requested by Marcelo.  This should fit in with
whatever variant of the refator of sctp setsockopt we go with, but
just solved the immediate problem for now.

Changes since v3:
 - dropped all the merged patches, just sctp setsockopt left now
 - factor out a new sctp_setsockopt_bindx_kernel helper instead of
   duplicating a small amount of logic

Changes since v2:
 - drop the separately merged kernel_getopt_removal
 - drop the sctp patches, as there is conflicting cleanup going on
 - add an additional ACK for the rxrpc changes

Changes since v1:
 - use ->getname for sctp sockets in dlm
 - add a new ->bind_add struct proto method for dlm/sctp
 - switch the ipv6 and remaining sctp helpers to inline function so that
   the ipv6 and sctp modules are not pulled in by any module that could
   potentially use ipv6 or sctp connections
 - remove arguments to various sock_* helpers that are always used with
   the same constant arguments
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: remove kernel_setsockopt
Christoph Hellwig [Fri, 29 May 2020 12:09:43 +0000 (14:09 +0200)]
net: remove kernel_setsockopt

No users left.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: add a new bind_add method
Christoph Hellwig [Fri, 29 May 2020 12:09:42 +0000 (14:09 +0200)]
net: add a new bind_add method

The SCTP protocol allows to bind multiple address to a socket.  That
feature is currently only exposed as a socket option.  Add a bind_add
method struct proto that allows to bind additional addresses, and
switch the dlm code to use the method instead of going through the
socket option from kernel space.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosctp: refactor sctp_setsockopt_bindx
Christoph Hellwig [Fri, 29 May 2020 12:09:41 +0000 (14:09 +0200)]
sctp: refactor sctp_setsockopt_bindx

Split out a sctp_setsockopt_bindx_kernel that takes a kernel pointer
to the sockaddr and make sctp_setsockopt_bindx a small wrapper around
it.  This prepares for adding a new bind_add proto op.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosctp: add sctp_sock_set_nodelay
Christoph Hellwig [Fri, 29 May 2020 12:09:40 +0000 (14:09 +0200)]
sctp: add sctp_sock_set_nodelay

Add a helper to directly set the SCTP_NODELAY sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec...
David S. Miller [Fri, 29 May 2020 20:02:33 +0000 (13:02 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
pull request (net-next): ipsec-next 2020-05-29

1) Add IPv6 encapsulation support for ESP over UDP and TCP.
   From Sabrina Dubroca.

2) Remove unneeded reference when initializing xfrm interfaces.
   From Nicolas Dichtel.

3) Remove some indirect calls from the state_afinfo.
   From Florian Westphal.

Please note that this pull request has two merge conflicts

between commit:

  0c922a4850eb ("xfrm: Always set XFRM_TRANSFORMED in xfrm{4,6}_output_finish")

  from Linus' tree and commit:

    2ab6096db2f1 ("xfrm: remove output_finish indirection from xfrm_state_afinfo")

    from the ipsec-next tree.

and between commit:

  3986912f6a9a ("ipv6: move SIOCADDRT and SIOCDELRT handling into ->compat_ioctl")

  from the net-next tree and commit:

    0146dca70b87 ("xfrm: add support for UDPv6 encapsulation of ESP")

    from the ipsec-next tree.

Both conflicts can be resolved as done in linux-next.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: marvell: unlock after phy_select_page() failure
Dan Carpenter [Fri, 29 May 2020 10:02:07 +0000 (13:02 +0300)]
net: phy: marvell: unlock after phy_select_page() failure

We need to call phy_restore_page() even if phy_select_page() fails.
Otherwise we are holding the phy_lock_mdio_bus() lock.  This requirement
is documented at the start of the phy_select_page() function.

Fixes: a618e86da91d ("net : phy: marvell: Speedup TDR data retrieval by only changing page once")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: mscc: fix PHYs using the vsc8574_probe
Antoine Tenart [Fri, 29 May 2020 09:49:09 +0000 (11:49 +0200)]
net: phy: mscc: fix PHYs using the vsc8574_probe

PHYs using the vsc8574_probe fail to be initialized and their
config_init return -EIO leading to errors like:
"could not attach PHY: -5".

This is because when the conversion of the MSCC PHY driver to use the
shared PHY package helpers was done, the base address retrieval and the
base PHY read and write helpers in the driver were modified. In
particular, the base address retrieval logic was moved from the
config_init to the probe. But the vsc8574_probe was forgotten. This
patch fixes it.

Fixes: deb04e9c0ff2 ("net: phy: mscc: use phy_package_shared")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: mtk-star-emac: remove unused variable
Bartosz Golaszewski [Fri, 29 May 2020 08:26:48 +0000 (10:26 +0200)]
net: ethernet: mtk-star-emac: remove unused variable

The desc pointer is set but not used. Remove it.

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Fri, 29 May 2020 19:17:45 +0000 (12:17 -0700)]
Merge branch '10GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2020-05-28

This series contains updates to e1000, e1000e, igc, igb, ixgbe and i40e.

Takashi Iwai, from SUSE, replaces some uses of snprintf() with
scnprintf() since the succeeding calls may go beyond the given buffer
limit in i40e.

Jesper Dangaard Brouer fixes up code comments in i40e_xsk.c

Xie XiuQi, from Huawei, fixes a signed-integer-overflow warning ixgbe
driver.

Jason Yan, from Huawei, converts '==' expression to bool to resolve
warnings, also fixed a warning for assigning 0/1 to a bool variable in
the ixgbe driver.  Converts functions that always return 0 to void in the
igb and i40e drivers.

YueHaibing, from Hauwei, cleans up dead code in ixgbe driver.

Sasha cleans up more dead code which is not used in the igc driver.
Added receive error counter to reflect the total number of non-filtered
packets received with errors.  Fixed a register define name to properly
reflect the register address being used.

Andre updates the igc driver to reject NFC rules that have multiple
matches, which is not supported in i225 devices.  Updates the total
number of NFC rules supported and added a code comment to explain what
is supported.

Punit Agrawal, from Toshiba, relaxes the condition to trigger a reset
for ME, which was leading to inconsistency between the state of the
hardware as expected by the driver in e1000e.

Hari, from the Linux community, cleaned up a code comment in the e1000
driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovmxnet3: use correct hdr reference when packet is encapsulated
Ronak Doshi [Fri, 29 May 2020 02:53:52 +0000 (19:53 -0700)]
vmxnet3: use correct hdr reference when packet is encapsulated

'Commit dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload
support")' added support for encapsulation offload. However, while
preparing inner tso packet, it uses reference to outer ip headers.

This patch fixes this issue by using correct reference for inner
headers.

Fixes: dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload support")
Signed-off-by: Ronak Doshi <doshir@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoe1000: Fix typo in the comment
Hari [Sat, 23 May 2020 13:13:26 +0000 (18:43 +0530)]
e1000: Fix typo in the comment

Continuous Double "the" in a comment. Changed it to single "the"

Signed-off-by: Hari <harichandrakanthan@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Fix wrong register name
Sasha Neftin [Thu, 28 May 2020 07:25:21 +0000 (10:25 +0300)]
igc: Fix wrong register name

Accordance to the i225 datasheet this register address
used by Host Transmit Discarded Packet by MAC counter
and not by not applicable Carrier Extension Error counter.
This patch comes to fix this wrong definition.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Remove Sequence Error Counter
Sasha Neftin [Thu, 28 May 2020 07:11:11 +0000 (10:11 +0300)]
igc: Remove Sequence Error Counter

Accordance to the i225 datasheet sequence error counter does not
applicable to the i225 device.
This patch comes to clean up this counter.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Add Receive Error Counter
Sasha Neftin [Tue, 19 May 2020 14:55:42 +0000 (17:55 +0300)]
igc: Add Receive Error Counter

Receive error counter reflect total number of non-filtered
packets received with errors. This includes: CRC error,
symbol error, Rx data error and carrier extend error.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Remove symbol error counter
Sasha Neftin [Tue, 19 May 2020 14:36:34 +0000 (17:36 +0300)]
igc: Remove symbol error counter

Accordance to the i225 datasheet symbol error counter does not
applicable to the i225 device.
This patch comes to clean up this counter.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoi40e: Make i40e_shutdown_adminq() return void
Jason Yan [Wed, 6 May 2020 06:18:35 +0000 (14:18 +0800)]
i40e: Make i40e_shutdown_adminq() return void

Fix the following coccicheck warning:

drivers/net/ethernet/intel/i40e/i40e_adminq.c:699:13-21: Unneeded
variable: "ret_code". Return "0" on line 710

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoe1000e: Relax condition to trigger reset for ME workaround
Punit Agrawal [Fri, 15 May 2020 04:31:27 +0000 (13:31 +0900)]
e1000e: Relax condition to trigger reset for ME workaround

It's an error if the value of the RX/TX tail descriptor does not match
what was written. The error condition is true regardless the duration
of the interference from ME. But the driver only performs the reset if
E1000_ICH_FWSM_PCIM2PCI_COUNT (2000) iterations of 50us delay have
transpired. The extra condition can lead to inconsistency between the
state of hardware as expected by the driver.

Fix this by dropping the check for number of delay iterations.

While at it, also make __ew32_prepare() static as it's not used
anywhere else.

CC: stable <stable@vger.kernel.org>
Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Fix IGC_MAX_RXNFC_RULES
Andre Guedes [Tue, 12 May 2020 17:35:53 +0000 (10:35 -0700)]
igc: Fix IGC_MAX_RXNFC_RULES

IGC supports a total of 32 rules. 16 MAC address based, 8 VLAN priority
based, and 8 Ethertype based. This patch fixes IGC_MAX_RXNFC_RULES
accordingly.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Acked-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Reject NFC rules with multiple matches
Andre Guedes [Tue, 12 May 2020 17:35:52 +0000 (10:35 -0700)]
igc: Reject NFC rules with multiple matches

The way Rx queue assignment based on mac address, Ethertype and VLAN
priority filtering operates in I225 doesn't allow us to properly support
NFC rules with multiple matches.

Consider the following example which assigns to queue 2 frames matching
the address MACADDR *and* Ethertype ETYPE.

$ ethtool -N eth0 flow-type ether dst <MACADDR> proto <ETYPE> queue 2

When such rule is applied, we have 2 unwanted behaviors:

    1) Any frame matching MACADDR will be assigned to queue 2. It
       doesn't matter the ETYPE value.

    2) Any accepted frame that has Ethertype equals to ETYPE, no matter
       the mac address, will be assigned to queue 2 as well.

In current code, multiple-match filters are accepted by the driver, even
though it doesn't support them properly. This patch adds a check for
multiple-match rules in igc_ethtool_is_nfc_rule_valid() so they are
rejected.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Remove unused flags
Sasha Neftin [Sun, 10 May 2020 15:52:00 +0000 (18:52 +0300)]
igc: Remove unused flags

Transmit underrun, late and excess collision flags not in use.
This patch comes to clean up these flags.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigb: make igb_set_fc_watermarks() return void
Jason Yan [Thu, 7 May 2020 11:09:15 +0000 (19:09 +0800)]
igb: make igb_set_fc_watermarks() return void

This function always return 0 now, we can make it return void to
simplify the code. This fixes the following coccicheck warning:

drivers/net/ethernet/intel/igb/e1000_mac.c:728:5-12: Unneeded variable:
"ret_val". Return "0" on line 751

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoixgbe: Remove unused inline function ixgbe_irq_disable_queues
YueHaibing [Tue, 5 May 2020 08:35:54 +0000 (16:35 +0800)]
ixgbe: Remove unused inline function ixgbe_irq_disable_queues

commit b5f69ccf6765 ("ixgbe: avoid bringing rings up/down as macvlans are added/removed")
left behind this, remove it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoixgbe: Use true, false for bool variable in __ixgbe_enable_sriov()
Jason Yan [Tue, 5 May 2020 07:43:37 +0000 (15:43 +0800)]
ixgbe: Use true, false for bool variable in __ixgbe_enable_sriov()

Fix the following coccicheck warning:

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c:105:2-38: WARNING:
Assignment of 0/1 to bool variable

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoixgbe: Remove conversion to bool in ixgbe_device_supports_autoneg_fc()
Jason Yan [Tue, 5 May 2020 07:41:57 +0000 (15:41 +0800)]
ixgbe: Remove conversion to bool in ixgbe_device_supports_autoneg_fc()

No need to convert '==' expression to bool. This fixes the following
coccicheck warning:

drivers/net/ethernet/intel/ixgbe/ixgbe_common.c:68:11-16: WARNING:
conversion to bool not needed here

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoixgbe: fix signed-integer-overflow warning
Xie XiuQi [Tue, 5 May 2020 02:45:21 +0000 (10:45 +0800)]
ixgbe: fix signed-integer-overflow warning

ubsan report this warning, fix it by adding a unsigned suffix.

UBSAN: signed-integer-overflow in
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c:2246:26
65535 * 65537 cannot be represented in type 'int'
CPU: 21 PID: 7 Comm: kworker/u256:0 Not tainted 5.7.0-rc3-debug+ #39
Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 03/27/2020
Workqueue: ixgbe ixgbe_service_task [ixgbe]
Call trace:
 dump_backtrace+0x0/0x3f0
 show_stack+0x28/0x38
 dump_stack+0x154/0x1e4
 ubsan_epilogue+0x18/0x60
 handle_overflow+0xf8/0x148
 __ubsan_handle_mul_overflow+0x34/0x48
 ixgbe_fc_enable_generic+0x4d0/0x590 [ixgbe]
 ixgbe_service_task+0xc20/0x1f78 [ixgbe]
 process_one_work+0x8f0/0xf18
 worker_thread+0x430/0x6d0
 kthread+0x218/0x238
 ret_from_fork+0x10/0x18

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoi40e: trivial fixup of comments in i40e_xsk.c
Jesper Dangaard Brouer [Mon, 16 Mar 2020 10:16:38 +0000 (11:16 +0100)]
i40e: trivial fixup of comments in i40e_xsk.c

The comment above i40e_run_xdp_zc() was clearly copy-pasted from
function i40e_xsk_umem_setup, which is just above.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoi40e: Use scnprintf() for avoiding potential buffer overflow
Takashi Iwai [Wed, 11 Mar 2020 08:37:40 +0000 (09:37 +0100)]
i40e: Use scnprintf() for avoiding potential buffer overflow

Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit.  Fix it by replacing with scnprintf().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoMerge branch 'hns3-next'
David S. Miller [Thu, 28 May 2020 23:39:04 +0000 (16:39 -0700)]
Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: misc updates for -next

This patchset includes some updates for the HNS3 ethernet driver.

====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: print out speed info when parsing speed fails
Huazhong Tan [Thu, 28 May 2020 13:48:19 +0000 (21:48 +0800)]
net: hns3: print out speed info when parsing speed fails

When calling hclge_parse_speed() fails, printing out the speed is
helpful for debugging.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove some unused fields in struct hclge_dev
Huazhong Tan [Thu, 28 May 2020 13:48:18 +0000 (21:48 +0800)]
net: hns3: remove some unused fields in struct hclge_dev

Remove some fields in struct hclge_dev which have not been used.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove two duplicated register macros in hclgevf_main.h
Huazhong Tan [Thu, 28 May 2020 13:48:17 +0000 (21:48 +0800)]
net: hns3: remove two duplicated register macros in hclgevf_main.h

HCLGEVF_CMDQ_INTR_SRC_REG and HCLGEVF_CMDQ_INTR_STS_REG are same
as HCLGEVF_VECTOR0_CMDQ_SRC_REG and HCLGEVF_VECTOR0_CMDQ_STAT_REG,
replace the former with the latter, and rename macro
HCLGEVF_VECTOR0_CMDQ_STAT_REG since 'stat' is not abbreviation of
'state'.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove unused struct hnae3_unic_private_info
Huazhong Tan [Thu, 28 May 2020 13:48:16 +0000 (21:48 +0800)]
net: hns3: remove unused struct hnae3_unic_private_info

Since field .uinfo in struct hnae3_handle never be used,
so remove it and its structure definition.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3; remove unused HNAE3_RESTORE_CLIENT in enum hnae3_reset_notify_type
Huazhong Tan [Thu, 28 May 2020 13:48:15 +0000 (21:48 +0800)]
net: hns3; remove unused HNAE3_RESTORE_CLIENT in enum hnae3_reset_notify_type

Remove HNAE3_RESTORE_CLIENT which is not needed now.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove some unused fields in struct hns3_nic_priv
Huazhong Tan [Thu, 28 May 2020 13:48:14 +0000 (21:48 +0800)]
net: hns3: remove some unused fields in struct hns3_nic_priv

Remove some fileds which defined in struct hns3_nic_priv,
but not used, and remove the related definition of struct
hns3_udp_tunnel and enum hns3_udp_tnl_type.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: modify an incorrect type in struct hclgevf_cfg_gro_status_cmd
Huazhong Tan [Thu, 28 May 2020 13:48:13 +0000 (21:48 +0800)]
net: hns3: modify an incorrect type in struct hclgevf_cfg_gro_status_cmd

Modify field .gro_en in struct hclgevf_cfg_gro_status_cmd to u8
according to the UM, otherwise, it will overwrite the reserved
byte which may be used for other purpose.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: modify an incorrect type in struct hclge_cfg_gro_status_cmd
Huazhong Tan [Thu, 28 May 2020 13:48:12 +0000 (21:48 +0800)]
net: hns3: modify an incorrect type in struct hclge_cfg_gro_status_cmd

Modify field .gro_en in struct hclge_cfg_gro_status_cmd to u8
according to the UM, otherwise, it will overwrite the reserved
byte which may be used for other purpose.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: refactor hclge_query_bd_num_cmd_send()
Huazhong Tan [Thu, 28 May 2020 13:48:11 +0000 (21:48 +0800)]
net: hns3: refactor hclge_query_bd_num_cmd_send()

In order to improve code maintainability and readability, rewrite
the process of BDs' initialization in hclge_query_bd_num_cmd_send().

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: refactor hclge_config_tso()
Huazhong Tan [Thu, 28 May 2020 13:48:10 +0000 (21:48 +0800)]
net: hns3: refactor hclge_config_tso()

Since parameters 'tso_mss_min' and 'tso_mss_max' only indicate
the minimum and maximum MSS, the hnae3_set_field() calls are
meaningless, remove them and change the type of these two
parameters to u16.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add a missing mutex destroy in hclge_init_ad_dev()
Huazhong Tan [Thu, 28 May 2020 13:48:09 +0000 (21:48 +0800)]
net: hns3: add a missing mutex destroy in hclge_init_ad_dev()

Add a mutex destroy call in hclge_init_ae_dev() when fails.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove an unnecessary 'goto' in hclge_init_ae_dev()
Huazhong Tan [Thu, 28 May 2020 13:48:08 +0000 (21:48 +0800)]
net: hns3: remove an unnecessary 'goto' in hclge_init_ae_dev()

Remove the redundant 'goto' and return -ENOMEM directly, when
allocating memory for 'hdev' fails in hclge_init_ae_dev().

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ks8851-Unify-KS8851-SPI-and-MLL-drivers'
David S. Miller [Thu, 28 May 2020 23:30:04 +0000 (16:30 -0700)]
Merge branch 'net-ks8851-Unify-KS8851-SPI-and-MLL-drivers'

Marek Vasut says:

====================
net: ks8851: Unify KS8851 SPI and MLL drivers

The KS8851SNL/SNLI and KS8851-16MLL/MLLI/MLLU are very much the same pieces
of silicon, except the former has an SPI interface, while the later has a
parallel bus interface. Thus far, Linux has two separate drivers for each
and they are diverging considerably.

This series unifies them into a single driver with small SPI and parallel
bus specific parts. The approach here is to first separate out the SPI
specific parts into a separate file, then add parallel bus accessors in
another separate file and then finally remove the old parallel bus driver.
The reason for replacing the old parallel bus driver is because the SPI
bus driver is much higher quality.

Note that I dropped "net: ks8851: Drop define debug and pr_fmt()" for now,
will send it separatelly later.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Remove ks8851_mll.c
Marek Vasut [Thu, 28 May 2020 22:21:46 +0000 (00:21 +0200)]
net: ks8851: Remove ks8851_mll.c

The ks8851_mll.c is replaced by ks8851_par.c, which is using common code
from ks8851.c, just like ks8851_spi.c . Remove this old ad-hoc driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Implement Parallel bus operations
Marek Vasut [Thu, 28 May 2020 22:21:45 +0000 (00:21 +0200)]
net: ks8851: Implement Parallel bus operations

Implement accessors for KS8851-16MLL/MLLI/MLLU parallel bus variant of
the KS8851. This is based off the ks8851_mll.c , which is a driver for
exactly the same hardware, however the ks8851.c code is much higher
quality. Hence, this patch pulls out the relevant information from the
ks8851_mll.c on how to access the bus, but uses the common ks8851.c
code. To make this patch reviewable, instead of rewriting ks8851_mll.c,
ks8851_mll.c is removed in a separate subsequent patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Separate SPI operations into separate file
Marek Vasut [Thu, 28 May 2020 22:21:44 +0000 (00:21 +0200)]
net: ks8851: Separate SPI operations into separate file

Pull all the SPI bus specific code into a separate file, so that it is
not mixed with the common code. Rename ks8851.c to ks8851_common.c. The
ks8851_common.c is linked with ks8851_spi.c now, so it can call the
accessors in the ks8851_spi.c without any pointer indirection.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Implement register, FIFO, lock accessor callbacks
Marek Vasut [Thu, 28 May 2020 22:21:43 +0000 (00:21 +0200)]
net: ks8851: Implement register, FIFO, lock accessor callbacks

The register and FIFO accessors are bus specific, so is locking.
Implement callbacks so that each variant of the KS8851 can implement
matching accessors and locking, and use the rest of the common code.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Permit overridding interrupt enable register
Marek Vasut [Thu, 28 May 2020 22:21:42 +0000 (00:21 +0200)]
net: ks8851: Permit overridding interrupt enable register

The parallel bus variant does not need to use the TX interrupt at all
as it writes the TX FIFO directly with in .ndo_start_xmit, permit the
drivers to configure the interrupt enable bits.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Factor out TX work flush function
Marek Vasut [Thu, 28 May 2020 22:21:41 +0000 (00:21 +0200)]
net: ks8851: Factor out TX work flush function

While the SPI version of the KS8851 requires a TX worker thread to pump
data via SPI, the parallel bus version can write data into the TX FIFO
directly in .ndo_start_xmit, as the parallel bus access is much faster
and does not sleep. Factor out this TX work flush part, so it can be
overridden by the parallel bus driver.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Split out SPI specific code from probe() and remove()
Marek Vasut [Thu, 28 May 2020 22:21:40 +0000 (00:21 +0200)]
net: ks8851: Split out SPI specific code from probe() and remove()

Factor out common code into ks8851_probe_common() and
ks8851_remove_common() to permit both SPI and parallel
bus driver variants to use the common code path for
both probing and removal.

There should be no functional change.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Split out SPI specific entries in struct ks8851_net
Marek Vasut [Thu, 28 May 2020 22:21:39 +0000 (00:21 +0200)]
net: ks8851: Split out SPI specific entries in struct ks8851_net

Add a new struct ks8851_net_spi, which embeds the original
struct ks8851_net and contains the entries specific only to
the SPI variant of KS8851.

There should be no functional change.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Factor out SKB receive function
Marek Vasut [Thu, 28 May 2020 22:21:38 +0000 (00:21 +0200)]
net: ks8851: Factor out SKB receive function

Factor out this netif_rx_ni(), so it could be overridden by the parallel
bus variant of the KS8851 driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Factor out bus lock handling
Marek Vasut [Thu, 28 May 2020 22:21:37 +0000 (00:21 +0200)]
net: ks8851: Factor out bus lock handling

Pull out bus access locking code into separate functions, this is done
in preparation for unifying the driver with the parallel bus one. The
parallel bus driver does not need heavy mutex locking of the bus and
works better with spinlocks, hence prepare these locking functions to
be overridden then.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Use 16-bit read of RXFC register
Marek Vasut [Thu, 28 May 2020 22:21:36 +0000 (00:21 +0200)]
net: ks8851: Use 16-bit read of RXFC register

The RXFC register is the only one being read using 8-bit accessors.
To make it easier to support the 16-bit accesses used by the parallel
bus variant of KS8851, use 16-bit accessor to read RXFC register as
well as neighboring RXFCTR register.

Remove ks8851_rdreg8() as it is not used anywhere anymore.

There should be no functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Use 16-bit writes to program MAC address
Marek Vasut [Thu, 28 May 2020 22:21:35 +0000 (00:21 +0200)]
net: ks8851: Use 16-bit writes to program MAC address

On the SPI variant of KS8851, the MAC address can be programmed with
either 8/16/32-bit writes. To make it easier to support the 16-bit
parallel option of KS8851 too, switch both the MAC address programming
and readout to 16-bit operations.

Remove ks8851_wrreg8() as it is not used anywhere anymore.

There should be no functional change.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Remove ks8851_rdreg32()
Marek Vasut [Thu, 28 May 2020 22:21:34 +0000 (00:21 +0200)]
net: ks8851: Remove ks8851_rdreg32()

The ks8851_rdreg32() is used only in one place, to read two registers
using a single read. To make it easier to support 16-bit accesses via
parallel bus later on, replace this single read with two 16-bit reads
from each of the registers and drop the ks8851_rdreg32() altogether.

If this has noticeable performance impact on the SPI variant of KS8851,
then we should consider using regmap to abstract the SPI and parallel
bus options and in case of SPI, permit regmap to merge register reads
of neighboring registers into single, longer, read.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Use dev_{get,set}_drvdata()
Marek Vasut [Thu, 28 May 2020 22:21:33 +0000 (00:21 +0200)]
net: ks8851: Use dev_{get,set}_drvdata()

Replace spi_{get,set}_drvdata() with dev_{get,set}_drvdata(), which
works for both SPI and platform drivers. This is done in preparation
for unifying the KS8851 SPI and parallel bus drivers.

There should be no functional change.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Use devm_alloc_etherdev()
Marek Vasut [Thu, 28 May 2020 22:21:32 +0000 (00:21 +0200)]
net: ks8851: Use devm_alloc_etherdev()

Use device managed version of alloc_etherdev() to simplify the code.
No functional change intended.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Pass device node into ks8851_init_mac()
Marek Vasut [Thu, 28 May 2020 22:21:31 +0000 (00:21 +0200)]
net: ks8851: Pass device node into ks8851_init_mac()

Since the driver probe function already has a struct device *dev pointer
and can easily derive of_node pointer from it, pass the of_node pointer as
a parameter to ks8851_init_mac() to avoid fishing it out from ks->spidev.
This is the only reference to spidev in the function, so get rid of it.
This is done in preparation for unifying the KS8851 SPI and parallel bus
drivers.

No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Replace dev_err() with netdev_err() in IRQ handler
Marek Vasut [Thu, 28 May 2020 22:21:30 +0000 (00:21 +0200)]
net: ks8851: Replace dev_err() with netdev_err() in IRQ handler

Use netdev_err() instead of dev_err() to avoid accessing the spidev->dev
in the interrupt handler. This is the only place which uses the spidev
in this function, so replace it with netdev_err() to get rid of it. This
is done in preparation for unifying the KS8851 SPI and parallel drivers.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Rename ndev to netdev in probe
Marek Vasut [Thu, 28 May 2020 22:21:29 +0000 (00:21 +0200)]
net: ks8851: Rename ndev to netdev in probe

Rename ndev variable to netdev for the sake of consistency.

No functional change.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ks8851: Factor out spi->dev in probe()/remove()
Marek Vasut [Thu, 28 May 2020 22:21:28 +0000 (00:21 +0200)]
net: ks8851: Factor out spi->dev in probe()/remove()

Pull out the spi->dev into one common place in the function instead of
having it repeated over and over again. This is done in preparation for
unifying ks8851 and ks8851-mll drivers. No functional change.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'vmxnet3-upgrade-to-version-4'
David S. Miller [Thu, 28 May 2020 23:26:49 +0000 (16:26 -0700)]
Merge branch 'vmxnet3-upgrade-to-version-4'

Ronak Doshi says:

====================
vmxnet3: upgrade to version 4

vmxnet3 emulation has recently added several new features which includes
offload support for tunnel packets, support for new commands the driver
can issue to emulation, change in descriptor fields, etc. This patch
series extends the vmxnet3 driver to leverage these new features.

Compatibility is maintained using existing vmxnet3 versioning mechanism as
follows:
 - new features added to vmxnet3 emulation are associated with new vmxnet3
   version viz. vmxnet3 version 4.
 - emulation advertises all the versions it supports to the driver.
 - during initialization, vmxnet3 driver picks the highest version number
 supported by both the emulation and the driver and configures emulation
 to run at that version.

In particular, following changes are introduced:

Patch 1:
  This patch introduces utility macros for vmxnet3 version 4 comparison
  and updates Copyright information.

Patch 2:
  This patch implements get_rss_hash_opts and set_rss_hash_opts methods
  to allow querying and configuring different Rx flow hash configurations
  which can be used to support UDP/ESP RSS.

Patch 3:
  This patch introduces segmentation and checksum offload support for
  encapsulated packets. This avoids segmenting and calculating checksum
  for each segment and hence gives performance boost.

Patch 4:
  With all vmxnet3 version 4 changes incorporated in the vmxnet3 driver,
  with this patch, the driver can configure emulation to run at vmxnet3
  version 4.

Changes in v3 -> v4:
   - Replaced BUG_ON() with WARN_ON_ONCE()

Changes in v2 -> v3:
   - fixed get_rss_hash_opts to return correct values for udp rss

Changes in v2:
   - Fixed compilation issue due to missing closed brace
   - added fallthrough comment
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovmxnet3: update to version 4
Ronak Doshi [Thu, 28 May 2020 21:53:22 +0000 (14:53 -0700)]
vmxnet3: update to version 4

With all vmxnet3 version 4 changes incorporated in the vmxnet3 driver,
the driver can configure emulation to run at vmxnet3 version 4, provided
the emulation advertises support for version 4.

Signed-off-by: Ronak Doshi <doshir@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovmxnet3: add geneve and vxlan tunnel offload support
Ronak Doshi [Thu, 28 May 2020 21:53:21 +0000 (14:53 -0700)]
vmxnet3: add geneve and vxlan tunnel offload support

Vmxnet3 version 3 device supports checksum/TSO offload. Thus, vNIC to
pNIC traffic can leverage hardware checksum/TSO offloads. However,
vmxnet3 does not support checksum/TSO offload for Geneve/VXLAN
encapsulated packets. Thus, for a vNIC configured with an overlay, the
guest stack must first segment the inner packet, compute the inner
checksum for each segment and encapsulate each segment before
transmitting the packet via the vNIC. This results in significant
performance penalty.

This patch will enhance vmxnet3 to support Geneve/VXLAN TSO as well as
checksum offload.

Signed-off-by: Ronak Doshi <doshir@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovmxnet3: add support to get/set rx flow hash
Ronak Doshi [Thu, 28 May 2020 21:53:20 +0000 (14:53 -0700)]
vmxnet3: add support to get/set rx flow hash

With vmxnet3 version 4, the emulation supports multiqueue(RSS) for
UDP and ESP traffic. A guest can enable/disable RSS for UDP/ESP over
IPv4/IPv6 by issuing commands introduced in this patch. ESP ipv6 is
not yet supported in this patch.

This patch implements get_rss_hash_opts and set_rss_hash_opts
methods to allow querying and configuring different Rx flow hash
configurations.

Signed-off-by: Ronak Doshi <doshir@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovmxnet3: prepare for version 4 changes
Ronak Doshi [Thu, 28 May 2020 21:53:19 +0000 (14:53 -0700)]
vmxnet3: prepare for version 4 changes

vmxnet3 is currently at version 3 and this patch initiates the
preparation to accommodate changes for version 4. Introduced utility
macros for vmxnet3 version 4 comparison and update Copyright
information.

Signed-off-by: Ronak Doshi <doshir@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: avoid an unused-variable warning
Arnd Bergmann [Wed, 27 May 2020 13:41:06 +0000 (15:41 +0200)]
sfc: avoid an unused-variable warning

'nic_data' is no longer used outside of the #ifdef block
in efx_ef10_set_mac_address:

drivers/net/ethernet/sfc/ef10.c:3231:28: error: unused variable 'nic_data' [-Werror,-Wunused-variable]
        struct efx_ef10_nic_data *nic_data = efx->nic_data;

Move the variable into a local scope.

Fixes: dfcabb078847 ("sfc: move vport_id to struct efx_nic")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
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, 28 May 2020 18:17:20 +0000 (11:17 -0700)]
Merge branch '100GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
100GbE Intel Wired LAN Driver Updates 2020-05-27

This series contains updates to the ice driver only.

Jesse fixes a number of issues, starting with fixing the remaining
signed versus unsigned comparison issues.  Cleaned up an unused code
define.  Fixed the implementation of the manage MAC write command, to
simplify it by using a simple array to represent the MAC address when
writing it.

Paul fixes the setting of the VF default LAN address, by removing a
check that assumed that the address had been deleted and zeroed.

Surabhi prevents a memory leak on filter management initialization
failures and during queue initialization and buffer allocation failures.

Brett adds additional receive error counters that are reported by
ethtool.  Fixed the enabling and disabling of VLAN stripping when the
PVID has been set.

Evan fixes a race condition between the firmware and software, which can
occur between the admin queue setup and the first command sent.

Marta fixes the driver when XDP transmit rings are destroyed, also make
sure the XDP transmit queues are also destroyed.  Update the statistics
when XDP transmit programs are loaded and packets are sent.  Changed the
number of XDP transmit queues to match the number of receive queues,
instead of matching the number of transmit queues.

Bruce avoids undefined behavior by not writing the 8-bit element
init_q_state with the associated internal-to-hardware field which is
122-bits.

Anirudh (Ani) refactors the receive checksum checks.

Krzysztof notifies the user if the fill queue is not long enough to
prepare all buffers before packet processing starts and allocates the
buffers during the NAPI poll.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'remove-most-callers-of-kernel_setsockopt-v3'
David S. Miller [Thu, 28 May 2020 18:11:46 +0000 (11:11 -0700)]
Merge branch 'remove-most-callers-of-kernel_setsockopt-v3'

Christoph Hellwig says:

====================
remove most callers of kernel_setsockopt v3

this series removes most callers of the kernel_setsockopt functions, and
instead switches their users to small functions that implement setting a
sockopt directly using a normal kernel function call with type safety and
all the other benefits of not having a function call.

In some cases these functions seem pretty heavy handed as they do
a lock_sock even for just setting a single variable, but this mirrors
the real setsockopt implementation unlike a few drivers that just set
set the fields directly.

Changes since v2:
 - drop the separately merged kernel_getopt_removal
 - drop the sctp patches, as there is conflicting cleanup going on
 - add an additional ACK for the rxrpc changes

Changes since v1:
 - use ->getname for sctp sockets in dlm
 - add a new ->bind_add struct proto method for dlm/sctp
 - switch the ipv6 and remaining sctp helpers to inline function so that
   the ipv6 and sctp modules are not pulled in by any module that could
   potentially use ipv6 or sctp connections
 - remove arguments to various sock_* helpers that are always used with
   the same constant arguments
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotipc: call tsk_set_importance from tipc_topsrv_create_listener
Christoph Hellwig [Thu, 28 May 2020 05:12:36 +0000 (07:12 +0200)]
tipc: call tsk_set_importance from tipc_topsrv_create_listener

Avoid using kernel_setsockopt for the TIPC_IMPORTANCE option when we can
just use the internal helper.  The only change needed is to pass a struct
sock instead of tipc_sock, which is private to socket.c

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agorxrpc: add rxrpc_sock_set_min_security_level
Christoph Hellwig [Thu, 28 May 2020 05:12:35 +0000 (07:12 +0200)]
rxrpc: add rxrpc_sock_set_min_security_level

Add a helper to directly set the RXRPC_MIN_SECURITY_LEVEL sockopt from
kernel space without going through a fake uaccess.

Thanks to David Howells for the documentation updates.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: add ip6_sock_set_recvpktinfo
Christoph Hellwig [Thu, 28 May 2020 05:12:34 +0000 (07:12 +0200)]
ipv6: add ip6_sock_set_recvpktinfo

Add a helper to directly set the IPV6_RECVPKTINFO sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: add ip6_sock_set_addr_preferences
Christoph Hellwig [Thu, 28 May 2020 05:12:33 +0000 (07:12 +0200)]
ipv6: add ip6_sock_set_addr_preferences

Add a helper to directly set the IPV6_ADD_PREFERENCES sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: add ip6_sock_set_recverr
Christoph Hellwig [Thu, 28 May 2020 05:12:32 +0000 (07:12 +0200)]
ipv6: add ip6_sock_set_recverr

Add a helper to directly set the IPV6_RECVERR sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: add ip6_sock_set_v6only
Christoph Hellwig [Thu, 28 May 2020 05:12:31 +0000 (07:12 +0200)]
ipv6: add ip6_sock_set_v6only

Add a helper to directly set the IPV6_V6ONLY sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: add ip_sock_set_pktinfo
Christoph Hellwig [Thu, 28 May 2020 05:12:30 +0000 (07:12 +0200)]
ipv4: add ip_sock_set_pktinfo

Add a helper to directly set the IP_PKTINFO sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: add ip_sock_set_mtu_discover
Christoph Hellwig [Thu, 28 May 2020 05:12:29 +0000 (07:12 +0200)]
ipv4: add ip_sock_set_mtu_discover

Add a helper to directly set the IP_MTU_DISCOVER sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com> [rxrpc bits]
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: add ip_sock_set_recverr
Christoph Hellwig [Thu, 28 May 2020 05:12:28 +0000 (07:12 +0200)]
ipv4: add ip_sock_set_recverr

Add a helper to directly set the IP_RECVERR sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: add ip_sock_set_freebind
Christoph Hellwig [Thu, 28 May 2020 05:12:27 +0000 (07:12 +0200)]
ipv4: add ip_sock_set_freebind

Add a helper to directly set the IP_FREEBIND sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv4: add ip_sock_set_tos
Christoph Hellwig [Thu, 28 May 2020 05:12:26 +0000 (07:12 +0200)]
ipv4: add ip_sock_set_tos

Add a helper to directly set the IP_TOS sockopt from kernel space without
going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tcp_sock_set_keepcnt
Christoph Hellwig [Thu, 28 May 2020 05:12:25 +0000 (07:12 +0200)]
tcp: add tcp_sock_set_keepcnt

Add a helper to directly set the TCP_KEEPCNT sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tcp_sock_set_keepintvl
Christoph Hellwig [Thu, 28 May 2020 05:12:24 +0000 (07:12 +0200)]
tcp: add tcp_sock_set_keepintvl

Add a helper to directly set the TCP_KEEPINTVL sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tcp_sock_set_keepidle
Christoph Hellwig [Thu, 28 May 2020 05:12:23 +0000 (07:12 +0200)]
tcp: add tcp_sock_set_keepidle

Add a helper to directly set the TCP_KEEP_IDLE sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tcp_sock_set_user_timeout
Christoph Hellwig [Thu, 28 May 2020 05:12:22 +0000 (07:12 +0200)]
tcp: add tcp_sock_set_user_timeout

Add a helper to directly set the TCP_USER_TIMEOUT sockopt from kernel
space without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tcp_sock_set_syncnt
Christoph Hellwig [Thu, 28 May 2020 05:12:21 +0000 (07:12 +0200)]
tcp: add tcp_sock_set_syncnt

Add a helper to directly set the TCP_SYNCNT sockopt from kernel space
without going through a fake uaccess.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotcp: add tcp_sock_set_quickack
Christoph Hellwig [Thu, 28 May 2020 05:12:20 +0000 (07:12 +0200)]
tcp: add tcp_sock_set_quickack

Add a helper to directly set the TCP_QUICKACK sockopt from kernel space
without going through a fake uaccess.  Cleanup the callers to avoid
pointless wrappers now that this is a simple function call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>