1. 10 3月, 2015 1 次提交
  2. 08 3月, 2015 1 次提交
    • P
      net: bcmgenet: rework Rx queue init · 6f5a272c
      Petri Gynther 提交于
      In preparation for supporting multiple Rx queues:
      1. Move the initialization of priv->num_rx_bds, priv->rx_bds, and
         priv->rx_cbs from bcmgenet_init_rx_ring() to bcmgenet_init_dma()
         since they are not specific to a single Rx queue. Mimics the Tx
         init model where priv->num_tx_bds, priv->tx_bds, and priv->tx_cbs
         are initialized in bcmgenet_init_dma().
      2. Program DMA_MBUF_DONE_THRESH = 1 so that future Rx queues Q0-Q15
         will get per-packet Rx interrupt.
      3. Group DMA_START_ADDR, RDMA_READ_PTR, RDMA_WRITE_PTR, and DMA_END_ADDR
         initialization together. Mimics the Tx init model.
      4. There is 1-to-1 mapping between RxCBs and RxBDs.
         Precalculate RxCB->bd_addr so that it can be used in the future.
      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>
      6f5a272c
  3. 07 3月, 2015 3 次提交
  4. 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
  5. 02 3月, 2015 1 次提交
    • F
      net: bcmgenet: fix software maintained statistics · f62ba9c1
      Florian Fainelli 提交于
      Commit 44c8bc3c ("net: bcmgenet: log RX buffer allocation and RX/TX dma
      failures") added a few software maintained statistics using
      BCMGENET_STAT_MIB_RX and BCMGENET_STAT_MIB_TX. These statistics are read from
      the hardware MIB counters, such that bcmgenet_update_mib_counters() was trying
      to read from a non-existing MIB offset for these counters.
      
      Fix this by introducing a special type: BCMGENET_STAT_SOFT, similar to
      BCMGENET_STAT_NETDEV, such that bcmgenet_get_ethtool_stats will read from the
      software mib.
      
      Fixes: 44c8bc3c ("net: bcmgenet: log RX buffer allocation and RX/TX dma failures")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f62ba9c1
  6. 01 3月, 2015 1 次提交
  7. 25 2月, 2015 4 次提交
  8. 09 12月, 2014 2 次提交
  9. 27 11月, 2014 2 次提交
  10. 22 11月, 2014 1 次提交
  11. 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
  12. 20 10月, 2014 1 次提交
  13. 11 10月, 2014 1 次提交
  14. 08 10月, 2014 1 次提交
  15. 06 10月, 2014 1 次提交
  16. 02 10月, 2014 1 次提交
  17. 27 9月, 2014 1 次提交
  18. 23 9月, 2014 2 次提交
    • F
      net: bcmgenet: call bcmgenet_dma_teardown in bcmgenet_fini_dma · 4a0c081e
      Florian Fainelli 提交于
      We should not be manipulaging the DMA_CTRL registers directly by writing
      0 to them to disable DMA. This is an operation that needs to be timed to
      make sure the DMA engines have been properly stopped since their state
      machine stops on a packet boundary, not immediately.
      
      Make sure that tha bcmgenet_fini_dma() calls bcmgenet_dma_teardown() to
      ensure a proper DMA engine state. As a result, we need to reorder the
      function bodies to resolve the use dependency.
      
      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>
      4a0c081e
    • F
      net: bcmgenet: fix TX reclaim accounting for fragments · 478a010c
      Florian Fainelli 提交于
      The GENET driver supports SKB fragments, and succeeds in transmitting
      them properly, but when reclaiming these transmitted fragments, we will
      only update the count of free buffer descriptors by 1, even for SKBs
      with fragments. This leads to the networking stack thinking it has more
      room than the hardware has when pushing new SKBs, and backing off
      consequently because we return NETDEV_TX_BUSY.
      
      Fix this by accounting for the SKB nr_frags plus one (itself) and update
      ring->free_bds accordingly with that value for each iteration loop in
      __bcmgenet_tx_reclaim().
      
      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>
      478a010c
  19. 20 9月, 2014 1 次提交
  20. 09 9月, 2014 1 次提交
    • F
      net: bcmgenet: check harder for out of memory conditions · b629be5c
      Florian Fainelli 提交于
      There is a potential case where we might be failing to refill a
      control block, leaving it with both a NULL skb pointer *and* a NULL
      dma_unmap_addr.
      
      The way we process incoming packets, by first calling
      dma_unmap_single(), and then only checking for a potential NULL skb can
      lead to situations where do pass a NULL dma_unmap_addr() to
      dma_unmap_single(), resulting in an oops.
      
      Fix this my moving the NULL skb check earlier, since no backing skb
      also means no corresponding DMA mapping for this packet.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b629be5c
  21. 12 8月, 2014 3 次提交
    • F
      net: bcmgenet: correctly resume adapter from Wake-on-LAN · 98bb7399
      Florian Fainelli 提交于
      In case we configured the adapter to be a wake up source from
      Wake-on-LAN, but we never actually woke up using Wake-on-LAN, we will
      leave the adapter in MagicPacket matching mode, which prevents any other
      type of packets from reaching the RX engine. Fix this by calling
      bcmgenet_power_up() with GENET_POWER_WOL_MAGIC to restore the adapter
      configuration in bcmgenet_resume().
      
      The second problem we had was an imbalanced clock disabling in
      bcmgenet_wol_resume(), the Wake-on-LAN slow clock is only enabled in
      bcmgenet_suspend() if we configured Wake-on-LAN, yet we unconditionally
      disabled the clock in bcmgenet_wol_resume().
      
      Fixes: 8c90db72 ("net: bcmgenet: suspend and resume from Wake-on-LAN")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      98bb7399
    • F
      net: bcmgenet: correctly suspend and resume PHY device · cc013fb4
      Florian Fainelli 提交于
      Make sure that we properly suspend and resume the PHY device when we
      enter low power modes. We had two calls to bcmgenet_mii_reset() which
      will issue a software-reset to the PHY without using the PHY library,
      get rid of them since they are completely bogus and mess up with the PHY
      library state. Make sure that we reset the PHY library cached values
      (link, pause and duplex) to allow the link adjustment callback to be
      invoked when needed.
      
      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>
      cc013fb4
    • F
      net: bcmgenet: request and enable main clock earlier · e4a60a93
      Florian Fainelli 提交于
      bcmgenet_set_hw_params() will read the hardware version and compare it
      with the one we are getting from Device Tree. Due to the clock being
      enabled too late, bcmgenet_set_hw_params() will cause bus errors since
      the GENET hardware block is still gated off by the time
      bcmgenet_set_hw_params() is called, this will also make us fail the
      version check since we will read the value 0 from the hardware.
      
      Fix this by requesting the clock before the first piece of code that
      needs to access hardware register.
      
      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>
      e4a60a93
  22. 31 7月, 2014 1 次提交
  23. 24 7月, 2014 5 次提交
  24. 23 7月, 2014 1 次提交
  25. 22 7月, 2014 1 次提交