OSDN Git Service

uclinux-h8/linux.git
4 years agonet/smc: pre-fetch send buffer outside of send_lock
Karsten Graul [Sat, 30 May 2020 14:42:37 +0000 (16:42 +0200)]
net/smc: pre-fetch send buffer outside of send_lock

Pre-fetch send buffer for the CDC validation message before entering the
send_lock. Without that the send call might fail with -EBUSY because
there are no free buffers and waiting for buffers is not possible under
send_lock.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Fix-2-non-critical-issues-in-SJA1105-DSA'
David S. Miller [Sun, 31 May 2020 01:00:36 +0000 (18:00 -0700)]
Merge branch 'Fix-2-non-critical-issues-in-SJA1105-DSA'

Vladimir Oltean says:

====================
Fix 2 non-critical issues in SJA1105 DSA

This small series suppresses the W=1 warnings in the sja1105 driver and
it corrects some register offsets. I would like to target it against
net-next since it would have non-trivial conflicts with net, and the
problems it solves are not that big of a deal.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: sja1105: fix port mirroring for P/Q/R/S
Vladimir Oltean [Sat, 30 May 2020 10:29:53 +0000 (13:29 +0300)]
net: dsa: sja1105: fix port mirroring for P/Q/R/S

The dynamic configuration interface for the General Params and the L2
Lookup Params tables was copy-pasted between E/T devices and P/Q/R/S
devices. Nonetheless, these interfaces are bitwise different.

The driver is using dynamic reconfiguration of the General Parameters
table for the port mirroring feature, which was therefore broken on
P/Q/R/S.

Note that this patch can't be backported easily very far to stable trees
(since it conflicts with some other development done since the
introduction of the driver). So the Fixes: tag is purely informational.

Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c
Vladimir Oltean [Sat, 30 May 2020 10:29:52 +0000 (13:29 +0300)]
net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_static_config.c

Newer compilers complain with W=1 builds that there are non-static
functions defined in sja1105_static_config.c that don't have a
prototype, because their prototype is defined in sja1105.h which this
translation unit does not include.

I don't entirely understand what is the point of these warnings, since
in principle there's nothing wrong with that. But let's move the
prototypes to a header file that _is_ included by
sja1105_static_config.c, since that will make these warnings go away.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'mlx5-cleanup-2020-05-29' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Sun, 31 May 2020 00:53:57 +0000 (17:53 -0700)]
Merge tag 'mlx5-cleanup-2020-05-29' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-cleanup-2020-05-29

Accumulated cleanup patches and sparse warning fixes for mlx5 driver.

1) sync with mlx5-next branch

2) Eli Cohen declares mpls_entry_encode() helper in mpls.h as suggested
by Jakub Kicinski and David Ahern, and use it in mlx5

3) Jesper Fixes xdp data_meta setup in mlx5

4) Many sparse and build warnings cleanup
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'hns3-next'
David S. Miller [Sun, 31 May 2020 00:41:22 +0000 (17:41 -0700)]
Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: adds some cleanups for -next

There are some cleanups for the HNS3 ethernet driver, fix an
incorrect print format, an incorrect comment and some coding
style issues, also remove some unused codes and macros.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove some unused codes in hns3_nic_set_features()
Huazhong Tan [Sat, 30 May 2020 01:08:32 +0000 (09:08 +0800)]
net: hns3: remove some unused codes in hns3_nic_set_features()

NETIF_F_HW_VLAN_CTAG_FILTER is not set in netdev->hw_feature for
the HNS3 driver, so the handler of NETIF_F_HW_VLAN_CTAG_FILTER
in hns3_nic_set_features() won't be called, remove it.

Reported-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: fix two coding style issues in hclgevf_main.c
Huazhong Tan [Sat, 30 May 2020 01:08:31 +0000 (09:08 +0800)]
net: hns3: fix two coding style issues in hclgevf_main.c

Remove a redundant blank line in hclgevf_cmd_set_promisc_mode(),
and fix a reverse xmas tree coding style issue in
hclgevf_set_rss_tc_mode().

