1. 14 9月, 2016 13 次提交
    • D
      rxrpc: Use rxrpc_extract_addr_from_skb() rather than doing this manually · 1c2bc7b9
      David Howells 提交于
      There are two places that want to transmit a packet in response to one just
      received and manually pick the address to reply to out of the sk_buff.
      Make them use rxrpc_extract_addr_from_skb() instead so that IPv6 is handled
      automatically.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      1c2bc7b9
    • D
      rxrpc: Don't specify protocol to when creating transport socket · aaa31cbc
      David Howells 提交于
      Pass 0 as the protocol argument when creating the transport socket rather
      than IPPROTO_UDP.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      aaa31cbc
    • D
      rxrpc: Create an address for sendmsg() to bind unbound socket with · cd5892c7
      David Howells 提交于
      Create an address for sendmsg() to bind unbound socket with rather than
      using a completely blank address otherwise the transport socket creation
      will fail because it will try to use address family 0.
      
      We use the address family specified in the protocol argument when the
      AF_RXRPC socket was created and SOCK_DGRAM as the default.  For anything
      else, bind() must be used.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cd5892c7
    • D
      rxrpc: Correctly initialise, limit and transmit call->rx_winsize · 75e42126
      David Howells 提交于
      call->rx_winsize should be initialised to the sysctl setting and the sysctl
      setting should be limited to the maximum we want to permit.  Further, we
      need to place this in the ACK info instead of the sysctl setting.
      
      Furthermore, discard the idea of accepting the subpackets of a jumbo packet
      that lie beyond the receive window when the first packet of the jumbo is
      within the window.  Just discard the excess subpackets instead.  This
      allows the receive window to be opened up right to the buffer size less one
      for the dead slot.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      75e42126
    • D
      rxrpc: Fix prealloc refcounting · 3432a757
      David Howells 提交于
      The preallocated call buffer holds a ref on the calls within that buffer.
      The ref was being released in the wrong place - it worked okay for incoming
      calls to the AFS cache manager service, but doesn't work right for incoming
      calls to a userspace service.
      
      Instead of releasing an extra ref service calls in rxrpc_release_call(),
      the ref needs to be released during the acceptance/rejectance process.  To
      this end:
      
       (1) The prealloc ref is now normally released during
           rxrpc_new_incoming_call().
      
       (2) For preallocated kernel API calls, the kernel API's ref needs to be
           released when the call is discarded on socket close.
      
       (3) We shouldn't take a second ref in rxrpc_accept_call().
      
       (4) rxrpc_recvmsg_new_call() needs to get a ref of its own when it adds
           the call to the to_be_accepted socket queue.
      
      In doing (4) above, we would prefer not to put the call's refcount down to
      0 as that entails doing cleanup in softirq context, but it's unlikely as
      there are several refs held elsewhere, at least one of which must be put by
      someone in process context calling rxrpc_release_call().  However, it's not
      a problem if we do have to do that.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      3432a757
    • D
      rxrpc: Adjust the call ref tracepoint to show kernel API refs · cbd00891
      David Howells 提交于
      Adjust the call ref tracepoint to show references held on a call by the
      kernel API separately as much as possible and add an additional trace to at
      the allocation point from the preallocation buffer for an incoming call.
      
      Note that this doesn't show the allocation of a client call for the kernel
      separately at the moment.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cbd00891
    • D
      rxrpc: Allow tx_winsize to grow in response to an ACK · 01fd0742
      David Howells 提交于
      Allow tx_winsize to grow when the ACK info packet shows a larger receive
      window at the other end rather than only permitting it to shrink.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      01fd0742
    • D
      rxrpc: Use skb->len not skb->data_len · 89a80ed4
      David Howells 提交于
      skb->len should be used rather than skb->data_len when referring to the
      amount of data in a packet.  This will only cause a malfunction in the
      following cases:
      
       (1) We receive a jumbo packet (validation and splitting both are wrong).
      
       (2) We see if there's extra ACK info in an ACK packet (we think it's not
           there and just ignore it).
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      89a80ed4
    • D
      rxrpc: Add missing unlock in rxrpc_call_accept() · b25de360
      David Howells 提交于
      Add a missing unlock in rxrpc_call_accept() in the path taken if there's no
      call to wake up.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      b25de360
    • D
      rxrpc: Requeue call for recvmsg if more data · 33b603fd
      David Howells 提交于
      rxrpc_recvmsg() needs to make sure that the call it has just been
      processing gets requeued for further attention if the buffer has been
      filled and there's more data to be consumed.  The softirq producer only
      queues the call and wakes the socket if it fills the first slot in the
      window, so userspace might end up sleeping forever otherwise, despite there
      being data available.
      
      This is not a problem provided the userspace buffer is big enough or it
      empties the buffer completely before more data comes in.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      33b603fd
    • D
      rxrpc: The IDLE ACK packet should use rxrpc_idle_ack_delay · 91c2c7b6
      David Howells 提交于
      The IDLE ACK packet should use the rxrpc_idle_ack_delay setting when the
      timer is set for it.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      91c2c7b6
    • D
      rxrpc: Add missing wakeup on Tx window rotation · bc4abfcf
      David Howells 提交于
      We need to wake up the sender when Tx window rotation due to an incoming
      ACK makes space in the buffer otherwise the sender is liable to just hang
      endlessly.
      
      This problem isn't noticeable if the Tx phase transfers no more than will
      fit in a single window or the Tx window rotates fast enough that it doesn't
      get full.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      bc4abfcf
    • D
      rxrpc: Make sure we initialise the peer hash key · 08a39685
      David Howells 提交于
      Peer records created for incoming connections weren't getting their hash
      key set.  This meant that incoming calls wouldn't see more than one DATA
      packet - which is not a problem for AFS CM calls with small request data
      blobs.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      08a39685
  2. 13 9月, 2016 2 次提交
  3. 11 9月, 2016 21 次提交
  4. 10 9月, 2016 4 次提交
    • 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