1. 23 9月, 2016 13 次提交
    • D
      rxrpc: Add a tracepoint to log injected Rx packet loss · 89b475ab
      David Howells 提交于
      Add a tracepoint to log received packets that get discarded due to Rx
      packet loss.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      89b475ab
    • D
      rxrpc: Add data Tx tracepoint and adjust Tx ACK tracepoint · be832aec
      David Howells 提交于
      Add a tracepoint to log transmission of DATA packets (including loss
      injection).
      
      Adjust the ACK transmission tracepoint to include the packet serial number
      and to line this up with the DATA transmission display.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      be832aec
    • D
      rxrpc: Add a tracepoint for the call timer · fc7ab6d2
      David Howells 提交于
      Add a tracepoint to log call timer initiation, setting and expiry.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      fc7ab6d2
    • D
      rxrpc: Don't call the tx_ack tracepoint if don't generate an ACK · b86e218e
      David Howells 提交于
      rxrpc_send_call_packet() is invoking the tx_ack tracepoint before it checks
      whether there's an ACK to transmit (another thread may jump in and transmit
      it).
      
      Fix this by only invoking the tracepoint if we get a valid ACK to transmit.
      
      Further, only allocate a serial number if we're going to actually transmit
      something.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      b86e218e
    • D
      rxrpc: Pass the last Tx packet marker in the annotation buffer · 70790dbe
      David Howells 提交于
      When the last packet of data to be transmitted on a call is queued, tx_top
      is set and then the RXRPC_CALL_TX_LAST flag is set.  Unfortunately, this
      leaves a race in the ACK processing side of things because the flag affects
      the interpretation of tx_top and also allows us to start receiving reply
      data before we've finished transmitting.
      
      To fix this, make the following changes:
      
       (1) rxrpc_queue_packet() now sets a marker in the annotation buffer
           instead of setting the RXRPC_CALL_TX_LAST flag.
      
       (2) rxrpc_rotate_tx_window() detects the marker and sets the flag in the
           same context as the routines that use it.
      
       (3) rxrpc_end_tx_phase() is simplified to just shift the call state.
           The Tx window must have been rotated before calling to discard the
           last packet.
      
       (4) rxrpc_receiving_reply() is added to handle the arrival of the first
           DATA packet of a reply to a client call (which is an implicit ACK of
           the Tx phase).
      
       (5) The last part of rxrpc_input_ack() is reordered to perform Tx
           rotation, then soft-ACK application and then to end the phase if we've
           rotated the last packet.  In the event of a terminal ACK, the soft-ACK
           application will be skipped as nAcks should be 0.
      
       (6) rxrpc_input_ackall() now has to rotate as well as ending the phase.
      
      In addition:
      
       (7) Alter the transmit tracepoint to log the rotation of the last packet.
      
       (8) Remove the no-longer relevant queue_reqack tracepoint note.  The
           ACK-REQUESTED packet header flag is now set as needed when we actually
           transmit the packet and may vary by retransmission.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      70790dbe
    • D
      rxrpc: Fix call timer · 01a88f7f
      David Howells 提交于
      Fix the call timer in the following ways:
      
       (1) If call->resend_at or call->ack_at are before or equal to the current
           time, then ignore that timeout.
      
       (2) If call->expire_at is before or equal to the current time, then don't
           set the timer at all (possibly we should queue the call).
      
       (3) Don't skip modifying the timer if timer_pending() is true.  This
           indicates that the timer is working, not that it has expired and is
           running/waiting to run its expiry handler.
      
      Also call rxrpc_set_timer() to start the call timer going rather than
      calling add_timer().
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      01a88f7f
    • D
      rxrpc: Fix accidental cancellation of scheduled resend by ACK parser · be8aa338
      David Howells 提交于
      When rxrpc_input_soft_acks() is parsing the soft-ACKs from an ACK packet,
      it updates the Tx packet annotations in the annotation buffer.  If a
      soft-ACK is an ACK, then we overwrite unack'd, nak'd or to-be-retransmitted
      states and that is fine; but if the soft-ACK is an NACK, we overwrite the
      to-be-retransmitted with a nak - which isn't.
      
      Instead, we need to let any scheduled retransmission stand if the packet
      was NAK'd.
      
      Note that we don't reissue a resend if the annotation is in the
      to-be-retransmitted state because someone else must've scheduled the
      resend already.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      be8aa338
    • D
      rxrpc: Need to start the resend timer on initial transmission · dfc3da44
      David Howells 提交于
      When a DATA packet has its initial transmission, we may need to start or
      adjust the resend timer.  Without this we end up relying on being sent a
      NACK to initiate the resend.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      dfc3da44
    • D
      rxrpc: Use before_eq() and friends to compare serial numbers · 98dafac5
      David Howells 提交于
      before_eq() and friends should be used to compare serial numbers (when not
      checking for (non)equality) rather than casting to int, subtracting and
      checking the result.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      98dafac5
    • D
      rxrpc: Should be using ktime_add_ms() not ktime_add_ns() · 90bd684d
      David Howells 提交于
      ktime_add_ms() should be used to add the resend time (in ms) rather than
      ktime_add_ns().
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      90bd684d
    • D
      rxrpc: Make sure sendmsg() is woken on call completion · c0d058c2
      David Howells 提交于
      Make sure that sendmsg() gets woken up if the call it is waiting for
      completes abnormally.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      c0d058c2
    • D
      rxrpc: Don't send an ACK at the end of service call response transmission · 9aff212b
      David Howells 提交于
      Don't send an IDLE ACK at the end of the transmission of the response to a
      service call.  The service end resends DATA packets until the client sends an
      ACK that hard-acks all the send data.  At that point, the call is complete.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      9aff212b
    • D
      rxrpc: Preset timestamp on Tx sk_buffs · b24d2891
      David Howells 提交于
      Set the timestamp on sk_buffs holding packets to be transmitted before
      queueing them because the moment the packet is on the queue it can be seen
      by the retransmission algorithm - which may see a completely random
      timestamp.
      
      If the retransmission algorithm sees such a timestamp, it may retransmit
      the packet and, in future, tell the congestion management algorithm that
      the retransmit timer expired.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      b24d2891
  2. 22 9月, 2016 8 次提交
    • D
      rxrpc: Reduce the number of PING ACKs sent · fc943f67
      David Howells 提交于
      We don't want to send a PING ACK for every new incoming call as that just
      adds to the network traffic.  Instead, we send a PING ACK to the first
      three that we receive and then once per second thereafter.
      
      This could probably be made adjustable in future.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      fc943f67
    • D
      rxrpc: Reduce the number of ACK-Requests sent · 0d4b103c
      David Howells 提交于
      Reduce the number of ACK-Requests we set on DATA packets that we're sending
      to reduce network traffic.  We set the flag on odd-numbered DATA packets to
      start off the RTT cache until we have at least three entries in it and then
      probe once per second thereafter to keep it topped up.
      
      This could be made tunable in future.
      
      Note that from this point, the RXRPC_REQUEST_ACK flag is set on DATA
      packets as we transmit them and not stored statically in the sk_buff.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      0d4b103c
    • D
      rxrpc: Obtain RTT data by requesting ACKs on DATA packets · 50235c4b
      David Howells 提交于
      In addition to sending a PING ACK to gain RTT data, we can set the
      RXRPC_REQUEST_ACK flag on a DATA packet and get a REQUESTED-ACK ACK.  The
      ACK packet contains the serial number of the packet it is in response to,
      so we can look through the Tx buffer for a matching DATA packet.
      
      This requires that the data packets be stamped with the time of
      transmission as a ktime rather than having the resend_at time in jiffies.
      
      This further requires the resend code to do the resend determination in
      ktimes and convert to jiffies to set the timer.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      50235c4b
    • D
      rxrpc: Expedite ping response transmission · 7aa51da7
      David Howells 提交于
      Expedite the transmission of a response to a PING ACK by sending it from
      sendmsg if one is pending.  We're most likely to see a PING ACK during the
      client call Tx phase as the other side may use it to determine a number of
      parameters, such as the client's receive window size, the RTT and whether
      the client is doing slow start (similar to RFC5681).
      
      If we don't expedite it, it's left to the background processing thread to
      transmit.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      7aa51da7
    • D
      rxrpc: Send pings to get RTT data · 8e83134d
      David Howells 提交于
      Send a PING ACK packet to the peer when we get a new incoming call from a
      peer we don't have a record for.  The PING RESPONSE ACK packet will tell us
      the following about the peer:
      
       (1) its receive window size
      
       (2) its MTU sizes
      
       (3) its support for jumbo DATA packets
      
       (4) if it supports slow start (similar to RFC 5681)
      
       (5) an estimate of the RTT
      
      This is necessary because the peer won't normally send us an ACK until it
      gets to the Rx phase and we send it a packet, but we would like to know
      some of this information before we start sending packets.
      
      A pair of tracepoints are added so that RTT determination can be observed.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      8e83134d
    • D
      rxrpc: Add per-peer RTT tracker · cf1a6474
      David Howells 提交于
      Add a function to track the average RTT for a peer.  Sources of RTT data
      will be added in subsequent patches.
      
      The RTT data will be useful in the future for determining resend timeouts
      and for handling the slow-start part of the Rx protocol.
      
      Also add a pair of tracepoints, one to log transmissions to elicit a
      response for RTT purposes and one to log responses that contribute RTT
      data.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cf1a6474
    • D
      rxrpc: Add re-sent Tx annotation · f07373ea
      David Howells 提交于
      Add a Tx-phase annotation for packet buffers to indicate that a buffer has
      already been retransmitted.  This will be used by future congestion
      management.  Re-retransmissions of a packet don't affect the congestion
      window managment in the same way as initial retransmissions.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      f07373ea
    • D
      rxrpc: Don't store the rxrpc header in the Tx queue sk_buffs · 5a924b89
      David Howells 提交于
      Don't store the rxrpc protocol header in sk_buffs on the transmit queue,
      but rather generate it on the fly and pass it to kernel_sendmsg() as a
      separate iov.  This reduces the amount of storage required.
      
      Note that the security header is still stored in the sk_buff as it may get
      encrypted along with the data (and doesn't change with each transmission).
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      5a924b89
  3. 17 9月, 2016 19 次提交