Reported-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: fix an incorrect comment for num_tqps in struct hclgevf_dev
Huazhong Tan [Sat, 30 May 2020 01:08:30 +0000 (09:08 +0800)]
net: hns3: fix an incorrect comment for num_tqps in struct hclgevf_dev

struct hclgevf_dev stands for VF device, its field num_tqps
indicates the number of VF's task queue pairs, so the comment
is incorrect, replace 'PF' with 'VF'.

Reported-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
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 agonet/mlx5e: Make mlx5e_dcbnl_ops static
Saeed Mahameed [Fri, 29 May 2020 07:36:10 +0000 (00:36 -0700)]
net/mlx5e: Make mlx5e_dcbnl_ops static

Fix sparse warning:
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c:988:29:
error: symbol 'mlx5e_dcbnl_ops' was not declared. Should it be static?

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: en_tc: Fix cast to restricted __be32 warning
Saeed Mahameed [Thu, 28 May 2020 07:22:12 +0000 (00:22 -0700)]
net/mlx5e: en_tc: Fix cast to restricted __be32 warning

Fixes sparse warnings:
warning: cast to restricted __be32
warning: restricted __be32 degrades to integer

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
4 years agonet/mlx5e: en_tc: Fix incorrect type in initializer warnings
Saeed Mahameed [Thu, 28 May 2020 06:41:03 +0000 (23:41 -0700)]
net/mlx5e: en_tc: Fix incorrect type in initializer warnings

Fix some trivial warnings of the type:
warning: incorrect type in initializer (different base types)

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
4 years agonet/mlx5: IPSec: Fix incorrect type for spi
Saeed Mahameed [Fri, 29 May 2020 07:47:12 +0000 (00:47 -0700)]
net/mlx5: IPSec: Fix incorrect type for spi

spi is __be32, fix that.

Fixes sparse warning:
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c:74:64
warning: incorrect type

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Accel: fpga tls fix cast to __be64 and incorrect argument types
Saeed Mahameed [Fri, 29 May 2020 01:42:40 +0000 (18:42 -0700)]
net/mlx5: Accel: fpga tls fix cast to __be64 and incorrect argument types

tls handle and rcd_sn are actually big endian and not in host format.
Fix that.

Fix the following sparse warnings:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c:177:21:
warning: cast to restricted __be64

drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c:178:52:
warning: incorrect type in argument 2 (different base types)
    expected unsigned int [usertype] handle
    got restricted __be32 [usertype] handle

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: cmd: Fix memset with byte count warning
Saeed Mahameed [Thu, 28 May 2020 06:16:02 +0000 (23:16 -0700)]
net/mlx5: cmd: Fix memset with byte count warning

Fix sparse warning:
drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1949:15:
warning: memset with byte count of 271720

mlx5_cmd_stats array is too big to be held inline in mlx5_cmd.
Allocate it separately.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR: Fix incorrect type in return expression
Saeed Mahameed [Thu, 28 May 2020 08:14:31 +0000 (01:14 -0700)]
net/mlx5: DR: Fix incorrect type in return expression

dr_ste_crc32_calc() calculates crc32 and should return it in HW format.
It is being used to calculate a u32 index, hence we force the return value
of u32 to avoid the sparse warning:

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c:115:16:
warning: incorrect type in return expression (different base types)
    expected unsigned int
    got restricted __be32 [usertype]

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
4 years agonet/mlx5: DR: Fix cast to restricted __be32
Saeed Mahameed [Thu, 28 May 2020 08:11:37 +0000 (01:11 -0700)]
net/mlx5: DR: Fix cast to restricted __be32

raw_ip actual type is __be32 and not u32.
Fix that and get rid of the warning.

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c:906:31:
warning: cast to restricted __be32

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
4 years agonet/mlx5: DR: Fix incorrect type in argument
Saeed Mahameed [Thu, 28 May 2020 08:02:08 +0000 (01:02 -0700)]
net/mlx5: DR: Fix incorrect type in argument

HW spec objects should receive a void ptr to work on, the MLX5_SET/GET
macro will know how to handle it.

No need to provide explicit or wrong pointer type in this case.

