Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net] tcp: fix tcp_set_congestion_control() use from bpf hook
From: Lawrence Brakmo @ 2019-07-19  2:55 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller; +Cc: netdev, Eric Dumazet, Neal Cardwell
In-Reply-To: <20190719022814.233056-1-edumazet@google.com>

On 7/18/19, 7:28 PM, "Eric Dumazet" <edumazet@google.com> wrote:

    Neal reported incorrect use of ns_capable() from bpf hook.
    
    bpf_setsockopt(...TCP_CONGESTION...)
      -> tcp_set_congestion_control()
       -> ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)
        -> ns_capable_common()
         -> current_cred()
          -> rcu_dereference_protected(current->cred, 1)
    
    Accessing 'current' in bpf context makes no sense, since packets
    are processed from softirq context.
    
    As Neal stated : The capability check in tcp_set_congestion_control()
    was written assuming a system call context, and then was reused from
    a BPF call site.
    
    The fix is to add a new parameter to tcp_set_congestion_control(),
    so that the ns_capable() call is only performed under the right
    context.
    
    Fixes: 91b5b21c7c16 ("bpf: Add support for changing congestion control")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Lawrence Brakmo <brakmo@fb.com>
    Reported-by: Neal Cardwell <ncardwell@google.com>
    ---

Acked-by: Lawrence Brakmo <brakmo@fb.com>
Thanks, Eric!
 


^ permalink raw reply

* [PATCH] qca8k: enable port flow control
From: xiaofeis @ 2019-07-19  2:53 UTC (permalink / raw)
  To: davem
  Cc: vkoul, netdev, andrew, linux-arm-msm, bjorn.andersson,
	vivien.didelot, f.fainelli, niklas.cassel, xiazha, xiaofeis

Set phy device advertising to enable MAC flow control.

Change-Id: Ibf0f554b072fc73136ec9f7ffb90c20b25a4faae
Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org>
---
 drivers/net/dsa/qca8k.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index d93be14..95ac081 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2009 Felix Fietkau <nbd@nbd.name>
  * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
- * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved.
  * Copyright (c) 2016 John Crispin <john@phrozen.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -800,6 +800,8 @@
 	qca8k_port_set_status(priv, port, 1);
 	priv->port_sts[port].enabled = 1;
 
+	phy->advertising |= (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
+
 	return 0;
 }
 
-- 
1.9.1


^ permalink raw reply related

* Re: [PATCH v2] ag71xx: fix error return code in ag71xx_probe()
From: David Miller @ 2019-07-19  3:34 UTC (permalink / raw)
  To: weiyongjun1; +Cc: jcliburn, chris.snook, o.rempel, netdev, kernel-janitors
In-Reply-To: <20190719012157.100396-1-weiyongjun1@huawei.com>

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Fri, 19 Jul 2019 01:21:57 +0000

> Fix to return error code -ENOMEM from the dmam_alloc_coherent() error
> handling case instead of 0, as done elsewhere in this function.
> 
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

Applied.

^ permalink raw reply

* Re: [PATCH v2] ag71xx: fix return value check in ag71xx_probe()
From: David Miller @ 2019-07-19  3:34 UTC (permalink / raw)
  To: weiyongjun1; +Cc: jcliburn, chris.snook, o.rempel, netdev, kernel-janitors
In-Reply-To: <20190719012206.100478-1-weiyongjun1@huawei.com>

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Fri, 19 Jul 2019 01:22:06 +0000

> In case of error, the function of_get_mac_address() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().
> 
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

Applied.

^ permalink raw reply

* Re: [PATCH net] tcp: fix tcp_set_congestion_control() use from bpf hook
From: David Miller @ 2019-07-19  3:34 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet, brakmo, ncardwell
In-Reply-To: <20190719022814.233056-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Thu, 18 Jul 2019 19:28:14 -0700

> Neal reported incorrect use of ns_capable() from bpf hook.
> 
> bpf_setsockopt(...TCP_CONGESTION...)
>   -> tcp_set_congestion_control()
>    -> ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)
>     -> ns_capable_common()
>      -> current_cred()
>       -> rcu_dereference_protected(current->cred, 1)
> 
> Accessing 'current' in bpf context makes no sense, since packets
> are processed from softirq context.
> 
> As Neal stated : The capability check in tcp_set_congestion_control()
> was written assuming a system call context, and then was reused from
> a BPF call site.
> 
> The fix is to add a new parameter to tcp_set_congestion_control(),
> so that the ns_capable() call is only performed under the right
> context.
> 
> Fixes: 91b5b21c7c16 ("bpf: Add support for changing congestion control")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Lawrence Brakmo <brakmo@fb.com>
> Reported-by: Neal Cardwell <ncardwell@google.com>

Applied and queued up for -stable.

^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2019-07-19  3:44 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) Fix AF_XDP cq entry leak, from Ilya Maximets.

2) Fix handling of PHY power-down on RTL8411B, from Heiner Kallweit.

3) Add some new PCI IDs to iwlwifi, from Ihab Zhaika.

4) Fix handling of neigh timers wrt. entries added by userspace,
   from Lorenzo Bianconi.

5) Various cases of missing of_node_put(), from Nishka Dasgupta.

6) The new NET_ACT_CT needs to depend upon NF_NAT, from Yue Haibing.

7) Various RDS layer fixes, from Gerd Rausch.

8) Fix some more fallout from TCQ_F_CAN_BYPASS generalization, from
   Cong Wang.

9) Fix FIB source validation checks over loopback, also from Cong
   Wang.

10) Use promisc for unsupported number of filters, from Justin Chen.

11) Missing sibling route unlink on failure in ipv6, from Ido
    Schimmel.

Please pull, thanks a lot!

The following changes since commit 192f0f8e9db7efe4ac98d47f5fa4334e43c1204d:

  Merge tag 'powerpc-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux (2019-07-13 16:08:36 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 

for you to fetch changes up to 8d650cdedaabb33e85e9b7c517c0c71fcecc1de9:

  tcp: fix tcp_set_congestion_control() use from bpf hook (2019-07-18 20:33:48 -0700)

----------------------------------------------------------------
Andrii Nakryiko (9):
      bpf: fix precision bit propagation for BPF_ST instructions
      libbpf: fix ptr to u64 conversion warning on 32-bit platforms
      bpf: fix BTF verifier size resolution logic
      selftests/bpf: add trickier size resolution tests
      selftests/bpf: use typedef'ed arrays as map values
      selftests/bpf: remove logic duplication in test_verifier
      libbpf: fix another GCC8 warning for strncpy
      selftests/bpf: fix test_verifier/test_maps make dependencies
      selftests/bpf: structure test_{progs, maps, verifier} test runners uniformly

Arnd Bergmann (1):
      ath10k: work around uninitialized vht_pfr variable

Benjamin Poirier (1):
      be2net: Signal that the device cannot transmit during reconfiguration

Chuhong Yuan (3):
      liquidio: Replace vmalloc + memset with vzalloc
      net/mlx5: Replace kfree with kvfree
      gve: replace kfree with kvfree

Cong Wang (3):
      net_sched: unset TCQ_F_CAN_BYPASS when adding filters
      fib: relax source validation check for loopback packets
      selftests: add a test case for rp_filter

Daniel Borkmann (2):
      Merge branch 'bpf-btf-size-verification-fix'
      Merge branch 'bpf-fix-wide-loads-sockaddr'

Daniel T. Lee (1):
      tools: bpftool: add raw_tracepoint_writable prog type to header

David Ahern (1):
      ipv6: rt6_check should return NULL if 'from' is NULL

David S. Miller (6):
      Merge tag 'mlx5-fixes-2019-07-15' of git://git.kernel.org/.../saeed/linux
      Merge branch 'net-rds-RDMA-fixes'
      Merge branch 'mlxsw-Two-fixes'
      Merge branch 'ipv4-relax-source-validation-check-for-loopback-packets'
      Merge tag 'wireless-drivers-for-davem-2019-07-18' of git://git.kernel.org/.../kvalo/wireless-drivers
      Merge git://git.kernel.org/.../bpf/bpf

Denis Efremov (1):
      gve: Remove the exporting of gve_probe

Eli Cohen (1):
      net/mlx5e: Verify encapsulation is supported

Eric Dumazet (1):
      tcp: fix tcp_set_congestion_control() use from bpf hook

Fuqian Huang (4):
      atm: idt77252: Remove call to memset after dma_alloc_coherent
      ethernet: remove redundant memset
      hippi: Remove call to memset after pci_alloc_consistent
      vmxnet3: Remove call to memset after dma_alloc_coherent

Gerd Rausch (7):
      net/rds: Give fr_state a chance to transition to FRMR_IS_FREE
      net/rds: Get rid of "wait_clean_list_grace" and add locking
      net/rds: Wait for the FRMR_IS_FREE (or FRMR_IS_STALE) transition after posting IB_WR_LOCAL_INV
      net/rds: Fix NULL/ERR_PTR inconsistency
      net/rds: Set fr_state only to FRMR_IS_FREE if IB_WR_LOCAL_INV had been successful
      net/rds: Keep track of and wait for FRWR segments in use upon shutdown
      net/rds: Initialize ic->i_fastreg_wrs upon allocation

Gustavo A. R. Silva (1):
      bpf: verifier: avoid fall-through warnings

Haishuang Yan (1):
      sit: use dst_cache in ipip6_tunnel_xmit

Hariprasad Kelam (1):
      net: sctp: fix warning "NULL check before some freeing functions is not needed"

Heiner Kallweit (1):
      r8169: fix issue with confused RX unit after PHY power-down on RTL8411b

Ido Schimmel (2):
      mlxsw: spectrum: Do not process learned records with a dummy FID
      ipv6: Unlink sibling route in case of failure

Ihab Zhaika (1):
      iwlwifi: add new cards for 9000 and 20000 series

Ilias Apalodimas (1):
      MAINTAINERS: update netsec driver

Ilya Leoshkevich (15):
      selftests/bpf: fix bpf_target_sparc check
      selftests/bpf: do not ignore clang failures
      selftests/bpf: compile progs with -D__TARGET_ARCH_$(SRCARCH)
      selftests/bpf: fix s930 -> s390 typo
      selftests/bpf: make PT_REGS_* work in userspace
      selftests/bpf: fix compiling loop{1, 2, 3}.c on s390
      selftests/bpf: fix attach_probe on s390
      selftests/bpf: make directory prerequisites order-only
      selftests/bpf: put test_stub.o into $(OUTPUT)
      samples/bpf: build with -D__TARGET_ARCH_$(SRCARCH)
      selftests/bpf: fix "alu with different scalars 1" on s390
      selftests/bpf: skip nmi test when perf hw events are disabled
      selftests/bpf: fix perf_buffer on s390
      selftests/bpf: fix "valid read map access into a read-only array 1" on s390
      selftests/bpf: fix test_xdp_noinline on s390

Ilya Maximets (2):
      xdp: fix possible cq entry leak
      xdp: fix potential deadlock on socket mutex

Jon Maloy (1):
      tipc: initialize 'validated' field of received packets

Justin Chen (1):
      net: bcmgenet: use promisc for unsupported filters

Lorenzo Bianconi (1):
      net: neigh: fix multiple neigh timer scheduling

Luca Coelho (1):
      iwlwifi: pcie: add support for qu c-step devices

Michael Chan (1):
      bnxt_en: Fix VNIC accounting when enabling aRFS on 57500 chips.

Nishka Dasgupta (3):
      net: ethernet: ti: cpsw: Add of_node_put() before return and break
      net: ethernet: mscc: ocelot_board: Add of_node_put() before return
      net: ethernet: mediatek: mtk_eth_soc: Add of_node_put() before goto

Petr Machata (1):
      mlxsw: spectrum_dcb: Configure DSCP map as the last rule is removed

Phong Tran (1):
      ISDN: hfcsusb: checking idx of ep configuration

Qian Cai (1):
      skbuff: fix compilation warnings in skb_dump()

Rogan Dawes (1):
      usb: qmi_wwan: add D-Link DWM-222 A2 device ID

Rosen Penev (1):
      net: ag71xx: Add missing header

Sergej Benilov (1):
      sis900: correct a few typos

Soeren Moch (1):
      rt2x00usb: fix rx queue hang

Stanislav Fomichev (5):
      bpf: rename bpf_ctx_wide_store_ok to bpf_ctx_wide_access_ok
      bpf: allow wide aligned loads for bpf_sock_addr user_ip6 and msg_src_ip6
      selftests/bpf: rename verifier/wide_store.c to verifier/wide_access.c
      selftests/bpf: add selftests for wide loads
      bpf: sync bpf.h to tools/

Su Yanjun (1):
      udp: Fix typo in net/ipv4/udp.c

Taehee Yoo (1):
      caif-hsi: fix possible deadlock in cfhsi_exit_module()

Tasos Sahanidis (1):
      sky2: Disable MSI on P5W DH Deluxe

Vasily Gorbik (1):
      MAINTAINERS: update BPF JIT S390 maintainers

Vedang Patel (1):
      fix: taprio: Change type of txtime-delay parameter to u32

Vincent Bernat (1):
      bonding: add documentation for peer_notif_delay

Vlad Buslov (2):
      net/mlx5e: Rely on filter_dev instead of dissector keys for tunnels
      net/mlx5e: Allow dissector meta key in tc flower

Wei Yongjun (3):
      net: dsa: sja1105: Fix missing unlock on error in sk_buff()
      ag71xx: fix error return code in ag71xx_probe()
      ag71xx: fix return value check in ag71xx_probe()

