1. 06 9月, 2019 3 次提交
  2. 19 8月, 2019 1 次提交
  3. 08 5月, 2019 1 次提交
  4. 24 4月, 2019 1 次提交
  5. 08 4月, 2019 1 次提交
    • W
      drivers: Remove explicit invocations of mmiowb() · fb24ea52
      Will Deacon 提交于
      mmiowb() is now implied by spin_unlock() on architectures that require
      it, so there is no reason to call it from driver code. This patch was
      generated using coccinelle:
      
      	@mmiowb@
      	@@
      	- mmiowb();
      
      and invoked as:
      
      $ for d in drivers include/linux/qed sound; do \
      spatch --include-headers --sp-file mmiowb.cocci --dir $d --in-place; done
      
      NOTE: mmiowb() has only ever guaranteed ordering in conjunction with
      spin_unlock(). However, pairing each mmiowb() removal in this patch with
      the corresponding call to spin_unlock() is not at all trivial, so there
      is a small chance that this change may regress any drivers incorrectly
      relying on mmiowb() to order MMIO writes between CPUs using lock-free
      synchronisation. If you've ended up bisecting to this commit, you can
      reintroduce the mmiowb() calls using wmb() instead, which should restore
      the old behaviour on all architectures other than some esoteric ia64
      systems.
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      fb24ea52
  6. 21 3月, 2019 1 次提交
    • P
      net: remove 'fallback' argument from dev->ndo_select_queue() · a350ecce
      Paolo Abeni 提交于
      After the previous patch, all the callers of ndo_select_queue()
      provide as a 'fallback' argument netdev_pick_tx.
      The only exceptions are nested calls to ndo_select_queue(),
      which pass down the 'fallback' available in the current scope
      - still netdev_pick_tx.
      
      We can drop such argument and replace fallback() invocation with
      netdev_pick_tx(). This avoids an indirect call per xmit packet
      in some scenarios (TCP syn, UDP unconnected, XDP generic, pktgen)
      with device drivers implementing such ndo. It also clean the code
      a bit.
      
      Tested with ixgbe and CONFIG_FCOE=m
      
      With pktgen using queue xmit:
      threads		vanilla 	patched
      		(kpps)		(kpps)
      1		2334		2428
      2		4166		4278
      4		7895		8100
      
       v1 -> v2:
       - rebased after helper's name change
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a350ecce
  7. 08 3月, 2019 1 次提交
  8. 24 1月, 2019 1 次提交
    • S
      ravb: expand rx descriptor data to accommodate hw checksum · 12da6430
      Simon Horman 提交于
      EtherAVB may provide a checksum of packet data appended to packet data. In
      order to allow this checksum to be received by the host descriptor data
      needs to be enlarged by 2 bytes to accommodate the checksum.
      
      In the case of MTU-sized packets without a VLAN tag the
      checksum were already accommodated by virtue of the space reserved for the
      VLAN tag. However, a packet of MTU-size with a  VLAN tag consumed all
      packet data space provided by a descriptor leaving no space for the
      trailing checksum.
      
      This was not detected by the driver which incorrectly used the last two
      bytes of packet data as the checksum and truncate the packet by two bytes.
      This resulted all such packets being dropped.
      
      A work around is to disable RX checksum offload
       # ethtool -K eth0 rx off
      
      This patch resolves this problem by increasing the size available for
      packet data in RX descriptors by two bytes.
      
      Tested on R-Car E3 (r8a77990) ES1.0 based Ebisu-4D board
      
      v2
      * Use sizeof(__sum16) directly rather than adding a driver-local
        #define for the size of the checksum provided by the hw (2 bytes).
      
      Fixes: 4d86d381 ("ravb: RX checksum offload")
      Signed-off-by: NSimon Horman <horms+renesas@verge.net.au>
      Reviewed-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      12da6430
  9. 24 11月, 2018 2 次提交
  10. 22 9月, 2018 1 次提交
  11. 20 9月, 2018 1 次提交
  12. 19 9月, 2018 1 次提交
  13. 13 9月, 2018 1 次提交
  14. 23 8月, 2018 1 次提交
  15. 18 7月, 2018 3 次提交
  16. 10 7月, 2018 1 次提交
  17. 07 7月, 2018 7 次提交
  18. 07 3月, 2018 1 次提交
  19. 17 2月, 2018 1 次提交
  20. 13 2月, 2018 1 次提交
  21. 03 1月, 2018 1 次提交
  22. 14 12月, 2017 1 次提交
  23. 13 10月, 2017 1 次提交
  24. 05 10月, 2017 1 次提交
    • S
      ravb: RX checksum offload · 4d86d381
      Simon Horman 提交于
      Add support for RX checksum offload. This is enabled by default and
      may be disabled and re-enabled using ethtool:
      
       # ethtool -K eth0 rx off
       # ethtool -K eth0 rx on
      
      The RAVB provides a simple checksumming scheme which appears to be
      completely compatible with CHECKSUM_COMPLETE: sum of all packet data after
      the L2 header is appended to packet data; this may be trivially read by the
      driver and used to update the skb accordingly.
      
      In terms of performance throughput is close to gigabit line-rate both with
      and without RX checksum offload enabled. Perf output, however, appears to
      indicate that significantly less time is spent in do_csum(). This is as
      expected.
      
      Test results with RX checksum offload enabled:
       # /usr/bin/perf_3.16 record -o /run/perf.data -a netperf -t TCP_MAERTS -H 10.4.3.162
       MIGRATED TCP MAERTS TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.4.3.162 () port 0 AF_INET : demo
       enable_enobufs failed: getprotobyname
       Recv   Send    Send
       Socket Socket  Message  Elapsed
       Size   Size    Size     Time     Throughput
       bytes  bytes   bytes    secs.    10^6bits/sec
      
        87380  16384  16384    10.00     937.54
      
       Summary of output of perf report:
          18.28%      ksoftirqd/0  [kernel.kallsyms]  [k] _raw_spin_unlock_irqrestore
          10.34%      ksoftirqd/0  [kernel.kallsyms]  [k] __pi_memcpy
           9.83%      ksoftirqd/0  [kernel.kallsyms]  [k] ravb_poll
           7.89%      ksoftirqd/0  [kernel.kallsyms]  [k] skb_put
           4.01%      ksoftirqd/0  [kernel.kallsyms]  [k] dev_gro_receive
           3.37%          netperf  [kernel.kallsyms]  [k] __arch_copy_to_user
           3.17%          swapper  [kernel.kallsyms]  [k] arch_cpu_idle
           2.55%          swapper  [kernel.kallsyms]  [k] tick_nohz_idle_enter
           2.04%      ksoftirqd/0  [kernel.kallsyms]  [k] __pi___inval_dcache_area
           2.03%          swapper  [kernel.kallsyms]  [k] _raw_spin_unlock_irq
           1.96%      ksoftirqd/0  [kernel.kallsyms]  [k] __netdev_alloc_skb
           1.59%      ksoftirqd/0  [kernel.kallsyms]  [k] __slab_alloc.isra.83
      
      Test results without RX checksum offload enabled:
       # /usr/bin/perf_3.16 record -o /run/perf.data -a netperf -t TCP_MAERTS -H 10.4.3.162
       MIGRATED TCP MAERTS TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.4.3.162 () port 0 AF_INET : demo
       enable_enobufs failed: getprotobyname
       Recv   Send    Send
       Socket Socket  Message  Elapsed
       Size   Size    Size     Time     Throughput
       bytes  bytes   bytes    secs.    10^6bits/sec
      
        87380  16384  16384    10.00     940.20
      
       Summary of output of perf report:
          17.10%    ksoftirqd/0  [kernel.kallsyms]  [k] _raw_spin_unlock_irqrestore
          10.99%    ksoftirqd/0  [kernel.kallsyms]  [k] __pi_memcpy
           8.87%    ksoftirqd/0  [kernel.kallsyms]  [k] ravb_poll
           8.16%    ksoftirqd/0  [kernel.kallsyms]  [k] skb_put
           7.42%    ksoftirqd/0  [kernel.kallsyms]  [k] do_csum
           3.91%    ksoftirqd/0  [kernel.kallsyms]  [k] dev_gro_receive
           2.31%        swapper  [kernel.kallsyms]  [k] arch_cpu_idle
           2.16%    ksoftirqd/0  [kernel.kallsyms]  [k] __pi___inval_dcache_area
           2.14%    ksoftirqd/0  [kernel.kallsyms]  [k] __netdev_alloc_skb
           1.93%        netperf  [kernel.kallsyms]  [k] __arch_copy_to_user
           1.79%        swapper  [kernel.kallsyms]  [k] tick_nohz_idle_enter
           1.63%    ksoftirqd/0  [kernel.kallsyms]  [k] __slab_alloc.isra.83
      
      Above results collected on an R-Car Gen 3 Salvator-X/r8a7796 ES1.0.
      Also tested on a R-Car Gen 3 Salvator-X/r8a7795 ES1.0.
      
      By inspection this also appears to be compatible with the ravb found
      on R-Car Gen 2 SoCs, however, this patch is currently untested on such
      hardware.
      Signed-off-by: NSimon Horman <horms+renesas@verge.net.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4d86d381
  25. 02 8月, 2017 2 次提交
    • N
      ravb: add workaround for clock when resuming with WoL enabled · fbf3d034
      Niklas Söderlund 提交于
      The renesas-cpg-mssr clock driver are not yet aware of PSCI sleep where
      power is cut to the SoC. When resuming from this state with WoL enabled
      the enable count of the ravb clock is 1 and the clock driver thinks the
      clock is already on when PM core enables the clock and increments the
      enable count to 2. This will result in the ravb driver failing to talk
      to the hardware since the module clock is off. Work around this by
      forcing the enable count to 0 and then back to 2 when resuming with WoL
      enabled.
      
      This workaround should be reverted once the renesas-cpg-mssr clock
      driver becomes aware of this PSCI sleep behavior.
      Signed-off-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Acked-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fbf3d034
    • N
      ravb: add wake-on-lan support via magic packet · 3e3d6477
      Niklas Söderlund 提交于
      WoL is enabled in the suspend callback by setting MagicPacket detection
      and disabling all interrupts expect MagicPacket. In the resume path the
      driver needs to reset the hardware to rearm the WoL logic, this prevents
      the driver from simply restoring the registers and to take advantage of
      that ravb was not suspended to reduce resume time. To reset the
      hardware the driver closes the device, sets it in reset mode and reopens
      the device just like it would do in a normal suspend/resume scenario
      without WoL enabled, but it both closes and opens the device in the
      resume callback since the device needs to be reset for WoL to work.
      
      One quirk needed for WoL is that the module clock needs to be prevented
      from being switched off by Runtime PM. To keep the clock alive the
      suspend callback need to call clk_enable() directly to increase the
      usage count of the clock. Then when Runtime PM decreases the clock usage
      count it won't reach 0 and be switched off.
      Signed-off-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Acked-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3e3d6477
  26. 14 6月, 2017 1 次提交
  27. 07 6月, 2017 1 次提交
    • E
      ravb: Fix use-after-free on `ifconfig eth0 down` · 79514ef6
      Eugeniu Rosca 提交于
      Commit a47b70ea ("ravb: unmap descriptors when freeing rings") has
      introduced the issue seen in [1] reproduced on H3ULCB board.
      
      Fix this by relocating the RX skb ringbuffer free operation, so that
      swiotlb page unmapping can be done first. Freeing of aligned TX buffers
      is not relevant to the issue seen in [1]. Still, reposition TX free
      calls as well, to have all kfree() operations performed consistently
      _after_ dma_unmap_*()/dma_free_*().
      
      [1] Console screenshot with the problem reproduced:
      
      salvator-x login: root
      root@salvator-x:~# ifconfig eth0 up
      Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00: \
             attached PHY driver [Micrel KSZ9031 Gigabit PHY]   \
             (mii_bus:phy_addr=e6800000.ethernet-ffffffff:00, irq=235)
      IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
      root@salvator-x:~#
      root@salvator-x:~# ifconfig eth0 down
      
      ==================================================================
      BUG: KASAN: use-after-free in swiotlb_tbl_unmap_single+0xc4/0x35c
      Write of size 1538 at addr ffff8006d884f780 by task ifconfig/1649
      
      CPU: 0 PID: 1649 Comm: ifconfig Not tainted 4.12.0-rc4-00004-g112eb072 #32
      Hardware name: Renesas H3ULCB board based on r8a7795 (DT)
      Call trace:
      [<ffff20000808f11c>] dump_backtrace+0x0/0x3a4
      [<ffff20000808f4d4>] show_stack+0x14/0x1c
      [<ffff20000865970c>] dump_stack+0xf8/0x150
      [<ffff20000831f8b0>] print_address_description+0x7c/0x330
      [<ffff200008320010>] kasan_report+0x2e0/0x2f4
      [<ffff20000831eac0>] check_memory_region+0x20/0x14c
      [<ffff20000831f054>] memcpy+0x48/0x68
      [<ffff20000869ed50>] swiotlb_tbl_unmap_single+0xc4/0x35c
      [<ffff20000869fcf4>] unmap_single+0x90/0xa4
      [<ffff20000869fd14>] swiotlb_unmap_page+0xc/0x14
      [<ffff2000080a2974>] __swiotlb_unmap_page+0xcc/0xe4
      [<ffff2000088acdb8>] ravb_ring_free+0x514/0x870
      [<ffff2000088b25dc>] ravb_close+0x288/0x36c
      [<ffff200008aaf8c4>] __dev_close_many+0x14c/0x174
      [<ffff200008aaf9b4>] __dev_close+0xc8/0x144
      [<ffff200008ac2100>] __dev_change_flags+0xd8/0x194
      [<ffff200008ac221c>] dev_change_flags+0x60/0xb0
      [<ffff200008ba2dec>] devinet_ioctl+0x484/0x9d4
      [<ffff200008ba7b78>] inet_ioctl+0x190/0x194
      [<ffff200008a78c44>] sock_do_ioctl+0x78/0xa8
      [<ffff200008a7a128>] sock_ioctl+0x110/0x3c4
      [<ffff200008365a70>] vfs_ioctl+0x90/0xa0
      [<ffff200008365dbc>] do_vfs_ioctl+0x148/0xc38
      [<ffff2000083668f0>] SyS_ioctl+0x44/0x74
      [<ffff200008083770>] el0_svc_naked+0x24/0x28
      
      The buggy address belongs to the page:
      page:ffff7e001b6213c0 count:0 mapcount:0 mapping:          (null) index:0x0
      flags: 0x4000000000000000()
      raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
      raw: 0000000000000000 ffff7e001b6213e0 0000000000000000 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8006d884f680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
       ffff8006d884f700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      >ffff8006d884f780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                         ^
       ffff8006d884f800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
       ffff8006d884f880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      ==================================================================
      Disabling lock debugging due to kernel taint
      root@salvator-x:~#
      
      Fixes: a47b70ea ("ravb: unmap descriptors when freeing rings")
      Signed-off-by: NEugeniu Rosca <erosca@de.adit-jv.com>
      Acked-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79514ef6
  28. 25 4月, 2017 1 次提交