1. 20 9月, 2022 1 次提交
  2. 16 9月, 2022 1 次提交
  3. 03 9月, 2022 3 次提交
  4. 01 9月, 2022 1 次提交
  5. 24 8月, 2022 1 次提交
  6. 02 7月, 2022 1 次提交
  7. 23 5月, 2022 2 次提交
  8. 19 5月, 2022 1 次提交
  9. 06 5月, 2022 1 次提交
  10. 28 4月, 2022 1 次提交
  11. 25 1月, 2022 1 次提交
  12. 15 12月, 2021 1 次提交
    • J
      net: fec: fix system hang during suspend/resume · 0b6f65c7
      Joakim Zhang 提交于
      1. During normal suspend (WoL not enabled) process, system has posibility
      to hang. The root cause is TXF interrupt coming after clocks disabled,
      system hang when accessing registers from interrupt handler. To fix this
      issue, disable all interrupts when system suspend.
      
      2. System also has posibility to hang with WoL enabled during suspend,
      after entering stop mode, then magic pattern coming after clocks
      disabled, system will be waked up, and interrupt handler will be called,
      system hang when access registers. To fix this issue, disable wakeup
      irq in .suspend(), and enable it in .resume().
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0b6f65c7
  13. 08 12月, 2021 1 次提交
    • J
      net: fec: only clear interrupt of handling queue in fec_enet_rx_queue() · b5bd95d1
      Joakim Zhang 提交于
      Background:
      We have a customer is running a Profinet stack on the 8MM which receives and
      responds PNIO packets every 4ms and PNIO-CM packets every 40ms. However, from
      time to time the received PNIO-CM package is "stock" and is only handled when
      receiving a new PNIO-CM or DCERPC-Ping packet (tcpdump shows the PNIO-CM and
      the DCERPC-Ping packet at the same time but the PNIO-CM HW timestamp is from
      the expected 40 ms and not the 2s delay of the DCERPC-Ping).
      
      After debugging, we noticed PNIO, PNIO-CM and DCERPC-Ping packets would
      be handled by different RX queues.
      
      The root cause should be driver ack all queues' interrupt when handle a
      specific queue in fec_enet_rx_queue(). The blamed patch is introduced to
      receive as much packets as possible once to avoid interrupt flooding.
      But it's unreasonable to clear other queues'interrupt when handling one
      queue, this patch tries to fix it.
      
      Fixes: ed63f1dc (net: fec: clear receive interrupts before processing a packet)
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Reported-by: NNicolas Diaz <nicolas.diaz@nxp.com>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Link: https://lore.kernel.org/r/20211206135457.15946-1-qiangqing.zhang@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      b5bd95d1
  14. 22 11月, 2021 1 次提交
  15. 19 10月, 2021 1 次提交
  16. 05 10月, 2021 1 次提交
  17. 02 10月, 2021 1 次提交
  18. 19 9月, 2021 1 次提交
  19. 24 8月, 2021 1 次提交
  20. 14 8月, 2021 1 次提交
  21. 05 8月, 2021 1 次提交
  22. 04 8月, 2021 1 次提交
  23. 28 7月, 2021 4 次提交
  24. 22 6月, 2021 2 次提交
    • F
      net: fec: add ndo_select_queue to fix TX bandwidth fluctuations · 52c4a1a8
      Fugang Duan 提交于
      As we know that AVB is enabled by default, and the ENET IP design is
      queue 0 for best effort, queue 1&2 for AVB Class A&B. Bandwidth of each
      queue 1&2 set in driver is 50%, TX bandwidth fluctuated when selecting
      tx queues randomly with FEC_QUIRK_HAS_AVB quirk available.
      
      This patch adds ndo_select_queue callback to select queues for
      transmitting to fix this issue. It will always return queue 0 if this is
      not a vlan packet, and return queue 1 or 2 based on priority of vlan
      packet.
      
      You may complain that in fact we only use single queue for trasmitting
      if we are not targeted to VLAN. Yes, but seems we have no choice, since
      AVB is enabled when the driver probed, we can't switch this feature
      dynamicly. After compare multiple queues to single queue, TX throughput
      almost no improvement.
      
      One way we can implemet is to configure the driver to multiple queues
      with Round-robin scheme by default. Then add ndo_setup_tc callback to
      enable/disable AVB feature for users. Unfortunately, ENET AVB IP seems
      not follow the standard 802.1Qav spec. We only can program
      DMAnCFG[IDLE_SLOPE] field to calculate bandwidth fraction. And idle
      slope is restricted to certain valus (a total of 19). It's far away from
      CBS QDisc implemented in Linux TC framework. If you strongly suggest to do
      this, I think we only can support limited numbers of bandwidth and reject
      others, but it's really urgly and wried.
      
      With this patch, VLAN tagged packets route to queue 0/1/2 based on vlan
      priority; VLAN untagged packets route to queue 0.
      Tested-by: NFrieder Schrempf <frieder.schrempf@kontron.de>
      Reported-by: NFrieder Schrempf <frieder.schrempf@kontron.de>
      Signed-off-by: NFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      52c4a1a8
    • J
      net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP · 471ff445
      Joakim Zhang 提交于
      Frieder Schrempf reported a TX throuthput issue [1], it happens quite often
      that the measured bandwidth in TX direction drops from its expected/nominal
      value to something like ~50% (for 100M) or ~67% (for 1G) connections.
      
      [1] https://lore.kernel.org/linux-arm-kernel/421cc86c-b66f-b372-32f7-21e59f9a98bc@kontron.de/
      
      The issue becomes clear after digging into it, Net core would select
      queues when transmitting packets. Since FEC have not impletemented
      ndo_select_queue callback yet, so it will call netdev_pick_tx to select
      queues randomly.
      
      For i.MX6SX ENET IP with AVB support, driver default enables this
      feature. According to the setting of QOS/RCMRn/DMAnCFG registers, AVB
      configured to Credit-based scheme, 50% bandwidth of each queue 1&2.
      
      With below tests let me think more:
      1) With FEC_QUIRK_HAS_AVB quirk, can reproduce TX bandwidth fluctuations issue.
      2) Without FEC_QUIRK_HAS_AVB quirk, can't reproduce TX bandwidth fluctuations issue.
      
      The related difference with or w/o FEC_QUIRK_HAS_AVB quirk is that, whether we
      program FTYPE field of TxBD or not. As I describe above, AVB feature is
      enabled by default. With FEC_QUIRK_HAS_AVB quirk, frames in queue 0
      marked as non-AVB, and frames in queue 1&2 marked as AVB Class A&B. It's
      unreasonable if frames in queue 1&2 are not required to be time-sensitive.
      So when Net core select tx queues ramdomly, Credit-based scheme would work
      and lead to TX bandwidth fluctuated. On the other hand, w/o
      FEC_QUIRK_HAS_AVB quirk, frames in queue 1&2 are all marked as non-AVB, so
      Credit-based scheme would not work.
      
      Till now, how can we fix this TX throughput issue? Yes, please remove
      FEC_QUIRK_HAS_AVB quirk if you suffer it from time-nonsensitive networking.
      However, this quirk is used to indicate i.MX6SX, other setting depends
      on it. So this patch adds a new quirk FEC_QUIRK_HAS_MULTI_QUEUES to
      represent i.MX6SX, it is safe for us remove FEC_QUIRK_HAS_AVB quirk
      now.
      
      FEC_QUIRK_HAS_AVB quirk is set by default in the driver, and users may
      not know much about driver details, they would waste effort to find the
      root cause, that is not we want. The following patch is a implementation
      to fix it and users don't need to modify the driver.
      Tested-by: NFrieder Schrempf <frieder.schrempf@kontron.de>
      Reported-by: NFrieder Schrempf <frieder.schrempf@kontron.de>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      471ff445
  25. 13 5月, 2021 2 次提交
  26. 21 4月, 2021 1 次提交
  27. 14 4月, 2021 1 次提交
    • 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
  28. 10 4月, 2021 1 次提交
  29. 03 2月, 2021 1 次提交
  30. 27 1月, 2021 1 次提交
    • L
      net: fec: Fix temporary RMII clock reset on link up · c730ab42
      Laurent Badel 提交于
      fec_restart() does a hard reset of the MAC module when the link status
      changes to up. This temporarily resets the R_CNTRL register which controls
      the MII mode of the ENET_OUT clock. In the case of RMII, the clock
      frequency momentarily drops from 50MHz to 25MHz until the register is
      reconfigured. Some link partners do not tolerate this glitch and
      invalidate the link causing failure to establish a stable link when using
      PHY polling mode. Since as per IEEE802.3 the criteria for link validity
      are PHY-specific, what the partner should tolerate cannot be assumed, so
      avoid resetting the MII clock by using software reset instead of hardware
      reset when the link is up. This is generally relevant only if the SoC
      provides the clock to an external PHY and the PHY is configured for RMII.
      Signed-off-by: NLaurent Badel <laurentbadel@eaton.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      c730ab42
  31. 23 1月, 2021 1 次提交
  32. 17 11月, 2020 1 次提交
    • Z
      net: fec: Fix reference count leak in fec series ops · da875fa5
      Zhang Qilong 提交于
      pm_runtime_get_sync() will increment pm usage at first and it will
      resume the device later. If runtime of the device has error or
      device is in inaccessible state(or other error state), resume
      operation will fail. If we do not call put operation to decrease
      the reference, it will result in reference count leak. Moreover,
      this device cannot enter the idle state and always stay busy or other
      non-idle state later. So we fixed it by replacing it with
      pm_runtime_resume_and_get.
      
      Fixes: 8fff755e ("net: fec: Ensure clocks are enabled while using mdio bus")
      Signed-off-by: NZhang Qilong <zhangqilong3@huawei.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      da875fa5