YueHaibing (1):
      net/sched: Make NET_ACT_CT depends on NF_NAT

 Documentation/networking/bonding.txt                         |  16 ++++++++--
 MAINTAINERS                                                  |   3 +-
 drivers/atm/idt77252.c                                       |   1 -
 drivers/isdn/hardware/mISDN/hfcsusb.c                        |   3 ++
 drivers/net/caif/caif_hsi.c                                  |   2 +-
 drivers/net/ethernet/atheros/ag71xx.c                        |   9 ++++--
 drivers/net/ethernet/atheros/atlx/atl1.c                     |   2 --
 drivers/net/ethernet/atheros/atlx/atl2.c                     |   1 -
 drivers/net/ethernet/broadcom/bnxt/bnxt.c                    |   9 +++---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c               |  57 ++++++++++++++++------------------
 drivers/net/ethernet/cavium/liquidio/request_manager.c       |   6 ++--
 drivers/net/ethernet/chelsio/cxgb4/sched.c                   |   1 -
 drivers/net/ethernet/emulex/benet/be_main.c                  |   6 +++-
 drivers/net/ethernet/freescale/fec_main.c                    |   2 --
 drivers/net/ethernet/google/gve/gve_main.c                   |  23 +++++++-------
 drivers/net/ethernet/google/gve/gve_rx.c                     |   4 +--
 drivers/net/ethernet/jme.c                                   |   5 ---
 drivers/net/ethernet/marvell/skge.c                          |   2 --
 drivers/net/ethernet/marvell/sky2.c                          |   7 +++++
 drivers/net/ethernet/mediatek/mtk_eth_soc.c                  |   4 ++-
 drivers/net/ethernet/mellanox/mlx4/eq.c                      |   2 --
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c              |  13 ++++----
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c            |   1 -
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c   |   3 --
 drivers/net/ethernet/mellanox/mlx5/core/health.c             |   2 +-
 drivers/net/ethernet/mellanox/mlxsw/pci.c                    |   1 -
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h               |   1 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c           |  16 +++++-----
 drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c           |  10 ++++++
 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c     |   6 ++++
 drivers/net/ethernet/mscc/ocelot_board.c                     |   5 ++-
 drivers/net/ethernet/neterion/s2io.c                         |   1 -
 drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c          |   3 --
 drivers/net/ethernet/realtek/r8169_main.c                    | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/ethernet/sis/sis900.c                            |   6 ++--
 drivers/net/ethernet/ti/cpsw.c                               |  26 +++++++++++-----
 drivers/net/ethernet/ti/tlan.c                               |   1 -
 drivers/net/hippi/rrunner.c                                  |   2 --
 drivers/net/usb/qmi_wwan.c                                   |   1 +
 drivers/net/vmxnet3/vmxnet3_drv.c                            |   1 -
 drivers/net/wireless/ath/ath10k/mac.c                        |   2 ++
 drivers/net/wireless/intel/iwlwifi/cfg/22000.c               |  53 +++++++++++++++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/iwl-config.h              |   7 +++++
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h                 |   2 ++
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c                |  23 ++++++++++++++
 drivers/net/wireless/ralink/rt2x00/rt2x00usb.c               |  12 ++++----
 include/linux/filter.h                                       |   2 +-
 include/net/tcp.h                                            |   3 +-
 include/uapi/linux/bpf.h                                     |   4 +--
 include/uapi/linux/pkt_sched.h                               |   2 +-
 kernel/bpf/btf.c                                             |  19 +++++++-----
 kernel/bpf/verifier.c                                        |  13 ++++----
 net/core/filter.c                                            |  26 +++++++++++-----
 net/core/neighbour.c                                         |   2 ++
 net/core/skbuff.c                                            |   2 +-
 net/dsa/tag_sja1105.c                                        |   1 +
 net/ipv4/fib_frontend.c                                      |   5 +++
 net/ipv4/tcp.c                                               |   4 ++-
 net/ipv4/tcp_cong.c                                          |   6 ++--
 net/ipv4/udp.c                                               |   2 +-
 net/ipv6/ip6_fib.c                                           |  18 ++++++++++-
 net/ipv6/route.c                                             |   2 +-
 net/ipv6/sit.c                                               |  13 +++++---
 net/rds/ib.h                                                 |   1 +
 net/rds/ib_cm.c                                              |   9 +++++-
 net/rds/ib_frmr.c                                            |  84 +++++++++++++++++++++++++++++++++++++++++++++-----
 net/rds/ib_mr.h                                              |   4 +++
 net/rds/ib_rdma.c                                            |  60 ++++++++++++------------------------
 net/sched/Kconfig                                            |   2 +-
 net/sched/cls_api.c                                          |   1 +
 net/sched/sch_fq_codel.c                                     |   2 --
 net/sched/sch_sfq.c                                          |   2 --
 net/sched/sch_taprio.c                                       |   6 ++--
 net/sctp/sm_make_chunk.c                                     |  12 +++-----
 net/tipc/node.c                                              |   1 +
 net/xdp/xdp_umem.c                                           |  16 ++++------
 net/xdp/xsk.c                                                |  13 ++++----
 samples/bpf/Makefile                                         |   2 +-
 tools/bpf/bpftool/main.h                                     |   1 +
 tools/include/uapi/linux/bpf.h                               |   4 +--
 tools/lib/bpf/libbpf.c                                       |   4 +--
 tools/lib/bpf/xsk.c                                          |   3 +-
 tools/testing/selftests/bpf/Makefile                         |  64 +++++++++++++++++++-------------------
 tools/testing/selftests/bpf/bpf_helpers.h                    |  89 ++++++++++++++++++++++++++++++++++++----------------
 tools/testing/selftests/bpf/prog_tests/attach_probe.c        |  10 ++----
 tools/testing/selftests/bpf/prog_tests/perf_buffer.c         |   8 +----
 tools/testing/selftests/bpf/prog_tests/send_signal.c         |  33 +++++++++++++++++++-
 tools/testing/selftests/bpf/progs/loop1.c                    |   2 +-
 tools/testing/selftests/bpf/progs/loop2.c                    |   2 +-
 tools/testing/selftests/bpf/progs/loop3.c                    |   2 +-
 tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c     |   3 +-
 tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c |   3 +-
 tools/testing/selftests/bpf/progs/test_stacktrace_map.c      |   2 +-
 tools/testing/selftests/bpf/progs/test_xdp_noinline.c        |  17 +++++-----
 tools/testing/selftests/bpf/test_btf.c                       |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/test_progs.h                     |   8 +++++
 tools/testing/selftests/bpf/test_verifier.c                  |  35 +++++++++------------
 tools/testing/selftests/bpf/verifier/array_access.c          |   2 +-
 tools/testing/selftests/bpf/verifier/value_ptr_arith.c       |   2 +-
 tools/testing/selftests/bpf/verifier/wide_access.c           |  73 +++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/verifier/wide_store.c            |  36 ----------------------
 tools/testing/selftests/net/fib_tests.sh                     |  35 ++++++++++++++++++++-
 102 files changed, 965 insertions(+), 400 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/verifier/wide_access.c
 delete mode 100644 tools/testing/selftests/bpf/verifier/wide_store.c

^ permalink raw reply

* [PATCH AUTOSEL 5.2 167/171] cxgb4: reduce kernel stack usage in cudbg_collect_mem_region()
From: Sasha Levin @ 2019-07-19  3:56 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, David S . Miller, Sasha Levin, netdev,
	clang-built-linux
In-Reply-To: <20190719035643.14300-1-sashal@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 752c2ea2d8e7c23b0f64e2e7d4337f3604d44c9f ]

The cudbg_collect_mem_region() and cudbg_read_fw_mem() both use several
hundred kilobytes of kernel stack space. One gets inlined into the other,
which causes the stack usage to be combined beyond the warning limit
when building with clang:

drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c:1057:12: error: stack frame size of 1244 bytes in function 'cudbg_collect_mem_region' [-Werror,-Wframe-larger-than=]

Restructuring cudbg_collect_mem_region() lets clang do the same
optimization that gcc does and reuse the stack slots as it can
see that the large variables are never used together.

A better fix might be to avoid using cudbg_meminfo on the stack
altogether, but that requires a larger rewrite.

Fixes: a1c69520f785 ("cxgb4: collect MC memory dump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/chelsio/cxgb4/cudbg_lib.c    | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
index a76529a7662d..c2e92786608b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
@@ -1054,14 +1054,12 @@ static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init,
 	}
 }
 
-static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
-				    struct cudbg_buffer *dbg_buff,
-				    struct cudbg_error *cudbg_err,
-				    u8 mem_type)
+static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init,
+					   struct cudbg_error *cudbg_err,
+					   u8 mem_type)
 {
 	struct adapter *padap = pdbg_init->adap;
 	struct cudbg_meminfo mem_info;
-	unsigned long size;
 	u8 mc_idx;
 	int rc;
 
@@ -1075,7 +1073,16 @@ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
 	if (rc)
 		return rc;
 
-	size = mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
+	return mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
+}
+
+static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
+				    struct cudbg_buffer *dbg_buff,
+				    struct cudbg_error *cudbg_err,
+				    u8 mem_type)
+{
+	unsigned long size = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type);
+
 	return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size,
 				 cudbg_err);
 }
-- 
2.20.1


^ permalink raw reply related

* [PATCH AUTOSEL 5.1 114/141] rds: Accept peer connection reject messages due to incompatible version
From: Sasha Levin @ 2019-07-19  4:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gerd Rausch, Zhu Yanjun, Santosh Shilimkar, Sasha Levin, netdev,
	linux-rdma
In-Reply-To: <20190719040246.15945-1-sashal@kernel.org>

From: Gerd Rausch <gerd.rausch@oracle.com>

[ Upstream commit 8c6166cfc9cd48e93d9176561e50b63cef4330d5 ]

Prior to
commit d021fabf525ff ("rds: rdma: add consumer reject")

function "rds_rdma_cm_event_handler_cmn" would always honor a rejected
connection attempt by issuing a "rds_conn_drop".

The commit mentioned above added a "break", eliminating
the "fallthrough" case and made the "rds_conn_drop" rather conditional:

Now it only happens if a "consumer defined" reject (i.e. "rdma_reject")
carries an integer-value of "1" inside "private_data":

  if (!conn)
    break;
    err = (int *)rdma_consumer_reject_data(cm_id, event, &len);
    if (!err || (err && ((*err) == RDS_RDMA_REJ_INCOMPAT))) {
      pr_warn("RDS/RDMA: conn <%pI6c, %pI6c> rejected, dropping connection\n",
              &conn->c_laddr, &conn->c_faddr);
              conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
              rds_conn_drop(conn);
    }
    rdsdebug("Connection rejected: %s\n",
             rdma_reject_msg(cm_id, event->status));
    break;
    /* FALLTHROUGH */
A number of issues are worth mentioning here:
   #1) Previous versions of the RDS code simply rejected a connection
       by calling "rdma_reject(cm_id, NULL, 0);"
       So the value of the payload in "private_data" will not be "1",
       but "0".

   #2) Now the code has become dependent on host byte order and sizing.
       If one peer is big-endian, the other is little-endian,
       or there's a difference in sizeof(int) (e.g. ILP64 vs LP64),
       the *err check does not work as intended.

   #3) There is no check for "len" to see if the data behind *err is even valid.
       Luckily, it appears that the "rdma_reject(cm_id, NULL, 0)" will always
       carry 148 bytes of zeroized payload.
       But that should probably not be relied upon here.

   #4) With the added "break;",
       we might as well drop the misleading "/* FALLTHROUGH */" comment.

This commit does _not_ address issue #2, as the sender would have to
agree on a byte order as well.

Here is the sequence of messages in this observed error-scenario:
   Host-A is pre-QoS changes (excluding the commit mentioned above)
   Host-B is post-QoS changes (including the commit mentioned above)

   #1 Host-B
      issues a connection request via function "rds_conn_path_transition"
      connection state transitions to "RDS_CONN_CONNECTING"

   #2 Host-A
      rejects the incompatible connection request (from #1)
      It does so by calling "rdma_reject(cm_id, NULL, 0);"

   #3 Host-B
      receives an "RDMA_CM_EVENT_REJECTED" event (from #2)
      But since the code is changed in the way described above,
      it won't drop the connection here, simply because "*err == 0".

   #4 Host-A
      issues a connection request

   #5 Host-B
      receives an "RDMA_CM_EVENT_CONNECT_REQUEST" event
      and ends up calling "rds_ib_cm_handle_connect".
      But since the state is already in "RDS_CONN_CONNECTING"
      (as of #1) it will end up issuing a "rdma_reject" without
      dropping the connection:
         if (rds_conn_state(conn) == RDS_CONN_CONNECTING) {
             /* Wait and see - our connect may still be succeeding */
             rds_ib_stats_inc(s_ib_connect_raced);
         }
         goto out;

   #6 Host-A
      receives an "RDMA_CM_EVENT_REJECTED" event (from #5),
      drops the connection and tries again (goto #4) until it gives up.

Tested-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/rds/rdma_transport.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index 46bce8389066..9db455d02255 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -112,7 +112,9 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
 		if (!conn)
 			break;
 		err = (int *)rdma_consumer_reject_data(cm_id, event, &len);
-		if (!err || (err && ((*err) == RDS_RDMA_REJ_INCOMPAT))) {
+		if (!err ||
+		    (err && len >= sizeof(*err) &&
+		     ((*err) <= RDS_RDMA_REJ_INCOMPAT))) {
 			pr_warn("RDS/RDMA: conn <%pI6c, %pI6c> rejected, dropping connection\n",
 				&conn->c_laddr, &conn->c_faddr);
 			conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
@@ -122,7 +124,6 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
 		rdsdebug("Connection rejected: %s\n",
 			 rdma_reject_msg(cm_id, event->status));
 		break;
-		/* FALLTHROUGH */
 	case RDMA_CM_EVENT_ADDR_ERROR:
 	case RDMA_CM_EVENT_ROUTE_ERROR:
 	case RDMA_CM_EVENT_CONNECT_ERROR:
-- 
2.20.1


^ permalink raw reply related

* [PATCH AUTOSEL 4.19 098/101] cxgb4: reduce kernel stack usage in cudbg_collect_mem_region()
From: Sasha Levin @ 2019-07-19  4:07 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, David S . Miller, Sasha Levin, netdev,
	clang-built-linux
In-Reply-To: <20190719040732.17285-1-sashal@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 752c2ea2d8e7c23b0f64e2e7d4337f3604d44c9f ]

The cudbg_collect_mem_region() and cudbg_read_fw_mem() both use several
hundred kilobytes of kernel stack space. One gets inlined into the other,
which causes the stack usage to be combined beyond the warning limit
when building with clang:

drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c:1057:12: error: stack frame size of 1244 bytes in function 'cudbg_collect_mem_region' [-Werror,-Wframe-larger-than=]

Restructuring cudbg_collect_mem_region() lets clang do the same
optimization that gcc does and reuse the stack slots as it can
see that the large variables are never used together.

A better fix might be to avoid using cudbg_meminfo on the stack
altogether, but that requires a larger rewrite.

Fixes: a1c69520f785 ("cxgb4: collect MC memory dump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/chelsio/cxgb4/cudbg_lib.c    | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
index d97e0d7e541a..b766362031c3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
@@ -1065,14 +1065,12 @@ static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init,
 	}
 }
 
-static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
-				    struct cudbg_buffer *dbg_buff,
-				    struct cudbg_error *cudbg_err,
-				    u8 mem_type)
+static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init,
+					   struct cudbg_error *cudbg_err,
+					   u8 mem_type)
 {
 	struct adapter *padap = pdbg_init->adap;
 	struct cudbg_meminfo mem_info;
-	unsigned long size;
 	u8 mc_idx;
 	int rc;
 
@@ -1086,7 +1084,16 @@ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
 	if (rc)
 		return rc;
 
-	size = mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
+	return mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
+}
+
+static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
+				    struct cudbg_buffer *dbg_buff,
+				    struct cudbg_error *cudbg_err,
+				    u8 mem_type)
+{
+	unsigned long size = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type);
+
 	return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size,
 				 cudbg_err);
 }
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH v2 net-next 03/11] net/ipv4: Plumb support for filtering route dumps
From: Hangbin Liu @ 2019-07-19  4:17 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, David Ahern, Jianlin Shi
In-Reply-To: <20181016015651.22696-4-dsahern@kernel.org>

