1. 11 9月, 2016 23 次提交
  2. 10 9月, 2016 17 次提交
    • M
      ATM-iphase: Use kmalloc_array() in tx_init() · e808bb6e
      Markus Elfring 提交于
      * Multiplications for the size determination of memory allocations
        indicated that array data structures should be processed.
        Thus use the corresponding function "kmalloc_array".
      
        This issue was detected by using the Coccinelle software.
      
      * Replace the specification of data types by pointer dereferences
        to make the corresponding size determination a bit safer according to
        the Linux coding style convention.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e808bb6e
    • D
      Merge branch 'alx-msix' · 171a6c52
      David S. Miller 提交于
      Tobias Regnery says:
      
      ====================
      alx: add msi-x support
      
      This patchset adds msi-x support to the alx driver. It is a preparatory
      series for multi queue support, which I am currently working on. As there
      is no advantage over msi interrupts without multi queue support, msi-x
      interrupts are disabled by default. In order to test for regressions, a
      new module parameter is added to enable msi-x interrupts.
      
      Based on information of the downstream driver at github.com/qca/alx
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      171a6c52
    • T
      alx: add module parameter to enable msi-x support · 0c58ee0b
      Tobias Regnery 提交于
      msi-x support is default disabled in the alx driver. In order to test msi-x
      interrupts for regressions add a module parameter to the driver.
      Signed-off-by: NTobias Regnery <tobias.regnery@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c58ee0b
    • T
      alx: add msi-x support · dc39a78b
      Tobias Regnery 提交于
      Add msi-x support to the alx driver. This is in preparation for multi queue
      support.
      
      msi-x interrupts are disabled by default because without multi queue support
      there is no advantage over msi interrupts. The performance numbers observed
      with iperf stay the same.
      
      Based on information of the downstream driver at github.com/qca/alx
      Signed-off-by: NTobias Regnery <tobias.regnery@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dc39a78b
    • T
      alx: factor out part of the interrupt handler · a0373aef
      Tobias Regnery 提交于
      Factor out the handling of misc interrupts into a new function.
      This function can be reused later for msi-x interrupts.
      Signed-off-by: NTobias Regnery <tobias.regnery@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0373aef
    • T
      alx: refactor msi enablement and disablement · 9ee7b683
      Tobias Regnery 提交于
      Introduce a new flag field for the advanced interrupt capatibilities and add
      new functions to enable and disable msi interrupts. These functions will be
      extended later to cover msi-x interrupts.
      
      We enable msi interrupts earlier in alx_init_intr because with msi-x and multi
      queue support the number of queues must be set before we allocate resources for
      the rx and tx paths.
      Signed-off-by: NTobias Regnery <tobias.regnery@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9ee7b683
    • B
      qed: mark symbols static where possible · ba56947a
      Baoyou Xie 提交于
      We get a few warnings when building kernel with W=1:
      drivers/net/ethernet/qlogic/qed/qed_l2.c:112:5: warning: no previous prototype for 'qed_sp_vport_start' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:110:6: warning: no previous prototype for 'qed_iov_is_valid_vfid' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:188:5: warning: no previous prototype for 'qed_iov_post_vf_bulletin' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:578:6: warning: no previous prototype for 'qed_iov_set_vfs_to_disable' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:1135:28: warning: no previous prototype for 'qed_iov_get_public_vf_info' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:1148:6: warning: no previous prototype for 'qed_iov_clean_vf' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:2444:5: warning: no previous prototype for 'qed_iov_chk_ucast' [-Wmissing-prototypes]
      drivers/net/ethernet/qlogic/qed/qed_sriov.c:2762:5: warning: no previous prototype for 'qed_iov_vf_flr_cleanup' [-Wmissing-prototypes]
      ....
      
      In fact, these functions are only used in the file in which they are
      declared and don't need a declaration, but can be made static.
      so this patch marks these functions with 'static'.
      Signed-off-by: NBaoyou Xie <baoyou.xie@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ba56947a
    • D
      Merge branch 'bpf-helper-cleanups' · 349aa334
      David S. Miller 提交于
      Daniel Borkmann says:
      
      ====================
      Some BPF helper cleanups
      
      This series contains a couple of misc cleanups and improvements
      for BPF helpers. For details please see individual patches. We
      let this also sit for a few days with Fengguang's kbuild test
      robot, and there were no issues seen (besides one false positive,
      see last one for details).
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      349aa334
    • D
      bpf: add BPF_CALL_x macros for declaring helpers · f3694e00
      Daniel Borkmann 提交于
      This work adds BPF_CALL_<n>() macros and converts all the eBPF helper functions
      to use them, in a similar fashion like we do with SYSCALL_DEFINE<n>() macros
      that are used today. Motivation for this is to hide all the register handling
      and all necessary casts from the user, so that it is done automatically in the
      background when adding a BPF_CALL_<n>() call.
      
      This makes current helpers easier to review, eases to write future helpers,
      avoids getting the casting mess wrong, and allows for extending all helpers at
      once (f.e. build time checks, etc). It also helps detecting more easily in
      code reviews that unused registers are not instrumented in the code by accident,
      breaking compatibility with existing programs.
      
      BPF_CALL_<n>() internals are quite similar to SYSCALL_DEFINE<n>() ones with some
      fundamental differences, for example, for generating the actual helper function
      that carries all u64 regs, we need to fill unused regs, so that we always end up
      with 5 u64 regs as an argument.
      
      I reviewed several 0-5 generated BPF_CALL_<n>() variants of the .i results and
      they look all as expected. No sparse issue spotted. We let this also sit for a
      few days with Fengguang's kbuild test robot, and there were no issues seen. On
      s390, it barked on the "uses dynamic stack allocation" notice, which is an old
      one from bpf_perf_event_output{,_tp}() reappearing here due to the conversion
      to the call wrapper, just telling that the perf raw record/frag sits on stack
      (gcc with s390's -mwarn-dynamicstack), but that's all. Did various runtime tests
      and they were fine as well. All eBPF helpers are now converted to use these
      macros, getting rid of a good chunk of all the raw castings.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f3694e00
    • D
      bpf: add own ctx rewriter on ifindex for clsact progs · 374fb54e
      Daniel Borkmann 提交于
      When fetching ifindex, we don't need to test dev for being NULL since
      we're always guaranteed to have a valid dev for clsact programs. Thus,
      avoid this test in fast path.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      374fb54e
    • D
      bpf: add BPF_SIZEOF and BPF_FIELD_SIZEOF macros · f035a515
      Daniel Borkmann 提交于
      Add BPF_SIZEOF() and BPF_FIELD_SIZEOF() macros to improve the code a bit
      which otherwise often result in overly long bytes_to_bpf_size(sizeof())
      and bytes_to_bpf_size(FIELD_SIZEOF()) lines. So place them into a macro
      helper instead. Moreover, we currently have a BUILD_BUG_ON(BPF_FIELD_SIZEOF())
      check in convert_bpf_extensions(), but we should rather make that generic
      as well and add a BUILD_BUG_ON() test in all BPF_SIZEOF()/BPF_FIELD_SIZEOF()
      users to detect any rewriter size issues at compile time. Note, there are
      currently none, but we want to assert that it stays this way.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f035a515
    • D
      bpf: minor cleanups in helpers · 6088b582
      Daniel Borkmann 提交于
      Some minor misc cleanups, f.e. use sizeof(__u32) instead of hardcoding
      and in __bpf_skb_max_len(), I missed that we always have skb->dev valid
      anyway, so we can drop the unneeded test for dev; also few more other
      misc bits addressed here.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6088b582
    • E
      ip_tunnel: do not clear l4 hashes · bf8d85d4
      Eric Dumazet 提交于
      If skb has a valid l4 hash, there is no point clearing hash and force
      a further flow dissection when a tunnel encapsulation is added.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bf8d85d4
    • M
      ATM-ForeRunnerHE: Use kmalloc_array() in he_init_group() · 2c4f414f
      Markus Elfring 提交于
      * Multiplications for the size determination of memory allocations
        indicated that array data structures should be processed.
        Thus use the corresponding function "kmalloc_array".
      
        This issue was detected by using the Coccinelle software.
      
      * Replace the specification of data types by pointer dereferences
        to make the corresponding size determination a bit safer according to
        the Linux coding style convention.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2c4f414f
    • M
      ATM-ENI: Use kmalloc_array() in eni_start() · d9e6620c
      Markus Elfring 提交于
      * A multiplication for the size determination of a memory allocation
        indicated that an array data structure should be processed.
        Thus use the corresponding function "kmalloc_array".
      
        This issue was detected by using the Coccinelle software.
      
      * Replace the specification of a data structure by a pointer dereference
        to make the corresponding size determination a bit safer according to
        the Linux coding style convention.
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d9e6620c
    • D
      Merge tag 'rxrpc-rewrite-20160908' of... · fa5f4aaf
      David S. Miller 提交于
      Merge tag 'rxrpc-rewrite-20160908' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
      
      David Howells says:
      
      ====================
      rxrpc: Rewrite data and ack handling
      
      This patch set constitutes the main portion of the AF_RXRPC rewrite.  It
      consists of five fix/helper patches:
      
       (1) Fix ASSERTCMP's and ASSERTIFCMP's handling of signed values.
      
       (2) Update some protocol definitions slightly.
      
       (3) Use of an hlist for RCU purposes.
      
       (4) Removal of per-call sk_buff accounting (not really needed when skbs
           aren't being queued on the main queue).
      
       (5) Addition of a tracepoint to log incoming packets in the data_ready
           callback and to log the end of the data_ready callback.
      
      And then there are two patches that form the main part:
      
       (6) Preallocation of resources for incoming calls so that in patch (7) the
           data_ready handler can be made to fully instantiate an incoming call
           and make it live.  This extends through into AFS so that AFS can
           preallocate its own incoming call resources.
      
           The preallocation size is capped at the listen() backlog setting - and
           that is capped at a sysctl limit which can be set between 4 and 32.
      
           The preallocation is (re)charged either by accepting/rejecting pending
           calls or, in the case of AFS, manually.  If insufficient preallocation
           resources exist, a BUSY packet will be transmitted.
      
           The advantage of using this preallocation is that once a call is set
           up in the data_ready handler, DATA packets can be queued on it
           immediately rather than the DATA packets being queued for a background
           work item to do all the allocation and then try and sort out the DATA
           packets whilst other DATA packets may still be coming in and going
           either to the background thread or the new call.
      
       (7) Rewrite the handling of DATA, ACK and ABORT packets.
      
           In the receive phase, DATA packets are now held in per-call circular
           buffers with deduplication, out of sequence detection and suchlike
           being done in data_ready.  Since there is only one producer and only
           once consumer, no locks need be used on the receive queue.
      
           Received ACK and ABORT packets are now parsed and discarded in
           data_ready to recycle resources as fast as possible.
      
           sk_buffs are no longer pulled, trimmed or cloned, but rather the
           offset and size of the content is tracked.  This particularly affects
           jumbo DATA packets which need insertion into the receive buffer in
           multiple places.  Annotations are kept to track which bit is which.
      
           Packets are no longer queued on the socket receive queue; rather,
           calls are queued.  Dummy packets to convey events therefore no longer
           need to be invented and metadata packets can be discarded as soon as
           parsed rather then being pushed onto the socket receive queue to
           indicate terminal events.
      
           The preallocation facility added in (6) is now used to set up incoming
           calls with very little locking required and no calls to the allocator
           in data_ready.
      
           Decryption and verification is now handled in recvmsg() rather than in
           a background thread.  This allows for the future possibility of
           decrypting directly into the user buffer.
      
           With this patch, the code is a lot simpler and most of the mass of
           call event and state wangling code in call_event.c is gone.
      
      With this, the majority of the AF_RXRPC rewrite is complete.  However,
      there are still things to be done, including:
      
       (*) Limit the number of active service calls to prevent an attacker from
           filling up a server's memory.
      
       (*) Limit the number of calls on the rebuff-with-BUSY queue.
      
       (*) Transmit delayed/deferred ACKs from recvmsg() if possible, rather than
           punting to the background thread.  Ideally, the background thread
           shouldn't run at all, but data_ready can't call kernel_sendmsg() and
           we can't rely on recvmsg() attending to the call in a timely fashion.
      
       (*) Prevent the call at the front of the socket queue from hogging
           recvmsg()'s attention if there's a sufficiently continuous supply of
           data.
      
       (*) Distribute ICMP errors by connection rather than by call.  Possibly
           parse the ICMP packet to try and pin down the exact connection and
           call.
      
       (*) Encrypt/decrypt directly between user buffers and socket buffers where
           possible.
      
       (*) IPv6.
      
       (*) Service ID upgrade.  This is a facility whereby a special flag bit is
           set in the DATA packet header when making a call that tells the server
           that it is allowed to change the service ID to an upgraded one and
           reply with an equivalent call from the upgraded service.
      
           This is used, for example, to override certain AFS calls so that IPv6
           addresses can be returned.
      
       (*) Allow userspace to preallocate call user IDs for incoming calls.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa5f4aaf
    • C
      via-velocity: remove null pointer check on array tdinfo->skb_dma · 46dfc23e
      Colin Ian King 提交于
      tdinfo->skb_dma is a 7 element array of dma_addr_t hence cannot be
      null, so the pull pointer check on tdinfo->skb_dma  is redundant.
      Remove it.
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Acked-by: NFrancois Romieu <romieu@fr.zoreil.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      46dfc23e