• Florian Westphal's avatar
    mptcp: update mptcp ack sequence from work queue · 6771bfd9
    Florian Westphal authored
    If userspace is not reading data, all the mptcp-level acks contain the
    ack_seq from the last time userspace read data rather than the most
    recent in-sequence value.
    
    This causes pointless retransmissions for data that is already queued.
    
    The reason for this is that all the mptcp protocol level processing
    happens at mptcp_recv time.
    
    This adds work queue to move skbs from the subflow sockets receive
    queue on the mptcp socket receive queue (which was not used so far).
    
    This allows us to announce the correct mptcp ack sequence in a timely
    fashion, even when the application does not call recv() on the mptcp socket
    for some time.
    
    We still wake userspace tasks waiting for POLLIN immediately:
    If the mptcp level receive queue is empty (because the work queue is
    still pending) it can be filled from in-sequence subflow sockets at
    recv time without a need to wait for the worker.
    
    The skb_orphan when moving skbs from subflow to mptcp level is needed,
    because the destructor (sock_rfree) relies on skb->sk (ssk!) lock
    being taken.
    
    A followup patch will add needed rmem accouting for the moved skbs.
    
    Other problem: In case application behaves as expected, and calls
    recv() as soon as mptcp socket becomes readable, the work queue will
    only waste cpu cycles.  This will also be addressed in followup patches.
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6771bfd9
protocol.c 31.4 KB