Hi David,

Before commit 18a8021a7be3 ("net/ipv4: Plumb support for filtering route
dumps"), when we dump a non-exist table, ip cmd exits silently.

# ip -4 route list table 1
# echo $?
0

After commit 18a8021a7be3 ("net/ipv4: Plumb support for filtering route
dumps"). When we dump a non-exist table, as we returned -ENOENT, ip route
shows:

# ip -4 route show table 1
Error: ipv4: FIB table does not exist.
Dump terminated
# echo $?
2

For me it looks make sense to return -ENOENT if we do not have the route
table. But this changes the userspace behavior. Do you think if we need to
keep backward compatible or just let it do as it is right now?

Thanks
Hangbin

^ permalink raw reply

* Re: [PATCH] qca8k: enable port flow control
From: Vinod Koul @ 2019-07-19  4:18 UTC (permalink / raw)
  To: xiaofeis
  Cc: davem, netdev, andrew, linux-arm-msm, bjorn.andersson,
	vivien.didelot, f.fainelli, niklas.cassel, xiazha
In-Reply-To: <1563504791-43398-1-git-send-email-xiaofeis@codeaurora.org>

On 19-07-19, 10:53, xiaofeis wrote:
> Set phy device advertising to enable MAC flow control.

How about:

to Pause for enabling MAC flow control 
> 
> Change-Id: Ibf0f554b072fc73136ec9f7ffb90c20b25a4faae

Please remove this

> Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org>
> ---
>  drivers/net/dsa/qca8k.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
> index d93be14..95ac081 100644
> --- a/drivers/net/dsa/qca8k.c
> +++ b/drivers/net/dsa/qca8k.c
> @@ -1,7 +1,7 @@
>  /*
>   * Copyright (C) 2009 Felix Fietkau <nbd@nbd.name>
>   * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
> - * Copyright (c) 2015, The Linux Foundation. All rights reserved.
> + * Copyright (c) 2015, 2019, The Linux Foundation. All rights reserved.
>   * Copyright (c) 2016 John Crispin <john@phrozen.org>
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -800,6 +800,8 @@
>  	qca8k_port_set_status(priv, port, 1);
>  	priv->port_sts[port].enabled = 1;
>  
> +	phy->advertising |= (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
> +
>  	return 0;
>  }
>  
> -- 
> 1.9.1

-- 
~Vinod

^ permalink raw reply

* [PATCH AUTOSEL 5.1 137/141] cxgb4: reduce kernel stack usage in cudbg_collect_mem_region()
From: Sasha Levin @ 2019-07-19  4:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, David S . Miller, Sasha Levin, netdev,
	clang-built-linux
In-Reply-To: <20190719040246.15945-1-sashal@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 752c2ea2d8e7c23b0f64e2e7d4337f3604d44c9f ]

The cudbg_collect_mem_region() and cudbg_read_fw_mem() both use several
hundred kilobytes of kernel stack space. One gets inlined into the other,
which causes the stack usage to be combined beyond the warning limit
when building with clang:

drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c:1057:12: error: stack frame size of 1244 bytes in function 'cudbg_collect_mem_region' [-Werror,-Wframe-larger-than=]

Restructuring cudbg_collect_mem_region() lets clang do the same
optimization that gcc does and reuse the stack slots as it can
see that the large variables are never used together.

A better fix might be to avoid using cudbg_meminfo on the stack
altogether, but that requires a larger rewrite.

Fixes: a1c69520f785 ("cxgb4: collect MC memory dump")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/ethernet/chelsio/cxgb4/cudbg_lib.c    | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
index 7c5bfc931128..f46202288837 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
@@ -1066,14 +1066,12 @@ static void cudbg_t4_fwcache(struct cudbg_init *pdbg_init,
 	}
 }
 
-static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
-				    struct cudbg_buffer *dbg_buff,
-				    struct cudbg_error *cudbg_err,
-				    u8 mem_type)
+static unsigned long cudbg_mem_region_size(struct cudbg_init *pdbg_init,
+					   struct cudbg_error *cudbg_err,
+					   u8 mem_type)
 {
 	struct adapter *padap = pdbg_init->adap;
 	struct cudbg_meminfo mem_info;
-	unsigned long size;
 	u8 mc_idx;
 	int rc;
 
@@ -1087,7 +1085,16 @@ static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
 	if (rc)
 		return rc;
 
-	size = mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
+	return mem_info.avail[mc_idx].limit - mem_info.avail[mc_idx].base;
+}
+
+static int cudbg_collect_mem_region(struct cudbg_init *pdbg_init,
+				    struct cudbg_buffer *dbg_buff,
+				    struct cudbg_error *cudbg_err,
+				    u8 mem_type)
+{
+	unsigned long size = cudbg_mem_region_size(pdbg_init, cudbg_err, mem_type);
+
 	return cudbg_read_fw_mem(pdbg_init, dbg_buff, mem_type, size,
 				 cudbg_err);
 }
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH] net: ethernet: mediatek: Add MT7628/88 SoC support
From: Stefan Roese @ 2019-07-19  4:06 UTC (permalink / raw)
  To: Daniel Golle
  Cc: netdev, René van Dorst, Felix Fietkau, Sean Wang,
	linux-mediatek, John Crispin
In-Reply-To: <20190717121506.GD18996@makrotopia.org>

On 17.07.19 14:15, Daniel Golle wrote:
> On Wed, Jul 17, 2019 at 01:02:43PM +0200, Stefan Roese wrote:
>> This patch adds support for the MediaTek MT7628/88 SoCs to the common
>> MediaTek ethernet driver. Some minor changes are needed for this and
>> a bigger change, as the MT7628 does not support QDMA (only PDMA).
> 
> The Ethernet core found in MT7628/88 is identical to that found in
> Ralink Rt5350F SoC. Wouldn't it hence make sense to indicate that
> in the compatible string of this driver as well? In OpenWrt we are
> using "ralink,rt5350-eth".

Yes sure, I can switch back to the original compatible string.

I'm on vacation for a bit over 2 weeks now and will try to address
all review comments after that.

Thanks,
Stefan
  
> 
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: René van Dorst <opensource@vdorst.com>
>> Cc: Sean Wang <sean.wang@mediatek.com>
>> Cc: Felix Fietkau <nbd@openwrt.org>
>> Cc: John Crispin <john@phrozen.org>
>> ---
>>   .../devicetree/bindings/net/mediatek-net.txt  |   1 +
>>   drivers/net/ethernet/mediatek/mtk_eth_path.c  |   4 +
>>   drivers/net/ethernet/mediatek/mtk_eth_soc.c   | 490 ++++++++++++++----
>>   drivers/net/ethernet/mediatek/mtk_eth_soc.h   |  39 +-
>>   4 files changed, 424 insertions(+), 110 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
>> index 770ff98d4524..ec6793562148 100644
>> --- a/Documentation/devicetree/bindings/net/mediatek-net.txt
>> +++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
>> @@ -11,6 +11,7 @@ Required properties:
>>   		"mediatek,mt2701-eth": for MT2701 SoC
>>   		"mediatek,mt7623-eth", "mediatek,mt2701-eth": for MT7623 SoC
>>   		"mediatek,mt7622-eth": for MT7622 SoC
>> +		"mediatek,mt7628-eth": for MT7628/88 SoC
>>   		"mediatek,mt7629-eth": for MT7629 SoC
>>   - reg: Address and length of the register set for the device
>>   - interrupts: Should contain the three frame engines interrupts in numeric
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_path.c b/drivers/net/ethernet/mediatek/mtk_eth_path.c
>> index 7f05880cf9ef..28960e4c4e43 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_path.c
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c
>> @@ -315,6 +315,10 @@ int mtk_setup_hw_path(struct mtk_eth *eth, int mac_id, int phymode)
>>   {
>>   	int err;
>>   
>> +	/* No mux'ing for MT7628/88 */
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +		return 0;
>> +
>>   	switch (phymode) {
>>   	case PHY_INTERFACE_MODE_TRGMII:
>>   	case PHY_INTERFACE_MODE_RGMII_TXID:
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> index b20b3a5a1ebb..1f248ef6ef88 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
>> @@ -323,11 +323,14 @@ static int mtk_phy_connect(struct net_device *dev)
>>   		goto err_phy;
>>   	}
>>   
>> -	/* put the gmac into the right mode */
>> -	regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val);
>> -	val &= ~SYSCFG0_GE_MODE(SYSCFG0_GE_MASK, mac->id);
>> -	val |= SYSCFG0_GE_MODE(mac->ge_mode, mac->id);
>> -	regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
>> +	/* No MT7628/88 support for now */
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		/* put the gmac into the right mode */
>> +		regmap_read(eth->ethsys, ETHSYS_SYSCFG0, &val);
>> +		val &= ~SYSCFG0_GE_MODE(SYSCFG0_GE_MASK, mac->id);
>> +		val |= SYSCFG0_GE_MODE(mac->ge_mode, mac->id);
>> +		regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
>> +	}
>>   
>>   	/* couple phydev to net_device */
>>   	if (mtk_phy_connect_node(eth, mac, np))
>> @@ -395,8 +398,8 @@ static inline void mtk_tx_irq_disable(struct mtk_eth *eth, u32 mask)
>>   	u32 val;
>>   
>>   	spin_lock_irqsave(&eth->tx_irq_lock, flags);
>> -	val = mtk_r32(eth, MTK_QDMA_INT_MASK);
>> -	mtk_w32(eth, val & ~mask, MTK_QDMA_INT_MASK);
>> +	val = mtk_r32(eth, eth->tx_int_mask_reg);
>> +	mtk_w32(eth, val & ~mask, eth->tx_int_mask_reg);
>>   	spin_unlock_irqrestore(&eth->tx_irq_lock, flags);
>>   }
>>   
>> @@ -406,8 +409,8 @@ static inline void mtk_tx_irq_enable(struct mtk_eth *eth, u32 mask)
>>   	u32 val;
>>   
>>   	spin_lock_irqsave(&eth->tx_irq_lock, flags);
>> -	val = mtk_r32(eth, MTK_QDMA_INT_MASK);
>> -	mtk_w32(eth, val | mask, MTK_QDMA_INT_MASK);
>> +	val = mtk_r32(eth, eth->tx_int_mask_reg);
>> +	mtk_w32(eth, val | mask, eth->tx_int_mask_reg);
>>   	spin_unlock_irqrestore(&eth->tx_irq_lock, flags);
>>   }
>>   
>> @@ -437,6 +440,7 @@ static int mtk_set_mac_address(struct net_device *dev, void *p)
>>   {
>>   	int ret = eth_mac_addr(dev, p);
>>   	struct mtk_mac *mac = netdev_priv(dev);
>> +	struct mtk_eth *eth = mac->hw;
>>   	const char *macaddr = dev->dev_addr;
>>   
>>   	if (ret)
>> @@ -446,11 +450,19 @@ static int mtk_set_mac_address(struct net_device *dev, void *p)
>>   		return -EBUSY;
>>   
>>   	spin_lock_bh(&mac->hw->page_lock);
>> -	mtk_w32(mac->hw, (macaddr[0] << 8) | macaddr[1],
>> -		MTK_GDMA_MAC_ADRH(mac->id));
>> -	mtk_w32(mac->hw, (macaddr[2] << 24) | (macaddr[3] << 16) |
>> -		(macaddr[4] << 8) | macaddr[5],
>> -		MTK_GDMA_MAC_ADRL(mac->id));
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		mtk_w32(mac->hw, (macaddr[0] << 8) | macaddr[1],
>> +			MT7628_SDM_MAC_ADRH);
>> +		mtk_w32(mac->hw, (macaddr[2] << 24) | (macaddr[3] << 16) |
>> +			(macaddr[4] << 8) | macaddr[5],
>> +			MT7628_SDM_MAC_ADRL);
>> +	} else {
>> +		mtk_w32(mac->hw, (macaddr[0] << 8) | macaddr[1],
>> +			MTK_GDMA_MAC_ADRH(mac->id));
>> +		mtk_w32(mac->hw, (macaddr[2] << 24) | (macaddr[3] << 16) |
>> +			(macaddr[4] << 8) | macaddr[5],
>> +			MTK_GDMA_MAC_ADRL(mac->id));
>> +	}
>>   	spin_unlock_bh(&mac->hw->page_lock);
>>   
>>   	return 0;
>> @@ -626,19 +638,47 @@ static inline struct mtk_tx_buf *mtk_desc_to_tx_buf(struct mtk_tx_ring *ring,
>>   	return &ring->buf[idx];
>>   }
>>   
>> +static struct mtk_tx_dma *qdma_to_pdma(struct mtk_tx_ring *ring,
>> +				       struct mtk_tx_dma *dma)
>> +{
>> +	return ring->dma_pdma - ring->dma + dma;
>> +}
>> +
>> +static int txd_to_idx(struct mtk_tx_ring *ring, struct mtk_tx_dma *dma)
>> +{
>> +	return ((u32)dma - (u32)ring->dma) / sizeof(*dma);
>> +}
>> +
>>   static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf)
>>   {
>> -	if (tx_buf->flags & MTK_TX_FLAGS_SINGLE0) {
>> -		dma_unmap_single(eth->dev,
>> -				 dma_unmap_addr(tx_buf, dma_addr0),
>> -				 dma_unmap_len(tx_buf, dma_len0),
>> -				 DMA_TO_DEVICE);
>> -	} else if (tx_buf->flags & MTK_TX_FLAGS_PAGE0) {
>> -		dma_unmap_page(eth->dev,
>> -			       dma_unmap_addr(tx_buf, dma_addr0),
>> -			       dma_unmap_len(tx_buf, dma_len0),
>> -			       DMA_TO_DEVICE);
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		if (dma_unmap_len(tx_buf, dma_len0)) {
>> +			dma_unmap_page(eth->dev,
>> +				       dma_unmap_addr(tx_buf, dma_addr0),
>> +				       dma_unmap_len(tx_buf, dma_len0),
>> +				       DMA_TO_DEVICE);
>> +		}
>> +
>> +		if (dma_unmap_len(tx_buf, dma_len1)) {
>> +			dma_unmap_page(eth->dev,
>> +				       dma_unmap_addr(tx_buf, dma_addr1),
>> +				       dma_unmap_len(tx_buf, dma_len1),
>> +				       DMA_TO_DEVICE);
>> +		}
>> +	} else {
>> +		if (tx_buf->flags & MTK_TX_FLAGS_SINGLE0) {
>> +			dma_unmap_single(eth->dev,
>> +					 dma_unmap_addr(tx_buf, dma_addr0),
>> +					 dma_unmap_len(tx_buf, dma_len0),
>> +					 DMA_TO_DEVICE);
>> +		} else if (tx_buf->flags & MTK_TX_FLAGS_PAGE0) {
>> +			dma_unmap_page(eth->dev,
>> +				       dma_unmap_addr(tx_buf, dma_addr0),
>> +				       dma_unmap_len(tx_buf, dma_len0),
>> +				       DMA_TO_DEVICE);
>> +		}
>>   	}
>> +
>>   	tx_buf->flags = 0;
>>   	if (tx_buf->skb &&
>>   	    (tx_buf->skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC))
>> @@ -646,19 +686,45 @@ static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf)
>>   	tx_buf->skb = NULL;
>>   }
>>   
>> +static void setup_tx_buf(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf,
>> +			 struct mtk_tx_dma *txd, dma_addr_t mapped_addr,
>> +			 size_t size, int idx)
>> +{
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		if (idx & 1) {
>> +			txd->txd3 = mapped_addr;
>> +			txd->txd2 |= TX_DMA_PLEN1(size);
>> +			dma_unmap_addr_set(tx_buf, dma_addr1, mapped_addr);
>> +			dma_unmap_len_set(tx_buf, dma_len1, size);
>> +		} else {
>> +			tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC;
>> +			txd->txd1 = mapped_addr;
>> +			txd->txd2 = TX_DMA_PLEN0(size);
>> +			dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr);
>> +			dma_unmap_len_set(tx_buf, dma_len0, size);
>> +		}
>> +	} else {
>> +		dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr);
>> +		dma_unmap_len_set(tx_buf, dma_len0, size);
>> +	}
>> +}
>> +
>>   static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   		      int tx_num, struct mtk_tx_ring *ring, bool gso)
>>   {
>>   	struct mtk_mac *mac = netdev_priv(dev);
>>   	struct mtk_eth *eth = mac->hw;
>>   	struct mtk_tx_dma *itxd, *txd;
>> +	struct mtk_tx_dma *itxd_pdma, *txd_pdma;
>>   	struct mtk_tx_buf *itx_buf, *tx_buf;
>>   	dma_addr_t mapped_addr;
>>   	unsigned int nr_frags;
>>   	int i, n_desc = 1;
>>   	u32 txd4 = 0, fport;
>> +	int k = 0;
>>   
>>   	itxd = ring->next_free;
>> +	itxd_pdma = qdma_to_pdma(ring, itxd);
>>   	if (itxd == ring->last_free)
>>   		return -ENOMEM;
>>   
>> @@ -689,12 +755,14 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   	itx_buf->flags |= MTK_TX_FLAGS_SINGLE0;
>>   	itx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 :
>>   			  MTK_TX_FLAGS_FPORT1;
>> -	dma_unmap_addr_set(itx_buf, dma_addr0, mapped_addr);
>> -	dma_unmap_len_set(itx_buf, dma_len0, skb_headlen(skb));
>> +	setup_tx_buf(eth, itx_buf, itxd_pdma, mapped_addr, skb_headlen(skb),
>> +		     k++);
>>   
>>   	/* TX SG offload */
>>   	txd = itxd;
>> +	txd_pdma = qdma_to_pdma(ring, txd);
>>   	nr_frags = skb_shinfo(skb)->nr_frags;
>> +
>>   	for (i = 0; i < nr_frags; i++) {
>>   		struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
>>   		unsigned int offset = 0;
>> @@ -703,12 +771,20 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   		while (frag_size) {
>>   			bool last_frag = false;
>>   			unsigned int frag_map_size;
>> +			bool new_desc = true;
>> +
>> +			if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
>> +			    !(i & 0x1)) {
>> +				new_desc = false;
>> +			} else {
>> +				txd = mtk_qdma_phys_to_virt(ring, txd->txd2);
>> +				txd_pdma = qdma_to_pdma(ring, txd);
>> +				if (txd == ring->last_free)
>> +					goto err_dma;
>> +
>> +				n_desc++;
>> +			}
>>   
>> -			txd = mtk_qdma_phys_to_virt(ring, txd->txd2);
>> -			if (txd == ring->last_free)
>> -				goto err_dma;
>> -
>> -			n_desc++;
>>   			frag_map_size = min(frag_size, MTK_TX_DMA_BUF_LEN);
>>   			mapped_addr = skb_frag_dma_map(eth->dev, frag, offset,
>>   						       frag_map_size,
>> @@ -727,14 +803,16 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   			WRITE_ONCE(txd->txd4, fport);
>>   
>>   			tx_buf = mtk_desc_to_tx_buf(ring, txd);
>> -			memset(tx_buf, 0, sizeof(*tx_buf));
>> +			if (new_desc)
>> +				memset(tx_buf, 0, sizeof(*tx_buf));
>>   			tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC;
>>   			tx_buf->flags |= MTK_TX_FLAGS_PAGE0;
>>   			tx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 :
>>   					 MTK_TX_FLAGS_FPORT1;
>>   
>> -			dma_unmap_addr_set(tx_buf, dma_addr0, mapped_addr);
>> -			dma_unmap_len_set(tx_buf, dma_len0, frag_map_size);
>> +			setup_tx_buf(eth, tx_buf, txd_pdma, mapped_addr,
>> +				     frag_map_size, k++);
>> +
>>   			frag_size -= frag_map_size;
>>   			offset += frag_map_size;
>>   		}
>> @@ -746,6 +824,12 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   	WRITE_ONCE(itxd->txd4, txd4);
>>   	WRITE_ONCE(itxd->txd3, (TX_DMA_SWC | TX_DMA_PLEN0(skb_headlen(skb)) |
>>   				(!nr_frags * TX_DMA_LS0)));
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		if (k & 0x1)
>> +			txd_pdma->txd2 |= TX_DMA_LS0;
>> +		else
>> +			txd_pdma->txd2 |= TX_DMA_LS1;
>> +	}
>>   
>>   	netdev_sent_queue(dev, skb->len);
>>   	skb_tx_timestamp(skb);
>> @@ -758,9 +842,15 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   	 */
>>   	wmb();
>>   
>> -	if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
>> -	    !netdev_xmit_more())
>> -		mtk_w32(eth, txd->txd2, MTK_QTX_CTX_PTR);
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		int next_idx = NEXT_DESP_IDX(txd_to_idx(ring, txd),
>> +					     ring->dma_size);
>> +		mtk_w32(eth, next_idx, MT7628_TX_CTX_IDX0);
>> +	} else {
>> +		if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) ||
>> +		    !netdev_xmit_more())
>> +			mtk_w32(eth, txd->txd2, MTK_QTX_CTX_PTR);
>> +	}
>>   
>>   	return 0;
>>   
>> @@ -772,7 +862,11 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,
>>   		mtk_tx_unmap(eth, tx_buf);
>>   
>>   		itxd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
>> +		if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +			itxd_pdma->txd2 = TX_DMA_DESP2_DEF;
>> +
>>   		itxd = mtk_qdma_phys_to_virt(ring, itxd->txd2);
>> +		itxd_pdma = qdma_to_pdma(ring, itxd);
>>   	} while (itxd != txd);
>>   
>>   	return -ENOMEM;
>> @@ -902,7 +996,7 @@ static struct mtk_rx_ring *mtk_get_rx_ring(struct mtk_eth *eth)
>>   
>>   	for (i = 0; i < MTK_MAX_RX_RING_NUM; i++) {
>>   		ring = &eth->rx_ring[i];
>> -		idx = NEXT_RX_DESP_IDX(ring->calc_idx, ring->dma_size);
>> +		idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
>>   		if (ring->dma[idx].rxd2 & RX_DMA_DONE) {
>>   			ring->calc_idx_update = true;
>>   			return ring;
>> @@ -945,13 +1039,13 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>>   		struct net_device *netdev;
>>   		unsigned int pktlen;
>>   		dma_addr_t dma_addr;
>> -		int mac = 0;
>> +		int mac;
>>   
>>   		ring = mtk_get_rx_ring(eth);
>>   		if (unlikely(!ring))
>>   			goto rx_done;
>>   
>> -		idx = NEXT_RX_DESP_IDX(ring->calc_idx, ring->dma_size);
>> +		idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
>>   		rxd = &ring->dma[idx];
>>   		data = ring->data[idx];
>>   
>> @@ -960,9 +1054,13 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>>   			break;
>>   
>>   		/* find out which mac the packet come from. values start at 1 */
>> -		mac = (trxd.rxd4 >> RX_DMA_FPORT_SHIFT) &
>> -		      RX_DMA_FPORT_MASK;
>> -		mac--;
>> +		if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +			mac = 0;
>> +		} else {
>> +			mac = (trxd.rxd4 >> RX_DMA_FPORT_SHIFT) &
>> +				RX_DMA_FPORT_MASK;
>> +			mac--;
>> +		}
>>   
>>   		if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||
>>   			     !eth->netdev[mac]))
>> @@ -980,7 +1078,8 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>>   			goto release_desc;
>>   		}
>>   		dma_addr = dma_map_single(eth->dev,
>> -					  new_data + NET_SKB_PAD,
>> +					  new_data + NET_SKB_PAD +
>> +					  eth->ip_align,
>>   					  ring->buf_size,
>>   					  DMA_FROM_DEVICE);
>>   		if (unlikely(dma_mapping_error(eth->dev, dma_addr))) {
>> @@ -1003,7 +1102,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>>   		pktlen = RX_DMA_GET_PLEN0(trxd.rxd2);
>>   		skb->dev = netdev;
>>   		skb_put(skb, pktlen);
>> -		if (trxd.rxd4 & RX_DMA_L4_VALID)
>> +		if (trxd.rxd4 & eth->rx_dma_l4_valid)
>>   			skb->ip_summed = CHECKSUM_UNNECESSARY;
>>   		else
>>   			skb_checksum_none_assert(skb);
>> @@ -1020,7 +1119,10 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>>   		rxd->rxd1 = (unsigned int)dma_addr;
>>   
>>   release_desc:
>> -		rxd->rxd2 = RX_DMA_PLEN0(ring->buf_size);
>> +		if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +			rxd->rxd2 = RX_DMA_LSO;
>> +		else
>> +			rxd->rxd2 = RX_DMA_PLEN0(ring->buf_size);
>>   
>>   		ring->calc_idx = idx;
>>   
>> @@ -1039,19 +1141,14 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>>   	return done;
>>   }
>>   
>> -static int mtk_poll_tx(struct mtk_eth *eth, int budget)
>> +static int mtk_poll_tx_qdma(struct mtk_eth *eth, int budget,
>> +			    unsigned int *done, unsigned int *bytes)
>>   {
>>   	struct mtk_tx_ring *ring = &eth->tx_ring;
>>   	struct mtk_tx_dma *desc;
>>   	struct sk_buff *skb;
>>   	struct mtk_tx_buf *tx_buf;
>> -	unsigned int done[MTK_MAX_DEVS];
>> -	unsigned int bytes[MTK_MAX_DEVS];
>>   	u32 cpu, dma;
>> -	int total = 0, i;
>> -
>> -	memset(done, 0, sizeof(done));
>> -	memset(bytes, 0, sizeof(bytes));
>>   
>>   	cpu = mtk_r32(eth, MTK_QTX_CRX_PTR);
>>   	dma = mtk_r32(eth, MTK_QTX_DRX_PTR);
>> @@ -1089,6 +1186,62 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget)
>>   
>>   	mtk_w32(eth, cpu, MTK_QTX_CRX_PTR);
>>   
>> +	return budget;
>> +}
>> +
>> +static int mtk_poll_tx_pdma(struct mtk_eth *eth, int budget,
>> +			    unsigned int *done, unsigned int *bytes)
>> +{
>> +	struct mtk_tx_ring *ring = &eth->tx_ring;
>> +	struct mtk_tx_dma *desc;
>> +	struct sk_buff *skb;
>> +	struct mtk_tx_buf *tx_buf;
>> +	u32 cpu, dma;
>> +
>> +	cpu = ring->cpu_idx;
>> +	dma = mtk_r32(eth, MT7628_TX_DTX_IDX0);
>> +
>> +	while ((cpu != dma) && budget) {
>> +		tx_buf = &ring->buf[cpu];
>> +		skb = tx_buf->skb;
>> +		if (!skb)
>> +			break;
>> +
>> +		if (skb != (struct sk_buff *)MTK_DMA_DUMMY_DESC) {
>> +			bytes[0] += skb->len;
>> +			done[0]++;
>> +			budget--;
>> +		}
>> +
>> +		mtk_tx_unmap(eth, tx_buf);
>> +
>> +		desc = &ring->dma[cpu];
>> +		ring->last_free = desc;
>> +		atomic_inc(&ring->free_count);
>> +
>> +		cpu = NEXT_DESP_IDX(cpu, ring->dma_size);
>> +	}
>> +
>> +	ring->cpu_idx = cpu;
>> +
>> +	return budget;
>> +}
>> +
>> +static int mtk_poll_tx(struct mtk_eth *eth, int budget)
>> +{
>> +	struct mtk_tx_ring *ring = &eth->tx_ring;
>> +	unsigned int done[MTK_MAX_DEVS];
>> +	unsigned int bytes[MTK_MAX_DEVS];
>> +	int total = 0, i;
>> +
>> +	memset(done, 0, sizeof(done));
>> +	memset(bytes, 0, sizeof(bytes));
>> +
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +		budget = mtk_poll_tx_pdma(eth, budget, done, bytes);
>> +	else
>> +		budget = mtk_poll_tx_qdma(eth, budget, done, bytes);
>> +
>>   	for (i = 0; i < MTK_MAC_COUNT; i++) {
>>   		if (!eth->netdev[i] || !done[i])
>>   			continue;
>> @@ -1120,8 +1273,12 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget)
>>   	u32 status, mask;
>>   	int tx_done = 0;
>>   
>> -	mtk_handle_status_irq(eth);
>> -	mtk_w32(eth, MTK_TX_DONE_INT, MTK_QMTK_INT_STATUS);
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		mtk_w32(eth, MTK_TX_DONE_INT, MTK_PDMA_INT_STATUS);
>> +	} else {
>> +		mtk_handle_status_irq(eth);
>> +		mtk_w32(eth, MTK_TX_DONE_INT, MTK_QMTK_INT_STATUS);
>> +	}
>>   	tx_done = mtk_poll_tx(eth, budget);
>>   
>>   	if (unlikely(netif_msg_intr(eth))) {
>> @@ -1135,7 +1292,10 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget)
>>   	if (tx_done == budget)
>>   		return budget;
>>   
>> -	status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +		status = mtk_r32(eth, MTK_PDMA_INT_STATUS);
>> +	else
>> +		status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
>>   	if (status & MTK_TX_DONE_INT)
>>   		return budget;
>>   
>> @@ -1202,6 +1362,24 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
>>   		ring->dma[i].txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
>>   	}
>>   
>> +	/* On MT7688 (PDMA only) this driver uses the ring->dma structs
>> +	 * only as the framework. The real HW descriptors are the PDMA
>> +	 * descriptors in ring->dma_pdma.
>> +	 */
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		ring->dma_pdma = dma_alloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
>> +						    &ring->phys_pdma,
>> +						    GFP_ATOMIC);
>> +		if (!ring->dma_pdma)
>> +			goto no_tx_mem;
>> +
>> +		for (i = 0; i < MTK_DMA_SIZE; i++) {
>> +			ring->dma_pdma[i].txd2 = TX_DMA_DESP2_DEF;
>> +			ring->dma_pdma[i].txd4 = 0;
>> +		}
>> +	}
>> +
>> +	ring->dma_size = MTK_DMA_SIZE;
>>   	atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
>>   	ring->next_free = &ring->dma[0];
>>   	ring->last_free = &ring->dma[MTK_DMA_SIZE - 1];
>> @@ -1212,15 +1390,23 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
>>   	 */
>>   	wmb();
>>   
>> -	mtk_w32(eth, ring->phys, MTK_QTX_CTX_PTR);
>> -	mtk_w32(eth, ring->phys, MTK_QTX_DTX_PTR);
>> -	mtk_w32(eth,
>> -		ring->phys + ((MTK_DMA_SIZE - 1) * sz),
>> -		MTK_QTX_CRX_PTR);
>> -	mtk_w32(eth,
>> -		ring->phys + ((MTK_DMA_SIZE - 1) * sz),
>> -		MTK_QTX_DRX_PTR);
>> -	mtk_w32(eth, (QDMA_RES_THRES << 8) | QDMA_RES_THRES, MTK_QTX_CFG(0));
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0);
>> +		mtk_w32(eth, MTK_DMA_SIZE, MT7628_TX_MAX_CNT0);
>> +		mtk_w32(eth, 0, MT7628_TX_CTX_IDX0);
>> +		mtk_w32(eth, MT7628_PST_DTX_IDX0, MTK_PDMA_RST_IDX);
>> +	} else {
>> +		mtk_w32(eth, ring->phys, MTK_QTX_CTX_PTR);
>> +		mtk_w32(eth, ring->phys, MTK_QTX_DTX_PTR);
>> +		mtk_w32(eth,
>> +			ring->phys + ((MTK_DMA_SIZE - 1) * sz),
>> +			MTK_QTX_CRX_PTR);
>> +		mtk_w32(eth,
>> +			ring->phys + ((MTK_DMA_SIZE - 1) * sz),
>> +			MTK_QTX_DRX_PTR);
>> +		mtk_w32(eth, (QDMA_RES_THRES << 8) | QDMA_RES_THRES,
>> +			MTK_QTX_CFG(0));
>> +	}
>>   
>>   	return 0;
>>   
>> @@ -1247,6 +1433,14 @@ static void mtk_tx_clean(struct mtk_eth *eth)
>>   				  ring->phys);
>>   		ring->dma = NULL;
>>   	}
>> +
>> +	if (ring->dma_pdma) {
>> +		dma_free_coherent(eth->dev,
>> +				  MTK_DMA_SIZE * sizeof(*ring->dma_pdma),
>> +				  ring->dma_pdma,
>> +				  ring->phys_pdma);
>> +		ring->dma_pdma = NULL;
>> +	}
>>   }
>>   
>>   static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
>> @@ -1294,14 +1488,17 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
>>   
>>   	for (i = 0; i < rx_dma_size; i++) {
>>   		dma_addr_t dma_addr = dma_map_single(eth->dev,
>> -				ring->data[i] + NET_SKB_PAD,
>> +				ring->data[i] + NET_SKB_PAD + eth->ip_align,
>>   				ring->buf_size,
>>   				DMA_FROM_DEVICE);
>>   		if (unlikely(dma_mapping_error(eth->dev, dma_addr)))
>>   			return -ENOMEM;
>>   		ring->dma[i].rxd1 = (unsigned int)dma_addr;
>>   
>> -		ring->dma[i].rxd2 = RX_DMA_PLEN0(ring->buf_size);
>> +		if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +			ring->dma[i].rxd2 = RX_DMA_LSO;
>> +		else
>> +			ring->dma[i].rxd2 = RX_DMA_PLEN0(ring->buf_size);
>>   	}
>>   	ring->dma_size = rx_dma_size;
>>   	ring->calc_idx_update = false;
>> @@ -1617,9 +1814,16 @@ static int mtk_dma_busy_wait(struct mtk_eth *eth)
>>   	unsigned long t_start = jiffies;
>>   
>>   	while (1) {
>> -		if (!(mtk_r32(eth, MTK_QDMA_GLO_CFG) &
>> -		      (MTK_RX_DMA_BUSY | MTK_TX_DMA_BUSY)))
>> -			return 0;
>> +		if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +			if (!(mtk_r32(eth, MTK_PDMA_GLO_CFG) &
>> +			      (MTK_RX_DMA_BUSY | MTK_TX_DMA_BUSY)))
>> +				return 0;
>> +		} else {
>> +			if (!(mtk_r32(eth, MTK_QDMA_GLO_CFG) &
>> +			      (MTK_RX_DMA_BUSY | MTK_TX_DMA_BUSY)))
>> +				return 0;
>> +		}
>> +
>>   		if (time_after(jiffies, t_start + MTK_DMA_BUSY_TIMEOUT))
>>   			break;
>>   	}
>> @@ -1636,20 +1840,24 @@ static int mtk_dma_init(struct mtk_eth *eth)
>>   	if (mtk_dma_busy_wait(eth))
>>   		return -EBUSY;
>>   
>> -	/* QDMA needs scratch memory for internal reordering of the
>> -	 * descriptors
>> -	 */
>> -	err = mtk_init_fq_dma(eth);
>> -	if (err)
>> -		return err;
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		/* QDMA needs scratch memory for internal reordering of the
>> +		 * descriptors
>> +		 */
>> +		err = mtk_init_fq_dma(eth);
>> +		if (err)
>> +			return err;
>> +	}
>>   
>>   	err = mtk_tx_alloc(eth);
>>   	if (err)
>>   		return err;
>>   
>> -	err = mtk_rx_alloc(eth, 0, MTK_RX_FLAGS_QDMA);
>> -	if (err)
>> -		return err;
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		err = mtk_rx_alloc(eth, 0, MTK_RX_FLAGS_QDMA);
>> +		if (err)
>> +			return err;
>> +	}
>>   
>>   	err = mtk_rx_alloc(eth, 0, MTK_RX_FLAGS_NORMAL);
>>   	if (err)
>> @@ -1666,10 +1874,14 @@ static int mtk_dma_init(struct mtk_eth *eth)
>>   			return err;
>>   	}
>>   
>> -	/* Enable random early drop and set drop threshold automatically */
>> -	mtk_w32(eth, FC_THRES_DROP_MODE | FC_THRES_DROP_EN | FC_THRES_MIN,
>> -		MTK_QDMA_FC_THRES);
>> -	mtk_w32(eth, 0x0, MTK_QDMA_HRED2);
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		/* Enable random early drop and set drop threshold
>> +		 * automatically
>> +		 */
>> +		mtk_w32(eth, FC_THRES_DROP_MODE | FC_THRES_DROP_EN |
>> +			FC_THRES_MIN, MTK_QDMA_FC_THRES);
>> +		mtk_w32(eth, 0x0, MTK_QDMA_HRED2);
>> +	}
>>   
>>   	return 0;
>>   }
>> @@ -1740,14 +1952,23 @@ static irqreturn_t mtk_handle_irq_tx(int irq, void *_eth)
>>   static irqreturn_t mtk_handle_irq(int irq, void *_eth)
>>   {
>>   	struct mtk_eth *eth = _eth;
>> +	u32 status;
>>   
>> +	status = mtk_r32(eth, MTK_PDMA_INT_STATUS);
>>   	if (mtk_r32(eth, MTK_PDMA_INT_MASK) & MTK_RX_DONE_INT) {
>>   		if (mtk_r32(eth, MTK_PDMA_INT_STATUS) & MTK_RX_DONE_INT)
>>   			mtk_handle_irq_rx(irq, _eth);
>>   	}
>> -	if (mtk_r32(eth, MTK_QDMA_INT_MASK) & MTK_TX_DONE_INT) {
>> -		if (mtk_r32(eth, MTK_QMTK_INT_STATUS) & MTK_TX_DONE_INT)
>> -			mtk_handle_irq_tx(irq, _eth);
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		if (mtk_r32(eth, MTK_PDMA_INT_MASK) & MTK_TX_DONE_INT) {
>> +			if (mtk_r32(eth, MTK_PDMA_INT_STATUS) & MTK_TX_DONE_INT)
>> +				mtk_handle_irq_tx(irq, _eth);
>> +		}
>> +	} else {
>> +		if (mtk_r32(eth, MTK_QDMA_INT_MASK) & MTK_TX_DONE_INT) {
>> +			if (mtk_r32(eth, MTK_QMTK_INT_STATUS) & MTK_TX_DONE_INT)
>> +				mtk_handle_irq_tx(irq, _eth);
>> +		}
>>   	}
>>   
>>   	return IRQ_HANDLED;
>> @@ -1778,17 +1999,23 @@ static int mtk_start_dma(struct mtk_eth *eth)
>>   		return err;
>>   	}
>>   
>> -	mtk_w32(eth,
>> -		MTK_TX_WB_DDONE | MTK_TX_DMA_EN |
>> -		MTK_DMA_SIZE_16DWORDS | MTK_NDP_CO_PRO |
>> -		MTK_RX_DMA_EN | MTK_RX_2B_OFFSET |
>> -		MTK_RX_BT_32DWORDS,
>> -		MTK_QDMA_GLO_CFG);
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		mtk_w32(eth,
>> +			MTK_TX_WB_DDONE | MTK_TX_DMA_EN |
>> +			MTK_DMA_SIZE_16DWORDS | MTK_NDP_CO_PRO |
>> +			MTK_RX_DMA_EN | MTK_RX_2B_OFFSET |
>> +			MTK_RX_BT_32DWORDS,
>> +			MTK_QDMA_GLO_CFG);
>>   
>> -	mtk_w32(eth,
>> -		MTK_RX_DMA_EN | rx_2b_offset |
>> -		MTK_RX_BT_32DWORDS | MTK_MULTI_EN,
>> -		MTK_PDMA_GLO_CFG);
>> +		mtk_w32(eth,
>> +			MTK_RX_DMA_EN | rx_2b_offset |
>> +			MTK_RX_BT_32DWORDS | MTK_MULTI_EN,
>> +			MTK_PDMA_GLO_CFG);
>> +	} else {
>> +		mtk_w32(eth, MTK_TX_WB_DDONE | MTK_TX_DMA_EN | MTK_RX_DMA_EN |
>> +			MTK_MULTI_EN | MTK_PDMA_SIZE_8DWORDS,
>> +			MTK_PDMA_GLO_CFG);
>> +	}
>>   
>>   	return 0;
>>   }
>> @@ -1816,7 +2043,6 @@ static int mtk_open(struct net_device *dev)
>>   
>>   	phy_start(dev->phydev);
>>   	netif_start_queue(dev);
>> -
>>   	return 0;
>>   }
>>   
>> @@ -1860,7 +2086,8 @@ static int mtk_stop(struct net_device *dev)
>>   	napi_disable(&eth->tx_napi);
>>   	napi_disable(&eth->rx_napi);
>>   
>> -	mtk_stop_dma(eth, MTK_QDMA_GLO_CFG);
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>> +		mtk_stop_dma(eth, MTK_QDMA_GLO_CFG);
>>   	mtk_stop_dma(eth, MTK_PDMA_GLO_CFG);
>>   
>>   	mtk_dma_free(eth);
>> @@ -1922,6 +2149,24 @@ static int mtk_hw_init(struct mtk_eth *eth)
>>   	if (ret)
>>   		goto err_disable_pm;
>>   
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		ret = device_reset(eth->dev);
>> +		if (ret) {
>> +			dev_err(eth->dev, "MAC reset failed!\n");
>> +			goto err_disable_pm;
>> +		}
>> +
>> +		/* enable interrupt delay for RX */
>> +		mtk_w32(eth, MTK_PDMA_DELAY_RX_DELAY, MTK_PDMA_DELAY_INT);
>> +
>> +		/* disable delay and normal interrupt */
>> +		mtk_tx_irq_disable(eth, ~0);
>> +		mtk_rx_irq_disable(eth, ~0);
>> +
>> +		return 0;
>> +	}
>> +
>> +	/* Non-MT7628 handling... */
>>   	ethsys_reset(eth, RSTCTRL_FE);
>>   	ethsys_reset(eth, RSTCTRL_PPE);
>>   
>> @@ -2425,13 +2670,13 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
>>   	eth->netdev[id]->netdev_ops = &mtk_netdev_ops;
>>   	eth->netdev[id]->base_addr = (unsigned long)eth->base;
>>   
>> -	eth->netdev[id]->hw_features = MTK_HW_FEATURES;
>> +	eth->netdev[id]->hw_features = eth->soc->hw_features;
>>   	if (eth->hwlro)
>>   		eth->netdev[id]->hw_features |= NETIF_F_LRO;
>>   
>> -	eth->netdev[id]->vlan_features = MTK_HW_FEATURES &
>> +	eth->netdev[id]->vlan_features = eth->soc->hw_features &
>>   		~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX);
>> -	eth->netdev[id]->features |= MTK_HW_FEATURES;
>> +	eth->netdev[id]->features |= eth->soc->hw_features;
>>   	eth->netdev[id]->ethtool_ops = &mtk_ethtool_ops;
>>   
>>   	eth->netdev[id]->irq = eth->irq[0];
>> @@ -2463,15 +2708,26 @@ static int mtk_probe(struct platform_device *pdev)
>>   	if (IS_ERR(eth->base))
>>   		return PTR_ERR(eth->base);
>>   
>> +	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		eth->tx_int_mask_reg = MTK_PDMA_INT_MASK;
>> +		eth->rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA;
>> +		eth->ip_align = NET_IP_ALIGN;
>> +	} else {
>> +		eth->tx_int_mask_reg = MTK_QDMA_INT_MASK;
>> +		eth->rx_dma_l4_valid = RX_DMA_L4_VALID;
>> +	}
>> +
>>   	spin_lock_init(&eth->page_lock);
>>   	spin_lock_init(&eth->tx_irq_lock);
>>   	spin_lock_init(&eth->rx_irq_lock);
>>   
>> -	eth->ethsys = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
>> -						      "mediatek,ethsys");
>> -	if (IS_ERR(eth->ethsys)) {
>> -		dev_err(&pdev->dev, "no ethsys regmap found\n");
>> -		return PTR_ERR(eth->ethsys);
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		eth->ethsys = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
>> +							      "mediatek,ethsys");
>> +		if (IS_ERR(eth->ethsys)) {
>> +			dev_err(&pdev->dev, "no ethsys regmap found\n");
>> +			return PTR_ERR(eth->ethsys);
>> +		}
>>   	}
>>   
>>   	if (MTK_HAS_CAPS(eth->soc->caps, MTK_INFRA)) {
>> @@ -2570,9 +2826,12 @@ static int mtk_probe(struct platform_device *pdev)
>>   	if (err)
>>   		goto err_free_dev;
>>   
>> -	err = mtk_mdio_init(eth);
>> -	if (err)
>> -		goto err_free_dev;
>> +	/* No MT7628/88 support yet */
>> +	if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
>> +		err = mtk_mdio_init(eth);
>> +		if (err)
>> +			goto err_free_dev;
>> +	}
>>   
>>   	for (i = 0; i < MTK_MAX_DEVS; i++) {
>>   		if (!eth->netdev[i])
>> @@ -2635,12 +2894,14 @@ static int mtk_remove(struct platform_device *pdev)
>>   
>>   static const struct mtk_soc_data mt2701_data = {
>>   	.caps = MT7623_CAPS | MTK_HWLRO,
>> +	.hw_features = MTK_HW_FEATURES,
>>   	.required_clks = MT7623_CLKS_BITMAP,
>>   	.required_pctl = true,
>>   };
>>   
>>   static const struct mtk_soc_data mt7621_data = {
>>   	.caps = MT7621_CAPS,
>> +	.hw_features = MTK_HW_FEATURES,
>>   	.required_clks = MT7621_CLKS_BITMAP,
>>   	.required_pctl = false,
>>   };
>> @@ -2648,19 +2909,29 @@ static const struct mtk_soc_data mt7621_data = {
>>   static const struct mtk_soc_data mt7622_data = {
>>   	.ana_rgc3 = 0x2028,
>>   	.caps = MT7622_CAPS | MTK_HWLRO,
>> +	.hw_features = MTK_HW_FEATURES,
>>   	.required_clks = MT7622_CLKS_BITMAP,
>>   	.required_pctl = false,
>>   };
>>   
>>   static const struct mtk_soc_data mt7623_data = {
>>   	.caps = MT7623_CAPS | MTK_HWLRO,
>> +	.hw_features = MTK_HW_FEATURES,
>>   	.required_clks = MT7623_CLKS_BITMAP,
>>   	.required_pctl = true,
>>   };
>>   
>> +static const struct mtk_soc_data mt7628_data = {
>> +	.caps = MT7628_CAPS,
>> +	.hw_features = MTK_HW_FEATURES_MT7628,
>> +	.required_clks = MT7628_CLKS_BITMAP,
>> +	.required_pctl = false,
>> +};
>> +
>>   static const struct mtk_soc_data mt7629_data = {
>>   	.ana_rgc3 = 0x128,
>>   	.caps = MT7629_CAPS | MTK_HWLRO,
>> +	.hw_features = MTK_HW_FEATURES,
>>   	.required_clks = MT7629_CLKS_BITMAP,
>>   	.required_pctl = false,
>>   };
>> @@ -2670,6 +2941,7 @@ const struct of_device_id of_mtk_match[] = {
>>   	{ .compatible = "mediatek,mt7621-eth", .data = &mt7621_data},
>>   	{ .compatible = "mediatek,mt7622-eth", .data = &mt7622_data},
>>   	{ .compatible = "mediatek,mt7623-eth", .data = &mt7623_data},
>> +	{ .compatible = "mediatek,mt7628-eth", .data = &mt7628_data},
>>   	{ .compatible = "mediatek,mt7629-eth", .data = &mt7629_data},
>>   	{},
>>   };
>> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> index bab94f763e2c..c3866d6451e2 100644
>> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
>> @@ -39,7 +39,8 @@
>>   				 NETIF_F_SG | NETIF_F_TSO | \
>>   				 NETIF_F_TSO6 | \
>>   				 NETIF_F_IPV6_CSUM)
>> -#define NEXT_RX_DESP_IDX(X, Y)	(((X) + 1) & ((Y) - 1))
>> +#define MTK_HW_FEATURES_MT7628	(NETIF_F_SG | NETIF_F_RXCSUM)
>> +#define NEXT_DESP_IDX(X, Y)	(((X) + 1) & ((Y) - 1))
>>   
>>   #define MTK_MAX_RX_RING_NUM	4
>>   #define MTK_HW_LRO_DMA_SIZE	8
>> @@ -118,6 +119,7 @@
>>   /* PDMA Global Configuration Register */
>>   #define MTK_PDMA_GLO_CFG	0xa04
>>   #define MTK_MULTI_EN		BIT(10)
>> +#define MTK_PDMA_SIZE_8DWORDS	(1 << 4)
>>   
>>   /* PDMA Reset Index Register */
>>   #define MTK_PDMA_RST_IDX	0xa08
>> @@ -276,11 +278,18 @@
>>   #define TX_DMA_OWNER_CPU	BIT(31)
>>   #define TX_DMA_LS0		BIT(30)
>>   #define TX_DMA_PLEN0(_x)	(((_x) & MTK_TX_DMA_BUF_LEN) << 16)
>> +#define TX_DMA_PLEN1(_x)	((_x) & MTK_TX_DMA_BUF_LEN)
>>   #define TX_DMA_SWC		BIT(14)
>>   #define TX_DMA_SDL(_x)		(((_x) & 0x3fff) << 16)
>>   
>> +/* PDMA on MT7628 */
>> +#define TX_DMA_DONE		BIT(31)
>> +#define TX_DMA_LS1		BIT(14)
>> +#define TX_DMA_DESP2_DEF	(TX_DMA_LS0 | TX_DMA_DONE)
>> +
>>   /* QDMA descriptor rxd2 */
>>   #define RX_DMA_DONE		BIT(31)
>> +#define RX_DMA_LSO		BIT(30)
>>   #define RX_DMA_PLEN0(_x)	(((_x) & 0x3fff) << 16)
>>   #define RX_DMA_GET_PLEN0(_x)	(((_x) >> 16) & 0x3fff)
>>   
>> @@ -289,6 +298,7 @@
>>   
>>   /* QDMA descriptor rxd4 */
>>   #define RX_DMA_L4_VALID		BIT(24)
>> +#define RX_DMA_L4_VALID_PDMA	BIT(30)		/* when PDMA is used */
>>   #define RX_DMA_FPORT_SHIFT	19
>>   #define RX_DMA_FPORT_MASK	0x7
>>   
>> @@ -412,6 +422,19 @@
>>   #define CO_QPHY_SEL            BIT(0)
>>   #define GEPHY_MAC_SEL          BIT(1)
>>   
>> +/* MT7628/88 specific stuff */
>> +#define MT7628_PDMA_OFFSET	0x0800
>> +#define MT7628_SDM_OFFSET	0x0c00
>> +
>> +#define MT7628_TX_BASE_PTR0	(MT7628_PDMA_OFFSET + 0x00)
>> +#define MT7628_TX_MAX_CNT0	(MT7628_PDMA_OFFSET + 0x04)
>> +#define MT7628_TX_CTX_IDX0	(MT7628_PDMA_OFFSET + 0x08)
>> +#define MT7628_TX_DTX_IDX0	(MT7628_PDMA_OFFSET + 0x0c)
>> +#define MT7628_PST_DTX_IDX0	BIT(0)
>> +
>> +#define MT7628_SDM_MAC_ADRL	(MT7628_SDM_OFFSET + 0x0c)
>> +#define MT7628_SDM_MAC_ADRH	(MT7628_SDM_OFFSET + 0x10)
>> +
>>   struct mtk_rx_dma {
>>   	unsigned int rxd1;
>>   	unsigned int rxd2;
>> @@ -509,6 +532,7 @@ enum mtk_clks_map {
>>   				 BIT(MTK_CLK_SGMII_CK) | \
>>   				 BIT(MTK_CLK_ETH2PLL))
>>   #define MT7621_CLKS_BITMAP	(0)
>> +#define MT7628_CLKS_BITMAP	(0)
>>   #define MT7629_CLKS_BITMAP	(BIT(MTK_CLK_ETHIF) | BIT(MTK_CLK_ESW) |  \
>>   				 BIT(MTK_CLK_GP0) | BIT(MTK_CLK_GP1) | \
>>   				 BIT(MTK_CLK_GP2) | BIT(MTK_CLK_FE) | \
>> @@ -563,6 +587,10 @@ struct mtk_tx_ring {
>>   	struct mtk_tx_dma *last_free;
>>   	u16 thresh;
>>   	atomic_t free_count;
>> +	int dma_size;
>> +	struct mtk_tx_dma *dma_pdma;	/* For MT7628/88 PDMA handling */
>> +	dma_addr_t phys_pdma;
>> +	int cpu_idx;
>>   };
>>   
>>   /* PDMA rx ring mode */
>> @@ -604,6 +632,7 @@ enum mkt_eth_capabilities {
>>   	MTK_HWLRO_BIT,
>>   	MTK_SHARED_INT_BIT,
>>   	MTK_TRGMII_MT7621_CLK_BIT,
>> +	MTK_SOC_MT7628,
>>   
>>   	/* MUX BITS*/
>>   	MTK_ETH_MUX_GDM1_TO_GMAC1_ESW_BIT,
>> @@ -696,6 +725,8 @@ enum mkt_eth_capabilities {
>>   
>>   #define MT7623_CAPS  (MTK_GMAC1_RGMII | MTK_GMAC1_TRGMII | MTK_GMAC2_RGMII)
>>   
>> +#define MT7628_CAPS  (MTK_SHARED_INT | MTK_SOC_MT7628)
>> +
>>   #define MT7629_CAPS  (MTK_GMAC1_SGMII | MTK_GMAC2_SGMII | MTK_GMAC2_GEPHY | \
>>   		      MTK_GDM1_ESW | MTK_MUX_GDM1_TO_GMAC1_ESW | \
>>   		      MTK_MUX_GMAC2_GMAC0_TO_GEPHY | \
>> @@ -707,6 +738,7 @@ enum mkt_eth_capabilities {
>>    * @ana_rgc3:                   The offset for register ANA_RGC3 related to
>>    *				sgmiisys syscon
>>    * @caps			Flags shown the extra capability for the SoC
>> + * @hw_features			Flags shown HW features
>>    * @required_clks		Flags shown the bitmap for required clocks on
>>    *				the target SoC
>>    * @required_pctl		A bool value to show whether the SoC requires
>> @@ -717,6 +749,7 @@ struct mtk_soc_data {
>>   	u32		caps;
>>   	u32		required_clks;
>>   	bool		required_pctl;
>> +	netdev_features_t hw_features;
>>   };
>>   
>>   /* currently no SoC has more than 2 macs */
>> @@ -810,6 +843,10 @@ struct mtk_eth {
>>   	unsigned long			state;
>>   
>>   	const struct mtk_soc_data	*soc;
>> +
>> +	u32				tx_int_mask_reg;
>> +	u32				rx_dma_l4_valid;
>> +	int				ip_align;
>>   };
>>   
>>   /* struct mtk_mac -	the structure that holds the info about the MACs of the
>> -- 
>> 2.22.0
>>
>>
>> _______________________________________________
>> Linux-mediatek mailing list
>> Linux-mediatek@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-mediatek

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply

* [PATCH AUTOSEL 5.1 121/141] net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn
From: Sasha Levin @ 2019-07-19  4:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Aya Levin, Feras Daoud, Saeed Mahameed, Sasha Levin, netdev,
	linux-rdma
In-Reply-To: <20190719040246.15945-1-sashal@kernel.org>

From: Aya Levin <ayal@mellanox.com>

[ Upstream commit ef1ce7d7b67b46661091c7ccc0396186b7a247ef ]

Check return value from mlx5e_attach_netdev, add error path on failure.

Fixes: 48935bbb7ae8 ("net/mlx5e: IPoIB, Add netdevice profile skeleton")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index 4eac42555c7d..5d0783e55f42 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -698,7 +698,9 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 
 	prof->init(mdev, netdev, prof, ipriv);
 
-	mlx5e_attach_netdev(epriv);
+	err = mlx5e_attach_netdev(epriv);
+	if (err)
+		goto detach;
 	netif_carrier_off(netdev);
 
 	/* set rdma_netdev func pointers */
@@ -714,6 +716,11 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 
 	return 0;
 
+detach:
+	prof->cleanup(epriv);
+	if (ipriv->sub_interface)
+		return err;
+	mlx5e_destroy_mdev_resources(mdev);
 destroy_ht:
 	mlx5i_pkey_qpn_ht_cleanup(netdev);
 	return err;
-- 
2.20.1


^ permalink raw reply related

* [PATCH AUTOSEL 5.2 155/171] net/mlx5: E-Switch, Fix default encap mode
From: Sasha Levin @ 2019-07-19  3:56 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Maor Gottlieb, Roi Dayan, Saeed Mahameed, Sasha Levin, netdev,
	linux-rdma
In-Reply-To: <20190719035643.14300-1-sashal@kernel.org>

From: Maor Gottlieb <maorg@mellanox.com>

[ Upstream commit 9a64144d683a4395f57562d90247c61a0bf5105f ]

Encap mode is related to switchdev mode only. Move the init of
the encap mode to eswitch_offloads. Before this change, we reported
that eswitch supports encap, even tough the device was in non
SRIOV mode.

Fixes: 7768d1971de67 ('net/mlx5: E-Switch, Add control for encapsulation')
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c          | 5 -----
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 6a921e24cd5e..e9339e7d6a18 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1882,11 +1882,6 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
 	esw->enabled_vports = 0;
 	esw->mode = SRIOV_NONE;
 	esw->offloads.inline_mode = MLX5_INLINE_MODE_NONE;
-	if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, reformat) &&
-	    MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap))
-		esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC;
-	else
-		esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
 
 	dev->priv.eswitch = esw;
 	return 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 47b446d30f71..c2beadc41c40 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1840,6 +1840,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int vf_nvports,
 {
 	int err;
 
+	if (MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, reformat) &&
+	    MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, decap))
+		esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC;
+	else
+		esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
+
 	err = esw_offloads_steering_init(esw, vf_nvports, total_nvports);
 	if (err)
 		return err;
@@ -1901,6 +1907,7 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw)
 	esw_offloads_devcom_cleanup(esw);
 	esw_offloads_unload_all_reps(esw, num_vfs);
 	esw_offloads_steering_cleanup(esw);
