1. 19 10月, 2019 1 次提交
    • D
      net: bcmgenet: soft reset 40nm EPHYs before MAC init · 1f515486
      Doug Berger 提交于
      It turns out that the "Workaround for putting the PHY in IDDQ mode"
      used by the internal EPHYs on 40nm Set-Top Box chips when powering
      down puts the interface to the GENET MAC in a state that can cause
      subsequent MAC resets to be incomplete.
      
      Rather than restore the forced soft reset when powering up internal
      PHYs, this commit moves the invocation of phy_init_hw earlier in
      the MAC initialization sequence to just before the MAC reset in the
      open and resume functions. This allows the interface to be stable
      and allows the MAC resets to be successful.
      
      The bcmgenet_mii_probe() function is split in two to accommodate
      this. The new function bcmgenet_mii_connect() handles the first
      half of the functionality before the MAC initialization, and the
      bcmgenet_mii_config() function is extended to provide the remaining
      PHY configuration following the MAC initialization.
      
      Fixes: 484bfa15 ("Revert "net: bcmgenet: Software reset EPHY after power on"")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1f515486
  2. 16 10月, 2019 1 次提交
  3. 26 6月, 2019 2 次提交
  4. 19 6月, 2019 1 次提交
  5. 30 8月, 2018 1 次提交
  6. 30 3月, 2018 1 次提交
    • F
      net: bcmgenet: Fix coalescing settings handling · 5e6ce1f1
      Florian Fainelli 提交于
      There were a number of issues with setting the RX coalescing parameters:
      
      - we would not be preserving values that would have been configured
        across close/open calls, instead we would always reset to no timeout
        and 1 interrupt per packet, this would also prevent DIM from setting its
        default usec/pkts values
      
      - when adaptive RX would be turned on, we woud not be fetching the
        default parameters, we would stay with no timeout/1 packet per interrupt
        until the estimator kicks in and changes that
      
      - finally disabling adaptive RX coalescing while providing parameters
        would not be honored, and we would stay with whatever DIM had previously
        determined instead of the user requested parameters
      
      Fixes: 9f4ca058 ("net: bcmgenet: Add support for adaptive RX coalescing")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NTal Gilboa <talgi@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5e6ce1f1
  7. 26 3月, 2018 1 次提交
  8. 26 10月, 2017 2 次提交
  9. 30 8月, 2017 2 次提交
  10. 01 8月, 2017 2 次提交
  11. 16 7月, 2017 1 次提交
    • D
      net: bcmgenet: Free skb after last Tx frag · f48bed16
      Doug Berger 提交于
      Since the skb is attached to the first control block of a fragmented
      skb it is possible that the skb could be freed when reclaiming that
      control block before all fragments of the skb have been consumed by
      the hardware and unmapped.
      
      This commit introduces first_cb and last_cb pointers to the skb
      control block used by the driver to keep track of which transmit
      control blocks within a transmit ring are the first and last ones
      associated with the skb.
      
      It then splits the bcmgenet_free_cb() function into transmit
      (bcmgenet_free_tx_cb) and receive (bcmgenet_free_rx_cb) versions
      that can handle the unmapping of dma mapped memory and cleaning up
      the corresponding control block structure so that the skb is only
      freed after the last associated transmit control block is reclaimed.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f48bed16
  12. 22 3月, 2017 1 次提交
    • F
      net: bcmgenet: Track per TX/RX rings statistics · 37a30b43
      Florian Fainelli 提交于
      __bcmgenet_tx_reclaim() is currently summing TX bytes/packets in a way
      that is not SMP friendly, mutliples CPUs could run
      __bcmgenet_tx_reclaim() independently and still update stats->tx_bytes
      and stats->tx_packets, cloberring the other CPUs statistics.
      
      Fix this by tracking per RX and TX rings the number of bytes, packets,
      dropped and errors statistics, and provide a bcmgenet_get_stats()
      function which aggregates everything and returns a consistent output.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      37a30b43
  13. 14 3月, 2017 1 次提交
  14. 10 3月, 2017 2 次提交
  15. 27 9月, 2016 2 次提交
    • F
      Revert "net: ethernet: bcmgenet: use phydev from struct net_device" · 0299b6ac
      Florian Fainelli 提交于
      This reverts commit 62469c76 ("net: ethernet: bcmgenet: use phydev
      from struct net_device") because it causes GENETv1/2/3 adapters to
      expose the following behavior after an ifconfig down/up sequence:
      
      PING fainelli-linux (10.112.156.244): 56 data bytes
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.352 ms
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.472 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.496 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.517 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.536 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.557 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=752.448 ms (DUP!)
      
      This was previously fixed by commit 5dbebbb4 ("net: bcmgenet:
      Software reset EPHY after power on") but the commit we are reverting was
      essentially making this previous commit void, here is why.
      
      Without commit 62469c76 we would have the following scenario after
      an ifconfig down then up sequence:
      
      - bcmgenet_open() calls bcmgenet_power_up() to make sure the PHY is
        initialized *before* we get to initialize the UniMAC, this is
        critical to ensure the PHY is in a correct state, priv->phydev is
        valid, this code executes fine
      
      - second time from bcmgenet_mii_probe(), through the normal
        phy_init_hw() call (which arguably could be optimized out)
      
      Everything is fine in that case. With commit 62469c76, we would have
      the following scenario to happen after an ifconfig down then up
      sequence:
      
      - bcmgenet_close() calls phy_disonnect() which makes dev->phydev become
        NULL
      
      - when bcmgenet_open() executes again and calls bcmgenet_mii_reset() from
        bcmgenet_power_up() to initialize the internal PHY, the NULL check
        becomes true, so we do not reset the PHY, yet we keep going on and
        initialize the UniMAC, causing MAC activity to occur
      
      - we call bcmgenet_mii_reset() from bcmgenet_mii_probe(), but this is
        too late, the PHY is botched, and causes the above bogus pings/packets
        transmission/reception to occur
      Reported-by: NJaedon Shin <jaedon.shin@gmail.com>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0299b6ac
    • F
      Revert "net: ethernet: bcmgenet: use phydev from struct net_device" · bf1a85a8
      Florian Fainelli 提交于
      This reverts commit 62469c76 ("net: ethernet: bcmgenet: use phydev
      from struct net_device") because it causes GENETv1/2/3 adapters to
      expose the following behavior after an ifconfig down/up sequence:
      
      PING fainelli-linux (10.112.156.244): 56 data bytes
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.352 ms
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.472 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.496 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.517 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.536 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.557 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=752.448 ms (DUP!)
      
      This was previously fixed by commit 5dbebbb4 ("net: bcmgenet:
      Software reset EPHY after power on") but the commit we are reverting was
      essentially making this previous commit void, here is why.
      
      Without commit 62469c76 we would have the following scenario after
      an ifconfig down then up sequence:
      
      - bcmgenet_open() calls bcmgenet_power_up() to make sure the PHY is
        initialized *before* we get to initialize the UniMAC, this is
        critical to ensure the PHY is in a correct state, priv->phydev is
        valid, this code executes fine
      
      - second time from bcmgenet_mii_probe(), through the normal
        phy_init_hw() call (which arguably could be optimized out)
      
      Everything is fine in that case. With commit 62469c76, we would have
      the following scenario to happen after an ifconfig down then up
      sequence:
      
      - bcmgenet_close() calls phy_disonnect() which makes dev->phydev become
        NULL
      
      - when bcmgenet_open() executes again and calls bcmgenet_mii_reset() from
        bcmgenet_power_up() to initialize the internal PHY, the NULL check
        becomes true, so we do not reset the PHY, yet we keep going on and
        initialize the UniMAC, causing MAC activity to occur
      
      - we call bcmgenet_mii_reset() from bcmgenet_mii_probe(), but this is
        too late, the PHY is botched, and causes the above bogus pings/packets
        transmission/reception to occur
      Reported-by: NJaedon Shin <jaedon.shin@gmail.com>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bf1a85a8
  16. 05 7月, 2016 1 次提交
  17. 25 3月, 2016 1 次提交
    • P
      net: bcmgenet: fix dev->stats.tx_bytes accounting · 55868120
      Petri Gynther 提交于
      1. Add bytes_compl local variable to __bcmgenet_tx_reclaim() to collect
         transmitted bytes. dev->stats updates can then be moved outside the
         while-loop. bytes_compl is also needed for future BQL support.
      2. When bcmgenet device uses Tx checksum offload, each transmitted skb
         gets an extra 64-byte header prepended to it. Before this header is
         prepended to the skb, we need to save the skb "wire" length in
         GENET_CB(skb)->bytes_sent, so that proper Tx bytes accounting can
         be done in __bcmgenet_tx_reclaim().
      3. skb->len covers the entire length of skb, whether it is linear or
         fragmented. Thus, when we clean the fragments, do not increase
         transmitted bytes.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NPetri Gynther <pgynther@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55868120
  18. 02 11月, 2015 1 次提交
  19. 18 9月, 2015 2 次提交
    • F
      net: bcmgenet: Implement RX coalescing control knobs · 4a29645b
      Florian Fainelli 提交于
      Add support for the ethtool rx-frames coalescing parameter which allows
      defining the number of RX interrupts per frames received. The RDMA
      engine supports a configurable timeout with a resolution of
      approximately 8.192 us.
      
      We can no longer enable the BDONE/PDONE interrupts as those would
      fire for each packet/buffer received, which would defeat the MBDONE
      interrupt purpose. The MBDONE interrupt is guaranteed to correspond to a
      PDONE/BDONE interrupt when the threshold is set to 1.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a29645b
    • F
      net: bcmgenet: Implement TX coalescing control knobs · 2f913070
      Florian Fainelli 提交于
      Configuring the ethtool tx-frames property, which translates into N
      packets before a TX interrupt is the simplest configuration scheme
      because it requires no locking neither at the softare nor hardware
      level, and is completely indepedent from the link speed. Since ethtool
      does not allow per-tx queue coalescing parameters, we apply the same
      setting to any transmit queue.
      
      We can no longer enable the BDONE/PDONE interrupts as those would fire
      for each packet/buffer received, which would defeat the MBDONE interrupt
      purpose. The MBDONE interrupt is guaranteed to correspond to a
      PDONE/BDONE interrupt when the threshold is set to 1, but offers
      interrupt coalescing when the value is > 1.
      
      Since the HW is configured to generate an interrupt when the ring
      becomes emtpy, we have to deny any timeout/timer settings coming from
      user-space to indicate we can only generate an interrupt very <N>
      packets.
      
      While we are at it, fix the DMA_INTR_THRESHOLD_MASK value which was off
      by one bit (0xff vs. 0x1ff).
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2f913070
  20. 21 7月, 2015 4 次提交
    • F
      net: bcmgenet: Remove init parameter from bcmgenet_mii_config · 28b45910
      Florian Fainelli 提交于
      Now that we have reworked the way we perform the PHY initialization, we
      no longer need to differentiate between init time vs. non-init time
      calls, just use a dev_info_once() print to print the PHY type.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28b45910
    • F
      net: bcmgenet: Delay PHY initialization to bcmgenet_open() · 6cc8e6d4
      Florian Fainelli 提交于
      We are currently doing a full PHY initialization and even starting the
      pHY state machine during bcmgenet_mii_init() which is executed in the
      driver's probe function. This is convenient to determine whether we can
      attach to a proper PHY device but comes at the expense of spending up to
      10ms per MDIO transactions (to reach the waitqueue timeout), which slows
      things down.
      
      This also creates a sitaution where we end-up attaching twice to the
      PHY, which is not quite correct either.
      
      Fix this by moving bcmgenet_mii_probe() into bcmgenet_open() and update
      its error path accordingly.
      
      Avoid printing the message "attached PHY at address 1 [...]" every time
      we bring up/down the interface and remove this print since it duplicates
      what the PHY driver already does for us.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6cc8e6d4
    • F
      net: bcmgenet: Determine PHY type before scanning MDIO bus · c624f891
      Florian Fainelli 提交于
      Our internal GPHY might be powered off before we attempt scanning the
      MDIO bus and bind a driver to it. The way we are currently determining
      whether a PHY is internal or not is done *after* we have successfully
      matched its driver. If the PHY is powered down, it will not respond to
      the MDIO bus, so we will not be able to bind a driver to it.
      
      Our Device Tree for GENET interfaces specifies a "phy-mode" value:
      "internal" which tells if this internal uses an internal PHY or not.
      
      If of_get_phy_mode() fails to parse the 'phy-mode' property, do an
      additional manual lookup, and if we find "internal" set the
      corresponding internal variable accordingly.
      
      Replace all uses of phy_is_internal() with a check against
      priv->internal_phy to avoid having to rely on whether or not
      priv->phydev is set correctly.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c624f891
    • F
      net: bcmgenet: Remove excessive PHY reset · 6ac3ce82
      Florian Fainelli 提交于
      We are currently issuing multiple PHY resets during a suspend/resume,
      first during bcmgenet_power_up() which does a hardware reset, then a
      software reset by calling bcmgenet_mii_reset(). This is both unnecessary
      and can take as long as 10ms per MDIO transactions while we re-apply
      workarounds because we do not yet have MDIO interrupts enabled.
      
      phy_resume() takes care of re-apply our workarounds in case we need any,
      and bcmgenet_power_up() does a PHY hardware reset, all of this is more
      than enough to guarantee that the PHY operates correctly.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6ac3ce82
  21. 29 6月, 2015 1 次提交
    • F
      net: bcmgenet: workaround initial read failures for integrated PHYs · 7b635da8
      Florian Fainelli 提交于
      All BCM7xxx integrated Gigabit PHYs have an issue in their MDIO
      management controller which will make the initial read or write to them
      to fail and return 0xffff. This is a real issue as the typical first
      thing we do is read from MII_PHYSID1 and MII_PHYSID2 from get_phy_id()
      to register a driver for these PHYs.
      
      Coupled with the workaround in drivers/net/phy/bcm7xxx.c, this
      workaround for the MDIO bus controller consists in scanning the list of
      PHYs to do this initial read workaround for as part of the MDIO bus
      reset routine which is invoked prior to mdiobus_scan().
      
      Once we have a proper PHY driver/device registered, all workarounds are
      located there (e.g: power management suspend/resume calls).
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7b635da8
  22. 02 4月, 2015 1 次提交
    • P
      net: bcmgenet: enable MoCA link state change detection · 8d88c6eb
      Petri Gynther 提交于
      Currently, MoCA fixed PHYs are always in link-up state, regardless of
      whether the link is actually up or not.
      
      Add code to properly detect MoCA link state changes and to reflect the
      new state in MoCA fixed PHY. Only GENET V3 and V4 MACs are capable of
      detecting MoCA link state changes.
      
      The code works as follows:
      1. GENET MAC detects MoCA link state change and issues UMAC_IRQ_LINK_UP
         or UMAC_IRQ_LINK_DOWN interrupt.
      2. Link up/down interrupt is processed in bcmgenet_irq_task(), which
         calls phy_mac_interrupt().
      3. phy_mac_interrupt() updates the fixed PHY phydev->link and kicks
         the PHY state machine.
      4. PHY state machine proceeds to read the fixed PHY link status
         register.
      5. When the fixed PHY link status register is being read, the new
         function bcmgenet_fixed_phy_link_update() gets called. It copies
         the fixed PHY phydev->link value to the fixed PHY status->link.
      6. PHY state machine receives the new link state of the fixed PHY.
      7. MoCA fixed PHY link state now correctly reflects the real MoCA
         hardware link state.
      Signed-off-by: NPetri Gynther <pgynther@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d88c6eb
  23. 01 4月, 2015 2 次提交
  24. 28 3月, 2015 3 次提交
  25. 24 3月, 2015 2 次提交
  26. 16 3月, 2015 1 次提交