1. 14 4月, 2021 3 次提交
    • O
      net: stmmac: introduce dma_recycle_rx_skbufs for stmmac_reinit_rx_buffers · 80f573c9
      Ong Boon Leong 提交于
      Rearrange RX buffer page_pool recycling logics into dma_recycle_rx_skbufs,
      so that we prepare stmmac_reinit_rx_buffers() for XSK pool expansion.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      80f573c9
    • O
      net: stmmac: rearrange RX buffer allocation and free functions · 4298255f
      Ong Boon Leong 提交于
      This patch restructures the per RX queue buffer allocation from page_pool
      to stmmac_alloc_rx_buffers().
      
      We also rearrange dma_free_rx_skbufs() so that it can be used in
      init_dma_rx_desc_rings() during freeing of RX buffer in the event of
      page_pool allocation failure to replace the more efficient method earlier.
      The replacement is needed to make the RX buffer alloc and free method
      scalable to XDP ZC xsk_pool alloc and free later.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4298255f
    • M
      of: net: pass the dst buffer to of_get_mac_address() · 83216e39
      Michael Walle 提交于
      of_get_mac_address() returns a "const void*" pointer to a MAC address.
      Lately, support to fetch the MAC address by an NVMEM provider was added.
      But this will only work with platform devices. It will not work with
      PCI devices (e.g. of an integrated root complex) and esp. not with DSA
      ports.
      
      There is an of_* variant of the nvmem binding which works without
      devices. The returned data of a nvmem_cell_read() has to be freed after
      use. On the other hand the return of_get_mac_address() points to some
      static data without a lifetime. The trick for now, was to allocate a
      device resource managed buffer which is then returned. This will only
      work if we have an actual device.
      
      Change it, so that the caller of of_get_mac_address() has to supply a
      buffer where the MAC address is written to. Unfortunately, this will
      touch all drivers which use the of_get_mac_address().
      
      Usually the code looks like:
      
        const char *addr;
        addr = of_get_mac_address(np);
        if (!IS_ERR(addr))
          ether_addr_copy(ndev->dev_addr, addr);
      
      This can then be simply rewritten as:
      
        of_get_mac_address(np, ndev->dev_addr);
      
      Sometimes is_valid_ether_addr() is used to test the MAC address.
      of_get_mac_address() already makes sure, it just returns a valid MAC
      address. Thus we can just test its return code. But we have to be
      careful if there are still other sources for the MAC address before the
      of_get_mac_address(). In this case we have to keep the
      is_valid_ether_addr() call.
      
      The following coccinelle patch was used to convert common cases to the
      new style. Afterwards, I've manually gone over the drivers and fixed the
      return code variable: either used a new one or if one was already
      available use that. Mansour Moufid, thanks for that coccinelle patch!
      
      <spml>
      @a@
      identifier x;
      expression y, z;
      @@
      - x = of_get_mac_address(y);
      + x = of_get_mac_address(y, z);
        <...
      - ether_addr_copy(z, x);
        ...>
      
      @@
      identifier a.x;
      @@
      - if (<+... x ...+>) {}
      
      @@
      identifier a.x;
      @@
        if (<+... x ...+>) {
            ...
        }
      - else {}
      
      @@
      identifier a.x;
      expression e;
      @@
      - if (<+... x ...+>@e)
      -     {}
      - else
      + if (!(e))
            {...}
      
      @@
      expression x, y, z;
      @@
      - x = of_get_mac_address(y, z);
      + of_get_mac_address(y, z);
        ... when != x
      </spml>
      
      All drivers, except drivers/net/ethernet/aeroflex/greth.c, were
      compile-time tested.
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NMichael Walle <michael@walle.cc>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      83216e39
  2. 04 4月, 2021 6 次提交
    • O
      net: stmmac: Add support for XDP_REDIRECT action · 8b278a5b
      Ong Boon Leong 提交于
      This patch adds the support of XDP_REDIRECT to another remote cpu for
      further action. It also implements ndo_xdp_xmit ops, enabling the driver
      to transmit packets forwarded to it by XDP program running on another
      interface.
      
      This patch has been tested using "xdp_redirect_cpu" for XDP_REDIRECT
      + drop testing. It also been tested with "xdp_redirect" sample app
      which can be used to exercise ndo_xdp_xmit ops. The burst traffics are
      generated using pktgen_sample03_burst_single_flow.sh in samples/pktgen
      directory.
      
      v4: Move xdp_do_flush() processing into stmmac_finalize_xdp_rx() and
          combined the XDP verdict of XDP TX and REDIRECT together.
      
      v3: Added 'nq->trans_start = jiffies' to avoid TX time-out as we are
          sharing TX queue between slow path and XDP. Thanks to Jakub Kicinski
          for point out.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8b278a5b
    • O
      net: stmmac: Add support for XDP_TX action · be8b38a7
      Ong Boon Leong 提交于
      This patch adds support for XDP_TX action which enables XDP program to
      transmit back received frames.
      
      This patch has been tested with the "xdp2" app located in samples/bpf
      dir. The DUT receives burst traffic packet generated using pktgen script
      'pktgen_sample03_burst_single_flow.sh'.
      
      v4: Moved stmmac_tx_timer_arm() to be done once at the end of NAPI RX.
          Fixed stmmac_xdp_xmit_back() to return STMMAC_XDP_CONSUMED if
          XDP buffer to frame conversion fails. Thanks to Jakub's input.
      
      v3: Added 'nq->trans_start = jiffies' to avoid TX time-out as we are
          sharing TX queue between slow path and XDP. Thanks to Jakub Kicinski
          for pointing out.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be8b38a7
    • O
      net: stmmac: Add initial XDP support · 5fabb012
      Ong Boon Leong 提交于
      This patch adds the initial XDP support to stmmac driver. It supports
      XDP_PASS, XDP_DROP and XDP_ABORTED actions. Upcoming patches will add
      support for XDP_TX and XDP_REDIRECT.
      
      To support XDP headroom, this patch adds page_offset into RX buffer and
      change the dma_sync_single_for_device|cpu(). The DMA address used for
      RX operation are changed to take into page_offset too. As page_pool
      can handle dma_sync_single_for_device() on behalf of driver with
      PP_FLAG_DMA_SYNC_DEV flag, we skip doing that in stmmac driver.
      
      Current stmmac driver supports split header support (SPH) in RX but
      the flexibility of splitting header and payload at different position
      makes it very complex to be supported for XDP processing. In addition,
      jumbo frame is not supported in XDP to keep the initial codes simple.
      
      This patch has been tested with the sample app "xdp1" located in
      samples/bpf directory for both SKB and Native (XDP) mode. The burst
      traffic generated using pktgen_sample03_burst_single_flow.sh in
      samples/pktgen directory.
      
      Changes in v3:
       - factor in xdp header and tail adjustment done by XDP program.
         Thanks to Jakub Kicinski for pointing out the gap in v2.
      
      Changes in v2:
       - fix for "warning: variable 'len' set but not used" reported by lkp.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5fabb012
    • O
      net: stmmac: arrange Tx tail pointer update to stmmac_flush_tx_descriptors · d96febed
      Ong Boon Leong 提交于
      This patch organizes TX tail pointer update into a new function called
      stmmac_flush_tx_descriptors() so that we can reuse it in stmmac_xmit(),
      stmmac_tso_xmit() and up-coming XDP implementation.
      
      Changes to v2:
       - Fix for warning: unused variable ‘desc_size’
         https://patchwork.hopto.org/static/nipa/457321/12170149/build_32bit/stderrSigned-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d96febed
    • O
      net: stmmac: make SPH enable/disable to be configurable · d08d32d1
      Ong Boon Leong 提交于
      SPH functionality splits header and payload according to split mode and
      offsef fields (SPLM and SPLOFST). It is beneficials for Linux network
      stack RX processing however it adds a lot of complexity in XDP
      processing.
      
      So, this patch makes the split-header (SPH) capability of the controller
      is stored in "priv->sph_cap" and the enabling/disabling of SPH is decided
      by "priv->sph".
      
      This is to prepare initial XDP enabling for stmmac to disable the use of
      SPH whenever XDP is enabled.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d08d32d1
    • O
      net: stmmac: set IRQ affinity hint for multi MSI vectors · 8deec94c
      Ong Boon Leong 提交于
      Certain platform likes Intel mGBE has independent hardware IRQ resources
      for TX and RX DMA operation. In preparation to support XDP TX, we add IRQ
      affinity hint to group both RX and TX queue of the same queue ID to the
      same CPU.
      
      Changes in v2:
       - IRQ affinity hint need to set to null before IRQ is released.
         Thanks to issue reported by Song, Yoong Siang.
      Reported-by: NSong, Yoong Siang <yoong.siang.song@intel.com>
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8deec94c
  3. 29 3月, 2021 1 次提交
  4. 27 3月, 2021 1 次提交
    • M
      net: stmmac: Fix kernel panic due to NULL pointer dereference of fpe_cfg · 63c173ff
      Mohammad Athari Bin Ismail 提交于
      In this patch, "net: stmmac: support FPE link partner hand-shaking
      procedure", priv->plat->fpe_cfg wouldn`t be "devm_kzalloc"ed if
      dma_cap->frpsel is 0 (Flexible Rx Parser is not supported in SoC) in
      tc_init(). So, fpe_cfg will be remain as NULL and accessing it will cause
      kernel panic.
      
      To fix this, move the "devm_kzalloc"ing of priv->plat->fpe_cfg before
      dma_cap->frpsel checking in tc_init(). Additionally, checking of
      priv->dma_cap.fpesel is added before calling stmmac_fpe_link_state_handle()
      as only FPE supported SoC is allowed to call the function.
      
      Below is the kernel panic dump reported by Marek Szyprowski
      <m.szyprowski@samsung.com>:
      
      meson8b-dwmac ff3f0000.ethernet eth0: PHY [0.0:00] driver [RTL8211F Gigabit Ethernet] (irq=35)
      meson8b-dwmac ff3f0000.ethernet eth0: No Safety Features support found
      meson8b-dwmac ff3f0000.ethernet eth0: PTP not supported by HW
      meson8b-dwmac ff3f0000.ethernet eth0: configuring for phy/rgmii link mode
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000001
      Mem abort info:
      ...
      user pgtable: 4k pages, 48-bit VAs, pgdp=00000000044eb000
      [0000000000000001] pgd=0000000000000000, p4d=0000000000000000
      Internal error: Oops: 96000004 [#1] PREEMPT SMP
      Modules linked in: dw_hdmi_i2s_audio dw_hdmi_cec meson_gxl realtek meson_gxbb_wdt snd_soc_meson_axg_sound_card dwmac_generic axg_audio meson_dw_hdmi crct10dif_ce snd_soc_meson_card_utils snd_soc_meson_axg_tdmout panfrost rc_odroid gpu_sched reset_meson_audio_arb meson_ir snd_soc_meson_g12a_tohdmitx snd_soc_meson_axg_frddr sclk_div clk_phase snd_soc_meson_codec_glue dwmac_meson8b snd_soc_meson_axg_fifo stmmac_platform meson_rng meson_drm stmmac rtc_meson_vrtc rng_core meson_canvas pwm_meson dw_hdmi mdio_mux_meson_g12a pcs_xpcs snd_soc_meson_axg_tdm_interface snd_soc_meson_axg_tdm_formatter nvmem_meson_efuse display_connector
      CPU: 1 PID: 7 Comm: kworker/u8:0 Not tainted 5.12.0-rc4-next-20210325+
      Hardware name: Hardkernel ODROID-C4 (DT)
      Workqueue: events_power_efficient phylink_resolve
      pstate: 20400009 (nzCv daif +PAN -UAO -TCO BTYPE=--)
      pc : stmmac_mac_link_up+0x14c/0x348 [stmmac]
      lr : stmmac_mac_link_up+0x284/0x348 [stmmac] ...
      Call trace:
       stmmac_mac_link_up+0x14c/0x348 [stmmac]
       phylink_resolve+0x104/0x420
       process_one_work+0x2a8/0x718
       worker_thread+0x48/0x460
       kthread+0x134/0x160
       ret_from_fork+0x10/0x18
      Code: b971ba60 350007c0 f958c260 f9402000 (39400401)
      ---[ end trace 0c9deb6c510228aa ]---
      
      Fixes: 5a558611 ("net: stmmac: support FPE link partner hand-shaking
      procedure")
      Reported-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NMohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
      Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63c173ff
  5. 26 3月, 2021 4 次提交
  6. 25 3月, 2021 1 次提交
  7. 19 3月, 2021 2 次提交
  8. 18 3月, 2021 2 次提交
    • O
      net: stmmac: add per-queue TX & RX coalesce ethtool support · db2f2842
      Ong Boon Leong 提交于
      Extending the driver to support per-queue RX and TX coalesce settings in
      order to support below commands:
      
      To show per-queue coalesce setting:-
       $ ethtool --per-queue <DEVNAME> queue_mask <MASK> --show-coalesce
      
      To set per-queue coalesce setting:-
       $ ethtool --per-queue <DEVNAME> queue_mask <MASK> --coalesce \
           [rx-usecs N] [rx-frames M] [tx-usecs P] [tx-frames Q]
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      db2f2842
    • V
      net: stmmac: add timestamp correction to rid CDC sync error · 3600be5f
      Voon Weifeng 提交于
      According to Synopsis DesignWare EQoS Databook, the Clock Domain Cross
      synchronization error is introduced tue to the clock(GMII Tx/Rx clock)
      being different at the capture as compared to the PTP
      clock(clk_ptp_ref_i) that is used to generate the time.
      
      The CDC synchronization error is almost equal to 2 times the clock
      period of the PTP clock(clk_ptp_ref_i).
      
      On a Intel Tigerlake platform (with Marvell 88E2110 external PHY):
      
      Before applying this patch (with CDC synchronization error):
      ptp4l[64.044]: rms    8 max   13 freq +30877 +/-  11 delay   216 +/-   0
      ptp4l[65.047]: rms   13 max   20 freq +30869 +/-  17 delay   213 +/-   0
      ptp4l[66.050]: rms   12 max   20 freq +30857 +/-  11 delay   213 +/-   0
      ptp4l[67.052]: rms   11 max   22 freq +30849 +/-  10 delay   215 +/-   0
      ptp4l[68.055]: rms   10 max   16 freq +30853 +/-  13 delay   215 +/-   0
      ptp4l[69.057]: rms    7 max   13 freq +30848 +/-   9 delay   216 +/-   0
      ptp4l[70.060]: rms    8 max   13 freq +30846 +/-  10 delay   216 +/-   0
      ptp4l[71.063]: rms    9 max   15 freq +30836 +/-   8 delay   218 +/-   0
      
      After applying this patch (CDC syncrhonization error is taken care of):
      ptp4l[61.516]: rms  773 max  824 freq +31526 +/- 158 delay   200 +/-   0
      ptp4l[62.519]: rms  427 max  596 freq +31668 +/-  39 delay   198 +/-   0
      ptp4l[63.522]: rms  113 max  206 freq +31482 +/-  57 delay   198 +/-   0
      ptp4l[64.525]: rms   40 max   56 freq +31316 +/-  29 delay   200 +/-   0
      ptp4l[65.528]: rms   47 max   56 freq +31255 +/-  17 delay   200 +/-   0
      ptp4l[66.531]: rms   26 max   36 freq +31246 +/-   9 delay   200 +/-   0
      ptp4l[67.534]: rms   12 max   18 freq +31254 +/-  12 delay   202 +/-   0
      ptp4l[68.537]: rms    7 max   12 freq +31263 +/-  10 delay   202 +/-   0
      Signed-off-by: NVoon Weifeng <weifeng.voon@intel.com>
      Signed-off-by: NWong Vee Khee <vee.khee.wong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3600be5f
  9. 16 3月, 2021 4 次提交
  10. 06 3月, 2021 1 次提交
    • O
      net: stmmac: Fix VLAN filter delete timeout issue in Intel mGBE SGMII · 9a7b3950
      Ong Boon Leong 提交于
      For Intel mGbE controller, MAC VLAN filter delete operation will time-out
      if serdes power-down sequence happened first during driver remove() with
      below message.
      
      [82294.764958] intel-eth-pci 0000:00:1e.4 eth2: stmmac_dvr_remove: removing driver
      [82294.778677] intel-eth-pci 0000:00:1e.4 eth2: Timeout accessing MAC_VLAN_Tag_Filter
      [82294.779997] intel-eth-pci 0000:00:1e.4 eth2: failed to kill vid 0081/0
      [82294.947053] intel-eth-pci 0000:00:1d.2 eth1: stmmac_dvr_remove: removing driver
      [82295.002091] intel-eth-pci 0000:00:1d.1 eth0: stmmac_dvr_remove: removing driver
      
      Therefore, we delay the serdes power-down to be after unregister_netdev()
      which triggers the VLAN filter delete.
      
      Fixes: b9663b7c ("net: stmmac: Enable SERDES power up/down sequence")
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9a7b3950
  11. 27 2月, 2021 4 次提交
    • J
      net: stmmac: re-init rx buffers when mac resume back · 9c63faaa
      Joakim Zhang 提交于
      During suspend/resume stress test, we found descriptor write back by DMA
      could exhibit unusual behavior, e.g.:
      	003 [0xc4310030]: 0x0 0x40 0x0 0xb5010040
      
      We can see that desc3 write back is 0xb5010040, it is still ownd by DMA,
      so application would not recycle this buffer. It will trigger fatal bus
      error when DMA try to use this descriptor again. To fix this issue, we
      should re-init all rx buffers when mac resume back.
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      9c63faaa
    • J
      net: stmmac: fix wrongly set buffer2 valid when sph unsupport · 396e13e1
      Joakim Zhang 提交于
      In current driver, buffer2 available only when hardware supports split
      header. Wrongly set buffer2 valid in stmmac_rx_refill when refill buffer
      address. You can see that desc3 is 0x81000000 after initialization, but
      turn out to be 0x83000000 after refill.
      
      Fixes: 67afd6d1 ("net: stmmac: Add Split Header support and enable it in XGMAC cores")
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      396e13e1
    • J
      net: stmmac: fix dma physical address of descriptor when display ring · bfaf91ca
      Joakim Zhang 提交于
      Driver uses dma_alloc_coherent to allocate dma memory for descriptors,
      dma_alloc_coherent will return both the virtual address and physical
      address. AFAIK, virt_to_phys could not convert virtual address to
      physical address, for which memory is allocated by dma_alloc_coherent.
      
      dwmac4_display_ring() function is broken for various descriptor, it only
      support normal descriptor(struct dma_desc) now, this patch also extends to
      support all descriptor types.
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      bfaf91ca
    • J
      net: stmmac: fix watchdog timeout during suspend/resume stress test · c511819d
      Joakim Zhang 提交于
      stmmac_xmit() call stmmac_tx_timer_arm() at the end to modify tx timer to
      do the transmission cleanup work. Imagine such a situation, stmmac enters
      suspend immediately after tx timer modified, it's expire callback
      stmmac_tx_clean() would not be invoked. This could affect BQL, since
      netdev_tx_sent_queue() has been called, but netdev_tx_completed_queue()
      have not been involved, as a result, dql_avail(&dev_queue->dql) finally
      always return a negative value.
      
      __dev_queue_xmit->__dev_xmit_skb->qdisc_run->__qdisc_run->qdisc_restart->dequeue_skb:
      	if ((q->flags & TCQ_F_ONETXQUEUE) &&
      		netif_xmit_frozen_or_stopped(txq)) // __QUEUE_STATE_STACK_XOFF is set
      
      Net core will stop transmitting any more. Finillay, net watchdong would timeout.
      To fix this issue, we should call netdev_tx_reset_queue() in stmmac_resume().
      
      Fixes: 54139cf3 ("net: stmmac: adding multiple buffers for rx")
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c511819d
  12. 14 1月, 2021 2 次提交
  13. 09 12月, 2020 4 次提交
    • F
      net: stmmac: overwrite the dma_cap.addr64 according to HW design · f119cc98
      Fugang Duan 提交于
      The current IP register MAC_HW_Feature1[ADDR64] only defines
      32/40/64 bit width, but some SOCs support others like i.MX8MP
      support 34 bits but it maps to 40 bits width in MAC_HW_Feature1[ADDR64].
      So overwrite dma_cap.addr64 according to HW real design.
      
      Fixes: 94abdad6 ("net: ethernet: dwmac: add ethernet glue logic for NXP imx8 chip")
      Signed-off-by: NFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f119cc98
    • F
      net: stmmac: delete the eee_ctrl_timer after napi disabled · 5f585913
      Fugang Duan 提交于
      There have chance to re-enable the eee_ctrl_timer and fire the timer
      in napi callback after delete the timer in .stmmac_release(), which
      introduces to access eee registers in the timer function after clocks
      are disabled then causes system hang. Found this issue when do
      suspend/resume and reboot stress test.
      
      It is safe to delete the timer after napi disabled and disable lpi mode.
      
      Fixes: d765955d ("stmmac: add the Energy Efficient Ethernet support")
      Signed-off-by: NFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5f585913
    • F
      net: stmmac: free tx skb buffer in stmmac_resume() · 4ec236c7
      Fugang Duan 提交于
      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: NFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4ec236c7
    • F
      net: stmmac: start phylink instance before stmmac_hw_setup() · 36d18b56
      Fugang Duan 提交于
      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: NFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36d18b56
  14. 25 11月, 2020 1 次提交
  15. 17 11月, 2020 1 次提交
  16. 31 10月, 2020 2 次提交
  17. 04 10月, 2020 1 次提交
    • V
      net: stmmac: Modify configuration method of EEE timers · 388e201d
      Vineetha G. Jaya Kumaran 提交于
      Ethtool manual stated that the tx-timer is the "the amount of time the
      device should stay in idle mode prior to asserting its Tx LPI". The
      previous implementation for "ethtool --set-eee tx-timer" sets the LPI TW
      timer duration which is not correct. Hence, this patch fixes the
      "ethtool --set-eee tx-timer" to configure the EEE LPI timer.
      
      The LPI TW Timer will be using the defined default value instead of
      "ethtool --set-eee tx-timer" which follows the EEE LS timer implementation.
      
      Changelog V2
      *Not removing/modifying the eee_timer.
      *EEE LPI timer can be configured through ethtool and also the eee_timer
      module param.
      *EEE TW Timer will be configured with default value only, not able to be
      configured through ethtool or module param. This follows the implementation
      of the EEE LS Timer.
      
      Fixes: d765955d ("stmmac: add the Energy Efficient Ethernet support")
      Signed-off-by: NVineetha G. Jaya Kumaran <vineetha.g.jaya.kumaran@intel.com>
      Signed-off-by: NVoon Weifeng <weifeng.voon@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      388e201d