1. 27 9月, 2016 1 次提交
    • 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
  2. 05 7月, 2016 1 次提交
  3. 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
  4. 02 11月, 2015 1 次提交
  5. 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
  6. 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
  7. 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
  8. 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
  9. 01 4月, 2015 2 次提交
  10. 28 3月, 2015 3 次提交
  11. 24 3月, 2015 2 次提交
  12. 16 3月, 2015 1 次提交
  13. 12 3月, 2015 1 次提交
  14. 10 3月, 2015 1 次提交
  15. 07 3月, 2015 1 次提交
  16. 05 3月, 2015 1 次提交
    • P
      net: bcmgenet: simplify __bcmgenet_tx_reclaim() · 66d06757
      Petri Gynther 提交于
      1. Use c_index and ring->c_index to determine how many TxCBs/TxBDs are
         ready for cleanup
         - c_index = the current value of TDMA_CONS_INDEX
         - TDMA_CONS_INDEX is HW-incremented and auto-wraparound (0x0-0xFFFF)
         - ring->c_index = __bcmgenet_tx_reclaim() cleaned up to this point on
           the previous invocation
      
      2. Add bcmgenet_tx_ring->clean_ptr
         - index of the next TxCB to be cleaned
         - incremented as TxCBs/TxBDs are processed
         - value always in range [ring->cb_ptr, ring->end_ptr]
      
      3. Fix incrementing of dev->stats.tx_packets
         - should be incremented only when tx_cb_ptr->skb != NULL
      
      These changes simplify __bcmgenet_tx_reclaim(). Furthermore, Tx ring size
      can now be any value.
      
      With the old code, Tx ring size had to be a power-of-2:
         num_tx_bds = ring->size;
         c_index &= (num_tx_bds - 1);
         last_c_index &= (num_tx_bds - 1);
      Signed-off-by: NPetri Gynther <pgynther@google.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      66d06757
  17. 01 3月, 2015 1 次提交
  18. 25 2月, 2015 1 次提交
  19. 27 11月, 2014 2 次提交
  20. 22 11月, 2014 1 次提交
  21. 12 11月, 2014 2 次提交
    • F
      net: bcmgenet: apply MII configuration in bcmgenet_open() · dbd479db
      Florian Fainelli 提交于
      In case an interface has been brought down before entering S3, and then
      brought up out of S3, all the initialization done during
      bcmgenet_probe() by bcmgenet_mii_init() calling bcmgenet_mii_config() is
      just lost since register contents are restored to their reset values.
      
      Re-apply this configuration anytime we call bcmgenet_open() to make sure
      our port multiplexer is properly configured to match the PHY interface.
      
      Since we are now calling bcmgenet_mii_config() everytime bcmgenet_open()
      is called, make sure we only print the message during initialization
      time not to pollute the console.
      
      Fixes: b6e978e5 ("net: bcmgenet: add suspend/resume callbacks")
      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>
      dbd479db
    • F
      net: bcmgenet: connect and disconnect from the PHY state machine · c96e731c
      Florian Fainelli 提交于
      phy_disconnect() is the only way to guarantee that we are not going to
      schedule more work on the PHY state machine workqueue for that
      particular PHY device.
      
      This fixes an issue where a network interface was suspended prior to a
      system suspend/resume cycle and would then be resumed as part of
      mdio_bus_resume(), since the GENET interface clocks would have been
      disabled, this basically resulted in bus errors to appear since we are
      invoking the GENET driver adjust_link() callback.
      
      Fixes: b6e978e5 ("net: bcmgenet: add suspend/resume callbacks")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c96e731c
  22. 08 10月, 2014 1 次提交
  23. 06 10月, 2014 1 次提交
  24. 20 9月, 2014 1 次提交
  25. 24 7月, 2014 2 次提交
  26. 22 7月, 2014 3 次提交
  27. 14 7月, 2014 1 次提交