1. 16 Jan, 2014 40 commits
    • Don Skidmore's avatar
      ixgbevf: create function for all of ring init · de02decb
      Don Skidmore authored
      This patch creates new functions for ring initialization,
      ixgbevf_configure_tx_ring() and ixgbevf_configure_rx_ring(). The work done
      in these function previously was spread between several other functions and
      this change should hopefully lead to greater readability and make the code
      more like ixgbe.  This patch also moves the placement of some older functions
      to avoid having to write prototypes.  It also promotes a couple of debug
      messages to errors.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      de02decb
    • Don Skidmore's avatar
      ixgbevf: Convert ring storage form pointer to an array to array of pointers · 87e70ab9
      Don Skidmore authored
      This will change how we store rings arrays in the adapter sturct.
      We use to have a pointer to an array now we will be using an array
      of pointers.  This will allow us to support multiple queues on
      muliple nodes at some point we would be able to reallocate the rings
      so that each is on a local node if needed.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87e70ab9
    • Wei Yongjun's avatar
      ixgbevf: use pci drvdata correctly in ixgbevf_suspend() · 27ae2967
      Wei Yongjun authored
      We had set the pci driver-specific data in ixgbevf_probe() as a type of
      struct net_device, so we should use it as netdev in ixgbevf_suspend().
      Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27ae2967
    • Jacob Keller's avatar
      ixgbevf: set the disable state when ixgbevf_qv_disable is called · e689e728
      Jacob Keller authored
      The ixgbevf_qv_disable function used by CONFIG_NET_RX_BUSY_POLL is broken,
      because it does not properly set the IXGBEVF_QV_STATE_DISABLED bit, indicating
      that the q_vector should be disabled (and preventing future locks from
      obtaining the vector). This patch corrects the issue by setting the disable
      state.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e689e728
    • John Fastabend's avatar
      ixgbe: reinit_locked() should be called with rtnl_lock · 8f4c5c9f
      John Fastabend authored
      ixgbe_service_task() is calling ixgbe_reinit_locked() without
      the rtnl_lock being held. This is because it is being called
      from a worker thread and not a rtnl netlink or dcbnl path.
      
      Add rtnl_{un}lock() semantics. I found this during code review.
      Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f4c5c9f
    • Eric Dumazet's avatar
      net: eth_type_trans() should use skb_header_pointer() · 0864c158
      Eric Dumazet authored
      eth_type_trans() can read uninitialized memory as drivers
      do not necessarily pull more than 14 bytes in skb->head before
      calling it.
      
      As David suggested, we can use skb_header_pointer() to
      fix this without breaking some drivers that might not expect
      eth_type_trans() pulling 2 additional bytes.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Ben Hutchings <bhutchings@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0864c158
    • David S. Miller's avatar
      Merge branch 'stmmac_pm' · 7967919d
      David S. Miller authored
      Srinivas Kandagatla says:
      
      ====================
      net: stmmac PM related fixes.
      
      During PM_SUSPEND_FREEZE testing, I have noticed that PM support in STMMAC is
      partly broken. I had to re-arrange the code to do PM correctly. There were lot
      of things I did not like personally and some bits did not work in the first
      place. I thought this is the nice opportunity to clean the mess up.
      
      Here is what I did:
       any
      1> Test PM suspend freeze via pm_test
      It did not work for following reasons.
       - If the power to gmac is removed when it enters in low power state.
      stmmac_resume could not cope up with such behaviour, it was expecting the ip
      register contents to be still same as before entering low power, This
      assumption is wrong. So I started to add some code to do Hardware
      initialization, thats when I started to re-arrange the code. stmmac_open
      contains both resource and memory allocations and hardware initialization. I
      had to separate these two things in two different functions.
      
      These two patches do that
        net: stmmac: move dma allocation to new function
        net: stmmac: move hardware setup for stmmac_open to new function
      
      And rest of the other patches are fixing the loose ends, things like mdio
      reset, which might be necessary in cases likes hibernation(I did not test).
      
      In hibernation cases the driver was just unregistering with subsystems and
      releasing resources which I did not like and its not necessary to do this as
      part of PM. So using the same stmmac_suspend/resume made more sense for
      hibernation cases than using stmmac_open/release.
      Also fixed a NULL pointer dereference bug too.
      
      2> Test WOL via PM_SUSPEND_FREEZE
      Did get an wakeup interrupt, but could not wakeup a freeze system.
      So I had to add pm_wakeup_event to the driver.
      net: stmmac: notify the PM core of a wakeup event. patch.
      
      Also few patches like
        net: stmmac: make stmmac_mdio_reset non-static
        net: stmmac: restore pinstate in pm resume.
      helps the resume function to reset the phy and put back the pins in default
      state.
      
      Changes since RFC:
      	- Rebased to net-next on Dave's suggestion.
      
      All these patches are Acked by Peppe.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7967919d
    • Srinivas Kandagatla's avatar
      net: stmmac: notify the PM core of a wakeup event. · 89f7f2cf
      Srinivas Kandagatla authored
      In PM_SUSPEND_FREEZE and WOL(Wakeup On Lan) case, when the driver gets a
      wakeup event, either the driver or platform specific PM code should notify
      the pm core about it, so that the system can wakeup from low power.
      
      In cases where there is no involvement of platform specific PM, it
      becomes driver responsibility to notify the PM core to wakeup the
      system.
      
      Without this WOL with PM_SUSPEND_FREEZE does not work on STi based SOCs.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89f7f2cf
    • Srinivas Kandagatla's avatar
      net: stmmac: restore pinstate in pm resume. · db88f10a
      Srinivas Kandagatla authored
      This patch adds code to restore default pinstate of the pins when it
      comes back from low power state. Without this patch the state of the
      pins would be unknown and the driver would not work.
      
      This patch also adds code to put the pins in to sleep state when the
      driver enters low power state.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      db88f10a
    • Srinivas Kandagatla's avatar
      net: stmmac: use suspend functions for hibernation · 33a23e22
      Srinivas Kandagatla authored
      In hibernation freeze case the driver just releases the resources like
      dma buffers, irqs, unregisters the drivers and during restore it does
      register, request the resources. This is not really necessary, as part
      of power management all the data structures are intact, all the
      previously allocated resources can be used after coming out of low
      power.
      
      This patch uses the suspend and resume callbacks for freeze and
      restore which initializes the hardware correctly without unregistering
      or releasing the resources, this should also help in reducing the time
      to restore.
      
      Also this patch fixes a bug in stmmac_pltfr_restore and
      stmmac_pltfr_freeze where it tries to get hold of platform data via
      dev_get_platdata call, which would return NULL in device tree cases and
      the next if statement would crash as there is no NULL check.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33a23e22
    • Srinivas Kandagatla's avatar
      net: stmmac: fix power management suspend-resume case · 623997fb
      Srinivas Kandagatla authored
      The driver PM resume assumes that the IP is still powered up and the
      all the register contents are not disturbed when it comes out of low
      power suspend case. This assumption is wrong, basically the driver
      should not consider any state of registers after it comes out of low
      power. However driver can keep the part of the IP powered up if its a
      wake up source. But it can not assume the register state of the IP. Also
      its possible that SOC glue layer can take the power off the IP if its
      not wake-up source to reduce the power consumption.
      
      This patch re initializes hardware by calling stmmac_hw_setup function in
      resume case.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      623997fb
    • Srinivas Kandagatla's avatar
      net: stmmac: make stmmac_mdio_reset non-static · 073752aa
      Srinivas Kandagatla authored
      This patch promotes stmmac_mdio_reset function from static to
      non-static, so that power management functions can decide to reset if
      the IP comes out from lowe power state specially hibernation cases.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      073752aa
    • Srinivas Kandagatla's avatar
      net: stmmac: move hardware setup for stmmac_open to new function · 523f11b5
      Srinivas Kandagatla authored
      This patch moves hardware setup part of the code in stmmac_open to a new
      function stmmac_hw_setup, the reason for doing this is to make hw
      initialization independent function so that PM functions can re-use it to
      re-initialize the IP after returning from low power state.
      This will also avoid code duplication across stmmac_resume/restore and
      stmmac_open.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      523f11b5
    • Srinivas Kandagatla's avatar
      net: stmmac: move dma allocation to new function · 09f8d696
      Srinivas Kandagatla authored
      This patch moves dma resource allocation to a new function
      alloc_dma_desc_resources, the reason for moving this to a new function
      is to keep the memory allocations in a separate function. One more reason
      it to get suspend and hibernation cases working without releasing and
      allocating these resources during suspend-resume and freeze-restore
      cases.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      09f8d696
    • Srinivas Kandagatla's avatar
      net: stmmac: mdio: remove reset gpio free · 984203ce
      Srinivas Kandagatla authored
      This patch removes gpio_free for reset line of the phy, driver stores
      the gpio number in its private data-structure to use in future. As the
      driver uses this pin in future this pin should not be freed.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      984203ce
    • Srinivas Kandagatla's avatar
      net: stmmac: support max-speed device tree property · 9cbadf09
      Srinivas Kandagatla authored
      This patch adds support to "max-speed" property which is a standard
      Ethernet device tree property. max-speed specifies maximum speed
      (specified in megabits per second) supported the device.
      
      Depending on the clocking schemes some of the boards can only support
      few link speeds, so having a way to limit the link speed in the mac
      driver would allow such setups to work reliably.
      
      Without this patch there is no way to tell the driver to limit the
      link speed.
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@st.com>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9cbadf09
    • David S. Miller's avatar
      Merge branch 'mvneta' · 82a342d1
      David S. Miller authored
      Willy Tarreau says:
      
      ====================
      Assorted mvneta fixes and improvements
      
      this series provides some fixes for a number of issues met with the
      mvneta driver, then adds some improvements. Patches 1-5 are fixes
      and would be needed in 3.13 and likely -stable. The next ones are
      performance improvements and cleanups :
      
        - driver lockup when reading stats while sending traffic from multiple
          CPUs : this obviously only happens on SMP and is the result of missing
          locking on the driver. The problem was present since the introduction
          of the driver in 3.8. The first patch performs some changes that are
          needed for the second one which actually fixes the issue by using
          per-cpu counters. It could make sense to backport this to the relevant
          stable versions.
      
        - mvneta_tx_timeout calls various functions to reset the NIC, and these
          functions sleep, which is not allowed here, resulting in a panic.
          Better completely disable this Tx timeout handler for now since it is
          never called. The problem was encountered while developing some new
          features, it's uncertain whether it's possible to reproduce it with
          regular usage, so maybe a backport to stable is not needed.
      
        - replace the Tx timer with a real Tx IRQ. As first reported by Arnaud
          Ebalard and explained by Eric Dumazet, there is no way this driver
          can work correctly if it uses a driver to recycle the Tx descriptors.
          If too many packets are sent at once, the driver quickly ends up with
          no descriptors (which happens twice as easily in GSO) and has to wait
          10ms for recycling its descriptors and being able to send again. Eric
          has worked around this in the core GSO code. But still when routing
          traffic or sending UDP packets, the limitation is very visible. Using
          Tx IRQs allows Tx descriptors to be recycled when sent. The coalesce
          value is still configurable using ethtool. This fix turns the UDP
          send bitrate from 134 Mbps to 987 Mbps (ie: line rate). It's made of
          two patches, one to add the relevant bits from the original Marvell's
          driver, and another one to implement the change. I don't know if it
          should be backported to stable, as the bug only causes poor performance.
      
        - Patches 6..8 are essentially cleanups, code deduplication and minor
          optimizations for not re-fetching a value we already have (status).
      
        - patch 9 changes the prefetch of Rx descriptor from current one to
          next one. In benchmarks, it results in about 1% general performance
          increase on HTTP traffic, probably because prefetching the current
          descriptor does not leave enough time between the start of prefetch
          and its usage.
      
        - patch 10 implements support for build_skb() on Rx path. The driver
          now preallocates frags instead of skbs and builds an skb just before
          delivering it. This results in a 2% performance increase on HTTP
          traffic, and up to 5% on small packet Rx rate.
      
        - patch 11 implements rx_copybreak for small packets (256 bytes). It
          avoids a dma_map_single()/dma_unmap_single() and increases the Rx
          rate by 16.4%, from 486kpps to 573kpps. Further improvements up to
          711kpps are possible depending how the DMA is used.
      
        - patches 12 and 13 are extra cleanups made possible by some of the
          simplifications above.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82a342d1
    • Arnaud Ebalard's avatar
      net: mvneta: make mvneta_txq_done() return void · cd713199
      Arnaud Ebalard authored
      The function return parameter is not used in mvneta_tx_done_gbe(),
      where the function is called. This patch makes the function return
      void.
      Reviewed-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd713199
    • Arnaud Ebalard's avatar
      net: mvneta: mvneta_tx_done_gbe() cleanups · 0713a86a
      Arnaud Ebalard authored
      mvneta_tx_done_gbe() return value and third parameter are no more
      used. This patch changes the function prototype and removes a useless
      variable where the function is called.
      Reviewed-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0713a86a
    • willy tarreau's avatar
      net: mvneta: implement rx_copybreak · f19fadfc
      willy tarreau authored
      calling dma_map_single()/dma_unmap_single() is quite expensive compared
      to copying a small packet. So let's copy short frames and keep the buffers
      mapped. We set the limit to 256 bytes which seems to give good results both
      on the XP-GP board and on the AX3/4.
      
      The Rx small packet rate increased by 16.4% doing this, from 486kpps to
      573kpps. It is worth noting that even the call to the function
      dma_sync_single_range_for_cpu() is expensive (300 ns) although less
      than dma_unmap_single(). Without it, the packet rate raises to 711kpps
      (+24% more). Thus on systems where coherency from device to CPU is
      guaranteed by a snoop control unit, this patch should provide even more
      gains, and probably rx_copybreak could be increased.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f19fadfc
    • willy tarreau's avatar
      net: mvneta: convert to build_skb() · 8ec2cd48
      willy tarreau authored
      Make use of build_skb() to allocate frags on the RX path. When frag size
      is lower than a page size, we can use netdev_alloc_frag(), and we fall back
      to kmalloc() for larger sizes. The frag size is stored into the mvneta_port
      struct. The alloc/free functions check the frag size to decide what alloc/
      free method to use. MTU changes are safe because the MTU change function
      stops the device and clears the queues before applying the change.
      
      With this patch, I observed a reproducible 2% performance improvement on
      HTTP-based benchmarks, and 5% on small packet RX rate.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8ec2cd48
    • willy tarreau's avatar
      net: mvneta: prefetch next rx descriptor instead of current one · 34e4179d
      willy tarreau authored
      Currently, the mvneta driver tries to prefetch the current Rx
      descriptor during read. Tests have shown that prefetching the
      next one instead increases general performance by about 1% on
      HTTP traffic.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34e4179d
    • willy tarreau's avatar
      net: mvneta: simplify access to the rx descriptor status · 5428213c
      willy tarreau authored
      At several places, we already know the value of the rx status but
      we call functions which dereference the pointer again to get it
      and don't need the descriptor for anything else. Simplify this
      task by replacing the rx desc pointer by the status word itself.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5428213c
    • willy tarreau's avatar
      net: mvneta: factor rx refilling code · a1a65ab1
      willy tarreau authored
      Make mvneta_rxq_fill() use mvneta_rx_refill() instead of using
      duplicate code.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1a65ab1
    • willy tarreau's avatar
      net: mvneta: remove tests for impossible cases in the tx_done path · 6c498974
      willy tarreau authored
      Currently, mvneta_txq_bufs_free() calls mvneta_tx_done_policy() with
      a non-null cause to retrieve the pointer to the next queue to process.
      There are useless tests on the return queue number and on the pointer,
      all of which are well defined within a known limited set. This code
      path is fast, although not critical. Removing 3 tests here that the
      compiler could not optimize (verified) is always desirable.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6c498974
    • willy tarreau's avatar
      net: mvneta: replace Tx timer with a real interrupt · 71f6d1b3
      willy tarreau authored
      Right now the mvneta driver doesn't handle Tx IRQ, and relies on two
      mechanisms to flush Tx descriptors : a flush at the end of mvneta_tx()
      and a timer. If a burst of packets is emitted faster than the device
      can send them, then the queue is stopped until next wake-up of the
      timer 10ms later. This causes jerky output traffic with bursts and
      pauses, making it difficult to reach line rate with very few streams.
      
      A test on UDP traffic shows that it's not possible to go beyond 134
      Mbps / 12 kpps of outgoing traffic with 1500-bytes IP packets. Routed
      traffic tends to observe pauses as well if the traffic is bursty,
      making it even burstier after the wake-up.
      
      It seems that this feature was inherited from the original driver but
      nothing there mentions any reason for not using the interrupt instead,
      which the chip supports.
      
      Thus, this patch enables Tx interrupts and removes the timer. It does
      the two at once because it's not really possible to make the two
      mechanisms coexist, so a split patch doesn't make sense.
      
      First tests performed on a Mirabox (Armada 370) show that less CPU
      seems to be used when sending traffic. One reason might be that we now
      call the mvneta_tx_done_gbe() with a mask indicating which queues have
      been done instead of looping over all of them.
      
      The same UDP test above now happily reaches 987 Mbps / 87.7 kpps.
      Single-stream TCP traffic can now more easily reach line rate. HTTP
      transfers of 1 MB objects over a single connection went from 730 to
      840 Mbps. It is even possible to go significantly higher (>900 Mbps)
      by tweaking tcp_tso_win_divisor.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Cc: Arnaud Ebalard <arno@natisbad.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71f6d1b3
    • willy tarreau's avatar
      net: mvneta: add missing bit descriptions for interrupt masks and causes · 40ba35e7
      willy tarreau authored
      Marvell has not published the chip's datasheet yet, so it's very hard
      to find the relevant bits to manipulate to change the IRQ behaviour.
      Fortunately, these bits are described in the proprietary LSP patch set
      which is publicly available here :
      
          http://www.plugcomputer.org/downloads/mirabox/
      
      So let's put them back in the driver in order to reduce the burden of
      current and future maintenance.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40ba35e7
    • willy tarreau's avatar
      net: mvneta: do not schedule in mvneta_tx_timeout · 29021366
      willy tarreau authored
      If a queue timeout is reported, we can oops because of some
      schedules while the caller is atomic, as shown below :
      
        mvneta d0070000.ethernet eth0: tx timeout
        BUG: scheduling while atomic: bash/1528/0x00000100
        Modules linked in: slhttp_ethdiv(C) [last unloaded: slhttp_ethdiv]
        CPU: 2 PID: 1528 Comm: bash Tainted: G        WC   3.13.0-rc4-mvebu-nf #180
        [<c0011bd9>] (unwind_backtrace+0x1/0x98) from [<c000f1ab>] (show_stack+0xb/0xc)
        [<c000f1ab>] (show_stack+0xb/0xc) from [<c02ad323>] (dump_stack+0x4f/0x64)
        [<c02ad323>] (dump_stack+0x4f/0x64) from [<c02abe67>] (__schedule_bug+0x37/0x4c)
        [<c02abe67>] (__schedule_bug+0x37/0x4c) from [<c02ae261>] (__schedule+0x325/0x3ec)
        [<c02ae261>] (__schedule+0x325/0x3ec) from [<c02adb97>] (schedule_timeout+0xb7/0x118)
        [<c02adb97>] (schedule_timeout+0xb7/0x118) from [<c0020a67>] (msleep+0xf/0x14)
        [<c0020a67>] (msleep+0xf/0x14) from [<c01dcbe5>] (mvneta_stop_dev+0x21/0x194)
        [<c01dcbe5>] (mvneta_stop_dev+0x21/0x194) from [<c01dcfe9>] (mvneta_tx_timeout+0x19/0x24)
        [<c01dcfe9>] (mvneta_tx_timeout+0x19/0x24) from [<c024afc7>] (dev_watchdog+0x18b/0x1c4)
        [<c024afc7>] (dev_watchdog+0x18b/0x1c4) from [<c0020b53>] (call_timer_fn.isra.27+0x17/0x5c)
        [<c0020b53>] (call_timer_fn.isra.27+0x17/0x5c) from [<c0020cad>] (run_timer_softirq+0x115/0x170)
        [<c0020cad>] (run_timer_softirq+0x115/0x170) from [<c001ccb9>] (__do_softirq+0xbd/0x1a8)
        [<c001ccb9>] (__do_softirq+0xbd/0x1a8) from [<c001cfad>] (irq_exit+0x61/0x98)
        [<c001cfad>] (irq_exit+0x61/0x98) from [<c000d4bf>] (handle_IRQ+0x27/0x60)
        [<c000d4bf>] (handle_IRQ+0x27/0x60) from [<c000843b>] (armada_370_xp_handle_irq+0x33/0xc8)
        [<c000843b>] (armada_370_xp_handle_irq+0x33/0xc8) from [<c000fba9>] (__irq_usr+0x49/0x60)
      
      Ben Hutchings attempted to propose a better fix consisting in using a
      scheduled work for this, but while it fixed this panic, it caused other
      random freezes and panics proving that the reset sequence in the driver
      is unreliable and that additional fixes should be investigated.
      
      When sending multiple streams over a link limited to 100 Mbps, Tx timeouts
      happen from time to time, and the driver correctly recovers only when the
      function is disabled.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29021366
    • willy tarreau's avatar
      net: mvneta: use per_cpu stats to fix an SMP lock up · 74c41b04
      willy tarreau authored
      Stats writers are mvneta_rx() and mvneta_tx(). They don't lock anything
      when they update the stats, and as a result, it randomly happens that
      the stats freeze on SMP if two updates happen during stats retrieval.
      This is very easily reproducible by starting two HTTP servers and binding
      each of them to a different CPU, then consulting /proc/net/dev in loops
      during transfers, the interface should immediately lock up. This issue
      also randomly happens upon link state changes during transfers, because
      the stats are collected in this situation, but it takes more attempts to
      reproduce it.
      
      The comments in netdevice.h suggest using per_cpu stats instead to get
      rid of this issue.
      
      This patch implements this. It merges both rx_stats and tx_stats into
      a single "stats" member with a single syncp. Both mvneta_rx() and
      mvneta_rx() now only update the a single CPU's counters.
      
      In turn, mvneta_get_stats64() does the summing by iterating over all CPUs
      to get their respective stats.
      
      With this change, stats are still correct and no more lockup is encountered.
      
      Note that this bug was present since the first import of the mvneta
      driver.  It might make sense to backport it to some stable trees. If
      so, it depends on "d33dc73 net: mvneta: increase the 64-bit rx/tx stats
      out of the hot path".
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      74c41b04
    • willy tarreau's avatar
      net: mvneta: increase the 64-bit rx/tx stats out of the hot path · dc4277dd
      willy tarreau authored
      Better count packets and bytes in the stack and on 32 bit then
      accumulate them at the end for once. This saves two memory writes
      and two memory barriers per packet. The incoming packet rate was
      increased by 4.7% on the Openblocks AX3 thanks to this.
      
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Tested-by: default avatarArnaud Ebalard <arno@natisbad.org>
      Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dc4277dd
    • Paul Gortmaker's avatar
      drivers/net: delete non-required instances of include <linux/init.h> · a81ab36b
      Paul Gortmaker authored
      None of these files are actually using any __init type directives
      and hence don't need to include <linux/init.h>.   Most are just a
      left over from __devinit and __cpuinit removal, or simply due to
      code getting copied from one driver to the next.
      
      This covers everything under drivers/net except for wireless, which
      has been submitted separately.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a81ab36b
    • David S. Miller's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nftables · 5ff1dd24
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      This small batch contains several Netfilter fixes for your net-next
      tree, more specifically:
      
      * Fix compilation warning in nft_ct in NF_CONNTRACK_MARK is not set,
        from Kristian Evensen.
      
      * Add dependency to IPV6 for NF_TABLES_INET. This one has been reported
        by the several robots that are testing .config combinations, from Paul
        Gortmaker.
      
      * Fix default base chain policy setting in nf_tables, from myself.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ff1dd24
    • Jiri Pirko's avatar
      neigh: use NEIGH_VAR_INIT in ndo_neigh_setup functions. · 89740ca7
      Jiri Pirko authored
      When ndo_neigh_setup is called, the bitfield used by NEIGH_VAR_SET is
      not initialized yet. This might cause confusion for the people who use
      NEIGH_VAR_SET in ndo_neigh_setup. So rather introduce NEIGH_VAR_INIT for
      usage in ndo_neigh_setup.
      Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89740ca7
    • David S. Miller's avatar
      Merge branch 'ixgbe' · d6e26404
      David S. Miller authored
      Aaron Brown says:
      
      ====================
      Intel Wired LAN Driver Updates
      
      This series contains several updates from Alex to ixgbe.
      
      To avoid head of line blocking in the event a VF stops cleaning Rx descriptors
      he makes sure QDE bits are set for a VF before the Rx queues are enabled.
      
      To avoid a situation where the head write-back registers can remain set ofter
      the driver is unloaded he clears them on a VF reset.
      
      Alexander Duyck (2):
        ixgbe: Force QDE via PFQDE for VFs during reset
        ixgbe: Clear head write-back registers on VF reset
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6e26404
    • Alexander Duyck's avatar
      ixgbe: Clear head write-back registers on VF reset · dbf231af
      Alexander Duyck authored
      The Tx head write-back registers are not cleared during an FLR or VF reset.
      As a result a configuration that had head write-back enabled can leave the
      registers set after the driver is unloaded.  If the next driver loaded doesn't
      use the write-back registers this can lead to a bad configuration where
      head write-back is enabled, but the driver didn't request it.
      
      To avoid this situation the PF should be resetting the Tx head write-back
      registers when the VF requests a reset.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dbf231af
    • Alexander Duyck's avatar
      ixgbe: Force QDE via PFQDE for VFs during reset · 87397379
      Alexander Duyck authored
      This change makes it so that the QDE bits are set for a VF before the Rx
      queues are enabled.  As such we avoid head of line blocking in the event
      that the VF stops cleaning Rx descriptors for whatever reason.
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
      Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
      
       drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |   14 ++++++++++++++
       drivers/net/ethernet/intel/ixgbe/ixgbe_type.h  |    7 ++++---
       2 files changed, 18 insertions(+), 3 deletions(-)
      Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87397379
    • David S. Miller's avatar
      Merge branch 'noprefixroute' · e5d64023
      David S. Miller authored
      Thomas Haller says:
      
      ====================
      ipv6 addrconf: add IFA_F_NOPREFIXROUTE flag to suppress creation of IP6 routes
      
      v1 -> v2: add a second commit, handling NOPREFIXROUTE in ip6_del_addr.
      v2 -> v3: reword commit messages, code comments and some refactoring.
      v3 -> v4: refactor, rename variables, add enum
      v4 -> v5: rebase, so that patch applies cleanly to current net-next/master
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e5d64023
    • Thomas Haller's avatar
      ipv6 addrconf: don't cleanup prefix route for IFA_F_NOPREFIXROUTE · 5b84efec
      Thomas Haller authored
      Refactor the deletion/update of prefix routes when removing an
      address. Now also consider IFA_F_NOPREFIXROUTE and if there is an address
      present with this flag, to not cleanup the route. Instead, assume
      that userspace is taking care of this route.
      
      Also perform the same cleanup, when userspace changes an existing address
      to add NOPREFIXROUTE (to an address that didn't have this flag). This is
      done because when the address was added, a prefix route was created for it.
      Since the user now wants to handle this route by himself, we cleanup this
      route.
      
      This cleanup of the route is not totally robust. There is no guarantee,
      that the route we are about to delete was really the one added by the
      kernel. This behavior does not change by the patch, and in practice it
      should work just fine.
      Signed-off-by: default avatarThomas Haller <thaller@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b84efec
    • Thomas Haller's avatar
      ipv6 addrconf: add IFA_F_NOPREFIXROUTE flag to suppress creation of IP6 routes · 761aac73
      Thomas Haller authored
      When adding/modifying an IPv6 address, the userspace application needs
      a way to suppress adding a prefix route. This is for example relevant
      together with IFA_F_MANAGERTEMPADDR, where userspace creates autoconf
      generated addresses, but depending on on-link, no route for the
      prefix should be added.
      Signed-off-by: default avatarThomas Haller <thaller@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      761aac73
    • David S. Miller's avatar
      Revert "batman-adv: drop dependency against CRC16" · 6631c5ce
      David S. Miller authored
      This reverts commit 12afc36e.
      
      The dependency is actually still necessary.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6631c5ce