warning: incorrect type in argument 1 (different base types)
    expected unsigned long long const [usertype] *sw_action
    got restricted __be64 [usertype] *[assigned] sw_action

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
4 years agonet/mlx5e: Use generic API to build MPLS label
Eli Cohen [Wed, 27 May 2020 05:38:03 +0000 (08:38 +0300)]
net/mlx5e: Use generic API to build MPLS label

Make use of generic API mpls_entry_encode() to build mpls label and get
rid of local function.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet: Make mpls_entry_encode() available for generic users
Eli Cohen [Wed, 27 May 2020 05:35:03 +0000 (08:35 +0300)]
net: Make mpls_entry_encode() available for generic users

Move mpls_entry_encode() from net/mpls/internal.h to include/net/mpls.h
and make it available for other users. Specifically, hardware driver that
offload MPLS can benefit from that.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: reduce stack usage in qp_read_field
Arnd Bergmann [Tue, 28 Apr 2020 21:23:47 +0000 (23:23 +0200)]
net/mlx5: reduce stack usage in qp_read_field

Moving the mlx5_ifc_query_qp_out_bits structure on the stack was a bit
excessive and now causes the compiler to complain on 32-bit architectures:

drivers/net/ethernet/mellanox/mlx5/core/debugfs.c: In function 'qp_read_field':
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c:274:1: error: the frame size of 1104 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

Revert the previous patch partially to use dynamically allocation as
the code did before. Unfortunately there is no good error handling
in case the allocation fails.

Fixes: 57a6c5e992f5 ("net/mlx5: Replace hand written QP context struct with automatic getters")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: Don't use err uninitialized in mlx5e_attach_decap
Nathan Chancellor [Wed, 27 May 2020 07:50:22 +0000 (00:50 -0700)]
net/mlx5e: Don't use err uninitialized in mlx5e_attach_decap

Clang warns:

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:3712:6: warning:
variable 'err' is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
        if (IS_ERR(d->pkt_reformat)) {
            ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:3718:6: note:
uninitialized use occurs here
        if (err)
            ^~~
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:3712:2: note: remove the
'if' if its condition is always true
        if (IS_ERR(d->pkt_reformat)) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:3670:9: note: initialize
the variable 'err' to silence this warning
        int err;
               ^
                = 0
1 warning generated.

It is not wrong, err is only ever initialized in if statements but this
one is not in one. Initialize err to 0 to fix this.

Fixes: 14e6b038afa0 ("net/mlx5e: Add support for hw decapsulation of MPLS over UDP")
Link: https://github.com/ClangBuiltLinux/linux/issues/1037
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Kconfig: Fix spelling typo
Saeed Mahameed [Wed, 27 May 2020 05:09:09 +0000 (22:09 -0700)]
net/mlx5: Kconfig: Fix spelling typo

"mdoe"->"mode"

Fixes: d956873f908c ("net/mlx5e: Introduce kconfig var for TC support")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
4 years agomlx5: fix xdp data_meta setup in mlx5e_fill_xdp_buff
Jesper Dangaard Brouer [Wed, 27 May 2020 13:44:09 +0000 (15:44 +0200)]
mlx5: fix xdp data_meta setup in mlx5e_fill_xdp_buff

The helper function xdp_set_data_meta_invalid() must be called after
setting xdp->data as it depends on it.

The bug was introduced in the cited patch below, and cause the kernel
to crash when using BPF helper bpf_xdp_adjust_head() on mlx5 driver.

Fixes: 39d6443c8daf ("mlx5, xsk: Migrate to new MEM_TYPE_XSK_BUFF_POOL")
Reported-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
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 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox...
Saeed Mahameed [Fri, 29 May 2020 21:38:02 +0000 (14:38 -0700)]
Merge branch 'mlx5-next' of git://git./linux/kernel/git/mellanox/linux

  net/mlx5: Add ability to read and write ECE options
  net/mlx5: Add support for RDMA TX FT headers modifying
  net/mlx5: Move iseg access helper routines close to mlx5_core driver
  net/mlx5: Cleanup mlx5_ifc_fte_match_set_misc2_bits
  net/mlx5: Add support in forward to namespace
  {IB/net}/mlx5: Simplify don't trap code
  net/mlx5: Replace zero-length array with flexible-array

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
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>