Skip to content

Commit f07373e

Browse files
committed
rxrpc: Add re-sent Tx annotation
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: David Howells <dhowells@redhat.com>
1 parent 5a924b8 commit f07373e

3 files changed

Lines changed: 32 additions & 12 deletions

File tree

‎net/rxrpc/ar-internal.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ struct rxrpc_call {
505505
#define RXRPC_TX_ANNO_UNACK 1
506506
#define RXRPC_TX_ANNO_NAK 2
507507
#define RXRPC_TX_ANNO_RETRANS 3
508+
#define RXRPC_TX_ANNO_MASK 0x03
509+
#define RXRPC_TX_ANNO_RESENT 0x04
508510
#define RXRPC_RX_ANNO_JUMBO 0x3f /* Jumbo subpacket number + 1 if not zero */
509511
#define RXRPC_RX_ANNO_JLAST 0x40 /* Set if last element of a jumbo packet */
510512
#define RXRPC_RX_ANNO_VERIFIED 0x80 /* Set if verified and decrypted */

‎net/rxrpc/call_event.c‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static void rxrpc_resend(struct rxrpc_call *call)
144144
rxrpc_seq_t cursor, seq, top;
145145
unsigned long resend_at, now;
146146
int ix;
147-
u8 annotation;
147+
u8 annotation, anno_type;
148148

149149
_enter("{%d,%d}", call->tx_hard_ack, call->tx_top);
150150

@@ -165,14 +165,16 @@ static void rxrpc_resend(struct rxrpc_call *call)
165165
for (seq = cursor + 1; before_eq(seq, top); seq++) {
166166
ix = seq & RXRPC_RXTX_BUFF_MASK;
167167
annotation = call->rxtx_annotations[ix];
168-
if (annotation == RXRPC_TX_ANNO_ACK)
168+
anno_type = annotation & RXRPC_TX_ANNO_MASK;
169+
annotation &= ~RXRPC_TX_ANNO_MASK;
170+
if (anno_type == RXRPC_TX_ANNO_ACK)
169171
continue;
170172

171173
skb = call->rxtx_buffer[ix];
172174
rxrpc_see_skb(skb, rxrpc_skb_tx_seen);
173175
sp = rxrpc_skb(skb);
174176

175-
if (annotation == RXRPC_TX_ANNO_UNACK) {
177+
if (anno_type == RXRPC_TX_ANNO_UNACK) {
176178
if (time_after(sp->resend_at, now)) {
177179
if (time_before(sp->resend_at, resend_at))
178180
resend_at = sp->resend_at;
@@ -181,7 +183,7 @@ static void rxrpc_resend(struct rxrpc_call *call)
181183
}
182184

183185
/* Okay, we need to retransmit a packet. */
184-
call->rxtx_annotations[ix] = RXRPC_TX_ANNO_RETRANS;
186+
call->rxtx_annotations[ix] = RXRPC_TX_ANNO_RETRANS | annotation;
185187
}
186188

187189
call->resend_at = resend_at;
@@ -194,7 +196,8 @@ static void rxrpc_resend(struct rxrpc_call *call)
194196
for (seq = cursor + 1; before_eq(seq, top); seq++) {
195197
ix = seq & RXRPC_RXTX_BUFF_MASK;
196198
annotation = call->rxtx_annotations[ix];
197-
if (annotation != RXRPC_TX_ANNO_RETRANS)
199+
anno_type = annotation & RXRPC_TX_ANNO_MASK;
200+
if (anno_type != RXRPC_TX_ANNO_RETRANS)
198201
continue;
199202

200203
skb = call->rxtx_buffer[ix];
@@ -220,10 +223,17 @@ static void rxrpc_resend(struct rxrpc_call *call)
220223
* received and the packet might have been hard-ACK'd (in which
221224
* case it will no longer be in the buffer).
222225
*/
223-
if (after(seq, call->tx_hard_ack) &&
224-
(call->rxtx_annotations[ix] == RXRPC_TX_ANNO_RETRANS ||
225-
call->rxtx_annotations[ix] == RXRPC_TX_ANNO_NAK))
226-
call->rxtx_annotations[ix] = RXRPC_TX_ANNO_UNACK;
226+
if (after(seq, call->tx_hard_ack)) {
227+
annotation = call->rxtx_annotations[ix];
228+
anno_type = annotation & RXRPC_TX_ANNO_MASK;
229+
if (anno_type == RXRPC_TX_ANNO_RETRANS ||
230+
anno_type == RXRPC_TX_ANNO_NAK) {
231+
annotation &= ~RXRPC_TX_ANNO_MASK;
232+
annotation |= RXRPC_TX_ANNO_UNACK;
233+
}
234+
annotation |= RXRPC_TX_ANNO_RESENT;
235+
call->rxtx_annotations[ix] = annotation;
236+
}
227237

228238
if (after(call->tx_hard_ack, seq))
229239
seq = call->tx_hard_ack;

‎net/rxrpc/input.c‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,25 @@ static void rxrpc_input_soft_acks(struct rxrpc_call *call, u8 *acks,
388388
{
389389
bool resend = false;
390390
int ix;
391+
u8 annotation, anno_type;
391392

392393
for (; nr_acks > 0; nr_acks--, seq++) {
393394
ix = seq & RXRPC_RXTX_BUFF_MASK;
395+
annotation = call->rxtx_annotations[ix];
396+
anno_type = annotation & RXRPC_TX_ANNO_MASK;
397+
annotation &= ~RXRPC_TX_ANNO_MASK;
394398
switch (*acks++) {
395399
case RXRPC_ACK_TYPE_ACK:
396-
call->rxtx_annotations[ix] = RXRPC_TX_ANNO_ACK;
400+
if (anno_type == RXRPC_TX_ANNO_ACK)
401+
continue;
402+
call->rxtx_annotations[ix] =
403+
RXRPC_TX_ANNO_ACK | annotation;
397404
break;
398405
case RXRPC_ACK_TYPE_NACK:
399-
if (call->rxtx_annotations[ix] == RXRPC_TX_ANNO_NAK)
406+
if (anno_type == RXRPC_TX_ANNO_NAK)
400407
continue;
401-
call->rxtx_annotations[ix] = RXRPC_TX_ANNO_NAK;
408+
call->rxtx_annotations[ix] =
409+
RXRPC_TX_ANNO_NAK | annotation;
402410
resend = true;
403411
break;
404412
default:

0 commit comments

Comments
 (0)