1. 09 7月, 2014 8 次提交
    • R
      net: fec: quiesce packet processing before changing features · 8506fa1d
      Russell King 提交于
      Changing the features (receive checksumming) requires the hardware to be
      reprogrammed, and also changes the checks in the receive packet
      processing.
      
      The current implementation has a race - fec_set_features() changes the
      flags which alter the receive packet processing while the adapter is
      active, and potentially receiving frames.  Only after we've modified
      the software flag do we shutdown and reconfigure the hardware.
      
      This can lead to packets being received and marked with a valid checksum
      (via CHECKSUM_UNNECESSARY) when the hardware checksum validation has not
      yet been enabled.
      
      We must quiesce the device, then change the software configuration for
      this feature, and then resume the device if it was previously running.
      
      The resulting code structure also allows us to add other configuration
      features in this path without having to quiesce and resume the network
      interface and device.
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8506fa1d
    • R
      net: fec: quiesce packet processing before stopping device in fec_set_features() · 9a7ba438
      Russell King 提交于
      fec_set_features() calls fec_stop() to stop the transmit ring while the
      transmit queue is still active.  This can lead to the transmit ring
      being restarted by an intervening packet queued for transmission, or
      by the tx quirk timer expiring.
      
      Fix this by disabling NAPI (which ensures that the NAPI handlers are
      not running), and then take the transmit lock while we stop and
      restart the adapter (which prevents new packets being queued).
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9a7ba438
    • R
      net: fec: quiesce packet processing before stopping device in fec_suspend() · 31a6de34
      Russell King 提交于
      fec_suspend() calls fec_stop() to stop the transmit ring while the
      transmit packet processing is still active.  This can lead to the
      transmit queue being restarted by an intervening packet queued for
      transmission, or by the tx quirk timer expiring.
      
      Fix this by disabling NAPI first, which will ensure that the NAPI
      handlers are not running.  Then, take the transmit lock before
      detaching the netif device.  This ensures that there are no races
      with the transmit path - and also ensures that the watchdog won't
      fire.
      
      We can then safely stop the ethernet device itself, knowing that the
      rest of the driver is safely shut down.
      
      On resume, we bring the device back up in reverse order - we restart
      the device, reattach the device (under the tx lock), and then enable
      the NAPI handlers.
      
      We also need to adjust the close function to cope with this new
      sequence, so that it's possible to cleanly close down the driver
      after the hardware fails to resume (eg, due to the regulator_enable()
      or pinctrl calls in the resume path returning an error.)
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31a6de34
    • R
      net: fec: remove inappropriate calls around fec_restart() · 6af42d42
      Russell King 提交于
      This is the second stage to "move calls to quiesce/resume packet
      processing out of fec_restart()", where we remove calls which are not
      appropriate to the call site.
      
      In the majority of cases, there is no need to detach and reattach the
      interface as we are holding the queue xmit lock across the reset.  The
      exception to that is in fec_resume(), where we are already detached by
      the suspend function.  Here, we can remove the call to detach the
      interface.
      
      We also do not need to stop the transmit queue.  Holding the xmit lock
      is enough to ensure that the transmit packet processing is not running
      while we perform our task.  However, since fec_restart() always cleans
      the rings, we call netif_wake_queue() (or netif_device_attach() in the
      case of resume) just before dropping the xmit lock.  This prevents the
      watchdog firing.
      
      Lastly, always call napi_enable() after the device has been reattached
      in the resume path so that we know that the transmit packet processing
      is already in an enabled state, so we don't call netif_wake_queue()
      while detached.
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6af42d42
    • R
      net: fec: move calls to quiesce/resume packet processing out of fec_restart() · dbc64a8e
      Russell King 提交于
      Move the calls to quiesce and resume packet processing out of
      fec_restart() to its call sites.  This is the first step in a two stage
      clean up of this code, where we just move the calls out of fec_restart()
      without changing them.  Not everywhere needs to issue these calls, and
      not everywhere needs all of these calls to be issued.
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dbc64a8e
    • R
      net: fec: only restart or stop the device if it is present and running · 8ce5624f
      Russell King 提交于
      Avoid calling fec_restart() or fec_stop() while the device is down
      or not present (iow suspended.)
      
      Although the ndo_timeout method will only be called if the device is
      present and running, we defer this to a work queue.  The work queue
      can run independently, and so needs to repeat these checks to ensure
      that a restart doesn't occur after the device has been taken down or
      detached for suspend.  In this case, we call fec_restart() in the
      resume path, so nothing is lost.
      
      For fec_set_features, we add a call to fec_restart() in fec_enet_open()
      to ensure that the hardware is appropriate programmed when the interface
      is opened.  fec_set_features() call should not occur while we're
      suspended, so we don't have to worry about that case.
      
      The adjust_link needs similar treatment - this also is called from a
      work queue, which may be run independently after we have taken the
      device down and detached it.  In this case, we just mark the link
      down and take no further action.  We will reset things appropriately
      once the device is up and running again, at which point we will receive
      another adjust_link callback.
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8ce5624f
    • R
      net: fec: ensure fec_enet_close() copes with resume failure · 8bbbd3c1
      Russell King 提交于
      When the FEC is suspended, the device is detached.  Upon resume failure,
      the device is left in detached mode, possibly with some of the required
      clocks not running.  We don't want to be poking the device in that state
      because as it may cause bus errors.
      
      If the device is marked detached, avoid calling fec_stop().
      
      This depends upon: "net:fec: improve safety of suspend/resume paths"
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8bbbd3c1
    • R
      net: fec: improve safety of suspend/resume/transmit timeout paths · da1774e5
      Russell King 提交于
      We should hold the rtnl lock while suspending, resuming or processing
      the transmit timeout to ensure that nothing will interfere while we
      bring up, take down or restart the hardware.  The transmit timeout
      could run if we're preempted during suspend.
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      da1774e5
  2. 08 7月, 2014 12 次提交
  3. 18 6月, 2014 1 次提交
    • F
      net: fec: Don't clear IPV6 header checksum field when IP accelerator enable · 62a02c98
      Fugang Duan 提交于
      The commit 96c50caa (net: fec: Enable IP header hardware checksum)
      enable HW IP header checksum for IPV4 and IPV6, which causes IPV6 TCP/UDP
      cannot work. (The issue is reported by Russell King)
      
      For FEC IP header checksum function: Insert IP header checksum. This "IINS"
      bit is written by the user. If set, IP accelerator calculates the IP header
      checksum and overwrites the IINS corresponding header field with the calculated
      value. The checksum field must be cleared by user, otherwise the checksum
      always is 0xFFFF.
      
      So the previous patch clear IP header checksum field regardless of IP frame
      type.
      
      In fact, IP HW detect the packet as IPV6 type, even if the "IINS" bit is set,
      the IP accelerator is not triggered to calculates IPV6 header checksum because
      IPV6 frame format don't have checksum.
      
      So this results in the IPV6 frame being corrupted.
      
      The patch just add software detect the current packet type, if it is IPV6
      frame, it don't clear IP header checksum field.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Reported-and-tested-by: NRussell King <linux@arm.linux.org.uk>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62a02c98
  4. 13 6月, 2014 6 次提交
    • 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 feature setting · 09d1e541
      Nimrod Andy 提交于
      In order to enhance the code readable, let's factorize the
      feature list.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      09d1e541
    • N
      net: fec: Enable IP header hardware checksum · 96c50caa
      Nimrod Andy 提交于
      IP header checksum is calcalated by network layer in default.
      To support software TSO, it is better to use HW calculate the
      IP header checksum.
      
      FEC hw checksum feature request the checksum field in frame
      is zero, otherwise the calculative CRC is not correct.
      
      For segmentated TCP packet, HW calculate the IP header checksum again,
      it doesn't bring any impact. For SW TSO, HW calculated checksum bring
      better performance.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      96c50caa
    • 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
  5. 03 6月, 2014 1 次提交
    • F
      fec: Include pinctrl header file · a68ab98e
      Fabio Estevam 提交于
      Commit 5bbde4d2 ("net: fec: use pinctrl PM helpers") caused the following
      build error on m68k:
      
      drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_open':
      drivers/net/ethernet/freescale/fec_main.c:1819:2: error: implicit declaration of function 'pinctrl_pm_select_default_state' [-Werror=implicit-function-declaration]
      drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_close':
      drivers/net/ethernet/freescale/fec_main.c:1863:2: error: implicit declaration of function 'pinctrl_pm_select_sleep_state' [-Werror=implicit-function-declaration]
      
      In order to fix the build error, include the linux/pinctrl/consumer.h header
      file.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a68ab98e
  6. 31 5月, 2014 1 次提交
  7. 23 5月, 2014 2 次提交
  8. 01 4月, 2014 1 次提交
  9. 28 3月, 2014 1 次提交
  10. 25 3月, 2014 1 次提交
  11. 14 3月, 2014 1 次提交
  12. 21 2月, 2014 1 次提交
  13. 19 2月, 2014 1 次提交
    • R
      NET: fec: only enable napi if we are successful · ce5eaf02
      Russell King 提交于
      If napi is left enabled after a failed attempt to bring the interface
      up, we BUG:
      
      fec 2188000.ethernet eth0: no PHY, assuming direct connection to switch
      libphy: PHY fixed-0:00 not found
      fec 2188000.ethernet eth0: could not attach to PHY
      ------------[ cut here ]------------
      kernel BUG at include/linux/netdevice.h:502!
      Internal error: Oops - BUG: 0 [#1] SMP ARM
      ...
      PC is at fec_enet_open+0x4d0/0x500
      LR is at __dev_open+0xa4/0xfc
      
      Only enable napi after we are past all the failure paths.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce5eaf02
  14. 17 1月, 2014 1 次提交
  15. 06 1月, 2014 1 次提交
  16. 30 12月, 2013 1 次提交