1. 08 Dec, 2020 10 commits
    • Fugang Duan's avatar
      net: stmmac: free tx skb buffer in stmmac_resume() · 4ec236c7
      Fugang Duan authored
      When do suspend/resume test, there have WARN_ON() log dump from
      stmmac_xmit() funciton, the code logic:
      	entry = tx_q->cur_tx;
      	first_entry = entry;
      	WARN_ON(tx_q->tx_skbuff[first_entry]);
      
      In normal case, tx_q->tx_skbuff[txq->cur_tx] should be NULL because
      the skb should be handled and freed in stmmac_tx_clean().
      
      But stmmac_resume() reset queue parameters like below, skb buffers
      may not be freed.
      	tx_q->cur_tx = 0;
      	tx_q->dirty_tx = 0;
      
      So free tx skb buffer in stmmac_resume() to avoid warning and
      memory leak.
      
      log:
      [   46.139824] ------------[ cut here ]------------
      [   46.144453] WARNING: CPU: 0 PID: 0 at drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3235 stmmac_xmit+0x7a0/0x9d0
      [   46.154969] Modules linked in: crct10dif_ce vvcam(O) flexcan can_dev
      [   46.161328] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O      5.4.24-2.1.0+g2ad925d15481 #1
      [   46.170369] Hardware name: NXP i.MX8MPlus EVK board (DT)
      [   46.175677] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [   46.180465] pc : stmmac_xmit+0x7a0/0x9d0
      [   46.184387] lr : dev_hard_start_xmit+0x94/0x158
      [   46.188913] sp : ffff800010003cc0
      [   46.192224] x29: ffff800010003cc0 x28: ffff000177e2a100
      [   46.197533] x27: ffff000176ef0840 x26: ffff000176ef0090
      [   46.202842] x25: 0000000000000000 x24: 0000000000000000
      [   46.208151] x23: 0000000000000003 x22: ffff8000119ddd30
      [   46.213460] x21: ffff00017636f000 x20: ffff000176ef0cc0
      [   46.218769] x19: 0000000000000003 x18: 0000000000000000
      [   46.224078] x17: 0000000000000000 x16: 0000000000000000
      [   46.229386] x15: 0000000000000079 x14: 0000000000000000
      [   46.234695] x13: 0000000000000003 x12: 0000000000000003
      [   46.240003] x11: 0000000000000010 x10: 0000000000000010
      [   46.245312] x9 : ffff00017002b140 x8 : 0000000000000000
      [   46.250621] x7 : ffff00017636f000 x6 : 0000000000000010
      [   46.255930] x5 : 0000000000000001 x4 : ffff000176ef0000
      [   46.261238] x3 : 0000000000000003 x2 : 00000000ffffffff
      [   46.266547] x1 : ffff000177e2a000 x0 : 0000000000000000
      [   46.271856] Call trace:
      [   46.274302]  stmmac_xmit+0x7a0/0x9d0
      [   46.277874]  dev_hard_start_xmit+0x94/0x158
      [   46.282056]  sch_direct_xmit+0x11c/0x338
      [   46.285976]  __qdisc_run+0x118/0x5f0
      [   46.289549]  net_tx_action+0x110/0x198
      [   46.293297]  __do_softirq+0x120/0x23c
      [   46.296958]  irq_exit+0xb8/0xd8
      [   46.300098]  __handle_domain_irq+0x64/0xb8
      [   46.304191]  gic_handle_irq+0x5c/0x148
      [   46.307936]  el1_irq+0xb8/0x180
      [   46.311076]  cpuidle_enter_state+0x84/0x360
      [   46.315256]  cpuidle_enter+0x34/0x48
      [   46.318829]  call_cpuidle+0x18/0x38
      [   46.322314]  do_idle+0x1e0/0x280
      [   46.325539]  cpu_startup_entry+0x24/0x40
      [   46.329460]  rest_init+0xd4/0xe0
      [   46.332687]  arch_call_rest_init+0xc/0x14
      [   46.336695]  start_kernel+0x420/0x44c
      [   46.340353] ---[ end trace bc1ee695123cbacd ]---
      
      Fixes: 47dd7a54 ("net: add support for STMicroelectronics Ethernet controllers.")
      Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ec236c7
    • Fugang Duan's avatar
      net: stmmac: start phylink instance before stmmac_hw_setup() · 36d18b56
      Fugang Duan authored
      Start phylink instance and resume back the PHY to supply
      RX clock to MAC before MAC layer initialization by calling
      .stmmac_hw_setup(), since DMA reset depends on the RX clock,
      otherwise DMA reset cost maximum timeout value then finally
      timeout.
      
      Fixes: 74371272 ("net: stmmac: Convert to phylink and remove phylib logic")
      Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      36d18b56
    • Fugang Duan's avatar
      net: stmmac: increase the timeout for dma reset · 9d14edfd
      Fugang Duan authored
      Current timeout value is not enough for gmac5 dma reset
      on imx8mp platform, increase the timeout range.
      Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d14edfd
    • Jarod Wilson's avatar
      bonding: fix feature flag setting at init time · 007ab534
      Jarod Wilson authored
      Don't try to adjust XFRM support flags if the bond device isn't yet
      registered. Bad things can currently happen when netdev_change_features()
      is called without having wanted_features fully filled in yet. This code
      runs both on post-module-load mode changes, as well as at module init
      time, and when run at module init time, it is before register_netdevice()
      has been called and filled in wanted_features. The empty wanted_features
      led to features also getting emptied out, which was definitely not the
      intended behavior, so prevent that from happening.
      
      Originally, I'd hoped to stop adjusting wanted_features at all in the
      bonding driver, as it's documented as being something only the network
      core should touch, but we actually do need to do this to properly update
      both the features and wanted_features fields when changing the bond type,
      or we get to a situation where ethtool sees:
      
          esp-hw-offload: off [requested on]
      
      I do think we should be using netdev_update_features instead of
      netdev_change_features here though, so we only send notifiers when the
      features actually changed.
      
      Fixes: a3b658cf ("bonding: allow xfrm offload setup post-module-load")
      Reported-by: default avatarIvan Vecera <ivecera@redhat.com>
      Suggested-by: default avatarIvan Vecera <ivecera@redhat.com>
      Cc: Jay Vosburgh <j.vosburgh@gmail.com>
      Cc: Veaceslav Falico <vfalico@gmail.com>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Link: https://lore.kernel.org/r/20201205172229.576587-1-jarod@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      007ab534
    • Jakub Kicinski's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · 819f56ba
      Jakub Kicinski authored
      Steffen Klassert says:
      
      ====================
      pull request (net): ipsec 2020-12-07
      
      1) Sysbot reported fixes for the new 64/32 bit compat layer.
         From Dmitry Safonov.
      
      2) Fix a memory leak in xfrm_user_policy that was introduced
         by adding the 64/32 bit compat layer. From Yu Kuai.
      
      * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec:
        net: xfrm: fix memory leak in xfrm_user_policy()
        xfrm/compat: Don't allocate memory with __GFP_ZERO
        xfrm/compat: memset(0) 64-bit padding at right place
        xfrm/compat: Translate by copying XFRMA_UNSPEC attribute
      ====================
      
      Link: https://lore.kernel.org/r/20201207093937.2874932-1-steffen.klassert@secunet.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      819f56ba
    • Martin Blumenstingl's avatar
      net: stmmac: dwmac-meson8b: fix mask definition of the m250_sel mux · 82ca4c92
      Martin Blumenstingl authored
      The m250_sel mux clock uses bit 4 in the PRG_ETH0 register. Fix this by
      shifting the PRG_ETH0_CLK_M250_SEL_MASK accordingly as the "mask" in
      struct clk_mux expects the mask relative to the "shift" field in the
      same struct.
      
      While here, get rid of the PRG_ETH0_CLK_M250_SEL_SHIFT macro and use
      __ffs() to determine it from the existing PRG_ETH0_CLK_M250_SEL_MASK
      macro.
      
      Fixes: 566e8251 ("net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC")
      Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Link: https://lore.kernel.org/r/20201205213207.519341-1-martin.blumenstingl@googlemail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      82ca4c92
    • Christophe JAILLET's avatar
      dpaa2-mac: Add a missing of_node_put after of_device_is_available · bbef72c6
      Christophe JAILLET authored
      Add an 'of_node_put()' call when a tested device node is not available.
      
      Fixes: 94ae899b ("dpaa2-mac: add PCS support through the Lynx module")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Link: https://lore.kernel.org/r/20201206151339.44306-1-christophe.jaillet@wanadoo.frSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bbef72c6
    • Jianguo Wu's avatar
      mptcp: print new line in mptcp_seq_show() if mptcp isn't in use · f55628b3
      Jianguo Wu authored
      When do cat /proc/net/netstat, the output isn't append with a new line, it looks like this:
      [root@localhost ~]# cat /proc/net/netstat
      ...
      MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0[root@localhost ~]#
      
      This is because in mptcp_seq_show(), if mptcp isn't in use, net->mib.mptcp_statistics is NULL,
      so it just puts all 0 after "MPTcpExt:", and return, forgot the '\n'.
      
      After this patch:
      
      [root@localhost ~]# cat /proc/net/netstat
      ...
      MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0
      [root@localhost ~]#
      
      Fixes: fc518953 ("mptcp: add and use MIB counter infrastructure")
      Signed-off-by: default avatarJianguo Wu <wujianguo@chinatelecom.cn>
      Acked-by: default avatarFlorian Westphal <fw@strlen.de>
      Link: https://lore.kernel.org/r/142e2fd9-58d9-bb13-fb75-951cccc2331e@163.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f55628b3
    • Joseph Huang's avatar
      bridge: Fix a deadlock when enabling multicast snooping · 851d0a73
      Joseph Huang authored
      When enabling multicast snooping, bridge module deadlocks on multicast_lock
      if 1) IPv6 is enabled, and 2) there is an existing querier on the same L2
      network.
      
      The deadlock was caused by the following sequence: While holding the lock,
      br_multicast_open calls br_multicast_join_snoopers, which eventually causes
      IP stack to (attempt to) send out a Listener Report (in igmp6_join_group).
      Since the destination Ethernet address is a multicast address, br_dev_xmit
      feeds the packet back to the bridge via br_multicast_rcv, which in turn
      calls br_multicast_add_group, which then deadlocks on multicast_lock.
      
      The fix is to move the call br_multicast_join_snoopers outside of the
      critical section. This works since br_multicast_join_snoopers only deals
      with IP and does not modify any multicast data structures of the bridge,
      so there's no need to hold the lock.
      
      Steps to reproduce:
      1. sysctl net.ipv6.conf.all.force_mld_version=1
      2. have another querier
      3. ip link set dev bridge type bridge mcast_snooping 0 && \
         ip link set dev bridge type bridge mcast_snooping 1 < deadlock >
      
      A typical call trace looks like the following:
      
      [  936.251495]  _raw_spin_lock+0x5c/0x68
      [  936.255221]  br_multicast_add_group+0x40/0x170 [bridge]
      [  936.260491]  br_multicast_rcv+0x7ac/0xe30 [bridge]
      [  936.265322]  br_dev_xmit+0x140/0x368 [bridge]
      [  936.269689]  dev_hard_start_xmit+0x94/0x158
      [  936.273876]  __dev_queue_xmit+0x5ac/0x7f8
      [  936.277890]  dev_queue_xmit+0x10/0x18
      [  936.281563]  neigh_resolve_output+0xec/0x198
      [  936.285845]  ip6_finish_output2+0x240/0x710
      [  936.290039]  __ip6_finish_output+0x130/0x170
      [  936.294318]  ip6_output+0x6c/0x1c8
      [  936.297731]  NF_HOOK.constprop.0+0xd8/0xe8
      [  936.301834]  igmp6_send+0x358/0x558
      [  936.305326]  igmp6_join_group.part.0+0x30/0xf0
      [  936.309774]  igmp6_group_added+0xfc/0x110
      [  936.313787]  __ipv6_dev_mc_inc+0x1a4/0x290
      [  936.317885]  ipv6_dev_mc_inc+0x10/0x18
      [  936.321677]  br_multicast_open+0xbc/0x110 [bridge]
      [  936.326506]  br_multicast_toggle+0xec/0x140 [bridge]
      
      Fixes: 4effd28c ("bridge: join all-snoopers multicast address")
      Signed-off-by: default avatarJoseph Huang <Joseph.Huang@garmin.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Link: https://lore.kernel.org/r/20201204235628.50653-1-Joseph.Huang@garmin.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      851d0a73
    • Claudiu Manoil's avatar
      enetc: Fix reporting of h/w packet counters · eb96b686
      Claudiu Manoil authored
      Noticed some inconsistencies in packet statistics reporting.
      This patch adds the missing Tx packet counter registers to
      ethtool reporting and fixes the information strings for a
      few of them.
      
      Fixes: 16eb4c85 ("enetc: Add ethtool statistics")
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20201204171505.21389-1-claudiu.manoil@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      eb96b686
  2. 07 Dec, 2020 2 commits
  3. 05 Dec, 2020 6 commits
  4. 04 Dec, 2020 10 commits
  5. 03 Dec, 2020 12 commits