1. 17 5月, 2016 40 次提交
    • P
      net: ethernet: gianfar: use phydev from struct net_device · 4c4a6b0e
      Philippe Reynes 提交于
      The private structure contain a pointer to phydev, but the structure
      net_device already contain such pointer. So we can remove the pointer
      phydev in the private structure, and update the driver to use the
      one contained in struct net_device.
      Signed-off-by: NPhilippe Reynes <tremyfr@gmail.com>
      Acked-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4c4a6b0e
    • D
      net: also make sch_handle_egress() drop monitor ready · 7e2c3aea
      Daniel Borkmann 提交于
      Follow-up for 8a3a4c6e ("net: make sch_handle_ingress() drop
      monitor ready") to also make the egress side drop monitor ready.
      
      Also here only TC_ACT_SHOT is a clear indication that something
      went wrong. Hence don't provide false positives to drop monitors
      such as 'perf record -e skb:kfree_skb ...'.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7e2c3aea
    • M
      net/hsr: Use setup_timer and mod_timer. · 15db6e0d
      Muhammad Falak R Wani 提交于
      The function setup_timer combines the initialization of a timer with the
      initialization of the timer's function and data fields. The mulitiline
      code for timer initialization is now replaced with function setup_timer.
      
      Also, quoting the mod_timer() function comment:
      -> mod_timer() is a more efficient way to update the expire field of an
         active timer (if the timer is inactive it will be activated).
      
      Use setup_timer() and mod_timer() to setup and arm a timer, making the
      code compact and aid readablity.
      Signed-off-by: NMuhammad Falak R Wani <falakreyaz@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      15db6e0d
    • D
      Merge branch 'qed-next' · a2a658a3
      David S. Miller 提交于
      Yuval Mintz says:
      
      ====================
      qed: IOV enhncements and fixups
      
      This is a follow-up on the recent patch series that adds SR-IOV support
      to qed. All content here is iov-related fixups [nothing terminal] and
      enhancements.
      
      Please consider applying this series to `net-next'.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a2a658a3
    • Y
      qed: VFs gracefully accept lack of PM · 416cdf06
      Yuval Mintz 提交于
      VF's probe might log that it has no PM capability in its PCI configuration
      space. As this is a valid configuration, silence such prints.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      416cdf06
    • Y
      qed: Allow more than 16 VFs · 83f34bd4
      Yuval Mintz 提交于
      In multi-function modes, PFs are currently limited to using 16 VFs -
      But that limitation would also currently apply in case there's a single
      PCI function exposed, where no such restriction should have existed.
      
      This lifts the restriction for the default mode; User should be able
      to start the maximum number of VFs as appear in the PCI config space.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      83f34bd4
    • M
      qed: Reset link on IOV disable · 079d20a6
      Manish Chopra 提交于
      PF updates its VFs' bulletin boards with link configurations whenever
      the physical carrier changes or whenever hyper-user explicitly requires
      some setting of the VFs link via the hypervisor's PF.
      
      Since the bulletin board is getting cleaned as part of the IOV disable
      flow on the PF side, re-enabling sriov would lead to a VF that sees the
      carrier as 'down', until an event causing the PF to re-fill the bulletin
      with the link configuration would occur.
      
      To fix this we simply refelect the link state during the flows, giving
      the later VFs a default reflecting the PFs link state.
      Signed-off-by: NManish Chopra <Manish.Chopra@qlogic.com>
      Signed-off-by: NYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      079d20a6
    • Y
      qed: Improve VF interrupt reset · b2b897eb
      Yuval Mintz 提交于
      During FLR flow, need to make sure HW is no longer capable of writing to
      host memory as part of its interrupt mechanisms.
      While we're at it, unify the logic cleaning the driver's status-blocks
      into using a single API function for both PFs and VFs.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b2b897eb
    • Y
      qed: Correct PF-sanity check · b0409fa0
      Yuval Mintz 提交于
      Seems like something broke in commit 1408cc1f ("qed: Introduce VFs")
      and the function no longer verifies that the vf is indeed a valid one.
      Signed-off-by: NYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0409fa0
    • T
      net/mlx4_core: Fix access to uninitialized index · 2bb07e15
      Tariq Toukan 提交于
      Prevent using uninitialized or negative index when handling
      steering entries.
      
      Fixes: b12d93d6 ('mlx4: Add support for promiscuous mode in the new steering model.')
      Signed-off-by: NTariq Toukan <tariqt@mellanox.com>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2bb07e15
    • D
      Merge branch 'for-upstream' of... · 2ffd7e03
      David S. Miller 提交于
      Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
      
      Johan Hedberg says:
      
      ====================
      pull request: bluetooth-next 2016-05-14
      
      Here are two more Bluetooth patches for the 4.7 kernel which we wanted
      to get into net-next before the merge window opens. Please let me know
      if there are any issues pulling. Thanks.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2ffd7e03
    • D
      Merge branch 'w5100-small-changes' · 14d7e487
      David S. Miller 提交于
      Akinobu Mita says:
      
      ====================
      net: w5100: collection of small changes
      
      This patch series is the collection of relatively small changes for
      w5100 driver which includes a cleanup with no functional change,
      two fixes, and adding a functionality.
      
      * Changes from v1
      - Remove the watchdong_timeo assignment to set default tx timeout,
        suggested by David Miller.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      14d7e487
    • A
      net: w5100-spi: add support to specify MAC address by device tree · c3875ca7
      Akinobu Mita 提交于
      This adds support to specify the MAC address by 'mac-address' or
      'local-mac-address' properties in the device tree.  These are common
      properties for the Ethernet controller.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Mike Sinkovsky <msink@permonline.ru>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c3875ca7
    • A
      net: w5100: increase TX timeout period · 7d6da453
      Akinobu Mita 提交于
      This increases TX timeout period from one second to 5 seconds which is
      the default value if the driver doesn't explicitly set
      net_device->watchdog_timeo.
      
      The one second timeout is too short for W5100 with SPI interface mode
      which doesn't support burst READ/WRITE processing in the SPI transfer.
      If the packet is transmitted while RX packets are being received at a
      very high rate, the TX transmittion work in the workqueue is delayed
      and the watchdog timer is expired.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Mike Sinkovsky <msink@permonline.ru>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d6da453
    • A
      net: w5100: fix MAC filtering for W5500 · d41cd5f7
      Akinobu Mita 提交于
      W5500 has different bit position for MAC filter in Socket n mode
      register from W5100 and W5200.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Mike Sinkovsky <msink@permonline.ru>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d41cd5f7
    • A
      net: w5100: remove unused is_w5200() · e9f0cd94
      Akinobu Mita 提交于
      The is_w5200() function is not used anymore by the commit which adds
      the W5500 support.
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Mike Sinkovsky <msink@permonline.ru>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e9f0cd94
    • D
      Merge branch 'lxt-cleanups' · b0456b24
      David S. Miller 提交于
      Sergei Shtylyov says:
      
      ====================
         Here's the set of 2 patches against DaveM's 'net-next.git' repo. We save
      several LoCs on the unneeded local variables....
      
      [1/2] lxt: simplify lxt97[01]_config_intr()
      [2/2] lxt: simplify lxt970_config_init()
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0456b24
    • S
      lxt: simplify lxt970_config_init() · c8396d84
      Sergei Shtylyov 提交于
      This function declares the 'err' local variable for no good reason, get rid
      of it.
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c8396d84
    • S
      lxt: simplify lxt97[01]_config_intr() · 04e6233d
      Sergei Shtylyov 提交于
      Both these functions declare the 'err' local variables for no good reason,
      get rid of them.
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      04e6233d
    • D
      Merge branch 'bpf-blinding' · 485b7778
      David S. Miller 提交于
      Daniel Borkmann says:
      
      ====================
      BPF updates
      
      This set implements constant blinding for BPF, first couple of
      patches are some preparatory cleanups, followed by the blinding.
      Please see individual patches for details.
      
      Thanks a lot!
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      485b7778
    • D
      bpf, s390: add support for constant blinding · d93a47f7
      Daniel Borkmann 提交于
      This patch adds recently added constant blinding helpers into the
      s390 eBPF JIT. In the bpf_int_jit_compile() path, requirements are
      to utilize bpf_jit_blind_constants()/bpf_jit_prog_release_other()
      pair for rewriting the program into a blinded one, and to map the
      BPF_REG_AX register to a CPU register. The mapping of BPF_REG_AX
      is at r12 and similarly like in x86 case performs reloading when
      ld_abs/ind is used. When blinding is not used, there's no additional
      overhead in the generated image.
      
      When BPF_REG_AX is used, we don't need to emit skb->data reload when
      helper function changed skb->data, as this will be reloaded later
      on anyway from stack on ld_abs/ind, where skb->data is needed. s390
      allows for this w/o much additional complexity unlike f.e. x86.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NMichael Holzheu <holzheu@linux.vnet.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d93a47f7
    • D
      bpf, arm64: add support for constant blinding · 26eb042e
      Daniel Borkmann 提交于
      This patch adds recently added constant blinding helpers into the
      arm64 eBPF JIT. In the bpf_int_jit_compile() path, requirements are
      to utilize bpf_jit_blind_constants()/bpf_jit_prog_release_other()
      pair for rewriting the program into a blinded one, and to map the
      BPF_REG_AX register to a CPU register. The mapping is on x9.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NZi Shen Lim <zlim.lnx@gmail.com>
      Acked-by: NYang Shi <yang.shi@linaro.org>
      Tested-by: NYang Shi <yang.shi@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      26eb042e
    • D
      bpf, x86: add support for constant blinding · 959a7579
      Daniel Borkmann 提交于
      This patch adds recently added constant blinding helpers into the
      x86 eBPF JIT. In the bpf_int_jit_compile() path, requirements are
      to utilize bpf_jit_blind_constants()/bpf_jit_prog_release_other()
      pair for rewriting the program into a blinded one, and to map the
      BPF_REG_AX register to a CPU register. The mapping of BPF_REG_AX
      is at non-callee saved register r10, and thus shared with cached
      skb->data used for ld_abs/ind and not in every program type needed.
      When blinding is not used, there's zero additional overhead in the
      generated image.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      959a7579
    • D
      bpf: add generic constant blinding for use in jits · 4f3446bb
      Daniel Borkmann 提交于
      This work adds a generic facility for use from eBPF JIT compilers
      that allows for further hardening of JIT generated images through
      blinding constants. In response to the original work on BPF JIT
      spraying published by Keegan McAllister [1], most BPF JITs were
      changed to make images read-only and start at a randomized offset
      in the page, where the rest was filled with trap instructions. We
      have this nowadays in x86, arm, arm64 and s390 JIT compilers.
      Additionally, later work also made eBPF interpreter images read
      only for kernels supporting DEBUG_SET_MODULE_RONX, that is, x86,
      arm, arm64 and s390 archs as well currently. This is done by
      default for mentioned JITs when JITing is enabled. Furthermore,
      we had a generic and configurable constant blinding facility on our
      todo for quite some time now to further make spraying harder, and
      first implementation since around netconf 2016.
      
      We found that for systems where untrusted users can load cBPF/eBPF
      code where JIT is enabled, start offset randomization helps a bit
      to make jumps into crafted payload harder, but in case where larger
      programs that cross page boundary are injected, we again have some
      part of the program opcodes at a page start offset. With improved
      guessing and more reliable payload injection, chances can increase
      to jump into such payload. Elena Reshetova recently wrote a test
      case for it [2, 3]. Moreover, eBPF comes with 64 bit constants, which
      can leave some more room for payloads. Note that for all this,
      additional bugs in the kernel are still required to make the jump
      (and of course to guess right, to not jump into a trap) and naturally
      the JIT must be enabled, which is disabled by default.
      
      For helping mitigation, the general idea is to provide an option
      bpf_jit_harden that admins can tweak along with bpf_jit_enable, so
      that for cases where JIT should be enabled for performance reasons,
      the generated image can be further hardened with blinding constants
      for unpriviledged users (bpf_jit_harden == 1), with trading off
      performance for these, but not for privileged ones. We also added
      the option of blinding for all users (bpf_jit_harden == 2), which
      is quite helpful for testing f.e. with test_bpf.ko. There are no
      further e.g. hardening levels of bpf_jit_harden switch intended,
      rationale is to have it dead simple to use as on/off. Since this
      functionality would need to be duplicated over and over for JIT
      compilers to use, which are already complex enough, we provide a
      generic eBPF byte-code level based blinding implementation, which is
      then just transparently JITed. JIT compilers need to make only a few
      changes to integrate this facility and can be migrated one by one.
      
      This option is for eBPF JITs and will be used in x86, arm64, s390
      without too much effort, and soon ppc64 JITs, thus that native eBPF
      can be blinded as well as cBPF to eBPF migrations, so that both can
      be covered with a single implementation. The rule for JITs is that
      bpf_jit_blind_constants() must be called from bpf_int_jit_compile(),
      and in case blinding is disabled, we follow normally with JITing the
      passed program. In case blinding is enabled and we fail during the
      process of blinding itself, we must return with the interpreter.
      Similarly, in case the JITing process after the blinding failed, we
      return normally to the interpreter with the non-blinded code. Meaning,
      interpreter doesn't change in any way and operates on eBPF code as
      usual. For doing this pre-JIT blinding step, we need to make use of
      a helper/auxiliary register, here BPF_REG_AX. This is strictly internal
      to the JIT and not in any way part of the eBPF architecture. Just like
      in the same way as JITs internally make use of some helper registers
      when emitting code, only that here the helper register is one
      abstraction level higher in eBPF bytecode, but nevertheless in JIT
      phase. That helper register is needed since f.e. manually written
      program can issue loads to all registers of eBPF architecture.
      
      The core concept with the additional register is: blind out all 32
      and 64 bit constants by converting BPF_K based instructions into a
      small sequence from K_VAL into ((RND ^ K_VAL) ^ RND). Therefore, this
      is transformed into: BPF_REG_AX := (RND ^ K_VAL), BPF_REG_AX ^= RND,
      and REG <OP> BPF_REG_AX, so actual operation on the target register
      is translated from BPF_K into BPF_X one that is operating on
      BPF_REG_AX's content. During rewriting phase when blinding, RND is
      newly generated via prandom_u32() for each processed instruction.
      64 bit loads are split into two 32 bit loads to make translation and
      patching not too complex. Only basic thing required by JITs is to
      call the helper bpf_jit_blind_constants()/bpf_jit_prog_release_other()
      pair, and to map BPF_REG_AX into an unused register.
      
      Small bpf_jit_disasm extract from [2] when applied to x86 JIT:
      
      echo 0 > /proc/sys/net/core/bpf_jit_harden
      
        ffffffffa034f5e9 + <x>:
        [...]
        39:   mov    $0xa8909090,%eax
        3e:   mov    $0xa8909090,%eax
        43:   mov    $0xa8ff3148,%eax
        48:   mov    $0xa89081b4,%eax
        4d:   mov    $0xa8900bb0,%eax
        52:   mov    $0xa810e0c1,%eax
        57:   mov    $0xa8908eb4,%eax
        5c:   mov    $0xa89020b0,%eax
        [...]
      
      echo 1 > /proc/sys/net/core/bpf_jit_harden
      
        ffffffffa034f1e5 + <x>:
        [...]
        39:   mov    $0xe1192563,%r10d
        3f:   xor    $0x4989b5f3,%r10d
        46:   mov    %r10d,%eax
        49:   mov    $0xb8296d93,%r10d
        4f:   xor    $0x10b9fd03,%r10d
        56:   mov    %r10d,%eax
        59:   mov    $0x8c381146,%r10d
        5f:   xor    $0x24c7200e,%r10d
        66:   mov    %r10d,%eax
        69:   mov    $0xeb2a830e,%r10d
        6f:   xor    $0x43ba02ba,%r10d
        76:   mov    %r10d,%eax
        79:   mov    $0xd9730af,%r10d
        7f:   xor    $0xa5073b1f,%r10d
        86:   mov    %r10d,%eax
        89:   mov    $0x9a45662b,%r10d
        8f:   xor    $0x325586ea,%r10d
        96:   mov    %r10d,%eax
        [...]
      
      As can be seen, original constants that carry payload are hidden
      when enabled, actual operations are transformed from constant-based
      to register-based ones, making jumps into constants ineffective.
      Above extract/example uses single BPF load instruction over and
      over, but of course all instructions with constants are blinded.
      
      Performance wise, JIT with blinding performs a bit slower than just
      JIT and faster than interpreter case. This is expected, since we
      still get all the performance benefits from JITing and in normal
      use-cases not every single instruction needs to be blinded. Summing
      up all 296 test cases averaged over multiple runs from test_bpf.ko
      suite, interpreter was 55% slower than JIT only and JIT with blinding
      was 8% slower than JIT only. Since there are also some extremes in
      the test suite, I expect for ordinary workloads that the performance
      for the JIT with blinding case is even closer to JIT only case,
      f.e. nmap test case from suite has averaged timings in ns 29 (JIT),
      35 (+ blinding), and 151 (interpreter).
      
      BPF test suite, seccomp test suite, eBPF sample code and various
      bigger networking eBPF programs have been tested with this and were
      running fine. For testing purposes, I also adapted interpreter and
      redirected blinded eBPF image to interpreter and also here all tests
      pass.
      
        [1] http://mainisusuallyafunction.blogspot.com/2012/11/attacking-hardened-linux-systems-with.html
        [2] https://github.com/01org/jit-spray-poc-for-ksp/
        [3] http://www.openwall.com/lists/kernel-hardening/2016/05/03/5Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: NElena Reshetova <elena.reshetova@intel.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4f3446bb
    • D
      bpf: prepare bpf_int_jit_compile/bpf_prog_select_runtime apis · d1c55ab5
      Daniel Borkmann 提交于
      Since the blinding is strictly only called from inside eBPF JITs,
      we need to change signatures for bpf_int_jit_compile() and
      bpf_prog_select_runtime() first in order to prepare that the
      eBPF program we're dealing with can change underneath. Hence,
      for call sites, we need to return the latest prog. No functional
      change in this patch.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1c55ab5
    • D
      bpf: add bpf_patch_insn_single helper · c237ee5e
      Daniel Borkmann 提交于
      Move the functionality to patch instructions out of the verifier
      code and into the core as the new bpf_patch_insn_single() helper
      will be needed later on for blinding as well. No changes in
      functionality.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c237ee5e
    • D
      bpf, x86/arm64: remove useless checks on prog · 93a73d44
      Daniel Borkmann 提交于
      There is never such a situation, where bpf_int_jit_compile() is
      called with either prog as NULL or len as 0, so the tests are
      unnecessary and confusing as people would just copy them. s390
      doesn't have them, so no change is needed there.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      93a73d44
    • D
      bpf: split HAVE_BPF_JIT into cBPF and eBPF variant · 6077776b
      Daniel Borkmann 提交于
      Split the HAVE_BPF_JIT into two for distinguishing cBPF and eBPF JITs.
      
      Current cBPF ones:
      
        # git grep -n HAVE_CBPF_JIT arch/
        arch/arm/Kconfig:44:    select HAVE_CBPF_JIT
        arch/mips/Kconfig:18:   select HAVE_CBPF_JIT if !CPU_MICROMIPS
        arch/powerpc/Kconfig:129:       select HAVE_CBPF_JIT
        arch/sparc/Kconfig:35:  select HAVE_CBPF_JIT
      
      Current eBPF ones:
      
        # git grep -n HAVE_EBPF_JIT arch/
        arch/arm64/Kconfig:61:  select HAVE_EBPF_JIT
        arch/s390/Kconfig:126:  select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES
        arch/x86/Kconfig:94:    select HAVE_EBPF_JIT                    if X86_64
      
      Later code also needs this facility to check for eBPF JITs.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6077776b
    • D
      bpf: move bpf_jit_enable declaration · c94987e4
      Daniel Borkmann 提交于
      Move the bpf_jit_enable declaration to the filter.h file where
      most other core code is declared, also since we're going to add
      a second knob there.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c94987e4
    • D
      bpf: minor cleanups in ebpf code · 4936e352
      Daniel Borkmann 提交于
      Besides others, remove redundant comments where the code is self
      documenting enough, and properly indent various bpf_verifier_ops
      and bpf_prog_type_list declarations. Moreover, remove two exports
      that actually have no module user.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4936e352
    • V
      net: dsa: mv88e6xxx: remove bridge work · 553eb544
      Vivien Didelot 提交于
      Now that the bridge code defers the switchdev port state setting, there
      is no need to defer the port STP state change within the mv88e6xxx code.
      Thus get rid of the driver's bridge work code.
      
      This also fixes a race condition where the DSA layer assumes that the
      bridge code already set the unbridged port's STP state to Disabled
      before restoring the Forwarding state.
      
      As a consequence, this also fixes the FDB flush for the unbridged port
      which now correctly occurs during the Forwarding to Disabled transition.
      
      Fixes: 0bc05d58 ("switchdev: allow caller to explicitly request attr_set as deferred")
      Reported-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      553eb544
    • D
      net: vrf: protect changes to private data with rcu · b0e95ccd
      David Ahern 提交于
      One cpu can be processing packets which includes using the cached route
      entries in the vrf device's private data and on another cpu the device
      gets deleted which releases the routes and sets the pointers in net_vrf
      to NULL. This results in datapath dereferencing a NULL pointer.
      
      Fix by protecting access to dst's with rcu.
      
      Fixes: 193125db ("net: Introduce VRF device driver")
      Fixes: 35402e31 ("net: Add IPv6 support to VRF device")
      Signed-off-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0e95ccd
    • E
      tcp: minor optimizations around tcp_hdr() usage · ea1627c2
      Eric Dumazet 提交于
      tcp_hdr() is slightly more expensive than using skb->data in contexts
      where we know they point to the same byte.
      
      In receive path, tcp_v4_rcv() and tcp_v6_rcv() are in this situation,
      as tcp header has not been pulled yet.
      
      In output path, the same can be said when we just pushed the tcp header
      in the skb, in tcp_transmit_skb() and tcp_make_synack()
      
      Also factorize the two checks for tcb->tcp_flags & TCPHDR_SYN in
      tcp_transmit_skb() and pass tcp header pointer to tcp_ecn_send(),
      so that compiler can further optimize and avoid a reload.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ea1627c2
    • N
      netlink: kill nla_put_u64() · 50225243
      Nicolas Dichtel 提交于
      This function is not used anymore. nla_put_u64_64bit() should be used
      instead.
      Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      50225243
    • E
      sock: propagate __sock_cmsg_send() error · 2632616b
      Eric Dumazet 提交于
      __sock_cmsg_send() might return different error codes, not only -EINVAL.
      
      Fixes: 24025c46 ("ipv4: process socket-level control messages in IPv4")
      Fixes: ad1e46a8 ("ipv6: process socket-level control messages in IPv6")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Soheil Hassas Yeganeh <soheil@google.com>
      Acked-by: NSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2632616b
    • A
      net: qrtr: fix build problems · a986a05d
      Arnd Bergmann 提交于
      Having multiple loadable modules with the same name cannot work
      with modprobe, and having both net/qrtr/smd.ko and drivers/soc/qcom/smd.ko
      results in a (somewhat cryptic) build error:
      
      ERROR: "qcom_smd_driver_unregister" [net/qrtr/smd.ko] undefined!
      ERROR: "qcom_smd_driver_register" [net/qrtr/smd.ko] undefined!
      ERROR: "qcom_smd_set_drvdata" [net/qrtr/smd.ko] undefined!
      ERROR: "qcom_smd_send" [net/qrtr/smd.ko] undefined!
      ERROR: "qcom_smd_get_drvdata" [net/qrtr/smd.ko] undefined!
      ERROR: "qcom_smd_driver_unregister" [drivers/soc/qcom/wcnss_ctrl.ko] undefined!
      ERROR: "qcom_smd_driver_register" [drivers/soc/qcom/wcnss_ctrl.ko] undefined!
      ERROR: "qcom_smd_set_drvdata" [drivers/soc/qcom/wcnss_ctrl.ko] undefined!
      ERROR: "qcom_smd_send" [drivers/soc/qcom/wcnss_ctrl.ko] undefined!
      ERROR: "qcom_smd_get_drvdata" [drivers/soc/qcom/wcnss_ctrl.ko] undefined!
      
      Also, the qrtr driver uses the SMD interface and has a Kconfig dependency,
      but also allows for compile-testing when SMD is disabled. However, if
      with QCOM_SMD=m and COMPILE_TEST=y we can end up with QRTR_SMD=y and
      that fails with a related link error.
      
      The changes the dependency so we can still compile-test the driver but
      not have it built-in if SMD is a module, to avoid running in the broken
      configuration, and changes the Makefile to provide the driver under
      a different module name.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: bdabad3e ("net: Add Qualcomm IPC router")
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a986a05d
    • D
      Merge branch 'tc_flower_offload' · 148bd3a3
      David S. Miller 提交于
      Amir Vadai says:
      
      ====================
      sched,mlx5: Offloaded TC flower filter statistics
      
      This patchset introduces counters support for offloaded cls_flower filters.
      When the user calls 'tc show -s ..', fl_dump is called.
      Before fl_dump() returns the statistics, it calls the NIC driver (using a new
      ndo_setup_tc() command - TC_CLSFLOWER_STATS) to read the hardware counters and
      update the statistics accordingly. A new TC action op was added (stats_update())
      to be used by the NIC driver to update the statistics.
      
      Patchset was applied and tested over commit ed7cbbce ("udp: Resolve NULL pointer
      dereference over flow-based vxlan device")
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      148bd3a3
    • A
      net/mlx5e: Hardware offloaded flower filter statistics support · aad7e08d
      Amir Vadai 提交于
      Introduce support in updating statistics of offloaded TC flower
      classifiers. Currently only the DROP action is supported.
      Signed-off-by: NAmir Vadai <amirva@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aad7e08d
    • A
      net/mlx5_core: Flow counters infrastructure · 43a335e0
      Amir Vadai 提交于
      If a counter has the aging flag set when created, it is added to a list
      of counters that will be queried periodically from a workqueue.  query
      result and last use timestamp are cached.
      add/del counter must be very efficient since thousands of such
      operations might be issued in a second.
      There is only a single reference to counters without aging, therefore
      no need for locks.
      But, counters with aging enabled are stored in a list. In order to make
      code as lockless as possible, all the list manipulation and access to
      hardware is done from a single context - the periodic counters query
      thread.
      
      The hardware supports multiple counters per FTE, however currently we
      are using one counter for each FTE.
      Signed-off-by: NAmir Vadai <amirva@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      43a335e0
    • A
      net/mlx5_core: Introduce flow steering destination of type counter · bd5251db
      Amir Vadai 提交于
      When adding a flow steering rule with a counter, need to supply a
      destination of type MLX5_FLOW_DESTINATION_TYPE_COUNTER, with a pointer
      to a struct mlx5_fc.
      Also, MLX5_FLOW_CONTEXT_ACTION_COUNT bit should be set in the action.
      Signed-off-by: NAmir Vadai <amirva@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd5251db