1. 16 10月, 2014 1 次提交
    • N
      net: fec: ptp: fix convergence issue to support LinuxPTP stack · 28b5f058
      Nimrod Andy 提交于
      iMX6SX IEEE 1588 module has one hw issue in capturing the ATVR register.
      The current SW flow is:
      		ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
      		ts_counter_ns = ENET0->ATVR;
      The ATVR value is not expected value that cause LinuxPTP stack cannot be convergent.
      
      ENET Block Guide/ Chapter for the iMX6SX (PELE) address the issue:
      After set ENET_ATCR[Capture], there need some time cycles before the counter
      value is capture in the register clock domain. The wait-time-cycles is at least
      6 clock cycles of the slower clock between the register clock and the 1588 clock.
      So need something like:
      		ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
      		wait();
      		ts_counter_ns = ENET0->ATVR;
      
      For iMX6SX, the 1588 ts_clk is fixed to 25Mhz, register clock is 66Mhz, so the
      wait-time-cycles must be greater than 240ns (40ns * 6). The patch add 1us delay
      before cpu read ATVR register.
      
      Changes V2:
      Modify the commit/comments log to describe the issue clearly.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28b5f058
  2. 15 10月, 2014 2 次提交
  3. 02 10月, 2014 1 次提交
  4. 27 9月, 2014 1 次提交
  5. 20 9月, 2014 2 次提交
  6. 17 9月, 2014 1 次提交
  7. 14 9月, 2014 5 次提交
  8. 23 8月, 2014 1 次提交
    • N
      net: fec: ptp: avoid register access when ipg clock is disabled · 91c0d987
      Nimrod Andy 提交于
      The current kernel hang on i.MX6SX with rootfs mount from MMC.
      The root cause is that ptp uses a periodic timer to access enet register
      even if ipg clock is disabled.
      
      FEC ptp driver start one period timer to read 1588 counter register in the
      ptp init function that is called after FEC driver is probed.
      
      To save power, after FEC probe finish, FEC driver disable all clocks including
      ipg clock that is needed for register access.
      
      i.MX5x, i.MX6q/dl/sl FEC register access don't cause system hang when ipg clock
      is disabled, just return zero value. But for i.MX6sx SOC, it cause system hang.
      
      To avoid the issue, we need to check ptp clock status before ptp timer count access.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      91c0d987
  9. 12 8月, 2014 1 次提交
  10. 09 7月, 2014 2 次提交
  11. 08 7月, 2014 1 次提交
  12. 13 6月, 2014 4 次提交
    • N
      net: fec: Add software TSO support · 79f33912
      Nimrod Andy 提交于
      Add software TSO support for FEC.
      This feature allows to improve outbound throughput performance.
      
      Tested on imx6dl sabresd board, running iperf tcp tests shows:
      - 16.2% improvement comparing with FEC SG patch
      - 82% improvement comparing with NO SG & TSO patch
      
      $ ethtool -K eth0 tso on
      $ iperf -c 10.192.242.167 -t 3 &
      [  3] local 10.192.242.108 port 35388 connected with 10.192.242.167 port 5001
      [ ID] Interval       Transfer     Bandwidth
      [  3]  0.0- 3.0 sec   181 MBytes   506 Mbits/sec
      
      During the testing, CPU loading is 30%.
      Since imx6dl FEC Bandwidth is limited to SOC system bus bandwidth, the
      performance with SW TSO is a milestone.
      
      CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
      CC: Eric Dumazet <eric.dumazet@gmail.com>
      CC: David Laight <David.Laight@ACULAB.COM>
      CC: Li Frank <B20596@freescale.com>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79f33912
    • N
      net: fec: Add Scatter/gather support · 6e909283
      Nimrod Andy 提交于
      Add Scatter/gather support for FEC.
      This feature allows to improve outbound throughput performance.
      
      Tested on imx6dl sabresd board:
      Running iperf tests shows a 55.4% improvement.
      
      $ ethtool -K eth0 sg off
      $ iperf -c 10.192.242.167 -t 3 &
      [  3] local 10.192.242.108 port 52618 connected with 10.192.242.167 port 5001
      [ ID] Interval       Transfer     Bandwidth
      [  3]  0.0- 3.0 sec  99.5 MBytes   278 Mbits/sec
      
      $ ethtool -K eth0 sg on
      $ iperf -c 10.192.242.167 -t 3 &
      [  3] local 10.192.242.108 port 52617 connected with 10.192.242.167 port 5001
      [ ID] Interval       Transfer     Bandwidth
      [  3]  0.0- 3.0 sec   154 MBytes   432 Mbits/sec
      
      CC: Li Frank <B20596@freescale.com>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6e909283
    • N
      net: fec: Increase buffer descriptor entry number · 55d0218a
      Nimrod Andy 提交于
      In order to support SG, software TSO, let's increase BD entry number.
      
      CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
      CC: Eric Dumazet <eric.dumazet@gmail.com>
      CC: David Laight <David.Laight@ACULAB.COM>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55d0218a
    • N
      net: fec: Factorize the .xmit transmit function · 61a4427b
      Nimrod Andy 提交于
      Make the code more readable and easy to support other features like
      SG, TSO, moving the common transmit function to one api.
      
      And the patch also factorize the getting BD index to it own function.
      
      CC: David Laight <David.Laight@ACULAB.COM>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      61a4427b
  13. 22 11月, 2013 1 次提交
  14. 05 9月, 2013 1 次提交
    • D
      net: fec: fix the error to get the previous BD entry · 36e24e2e
      Duan Fugang-B38611 提交于
      Bug: error to get the previous BD entry. When the current BD
      is the first BD, the previous BD entry must be the last BD,
      not "bdp - 1" in current logic.
      
      V4:
        * Optimize fec_enet_get_nextdesc() for code clean.
          Replace "ex_new_bd - ring_size" with "ex_base".
          Replace "new_bd - ring_size" with "base".
      
      V3:
        * Restore the API name because David suggest to use fec_enet_
          prefix for all function in fec driver.
          So, change next_bd() -> fec_enet_get_nextdesc()
              change pre_bd()  -> fec_enet_get_prevdesc()
        * Reduce the two APIs parameters for easy to call.
      
      V2:
        * Add tx_ring_size and rx_ring_size to struct fec_enet_private.
        * Replace api fec_enet_get_nextdesc() with next_bd().
          Replace api fec_enet_get_prevdesc() with pre_bd().
      
        * Move all ring size check logic to next_bd() and pre_bd(), which
          simplifies the code redundancy.
      
      V1:
        * Add BD ring size check to get the previous BD entry in correctly.
      Reviewed-by: NLi Frank <B20596@freescale.com>
      Signed-off-by: NFugang Duan  <B38611@freescale.com>
      Acked-by: NFrank Li <frank.li@freescale.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36e24e2e
  15. 28 7月, 2013 1 次提交
    • F
      net: fec: workaround stop tx during errata ERR006358 · 03191656
      Frank Li 提交于
      If the ready bit in the transmit buffer descriptor (TxBD[R])
      is previously detected as not set during a prior frame transmission,
      then the ENET_TDAR[TDAR] bit is cleared at a later time, even if
      additional TxBDs were added to the ring and the ENET_TDAR[TDAR]
      bit is set. This results in frames not being transmitted until
      there is a 0-to-1 transition on ENET_TDAR[TDAR].
      
      Workarounds:
      code can use the transmit frame interrupt flag (ENET_EIR[TXF])
      as a method to detect whether the ENET has completed transmission
      and the ENET_TDAR[TDAR] has been cleared. If ENET_TDAR[TDAR] is
      detected as cleared when packets are queued and waiting for transmit,
      then a write to the TDAR bit will restart TxBD processing.
      
      This case main happen when loading is light. A ethernet package may
      not send out utile next package put into tx queue.
      
      How to test:
      while [ true ]
      do
      	ping <IP> -s 10000 -w 4
      	ping <IP> -s 6000 -w 2
      	ping <IP> -s 4000 -w 2
      	ping <IP> -s 10000 -w 2
      done
      
      You will see below result in overnight test.
      
      6008 bytes from 10.192.242.116: seq=1 ttl=128 time=0.722 ms
      4008 bytes from 10.192.242.116: seq=0 ttl=128 time=1001.008 ms
      4008 bytes from 10.192.242.116: seq=1 ttl=128 time=1.010 ms
      10008 bytes from 10.192.242.116: seq=0 ttl=128 time=0.896 ms
      
      After apply this patch, >1000ms delay disappear.
      Signed-off-by: NFrank Li <Frank.Li@freescale.com>
      Acked-by: NFugang Duan  <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      03191656
  16. 04 7月, 2013 1 次提交
  17. 27 6月, 2013 1 次提交
  18. 08 6月, 2013 1 次提交
  19. 28 5月, 2013 1 次提交
  20. 09 5月, 2013 1 次提交
  21. 25 4月, 2013 1 次提交
  22. 04 4月, 2013 1 次提交
  23. 15 3月, 2013 1 次提交
  24. 05 3月, 2013 2 次提交
    • F
      net: fec: fix build error in no MXC platform · acac8406
      Frank Li 提交于
      build error cause by
      Commit ff43da86
      ("NET: FEC: dynamtic check DMA desc buff type")
      
      drivers/net/ethernet/freescale/fec.c: In function ‘fec_enet_get_nextdesc’:
      drivers/net/ethernet/freescale/fec.c:215:18: error: invalid use of undefined type ‘struct bufdesc_ex’
      drivers/net/ethernet/freescale/fec.c: In function ‘fec_enet_get_prevdesc’:
      drivers/net/ethernet/freescale/fec.c:224:18: error: invalid use of undefined type ‘struct bufdesc_ex’
      drivers/net/ethernet/freescale/fec.c: In function ‘fec_enet_start_xmit’:
      drivers/net/ethernet/freescale/fec.c:286:37: error: arithmetic on pointer to an incomplete type
      drivers/net/ethernet/freescale/fec.c:287:13: error: arithmetic on pointer to an incomplete type
      drivers/net/ethernet/freescale/fec.c:324:7: error: dereferencing pointer to incomplete type etc....
      Signed-off-by: NFrank Li <Frank.Li@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      acac8406
    • F
      net: fec: put tx to napi poll function to fix dead lock · de5fb0a0
      Frank Li 提交于
      up stack ndo_start_xmit already hold lock.
      fec_enet_start_xmit needn't spin lock.
      stat_xmit just update fep->cur_tx
      fec_enet_tx just update fep->dirty_tx
      
      Reserve a empty bdb to check full or empty
      cur_tx == dirty_tx    means full
      cur_tx == dirty_tx +1 means empty
      
      So needn't is_full variable.
      
      Fix spin lock deadlock
      
      =================================
      [ INFO: inconsistent lock state ]
      3.8.0-rc5+ #107 Not tainted
      ---------------------------------
      inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
      ptp4l/615 [HC1[1]:SC0[0]:HE0:SE1] takes:
       (&(&list->lock)->rlock#3){?.-...}, at: [<8042c3c4>] skb_queue_tail+0x20/0x50
       {HARDIRQ-ON-W} state was registered at:
       [<80067250>] mark_lock+0x154/0x4e8
       [<800676f4>] mark_irqflags+0x110/0x1a4
       [<80069208>] __lock_acquire+0x494/0x9c0
       [<80069ce8>] lock_acquire+0x90/0xa4
       [<80527ad0>] _raw_spin_lock_bh+0x44/0x54
       [<804877e0>] first_packet_length+0x38/0x1f0
       [<804879e4>] udp_poll+0x4c/0x5c
       [<804231f8>] sock_poll+0x24/0x28
       [<800d27f0>] do_poll.isra.10+0x120/0x254
       [<800d36e4>] do_sys_poll+0x15c/0x1e8
       [<800d3828>] sys_poll+0x60/0xc8
       [<8000e780>] ret_fast_syscall+0x0/0x3c
      
       *** DEADLOCK ***
      
       1 lock held by ptp4l/615:
        #0:  (&(&fep->hw_lock)->rlock){-.-...}, at: [<80355f9c>] fec_enet_tx+0x24/0x268
        stack backtrace:
        Backtrace:
        [<800121e0>] (dump_backtrace+0x0/0x10c) from [<80516210>] (dump_stack+0x18/0x1c)
        r6:8063b1fc r5:bf38b2f8 r4:bf38b000 r3:bf38b000
        [<805161f8>] (dump_stack+0x0/0x1c) from [<805189d0>] (print_usage_bug.part.34+0x164/0x1a4)
        [<8051886c>] (print_usage_bug.part.34+0x0/0x1a4) from [<80518a88>] (print_usage_bug+0x78/0x88)
        r8:80065664 r7:bf38b2f8 r6:00000002 r5:00000000 r4:bf38b000
        [<80518a10>] (print_usage_bug+0x0/0x88) from [<80518b58>] (mark_lock_irq+0xc0/0x270)
        r7:bf38b000 r6:00000002 r5:bf38b2f8 r4:00000000
        [<80518a98>] (mark_lock_irq+0x0/0x270) from [<80067270>] (mark_lock+0x174/0x4e8)
        [<800670fc>] (mark_lock+0x0/0x4e8) from [<80067744>] (mark_irqflags+0x160/0x1a4)
        [<800675e4>] (mark_irqflags+0x0/0x1a4) from [<80069208>] (__lock_acquire+0x494/0x9c0)
        r5:00000002 r4:bf38b2f8
        [<80068d74>] (__lock_acquire+0x0/0x9c0) from [<80069ce8>] (lock_acquire+0x90/0xa4)
        [<80069c58>] (lock_acquire+0x0/0xa4) from [<805278d8>] (_raw_spin_lock_irqsave+0x4c/0x60)
        [<8052788c>] (_raw_spin_lock_irqsave+0x0/0x60) from [<8042c3c4>] (skb_queue_tail+0x20/0x50)
        r6:bfbb2180 r5:bf1d0190 r4:bf1d0184
        [<8042c3a4>] (skb_queue_tail+0x0/0x50) from [<8042c4cc>] (sock_queue_err_skb+0xd8/0x188)
        r6:00000056 r5:bfbb2180 r4:bf1d0000 r3:00000000
        [<8042c3f4>] (sock_queue_err_skb+0x0/0x188) from [<8042d15c>] (skb_tstamp_tx+0x70/0xa0)
        r6:bf0dddb0 r5:bf1d0000 r4:bfbb2180 r3:00000004
        [<8042d0ec>] (skb_tstamp_tx+0x0/0xa0) from [<803561d0>] (fec_enet_tx+0x258/0x268)
        r6:c089d260 r5:00001c00 r4:bfbd0000
        [<80355f78>] (fec_enet_tx+0x0/0x268) from [<803562cc>] (fec_enet_interrupt+0xec/0xf8)
        [<803561e0>] (fec_enet_interrupt+0x0/0xf8) from [<8007d5b0>] (handle_irq_event_percpu+0x54/0x1a0)
        [<8007d55c>] (handle_irq_event_percpu+0x0/0x1a0) from [<8007d740>] (handle_irq_event+0x44/0x64)
        [<8007d6fc>] (handle_irq_event+0x0/0x64) from [<80080690>] (handle_fasteoi_irq+0xc4/0x15c)
        r6:bf0dc000 r5:bf811290 r4:bf811240 r3:00000000
        [<800805cc>] (handle_fasteoi_irq+0x0/0x15c) from [<8007ceec>] (generic_handle_irq+0x28/0x38)
        r5:807130c8 r4:00000096
        [<8007cec4>] (generic_handle_irq+0x0/0x38) from [<8000f16c>] (handle_IRQ+0x54/0xb4)
        r4:8071d280 r3:00000180
        [<8000f118>] (handle_IRQ+0x0/0xb4) from [<80008544>] (gic_handle_irq+0x30/0x64)
        r8:8000e924 r7:f4000100 r6:bf0ddef8 r5:8071c974 r4:f400010c
        r3:00000000
        [<80008514>] (gic_handle_irq+0x0/0x64) from [<8000e2e4>] (__irq_svc+0x44/0x5c)
        Exception stack(0xbf0ddef8 to 0xbf0ddf40)
      Signed-off-by: NFrank Li <Frank.Li@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de5fb0a0
  25. 30 1月, 2013 1 次提交
    • F
      net: fec: add napi support to improve proformance · dc975382
      Frank Li 提交于
      Add napi support
      
      Before this patch
      
       iperf -s -i 1
       ------------------------------------------------------------
       Server listening on TCP port 5001
       TCP window size: 85.3 KByte (default)
       ------------------------------------------------------------
       [  4] local 10.192.242.153 port 5001 connected with 10.192.242.138 port 50004
       [ ID] Interval       Transfer     Bandwidth
       [  4]  0.0- 1.0 sec  41.2 MBytes   345 Mbits/sec
       [  4]  1.0- 2.0 sec  43.7 MBytes   367 Mbits/sec
       [  4]  2.0- 3.0 sec  42.8 MBytes   359 Mbits/sec
       [  4]  3.0- 4.0 sec  43.7 MBytes   367 Mbits/sec
       [  4]  4.0- 5.0 sec  42.7 MBytes   359 Mbits/sec
       [  4]  5.0- 6.0 sec  43.8 MBytes   367 Mbits/sec
       [  4]  6.0- 7.0 sec  43.0 MBytes   361 Mbits/sec
      
      After this patch
       [  4]  2.0- 3.0 sec  51.6 MBytes   433 Mbits/sec
       [  4]  3.0- 4.0 sec  51.8 MBytes   435 Mbits/sec
       [  4]  4.0- 5.0 sec  52.2 MBytes   438 Mbits/sec
       [  4]  5.0- 6.0 sec  52.1 MBytes   437 Mbits/sec
       [  4]  6.0- 7.0 sec  52.1 MBytes   437 Mbits/sec
       [  4]  7.0- 8.0 sec  52.3 MBytes   439 Mbits/sec
      Signed-off-by: NFrank Li <Frank.Li@freescale.com>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dc975382
  26. 19 1月, 2013 1 次提交
    • F
      net: fec: enable pause frame to improve rx prefomance for 1G network · baa70a5c
      Frank Li 提交于
      The limition of imx6 internal bus cause fec can't achieve 1G perfomance.
      There will be many packages lost because FIFO over run.
      
      This patch enable pause frame flow control.
      
      Before this patch
      iperf -s -i 1
      TCP window size: 85.3 KByte (default)
      ------------------------------------------------------------
      [  4] local 10.192.242.153 port 5001 connected with 10.192.242.94 port 49773
      [ ID] Interval       Transfer     Bandwidth
      [  4]  0.0- 1.0 sec  6.35 MBytes  53.3 Mbits/sec
      [  4]  1.0- 2.0 sec  3.39 MBytes  28.5 Mbits/sec
      [  4]  2.0- 3.0 sec  2.63 MBytes  22.1 Mbits/sec
      [  4]  3.0- 4.0 sec  1.10 MBytes  9.23 Mbits/sec
      
      ifconfig
         RX packets:46195 errors:1859 dropped:1 overruns:1859 frame:1859
      
      After this patch
      iperf -s -i 1
      
      [  4] local 10.192.242.153 port 5001 connected with 10.192.242.94 port 49757
      [ ID] Interval       Transfer     Bandwidth
      [  4]  0.0- 1.0 sec  49.8 MBytes   418 Mbits/sec
      [  4]  1.0- 2.0 sec  50.1 MBytes   420 Mbits/sec
      [  4]  2.0- 3.0 sec  47.5 MBytes   399 Mbits/sec
      [  4]  3.0- 4.0 sec  45.9 MBytes   385 Mbits/sec
      [  4]  4.0- 5.0 sec  44.8 MBytes   376 Mbits/sec
      
      ifconfig
         RX packets:2348454 errors:0 dropped:16 overruns:0 frame:0
      Signed-off-by: NFrank Li <Frank.Li@freescale.com>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      baa70a5c
  27. 05 1月, 2013 1 次提交
  28. 02 11月, 2012 2 次提交