summaryrefslogtreecommitdiffstats
path: root/net/rxrpc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-10-08 10:46:01 -0400
committerDavid Howells <dhowells@redhat.com>2018-10-08 10:55:20 -0400
commitc479d5f2c2e1ce609da08c075054440d97ddff52 (patch)
treeb51690957e1c646c7b9286dc085d85ceb4728e60 /net/rxrpc
parentbfd2821117a751763718f1b5e57216c0d9b19a49 (diff)
rxrpc: Don't check RXRPC_CALL_TX_LAST after calling rxrpc_rotate_tx_window()
We should only call the function to end a call's Tx phase if we rotated the marked-last packet out of the transmission buffer. Make rxrpc_rotate_tx_window() return an indication of whether it just rotated the packet marked as the last out of the transmit buffer, carrying the information out of the locked section in that function. We can then check the return value instead of examining RXRPC_CALL_TX_LAST. Fixes: 70790dbe3f66 ("rxrpc: Pass the last Tx packet marker in the annotation buffer") Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc')
-rw-r--r--net/rxrpc/input.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 2dcef482acf2..8834aa627371 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -216,10 +216,11 @@ static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb,
216/* 216/*
217 * Apply a hard ACK by advancing the Tx window. 217 * Apply a hard ACK by advancing the Tx window.
218 */ 218 */
219static void rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to, 219static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
220 struct rxrpc_ack_summary *summary) 220 struct rxrpc_ack_summary *summary)
221{ 221{
222 struct sk_buff *skb, *list = NULL; 222 struct sk_buff *skb, *list = NULL;
223 bool rot_last = false;
223 int ix; 224 int ix;
224 u8 annotation; 225 u8 annotation;
225 226
@@ -243,15 +244,17 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
243 skb->next = list; 244 skb->next = list;
244 list = skb; 245 list = skb;
245 246
246 if (annotation & RXRPC_TX_ANNO_LAST) 247 if (annotation & RXRPC_TX_ANNO_LAST) {
247 set_bit(RXRPC_CALL_TX_LAST, &call->flags); 248 set_bit(RXRPC_CALL_TX_LAST, &call->flags);
249 rot_last = true;
250 }
248 if ((annotation & RXRPC_TX_ANNO_MASK) != RXRPC_TX_ANNO_ACK) 251 if ((annotation & RXRPC_TX_ANNO_MASK) != RXRPC_TX_ANNO_ACK)
249 summary->nr_rot_new_acks++; 252 summary->nr_rot_new_acks++;
250 } 253 }
251 254
252 spin_unlock(&call->lock); 255 spin_unlock(&call->lock);
253 256
254 trace_rxrpc_transmit(call, (test_bit(RXRPC_CALL_TX_LAST, &call->flags) ? 257 trace_rxrpc_transmit(call, (rot_last ?
255 rxrpc_transmit_rotate_last : 258 rxrpc_transmit_rotate_last :
256 rxrpc_transmit_rotate)); 259 rxrpc_transmit_rotate));
257 wake_up(&call->waitq); 260 wake_up(&call->waitq);
@@ -262,6 +265,8 @@ static void rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
262 skb->next = NULL; 265 skb->next = NULL;
263 rxrpc_free_skb(skb, rxrpc_skb_tx_freed); 266 rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
264 } 267 }
268
269 return rot_last;
265} 270}
266 271
267/* 272/*
@@ -332,11 +337,11 @@ static bool rxrpc_receiving_reply(struct rxrpc_call *call)
332 trace_rxrpc_timer(call, rxrpc_timer_init_for_reply, now); 337 trace_rxrpc_timer(call, rxrpc_timer_init_for_reply, now);
333 } 338 }
334 339
335 if (!test_bit(RXRPC_CALL_TX_LAST, &call->flags))
336 rxrpc_rotate_tx_window(call, top, &summary);
337 if (!test_bit(RXRPC_CALL_TX_LAST, &call->flags)) { 340 if (!test_bit(RXRPC_CALL_TX_LAST, &call->flags)) {
338 rxrpc_proto_abort("TXL", call, top); 341 if (!rxrpc_rotate_tx_window(call, top, &summary)) {
339 return false; 342 rxrpc_proto_abort("TXL", call, top);
343 return false;
344 }
340 } 345 }
341 if (!rxrpc_end_tx_phase(call, true, "ETD")) 346 if (!rxrpc_end_tx_phase(call, true, "ETD"))
342 return false; 347 return false;
@@ -897,8 +902,12 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
897 if (nr_acks > call->tx_top - hard_ack) 902 if (nr_acks > call->tx_top - hard_ack)
898 return rxrpc_proto_abort("AKN", call, 0); 903 return rxrpc_proto_abort("AKN", call, 0);
899 904
900 if (after(hard_ack, call->tx_hard_ack)) 905 if (after(hard_ack, call->tx_hard_ack)) {
901 rxrpc_rotate_tx_window(call, hard_ack, &summary); 906 if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) {
907 rxrpc_end_tx_phase(call, false, "ETA");
908 return;
909 }
910 }
902 911
903 if (nr_acks > 0) { 912 if (nr_acks > 0) {
904 if (skb_copy_bits(skb, offset, buf.acks, nr_acks) < 0) 913 if (skb_copy_bits(skb, offset, buf.acks, nr_acks) < 0)
@@ -907,11 +916,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
907 &summary); 916 &summary);
908 } 917 }
909 918
910 if (test_bit(RXRPC_CALL_TX_LAST, &call->flags)) {
911 rxrpc_end_tx_phase(call, false, "ETA");
912 return;
913 }
914
915 if (call->rxtx_annotations[call->tx_top & RXRPC_RXTX_BUFF_MASK] & 919 if (call->rxtx_annotations[call->tx_top & RXRPC_RXTX_BUFF_MASK] &
916 RXRPC_TX_ANNO_LAST && 920 RXRPC_TX_ANNO_LAST &&
917 summary.nr_acks == call->tx_top - hard_ack && 921 summary.nr_acks == call->tx_top - hard_ack &&
@@ -933,8 +937,7 @@ static void rxrpc_input_ackall(struct rxrpc_call *call, struct sk_buff *skb)
933 937
934 _proto("Rx ACKALL %%%u", sp->hdr.serial); 938 _proto("Rx ACKALL %%%u", sp->hdr.serial);
935 939
936 rxrpc_rotate_tx_window(call, call->tx_top, &summary); 940 if (rxrpc_rotate_tx_window(call, call->tx_top, &summary))
937 if (test_bit(RXRPC_CALL_TX_LAST, &call->flags))
938 rxrpc_end_tx_phase(call, false, "ETL"); 941 rxrpc_end_tx_phase(call, false, "ETL");
939} 942}
940 943