+	esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE;
 }
 
 static int esw_mode_from_devlink(u16 mode, u16 *mlx5_mode)
-- 
2.20.1


^ permalink raw reply related

* [PATCH AUTOSEL 5.2 150/171] net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn
From: Sasha Levin @ 2019-07-19  3:56 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Aya Levin, Feras Daoud, Saeed Mahameed, Sasha Levin, netdev,
	linux-rdma
In-Reply-To: <20190719035643.14300-1-sashal@kernel.org>

From: Aya Levin <ayal@mellanox.com>

[ Upstream commit ef1ce7d7b67b46661091c7ccc0396186b7a247ef ]

Check return value from mlx5e_attach_netdev, add error path on failure.

Fixes: 48935bbb7ae8 ("net/mlx5e: IPoIB, Add netdevice profile skeleton")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
index 9ca492b430d8..603d294757b4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
@@ -698,7 +698,9 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 
 	prof->init(mdev, netdev, prof, ipriv);
 
-	mlx5e_attach_netdev(epriv);
+	err = mlx5e_attach_netdev(epriv);
+	if (err)
+		goto detach;
 	netif_carrier_off(netdev);
 
 	/* set rdma_netdev func pointers */
@@ -714,6 +716,11 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 
 	return 0;
 
+detach:
+	prof->cleanup(epriv);
+	if (ipriv->sub_interface)
+		return err;
+	mlx5e_destroy_mdev_resources(mdev);
 destroy_ht:
 	mlx5i_pkey_qpn_ht_cleanup(netdev);
 	return err;
