Commit e8388eb1 authored by David Howells's avatar David Howells

af_rxrpc: Request an ACK for every alternate DATA packet

Set the RxRPC header flag to request an ACK packet for every odd-numbered DATA
packet unless it's the last one (which implicitly requests an ACK anyway).
This is similar to how librx appears to work.

If we don't do this, we'll send out a full window of packets and then just sit
there until the other side gets bored and sends an ACK to indicate that it's
been idle for a while and has received no new packets.

Requesting a lot of ACKs shouldn't be a problem as ACKs should be merged when
possible.

As AF_RXRPC currently works, it will schedule an ACK to be generated upon
receipt of a DATA packet with the ACK-request packet set - and in the time
taken to schedule this in a work queue, several other packets are likely to
arrive and then all get ACK'd together.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 817913d8
...@@ -669,6 +669,7 @@ static int rxrpc_send_data(struct kiocb *iocb, ...@@ -669,6 +669,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
/* add the packet to the send queue if it's now full */ /* add the packet to the send queue if it's now full */
if (sp->remain <= 0 || (segment == 0 && !more)) { if (sp->remain <= 0 || (segment == 0 && !more)) {
struct rxrpc_connection *conn = call->conn; struct rxrpc_connection *conn = call->conn;
uint32_t seq;
size_t pad; size_t pad;
/* pad out if we're using security */ /* pad out if we're using security */
...@@ -681,11 +682,12 @@ static int rxrpc_send_data(struct kiocb *iocb, ...@@ -681,11 +682,12 @@ static int rxrpc_send_data(struct kiocb *iocb,
memset(skb_put(skb, pad), 0, pad); memset(skb_put(skb, pad), 0, pad);
} }
seq = atomic_inc_return(&call->sequence);
sp->hdr.epoch = conn->epoch; sp->hdr.epoch = conn->epoch;
sp->hdr.cid = call->cid; sp->hdr.cid = call->cid;
sp->hdr.callNumber = call->call_id; sp->hdr.callNumber = call->call_id;
sp->hdr.seq = sp->hdr.seq = htonl(seq);
htonl(atomic_inc_return(&call->sequence));
sp->hdr.serial = sp->hdr.serial =
htonl(atomic_inc_return(&conn->serial)); htonl(atomic_inc_return(&conn->serial));
sp->hdr.type = RXRPC_PACKET_TYPE_DATA; sp->hdr.type = RXRPC_PACKET_TYPE_DATA;
...@@ -700,6 +702,8 @@ static int rxrpc_send_data(struct kiocb *iocb, ...@@ -700,6 +702,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
else if (CIRC_SPACE(call->acks_head, call->acks_tail, else if (CIRC_SPACE(call->acks_head, call->acks_tail,
call->acks_winsz) > 1) call->acks_winsz) > 1)
sp->hdr.flags |= RXRPC_MORE_PACKETS; sp->hdr.flags |= RXRPC_MORE_PACKETS;
if (more && seq & 1)
sp->hdr.flags |= RXRPC_REQUEST_ACK;
ret = rxrpc_secure_packet( ret = rxrpc_secure_packet(
call, skb, skb->mark, call, skb, skb->mark,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment