1. 18 7月, 2022 1 次提交
  2. 08 2月, 2022 1 次提交
    • Y
      net: stmmac: optimize locking around PTP clock reads · 642436a1
      Yannick Vignon 提交于
      Reading the PTP clock is a simple operation requiring only 3 register
      reads. Under a PREEMPT_RT kernel, protecting those reads by a spin_lock is
      counter-productive: if the 2nd task preempting the 1st has a higher prio
      but needs to read time as well, it will require 2 context switches, which
      will pretty much always be more costly than just disabling preemption for
      the duration of the reads. Moreover, with the code logic recently added
      to get_systime(), disabling preemption is not even required anymore:
      reads and writes just need to be protected from each other, to prevent a
      clock read while the clock is being updated.
      
      Improve the above situation by replacing the PTP spinlock by a rwlock, and
      using read_lock for PTP clock reads so simultaneous reads do not block
      each other.
      Signed-off-by: NYannick Vignon <yannick.vignon@nxp.com>
      Link: https://lore.kernel.org/r/20220204135545.2770625-1-yannick.vignon@oss.nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      642436a1
  3. 24 1月, 2022 1 次提交
  4. 30 12月, 2021 1 次提交
  5. 23 12月, 2021 1 次提交
    • O
      net: stmmac: add tc flower filter for EtherType matching · e48cb313
      Ong Boon Leong 提交于
      This patch adds basic support for EtherType RX frame steering for
      LLDP and PTP using the hardware offload capabilities.
      
      Example steps for setting up RX frame steering for LLDP and PTP:
      $ IFDEVNAME=eth0
      $ tc qdisc add dev $IFDEVNAME ingress
      $ tc qdisc add dev $IFDEVNAME root mqprio num_tc 8 \
           map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
           queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0
      
      For LLDP
      $ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88cc \
           flower hw_tc 5
      OR
      $ tc filter add dev $IFDEVNAME parent ffff: protocol LLDP \
           flower hw_tc 5
      
      For PTP
      $ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88f7 \
           flower hw_tc 6
      
      Show tc ingress filter
      $ tc filter show dev $IFDEVNAME ingress
      
      v1->v2:
       Thanks to Kurt's and Sebastian's suggestion.
       - change from __be16 to u16 etype
       - change ETHER_TYPE_FULL_MASK to use cpu_to_be16() macro
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e48cb313
  6. 14 12月, 2021 1 次提交
    • O
      net: stmmac: fix tc flower deletion for VLAN priority Rx steering · aeb7c75c
      Ong Boon Leong 提交于
      To replicate the issue:-
      
      1) Add 1 flower filter for VLAN Priority based frame steering:-
      $ IFDEVNAME=eth0
      $ tc qdisc add dev $IFDEVNAME ingress
      $ tc qdisc add dev $IFDEVNAME root mqprio num_tc 8 \
         map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
         queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0
      $ tc filter add dev $IFDEVNAME parent ffff: protocol 802.1Q \
         flower vlan_prio 0 hw_tc 0
      
      2) Get the 'pref' id
      $ tc filter show dev $IFDEVNAME ingress
      
      3) Delete a specific tc flower record (say pref 49151)
      $ tc filter del dev $IFDEVNAME parent ffff: pref 49151
      
      From dmesg, we will observe kernel NULL pointer ooops
      
      [  197.170464] BUG: kernel NULL pointer dereference, address: 0000000000000000
      [  197.171367] #PF: supervisor read access in kernel mode
      [  197.171367] #PF: error_code(0x0000) - not-present page
      [  197.171367] PGD 0 P4D 0
      [  197.171367] Oops: 0000 [#1] PREEMPT SMP NOPTI
      
      <snip>
      
      [  197.171367] RIP: 0010:tc_setup_cls+0x20b/0x4a0 [stmmac]
      
      <snip>
      
      [  197.171367] Call Trace:
      [  197.171367]  <TASK>
      [  197.171367]  ? __stmmac_disable_all_queues+0xa8/0xe0 [stmmac]
      [  197.171367]  stmmac_setup_tc_block_cb+0x70/0x110 [stmmac]
      [  197.171367]  tc_setup_cb_destroy+0xb3/0x180
      [  197.171367]  fl_hw_destroy_filter+0x94/0xc0 [cls_flower]
      
      The above issue is due to previous incorrect implementation of
      tc_del_vlan_flow(), shown below, that uses flow_cls_offload_flow_rule()
      to get struct flow_rule *rule which is no longer valid for tc filter
      delete operation.
      
        struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
        struct flow_dissector *dissector = rule->match.dissector;
      
      So, to ensure tc_del_vlan_flow() deletes the right VLAN cls record for
      earlier configured RX queue (configured by hw_tc) in tc_add_vlan_flow(),
      this patch introduces stmmac_rfs_entry as driver-side flow_cls_offload
      record for 'RX frame steering' tc flower, currently used for VLAN
      priority. The implementation has taken consideration for future extension
      to include other type RX frame steering such as EtherType based.
      
      v2:
       - Clean up overly extensive backtrace and rewrite git message to better
         explain the kernel NULL pointer issue.
      
      Fixes: 0e039f5c ("net: stmmac: add RX frame steering based on VLAN priority in tc flower")
      Tested-by: NKurt Kanzenbach <kurt@linutronix.de>
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aeb7c75c
  7. 29 11月, 2021 1 次提交
  8. 22 11月, 2021 1 次提交
    • H
      net: stmmac: retain PTP clock time during SIOCSHWTSTAMP ioctls · a6da2bbb
      Holger Assmann 提交于
      Currently, when user space emits SIOCSHWTSTAMP ioctl calls such as
      enabling/disabling timestamping or changing filter settings, the driver
      reads the current CLOCK_REALTIME value and programming this into the
      NIC's hardware clock. This might be necessary during system
      initialization, but at runtime, when the PTP clock has already been
      synchronized to a grandmaster, a reset of the timestamp settings might
      result in a clock jump. Furthermore, if the clock is also controlled by
      phc2sys in automatic mode (where the UTC offset is queried from ptp4l),
      that UTC-to-TAI offset (currently 37 seconds in 2021) would be
      temporarily reset to 0, and it would take a long time for phc2sys to
      readjust so that CLOCK_REALTIME and the PHC are apart by 37 seconds
      again.
      
      To address the issue, we introduce a new function called
      stmmac_init_tstamp_counter(), which gets called during ndo_open().
      It contains the code snippet moved from stmmac_hwtstamp_set() that
      manages the time synchronization. Besides, the sub second increment
      configuration is also moved here since the related values are hardware
      dependent and runtime invariant.
      
      Furthermore, the hardware clock must be kept running even when no time
      stamping mode is selected in order to retain the synchronized time base.
      That way, timestamping can be enabled again at any time only with the
      need to compensate the clock's natural drifting.
      
      As a side effect, this patch fixes the issue that ptp_clock_info::enable
      can be called before SIOCSHWTSTAMP and the driver (which looks at
      priv->systime_flags) was not prepared to handle that ordering.
      
      Fixes: 92ba6888 ("stmmac: add the support for PTP hw clock driver")
      Reported-by: NMichael Olbrich <m.olbrich@pengutronix.de>
      Signed-off-by: NAhmad Fatoum <a.fatoum@pengutronix.de>
      Signed-off-by: NHolger Assmann <h.assmann@pengutronix.de>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a6da2bbb
  9. 15 11月, 2021 1 次提交
    • O
      net: stmmac: enhance XDP ZC driver level switching performance · ac746c85
      Ong Boon Leong 提交于
      The previous stmmac_xdp_set_prog() implementation uses stmmac_release()
      and stmmac_open() which tear down the PHY device and causes undesirable
      autonegotiation which causes a delay whenever AFXDP ZC is setup.
      
      This patch introduces two new functions that just sufficiently tear
      down DMA descriptors, buffer, NAPI process, and IRQs and reestablish
      them accordingly in both stmmac_xdp_release() and stammac_xdp_open().
      
      As the results of this enhancement, we get rid of transient state
      introduced by the link auto-negotiation:
      
      $ ./xdpsock -i eth0 -t -z
      
       sock0@eth0:0 txonly xdp-drv
                         pps            pkts           1.00
      rx                 0              0
      tx                 634444         634560
      
       sock0@eth0:0 txonly xdp-drv
                         pps            pkts           1.00
      rx                 0              0
      tx                 632330         1267072
      
       sock0@eth0:0 txonly xdp-drv
                         pps            pkts           1.00
      rx                 0              0
      tx                 632438         1899584
      
       sock0@eth0:0 txonly xdp-drv
                         pps            pkts           1.00
      rx                 0              0
      tx                 632502         2532160
      Reported-by: NKurt Kanzenbach <kurt@linutronix.de>
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Tested-by: NKurt Kanzenbach <kurt@linutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ac746c85
  10. 21 8月, 2021 1 次提交
  11. 06 7月, 2021 1 次提交
  12. 16 6月, 2021 1 次提交
    • M
      stmmac: align RX buffers · a955318f
      Matteo Croce 提交于
      On RX an SKB is allocated and the received buffer is copied into it.
      But on some architectures, the memcpy() needs the source and destination
      buffers to have the same alignment to be efficient.
      
      This is not our case, because SKB data pointer is misaligned by two bytes
      to compensate the ethernet header.
      
      Align the RX buffer the same way as the SKB one, so the copy is faster.
      An iperf3 RX test gives a decent improvement on a RISC-V machine:
      
      before:
      [ ID] Interval           Transfer     Bitrate         Retr
      [  5]   0.00-10.00  sec   733 MBytes   615 Mbits/sec   88             sender
      [  5]   0.00-10.01  sec   730 MBytes   612 Mbits/sec                  receiver
      
      after:
      [ ID] Interval           Transfer     Bitrate         Retr
      [  5]   0.00-10.00  sec  1.10 GBytes   942 Mbits/sec    0             sender
      [  5]   0.00-10.00  sec  1.09 GBytes   940 Mbits/sec                  receiver
      
      And the memcpy() overhead during the RX drops dramatically.
      
      before:
      Overhead  Shared O  Symbol
        43.35%  [kernel]  [k] memcpy
        33.77%  [kernel]  [k] __asm_copy_to_user
         3.64%  [kernel]  [k] sifive_l2_flush64_range
      
      after:
      Overhead  Shared O  Symbol
        45.40%  [kernel]  [k] __asm_copy_to_user
        28.09%  [kernel]  [k] memcpy
         4.27%  [kernel]  [k] sifive_l2_flush64_range
      Signed-off-by: NMatteo Croce <mcroce@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a955318f
  13. 12 6月, 2021 1 次提交
    • W
      net: stmmac: Fix potential integer overflow · 52e597d3
      Wong Vee Khee 提交于
      The commit d96febed ("net: stmmac: arrange Tx tail pointer update
      to stmmac_flush_tx_descriptors") introduced the following coverity
      warning:-
      
        1. Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
           overflow_before_widen: Potentially overflowing expression
           'tx_q->cur_tx * desc_size' with type 'unsigned int' (32 bits,
           unsigned) is evaluated using 32-bit arithmetic, and then used in a
           context that expects an expression of type dma_addr_t (64 bits,
           unsigned).
      
      Fixed this by assigning tx_tail_addr to dma_addr_t type, as dma_addr_t
      datatype is decided by CONFIG_ARCH_DMA_ADDR_T_64_BIT.
      
      Fixes: d96febed ("net: stmmac: arrange Tx tail pointer update to stmmac_flush_tx_descriptors")
      Signed-off-by: NWong Vee Khee <vee.khee.wong@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      52e597d3
  14. 09 6月, 2021 1 次提交
  15. 15 4月, 2021 1 次提交
  16. 14 4月, 2021 3 次提交
    • O
      net: stmmac: Add TX via XDP zero-copy socket · 132c32ee
      Ong Boon Leong 提交于
      We add the support of XDP ZC TX submission and cleaning into
      stmmac_tx_clean(). The function is made to clean as many TX complete
      frames as possible, i.e. limit by priv->dma_tx_size instead of NAPI
      budget. For TX ring that is associated with XSK pool, the function
      stmmac_xdp_xmit_zc() is introduced to TX frame buffers from XSK pool by
      using xsk_tx_peek_desc(). To make stmmac_tx_clean() support the cleaning
      of XSK TX frames, STMMAC_TXBUF_T_XSK_TX TX buffer type is introduced.
      
      As stmmac_tx_clean() uses the return value to cue whether NAPI function
      should continue to poll, we augment the caller of stmmac_tx_clean() to
      pass NAPI budget instead of priv->dma_tx_size through 'budget' input and
      made stmmac_tx_clean() to always clean up-to the TX ring size instead.
      This allows us to use the return boolean status of stmmac_xdp_xmit_zc()
      to decide if XSK TX work is done or not: If true, set 'xmits' to return
      'budget - 1' so that NAPI poll may exit. Else, set 'xmits' to return
      'budget' to make NAPI poll continue to poll since XSK TX work is not
      done. Finally, at the end of stmmac_tx_clean(), the function now take
      a maximum value between 'count' and 'xmits' so that status from both
      TX cleaning and XSK TX (only for XDP ZC) is considered.
      
      This patch adds a new NAPI poll called stmmac_napi_poll_rxtx() that is
      meant to be enabled/disabled for RX and TX ring that are bound to XSK
      pool. This NAPI poll function starts with cleaning TX ring, then submits
      XSK TX frames to TX ring before proceed to perform RX operations, i.e.
      , receiving RX frames and replenishing RX ring with RX free buffers
      obtained from XSK pool. Therefore, during XSK RX and TX setup, the driver
      enables stmmac_napi_poll_rxtx() for RX and TX operations, then during
      XSK RX and TX pool tear-down, the driver reenables the exisiting
      independent NAPI poll functions accordingly: stmmac_napi_poll_rx() and
      stmmac_napi_poll_tx().
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      132c32ee
    • O
      net: stmmac: Enable RX via AF_XDP zero-copy · bba2556e
      Ong Boon Leong 提交于
      This patch adds the support for receiving packet via AF_XDP zero-copy
      mechanism.
      
      XDP ZC uses 1:1 mapping of XDP buffer to receive packet, therefore the
      use of split header is not used currently. The 'xdp_buff' is declared as
      union together with a struct that contains 'page', 'addr' and
      'page_offset' that are associated with primary buffer.
      
      RX buffers are now allocated either via page_pool or xsk pool. For RX
      buffers from xsk_pool they are allocated and deallocated using below
      functions:
      
       * stmmac_alloc_rx_buffers_zc(struct stmmac_priv *priv, u32 queue)
       * dma_free_rx_xskbufs(struct stmmac_priv *priv, u32 queue)
      
      With above functions now available, we then extend the following driver
      functions to support XDP ZC:
       * stmmac_reinit_rx_buffers()
       * __init_dma_rx_desc_rings()
       * init_dma_rx_desc_rings()
       * __free_dma_rx_desc_resources()
      
      Note: stmmac_alloc_rx_buffers_zc() may return -ENOMEM due to RX XDP
      buffer pool is not allocated (e.g. samples/bpf/xdpsock TX-only). But,
      it is still ok to let TX XDP ZC to continue, therefore, the -ENOMEM
      is silently ignored to let the driver succcessfully transition to XDP
      ZC mode for the said RX and TX queue.
      
      As XDP ZC buffer size is different, the DMA buffer size is required
      to be reprogrammed accordingly for RX DMA/Queue that is populated with
      XDP buffer from XSK pool.
      
      Next, to add or remove per-queue XSK pool, stmmac_xdp_setup_pool()
      will call stmmac_xdp_enable_pool() or stmmac_xdp_disable_pool()
      that in-turn coordinates the tearing down and setting up RX ring via
      RX buffers and descriptors removal and reallocation through
      stmmac_disable_rx_queue() and stmmac_enable_rx_queue(). In addition,
      stmmac_xsk_wakeup() is added to initiate XDP RX buffer replenishing
      by signalling user application to add available XDP frames back to
      FILL queue.
      
      For RX processing using XDP zero-copy buffer, stmmac_rx_zc() is
      introduced which is implemented with the assumption that RX split
      header is disabled. For XDP verdict is XDP_PASS, the XDP buffer is
      copied into a sk_buff allocated through stmmac_construct_skb_zc()
      and sent to Linux network GRO inside stmmac_dispatch_skb_zc(). Free RX
      buffers are then replenished using stmmac_rx_refill_zc()
      
      v2: introduce __stmmac_disable_all_queues() to contain the original code
          that does napi_disable() and then make stmmac_setup_tc_block_cb()
          to use it. Move synchronize_rcu() into stmmac_disable_all_queues()
          that eventually calls __stmmac_disable_all_queues(). Then,
          make both stmmac_release() and stmmac_suspend() to use
          stmmac_disable_all_queues(). Thanks David Miller for spotting the
          synchronize_rcu() issue in v1 patch.
      Signed-off-by: NOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bba2556e
    • 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
  17. 04 4月, 2021 4 次提交
    • 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: 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
  18. 26 3月, 2021 1 次提交
  19. 25 3月, 2021 1 次提交
  20. 18 3月, 2021 1 次提交
  21. 16 3月, 2021 1 次提交
    • J
      net: stmmac: add clocks management for gmac driver · 5ec55823
      Joakim Zhang 提交于
      This patch intends to add clocks management for stmmac driver:
      
      If CONFIG_PM enabled:
      1. Keep clocks disabled after driver probed.
      2. Enable clocks when up the net device, and disable clocks when down
      the net device.
      
      If CONFIG_PM disabled:
      Keep clocks always enabled after driver probed.
      
      Note:
      1. It is fine for ethtool, since the way of implementing ethtool_ops::begin
      in stmmac is only can be accessed when interface is enabled, so the clocks
      are ticked.
      2. The MDIO bus has a different life cycle to the MAC, need ensure
      clocks are enabled when _mdio_read/write() need clocks, because these
      functions can be called while the interface it not opened.
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NJoakim Zhang <qiangqing.zhang@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5ec55823
  22. 25 11月, 2020 1 次提交
  23. 31 10月, 2020 1 次提交
  24. 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
  25. 17 9月, 2020 1 次提交
  26. 16 9月, 2020 1 次提交
  27. 14 1月, 2020 1 次提交
  28. 19 12月, 2019 1 次提交
  29. 05 9月, 2019 1 次提交
  30. 18 8月, 2019 3 次提交
    • J
      net: stmmac: Add support for SA Insertion/Replacement in XGMAC cores · 8000ddc0
      Jose Abreu 提交于
      Add the support for Source Address Insertion and Replacement in XGMAC
      cores. Two methods are supported: Descriptor based and register based.
      Signed-off-by: NJose Abreu <joabreu@synopsys.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8000ddc0
    • J
      net: stmmac: Add Split Header support and enable it in XGMAC cores · 67afd6d1
      Jose Abreu 提交于
      Add the support for Split Header feature in the RX path and enable it in
      XGMAC cores.
      
      This does not impact neither beneficts bandwidth but it does reduces CPU
      usage because without the feature all the entire packet is memcpy'ed,
      while that with the feature only the header is.
      
      With Split Header disabled 'perf stat -d' gives:
      86870.624945 task-clock (msec)      #    0.429 CPUs utilized
           1073352 context-switches       #    0.012 M/sec
                 1 cpu-migrations         #    0.000 K/sec
               213 page-faults            #    0.002 K/sec
      327113872376 cycles                 #    3.766 GHz (62.53%)
       56618161216 instructions           #    0.17  insn per cycle (75.06%)
       10742205071 branches               #  123.658 M/sec (75.36%)
         584309242 branch-misses          #    5.44% of all branches (75.19%)
       17594787965 L1-dcache-loads        #  202.540 M/sec (74.88%)
        4003773131 L1-dcache-load-misses  #   22.76% of all L1-dcache hits (74.89%)
        1313301468 LLC-loads              #   15.118 M/sec (49.75%)
         355906510 LLC-load-misses        #   27.10% of all LL-cache hits (49.92%)
      
      With Split Header enabled 'perf stat -d' gives:
      49324.456539 task-clock (msec)     #    0.245 CPUs utilized
           2542387 context-switches      #    0.052 M/sec
                 1 cpu-migrations        #    0.000 K/sec
               213 page-faults           #    0.004 K/sec
      177092791469 cycles                #    3.590 GHz (62.30%)
       68555756017 instructions          #    0.39  insn per cycle (75.16%)
       12697019382 branches              #  257.418 M/sec (74.81%)
         442081897 branch-misses         #    3.48% of all branches (74.79%)
       20337958358 L1-dcache-loads       #  412.330 M/sec (75.46%)
        3820210140 L1-dcache-load-misses #   18.78% of all L1-dcache hits (75.35%)
        1257719198 LLC-loads             #   25.499 M/sec (49.73%)
         685543923 LLC-load-misses       #   54.51% of all LL-cache hits (49.86%)
      
      Changes from v2:
      	- Reword commit message (Jakub)
      Changes from v1:
      	- Add performance info (David)
      	- Add misssing dma_sync_single_for_device()
      Signed-off-by: NJose Abreu <joabreu@synopsys.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      67afd6d1
    • J
      net: stmmac: Prepare to add Split Header support · ec222003
      Jose Abreu 提交于
      In order to add Split Header support, stmmac_rx() needs to take into
      account that packet may be split accross multiple descriptors.
      
      Refactor the logic of this function in order to support this scenario.
      
      Changes from v2:
      	- Fixup if condition detection (Jakub)
      	- Don't stop NAPI with unfinished packet (Jakub)
      	- Use napi_alloc_skb() (Jakub)
      Signed-off-by: NJose Abreu <joabreu@synopsys.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ec222003
  31. 11 8月, 2019 1 次提交
    • G
      stmmac: no need to check return value of debugfs_create functions · 8d72ab11
      Greg Kroah-Hartman 提交于
      When calling debugfs functions, there is no need to ever check the
      return value.  The function can work or not, but the code logic should
      never do something different based on this.
      
      Because we don't care about the individual files, we can remove the
      stored dentry for the files, as they are not needed to be kept track of
      at all.
      
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Cc: Jose Abreu <joabreu@synopsys.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d72ab11
  32. 09 8月, 2019 2 次提交