-- 
2.20.1


^ permalink raw reply related

* [PATCH AUTOSEL 5.2 143/171] rds: Accept peer connection reject messages due to incompatible version
From: Sasha Levin @ 2019-07-19  3:56 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gerd Rausch, Zhu Yanjun, Santosh Shilimkar, Sasha Levin, netdev,
	linux-rdma
In-Reply-To: <20190719035643.14300-1-sashal@kernel.org>

From: Gerd Rausch <gerd.rausch@oracle.com>

[ Upstream commit 8c6166cfc9cd48e93d9176561e50b63cef4330d5 ]

Prior to
commit d021fabf525ff ("rds: rdma: add consumer reject")

function "rds_rdma_cm_event_handler_cmn" would always honor a rejected
connection attempt by issuing a "rds_conn_drop".

The commit mentioned above added a "break", eliminating
the "fallthrough" case and made the "rds_conn_drop" rather conditional:

Now it only happens if a "consumer defined" reject (i.e. "rdma_reject")
carries an integer-value of "1" inside "private_data":

  if (!conn)
    break;
    err = (int *)rdma_consumer_reject_data(cm_id, event, &len);
    if (!err || (err && ((*err) == RDS_RDMA_REJ_INCOMPAT))) {
      pr_warn("RDS/RDMA: conn <%pI6c, %pI6c> rejected, dropping connection\n",
              &conn->c_laddr, &conn->c_faddr);
              conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
              rds_conn_drop(conn);
    }
    rdsdebug("Connection rejected: %s\n",
             rdma_reject_msg(cm_id, event->status));
    break;
    /* FALLTHROUGH */
A number of issues are worth mentioning here:
   #1) Previous versions of the RDS code simply rejected a connection
       by calling "rdma_reject(cm_id, NULL, 0);"
       So the value of the payload in "private_data" will not be "1",
       but "0".

   #2) Now the code has become dependent on host byte order and sizing.
       If one peer is big-endian, the other is little-endian,
       or there's a difference in sizeof(int) (e.g. ILP64 vs LP64),
       the *err check does not work as intended.

   #3) There is no check for "len" to see if the data behind *err is even valid.
       Luckily, it appears that the "rdma_reject(cm_id, NULL, 0)" will always
       carry 148 bytes of zeroized payload.
       But that should probably not be relied upon here.

   #4) With the added "break;",
       we might as well drop the misleading "/* FALLTHROUGH */" comment.

This commit does _not_ address issue #2, as the sender would have to
agree on a byte order as well.

Here is the sequence of messages in this observed error-scenario:
   Host-A is pre-QoS changes (excluding the commit mentioned above)
   Host-B is post-QoS changes (including the commit mentioned above)

   #1 Host-B
      issues a connection request via function "rds_conn_path_transition"
      connection state transitions to "RDS_CONN_CONNECTING"

   #2 Host-A
      rejects the incompatible connection request (from #1)
      It does so by calling "rdma_reject(cm_id, NULL, 0);"

   #3 Host-B
      receives an "RDMA_CM_EVENT_REJECTED" event (from #2)
      But since the code is changed in the way described above,
      it won't drop the connection here, simply because "*err == 0".

   #4 Host-A
      issues a connection request

   #5 Host-B
      receives an "RDMA_CM_EVENT_CONNECT_REQUEST" event
      and ends up calling "rds_ib_cm_handle_connect".
      But since the state is already in "RDS_CONN_CONNECTING"
      (as of #1) it will end up issuing a "rdma_reject" without
      dropping the connection:
         if (rds_conn_state(conn) == RDS_CONN_CONNECTING) {
             /* Wait and see - our connect may still be succeeding */
             rds_ib_stats_inc(s_ib_connect_raced);
         }
         goto out;

   #6 Host-A
      receives an "RDMA_CM_EVENT_REJECTED" event (from #5),
      drops the connection and tries again (goto #4) until it gives up.

Tested-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/rds/rdma_transport.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index 46bce8389066..9db455d02255 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -112,7 +112,9 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
 		if (!conn)
 			break;
 		err = (int *)rdma_consumer_reject_data(cm_id, event, &len);
-		if (!err || (err && ((*err) == RDS_RDMA_REJ_INCOMPAT))) {
+		if (!err ||
+		    (err && len >= sizeof(*err) &&
+		     ((*err) <= RDS_RDMA_REJ_INCOMPAT))) {
 			pr_warn("RDS/RDMA: conn <%pI6c, %pI6c> rejected, dropping connection\n",
 				&conn->c_laddr, &conn->c_faddr);
 			conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
@@ -122,7 +124,6 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
 		rdsdebug("Connection rejected: %s\n",
 			 rdma_reject_msg(cm_id, event->status));
 		break;
-		/* FALLTHROUGH */
 	case RDMA_CM_EVENT_ADDR_ERROR:
 	case RDMA_CM_EVENT_ROUTE_ERROR:
 	case RDMA_CM_EVENT_CONNECT_ERROR:
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH iproute2 net-next v5 1/5] etf: Add skip_sock_check
From: Stephen Hemminger @ 2019-07-19  5:12 UTC (permalink / raw)
  To: Vedang Patel
  Cc: netdev, jhs, xiyou.wangcong, jiri, vinicius.gomes,
	leandro.maciel.dorileo, jakub.kicinski, m-karicheri2, dsahern
In-Reply-To: <1563479743-8371-1-git-send-email-vedang.patel@intel.com>

On Thu, 18 Jul 2019 12:55:39 -0700
Vedang Patel <vedang.patel@intel.com> wrote:

> -	print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s",
> +	print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s ",
>  				(qopt->flags & TC_ETF_DEADLINE_MODE_ON) ? "on" : "off");
> +	print_string(PRINT_ANY, "skip_sock_check", "skip_sock_check %s",
> +				(qopt->flags & TC_ETF_SKIP_SOCK_CHECK) ? "on" : "off");

These should really be boolean options in JSON, not string values.

^ permalink raw reply

* Re: [PATCH net] be2net: Synchronize be_update_queues with dev_watchdog
From: Benjamin Poirier @ 2019-07-19  5:26 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: David Miller, Ajit Khaparde, Sathya Perla, Somnath Kotur,
	Sriharsha Basavapatna, Saeed Mahameed, Firo Yang, netdev
In-Reply-To: <42269a37-0353-29c8-ce13-51cb2feeb9af@gmail.com>

On 2019/07/18 10:23, Florian Fainelli wrote:
> On 7/17/19 6:42 PM, Benjamin Poirier wrote:
> > As pointed out by Firo Yang, a netdev tx timeout may trigger just before an
> > ethtool set_channels operation is started. be_tx_timeout(), which dumps
> > some queue structures, is not written to run concurrently with
> > be_update_queues(), which frees/allocates those queues structures. Add some
> > synchronization between the two.
> > 
> > Message-id: <CH2PR18MB31898E033896F9760D36BFF288C90@CH2PR18MB3189.namprd18.prod.outlook.com>
> > Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
> 
> Would not moving the netif_tx_disable() in be_close() further up in the
> function resolve that problem as well?

Thanks for your review Florian,

No, netif_tx_disable() doesn't provide mutual exclusion with
dev_watchdog(). You can have:

cpu0                               cpu1
\ dev_watchdog
       \ netif_tx_lock
              \ be_tx_timeout
                     ...
                                   \ be_set_channels
                                          \ be_update_queues
                                                 \ netif_carrier_off
                                                 \ netif_tx_disable
                                                 ...
                                                 \ be_clear_queues
                     still running in
                     be_tx_timeout(),
                     boom!

^ permalink raw reply

* KASAN: slab-out-of-bounds Write in check_noncircular
From: syzbot @ 2019-07-19  5:48 UTC (permalink / raw)
  To: ast, daniel, john.fastabend, linux-kernel, netdev, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    22051d9c Merge tag 'platform-drivers-x86-v5.3-2' of git://..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14090a34600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=135cb826ac59d7fc
dashboard link: https://syzkaller.appspot.com/bug?extid=e2416b38b581ad58bc1e
compiler:       clang version 9.0.0 (/home/glider/llvm/clang  
80fee25776c2fb61e74c1ecb1a523375c2500b69)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1397afe0600000

The bug was bisected to:

commit e9db4ef6bf4ca9894bb324c76e01b8f1a16b2650
Author: John Fastabend <john.fastabend@gmail.com>
Date:   Sat Jun 30 13:17:47 2018 +0000

     bpf: sockhash fix omitted bucket lock in sock_close

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=131928f4600000
final crash:    https://syzkaller.appspot.com/x/report.txt?x=109928f4600000
console output: https://syzkaller.appspot.com/x/log.txt?x=171928f4600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+e2416b38b581ad58bc1e@syzkaller.appspotmail.com
Fixes: e9db4ef6bf4c ("bpf: sockhash fix omitted bucket lock in sock_close")

==================================================================
BUG: KASAN: slab-out-of-bounds in check_noncircular+0x91/0x560  
/kernel/locking/lockdep.c:1722
Write of size 56 at addr ffff88809752a1a0 by task syz-executor.2/9504

CPU: 1 PID: 9504 Comm: syz-executor.2 Not tainted 5.2.0+ #34
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:

Allocated by task 2258096832:
------------[ cut here ]------------
kernel BUG at mm/slab.c:4179!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 9504 Comm: syz-executor.2 Not tainted 5.2.0+ #34
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:__check_heap_object+0xcb/0xd0 /mm/slab.c:4203
Code: 4c 89 d1 4d 89 c8 e8 34 a6 07 00 5b 41 5e 5d c3 49 8b 73 58 41 0f b6  
d0 48 c7 c7 0f eb 7e 88 4c 89 d1 4d 89 c8 e8 d5 a6 07 00 <0f> 0b 0f 1f 00  
55 48 89 e5 53 48 83 ff 10 0f 84 90 00 00 00 48 85
RSP: 0018:ffff8880975297a0 EFLAGS: 00010046
RAX: 0000000000000fc5 RBX: 00000000000011e0 RCX: 000000000000000c
RDX: 000000000000000c RSI: 0000000000000002 RDI: 0000000000000001
RBP: ffff8880975297b0 R08: 0000000000000000 R09: fffff940004ba941
R10: ffff8880975298a0 R11: ffff8880aa5918c0 R12: ffff8880975298a2
R13: 01fffc0000010200 R14: ffff8880975286c0 R15: ffff8880975298a0
FS:  0000555556816940(0000) GS:ffff8880aeb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff8aff8f88 CR3: 000000008586d000 CR4: 00000000001406e0
Call Trace:
Modules linked in:
---[ end trace 35842f070e95906d ]---
RIP: 0010:__check_heap_object+0xcb/0xd0 /mm/slab.c:4203
Code: 4c 89 d1 4d 89 c8 e8 34 a6 07 00 5b 41 5e 5d c3 49 8b 73 58 41 0f b6  
d0 48 c7 c7 0f eb 7e 88 4c 89 d1 4d 89 c8 e8 d5 a6 07 00 <0f> 0b 0f 1f 00  
55 48 89 e5 53 48 83 ff 10 0f 84 90 00 00 00 48 85
RSP: 0018:ffff8880975297a0 EFLAGS: 00010046
RAX: 0000000000000fc5 RBX: 00000000000011e0 RCX: 000000000000000c
RDX: 000000000000000c RSI: 0000000000000002 RDI: 0000000000000001
RBP: ffff8880975297b0 R08: 0000000000000000 R09: fffff940004ba941
R10: ffff8880975298a0 R11: ffff8880aa5918c0 R12: ffff8880975298a2
R13: 01fffc0000010200 R14: ffff8880975286c0 R15: ffff8880975298a0
FS:  0000555556816940(0000) GS:ffff8880aeb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff8aff8f88 CR3: 000000008586d000 CR4: 00000000001406e0


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply

* Re: [PATCH] net: ethernet: mediatek: Add MT7628/88 SoC support
From: kbuild test robot @ 2019-07-19  5:52 UTC (permalink / raw)
  To: Stefan Roese
  Cc: kbuild-all, netdev, linux-mediatek, René van Dorst,
	Sean Wang, Felix Fietkau, John Crispin
In-Reply-To: <20190717110243.14240-1-sr@denx.de>

[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]

Hi Stefan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20190718]
[cannot apply to v5.2]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Stefan-Roese/net-ethernet-mediatek-Add-MT7628-88-SoC-support/20190719-020931
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):


vim +649 drivers/net//ethernet/mediatek/mtk_eth_soc.c

   646	
   647	static int txd_to_idx(struct mtk_tx_ring *ring, struct mtk_tx_dma *dma)
   648	{
 > 649		return ((u32)dma - (u32)ring->dma) / sizeof(*dma);
   650	}
   651	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 66257 bytes --]

^ permalink raw reply

* [PATCH] net-ipv6-ndisc: add support for RFC7710 RA Captive Portal Identifier
From: Maciej Żenczykowski @ 2019-07-19  6:30 UTC (permalink / raw)
  To: Maciej Żenczykowski, David S . Miller
  Cc: netdev, Lorenzo Colitti, Remin Nguyen Van, Alexey I . Froloff

From: Maciej Żenczykowski <maze@google.com>

This is trivial since we already have support for the entirely
identical (from the kernel's point of view) RDNSS and DNSSL that
also contain opaque data that needs to be passed down to userspace.

As specified in RFC7710, Captive Portal option contains a URL.
8-bit identifier of the option type as assigned by the IANA is 37.
This option should also be treated as userland.

Hence, treat ND option 37 as userland (Captive Portal support)

See:
  https://tools.ietf.org/html/rfc7710
  https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml

Fixes: e35f30c131a56
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: Remin Nguyen Van <reminv@google.com>
Cc: Alexey I. Froloff <raorn@raorn.name>
---
 include/net/ndisc.h | 1 +
 net/ipv6/ndisc.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 366150053043..b2f715ca0567 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -40,6 +40,7 @@ enum {
 	ND_OPT_RDNSS = 25,		/* RFC5006 */
 	ND_OPT_DNSSL = 31,		/* RFC6106 */
 	ND_OPT_6CO = 34,		/* RFC6775 */
+	ND_OPT_CAPTIVE_PORTAL = 37,	/* RFC7710 */
 	__ND_OPT_MAX
 };
 
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 083cc1c94cd3..53caf59c591e 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -196,6 +196,7 @@ static inline int ndisc_is_useropt(const struct net_device *dev,
 {
 	return opt->nd_opt_type == ND_OPT_RDNSS ||
 		opt->nd_opt_type == ND_OPT_DNSSL ||
+		opt->nd_opt_type == ND_OPT_CAPTIVE_PORTAL ||
 		ndisc_ops_is_useropt(dev, opt->nd_opt_type);
 }
 
-- 
2.22.0.657.g960e92d24f-goog


^ permalink raw reply related

* Re: [PATCH] [net-next] netfilter: bridge: make NF_TABLES_BRIDGE tristate
From: Pablo Neira Ayuso @ 2019-07-19  6:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jozsef Kadlecsik, Florian Westphal, Roopa Prabhu,
	Nikolay Aleksandrov, David S. Miller, wenxu, netfilter-devel,
	coreteam, bridge, netdev, linux-kernel
In-Reply-To: <20190718190110.akn54iwb2mui72cd@salvia>

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

On Thu, Jul 18, 2019 at 09:01:10PM +0200, Pablo Neira Ayuso wrote:
> On Wed, Jul 10, 2019 at 10:08:20AM +0200, Arnd Bergmann wrote:
> > The new nft_meta_bridge code fails to link as built-in when NF_TABLES
> > is a loadable module.
> > 
> > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_eval':
> > nft_meta_bridge.c:(.text+0x1e8): undefined reference to `nft_meta_get_eval'
> > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_init':
> > nft_meta_bridge.c:(.text+0x468): undefined reference to `nft_meta_get_init'
> > nft_meta_bridge.c:(.text+0x49c): undefined reference to `nft_parse_register'
> > nft_meta_bridge.c:(.text+0x4cc): undefined reference to `nft_validate_register_store'
> > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_module_exit':
> > nft_meta_bridge.c:(.exit.text+0x14): undefined reference to `nft_unregister_expr'
> > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_module_init':
> > nft_meta_bridge.c:(.init.text+0x14): undefined reference to `nft_register_expr'
> > net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x60): undefined reference to `nft_meta_get_dump'
> > net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x88): undefined reference to `nft_meta_set_eval'
> > 
> > This can happen because the NF_TABLES_BRIDGE dependency itself is just a
> > 'bool'.  Make the symbol a 'tristate' instead so Kconfig can propagate the
> > dependencies correctly.
> 
> Hm. Something breaks here. Investigating. Looks like bridge support is
> gone after this, nft fails to register the filter chain type:
> 
> # nft add table bridge x
> # nft add chain bridge x y { type filter hook input priority 0\; }
> Error: Could not process rule: No such file or directory

Found it. It seems this patch is needed, on top of your patch.

I can just squash this chunk into your original patch and push it out
if you're OK witht this.

Thanks.

[-- Attachment #2: x.patch --]
[-- Type: text/x-diff, Size: 523 bytes --]

diff --git a/net/netfilter/nft_chain_filter.c b/net/netfilter/nft_chain_filter.c
index 3fd540b2c6ba..b5d5d071d765 100644
--- a/net/netfilter/nft_chain_filter.c
+++ b/net/netfilter/nft_chain_filter.c
@@ -193,7 +193,7 @@ static inline void nft_chain_filter_inet_init(void) {}
 static inline void nft_chain_filter_inet_fini(void) {}
 #endif /* CONFIG_NF_TABLES_IPV6 */
 
-#ifdef CONFIG_NF_TABLES_BRIDGE
+#if IS_ENABLED(CONFIG_NF_TABLES_BRIDGE)
 static unsigned int
 nft_do_chain_bridge(void *priv,
 		    struct sk_buff *skb,

^ permalink raw reply related

* Re: [PATCH] [net-next] netfilter: bridge: make NF_TABLES_BRIDGE tristate
From: Arnd Bergmann @ 2019-07-19  6:49 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Jozsef Kadlecsik, Florian Westphal, Roopa Prabhu,
	Nikolay Aleksandrov, David S. Miller, wenxu, netfilter-devel,
	coreteam, bridge, Networking, Linux Kernel Mailing List
In-Reply-To: <20190719063749.45io5pxcxrlmrqqn@salvia>

On Fri, Jul 19, 2019 at 8:37 AM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> On Thu, Jul 18, 2019 at 09:01:10PM +0200, Pablo Neira Ayuso wrote:
> > On Wed, Jul 10, 2019 at 10:08:20AM +0200, Arnd Bergmann wrote:
> > > The new nft_meta_bridge code fails to link as built-in when NF_TABLES
> > > is a loadable module.
> > >
> > > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_eval':
> > > nft_meta_bridge.c:(.text+0x1e8): undefined reference to `nft_meta_get_eval'
> > > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_get_init':
> > > nft_meta_bridge.c:(.text+0x468): undefined reference to `nft_meta_get_init'
> > > nft_meta_bridge.c:(.text+0x49c): undefined reference to `nft_parse_register'
> > > nft_meta_bridge.c:(.text+0x4cc): undefined reference to `nft_validate_register_store'
> > > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_module_exit':
> > > nft_meta_bridge.c:(.exit.text+0x14): undefined reference to `nft_unregister_expr'
> > > net/bridge/netfilter/nft_meta_bridge.o: In function `nft_meta_bridge_module_init':
> > > nft_meta_bridge.c:(.init.text+0x14): undefined reference to `nft_register_expr'
> > > net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x60): undefined reference to `nft_meta_get_dump'
> > > net/bridge/netfilter/nft_meta_bridge.o:(.rodata+0x88): undefined reference to `nft_meta_set_eval'
> > >
> > > This can happen because the NF_TABLES_BRIDGE dependency itself is just a
> > > 'bool'.  Make the symbol a 'tristate' instead so Kconfig can propagate the
> > > dependencies correctly.
> >
> > Hm. Something breaks here. Investigating. Looks like bridge support is
> > gone after this, nft fails to register the filter chain type:
> >
> > # nft add table bridge x
> > # nft add chain bridge x y { type filter hook input priority 0\; }
> > Error: Could not process rule: No such file or directory
>
> Found it. It seems this patch is needed, on top of your patch.

Right, makes sense.

> I can just squash this chunk into your original patch and push it out
> if you're OK witht this.

Yes, please do.

      Arnd

^ permalink raw reply

* BUG: unable to handle kernel paging request in corrupted (2)
From: syzbot @ 2019-07-19  7:28 UTC (permalink / raw)
  To: linux-kernel, netdev, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    49d05fe2 ipv6: rt6_check should return NULL if 'from' is N..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=104b5f70600000
kernel config:  https://syzkaller.appspot.com/x/.config?x=87305c3ca9c25c70
dashboard link: https://syzkaller.appspot.com/bug?extid=08b7a2c58acdfa12c82d
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=143a78f4600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+08b7a2c58acdfa12c82d@syzkaller.appspotmail.com

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
BUG: unable to handle page fault for address: 00000000ffffffff
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 9ad32067 P4D 9ad32067 PUD 0
Oops: 0010 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 9920 Comm: syz-executor.1 Not tainted 5.2.0+ #91
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
BUG: kernel NULL pointer dereference, address: 0000000000000002
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 9ad32067 P4D 9ad32067 PUD 9ad33067 PMD 0
Oops: 0010 [#2] PREEMPT SMP KASAN
CPU: 0 PID: 9920 Comm: syz-executor.1 Not tainted 5.2.0+ #91
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:0x2
Code: Bad RIP value.
RSP: 0000:ffff888092932a20 EFLAGS: 00010086
RAX: 000000000000002d RBX: ffff888092932a40 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff815c1016 RDI: ffffed1012526536
RBP: ffffffff81724d28 R08: 000000000000002d R09: ffffed1015d044fa
R10: ffffed1015d044f9 R11: ffff8880ae8227cf R12: ffffffff81b3e334
R13: 0000000000000010 R14: 0000000000000000 R15: 1ffff1101252654b
FS:  000055555572a940(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd8 CR3: 000000009c4d1000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox