aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-10-06 21:04:24 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-06 21:04:24 -0400
commit0d818c288974e6f80923775dbf6225e3cb66659c (patch)
tree36286f4b31386698e72035d7a049a65238e32b75
parent4af1474e6198b10fee7bb20e81f7e033ad1b586c (diff)
parentbf7d620abf22c321208a4da4f435e7af52551a21 (diff)
Merge tag 'rxrpc-rewrite-20161004' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
David Howells says: ==================== rxrpc: Fixes This set of patches contains a bunch of fixes: (1) Fix an oops on incoming call to a local endpoint without a bound service. (2) Only ping for a lost reply in a client call (this is inapplicable to service calls). (3) Fix maybe uninitialised variable warnings in the ACK/ABORT sending function by splitting it. (4) Fix loss of PING RESPONSE ACKs due to them being subsumed by PING ACK generation. (5) OpenAFS improperly terminates calls it makes as a client under some circumstances by not fully hard-ACK'ing the last DATA packets. This is alleviated by a new call appearing on the same channel implicitly completing the previous call on that channel. Handle this implicit completion. (6) Properly handle expiry of service calls due to the aforementioned improper termination with no follow up call to implicitly complete it: (a) The call's background processor needs to be queued to complete the call, send an abort and notify the socket. (b) The call's background processor needs to notify the socket (or the kernel service) when it has completed the call. (c) A negative error code must thence be returned to the kernel service so that it knows the call died. (d) The AFS filesystem must detect the fatal error and end the call. (7) Must produce a DELAY ACK when the actual service operation takes a while to process and must cancel the ACK when the reply is ready. (8) Don't request an ACK on the last DATA packet of the Tx phase as this confuses OpenAFS. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--fs/afs/rxrpc.c2
-rw-r--r--net/rxrpc/af_rxrpc.c4
-rw-r--r--net/rxrpc/ar-internal.h18
-rw-r--r--net/rxrpc/call_accept.c4
-rw-r--r--net/rxrpc/call_event.c77
-rw-r--r--net/rxrpc/call_object.c3
-rw-r--r--net/rxrpc/input.c44
-rw-r--r--net/rxrpc/misc.c6
-rw-r--r--net/rxrpc/output.c179
-rw-r--r--net/rxrpc/recvmsg.c14
-rw-r--r--net/rxrpc/rxkad.c6
-rw-r--r--net/rxrpc/sendmsg.c12
12 files changed, 252 insertions, 117 deletions
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 59bdaa7527b6..477928b25940 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -418,7 +418,7 @@ static void afs_deliver_to_call(struct afs_call *call)
418 &call->abort_code); 418 &call->abort_code);
419 if (ret == -EINPROGRESS || ret == -EAGAIN) 419 if (ret == -EINPROGRESS || ret == -EAGAIN)
420 return; 420 return;
421 if (ret == 1) { 421 if (ret == 1 || ret < 0) {
422 call->state = AFS_CALL_COMPLETE; 422 call->state = AFS_CALL_COMPLETE;
423 goto done; 423 goto done;
424 } 424 }
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 44c9c2b0b190..2d59c9be40e1 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -678,9 +678,9 @@ static int rxrpc_release_sock(struct sock *sk)
678 sk->sk_state = RXRPC_CLOSE; 678 sk->sk_state = RXRPC_CLOSE;
679 spin_unlock_bh(&sk->sk_receive_queue.lock); 679 spin_unlock_bh(&sk->sk_receive_queue.lock);
680 680
681 if (rx->local && rx->local->service == rx) { 681 if (rx->local && rcu_access_pointer(rx->local->service) == rx) {
682 write_lock(&rx->local->services_lock); 682 write_lock(&rx->local->services_lock);
683 rx->local->service = NULL; 683 rcu_assign_pointer(rx->local->service, NULL);
684 write_unlock(&rx->local->services_lock); 684 write_unlock(&rx->local->services_lock);
685 } 685 }
686 686
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index d38dffd78085..f60e35576526 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -398,6 +398,7 @@ enum rxrpc_call_flag {
398 RXRPC_CALL_EXPOSED, /* The call was exposed to the world */ 398 RXRPC_CALL_EXPOSED, /* The call was exposed to the world */
399 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */ 399 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */
400 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */ 400 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */
401 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
401 RXRPC_CALL_PINGING, /* Ping in process */ 402 RXRPC_CALL_PINGING, /* Ping in process */
402 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ 403 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
403}; 404};
@@ -410,6 +411,7 @@ enum rxrpc_call_event {
410 RXRPC_CALL_EV_ABORT, /* need to generate abort */ 411 RXRPC_CALL_EV_ABORT, /* need to generate abort */
411 RXRPC_CALL_EV_TIMER, /* Timer expired */ 412 RXRPC_CALL_EV_TIMER, /* Timer expired */
412 RXRPC_CALL_EV_RESEND, /* Tx resend required */ 413 RXRPC_CALL_EV_RESEND, /* Tx resend required */
414 RXRPC_CALL_EV_PING, /* Ping send required */
413}; 415};
414 416
415/* 417/*
@@ -466,6 +468,7 @@ struct rxrpc_call {
466 struct rxrpc_sock __rcu *socket; /* socket responsible */ 468 struct rxrpc_sock __rcu *socket; /* socket responsible */
467 ktime_t ack_at; /* When deferred ACK needs to happen */ 469 ktime_t ack_at; /* When deferred ACK needs to happen */
468 ktime_t resend_at; /* When next resend needs to happen */ 470 ktime_t resend_at; /* When next resend needs to happen */
471 ktime_t ping_at; /* When next to send a ping */
469 ktime_t expire_at; /* When the call times out */ 472 ktime_t expire_at; /* When the call times out */
470 struct timer_list timer; /* Combined event timer */ 473 struct timer_list timer; /* Combined event timer */
471 struct work_struct processor; /* Event processor */ 474 struct work_struct processor; /* Event processor */
@@ -558,8 +561,10 @@ struct rxrpc_call {
558 rxrpc_seq_t ackr_prev_seq; /* previous sequence number received */ 561 rxrpc_seq_t ackr_prev_seq; /* previous sequence number received */
559 rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */ 562 rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */
560 rxrpc_seq_t ackr_seen; /* Highest packet shown seen */ 563 rxrpc_seq_t ackr_seen; /* Highest packet shown seen */
561 rxrpc_serial_t ackr_ping; /* Last ping sent */ 564
562 ktime_t ackr_ping_time; /* Time last ping sent */ 565 /* ping management */
566 rxrpc_serial_t ping_serial; /* Last ping sent */
567 ktime_t ping_time; /* Time last ping sent */
563 568
564 /* transmission-phase ACK management */ 569 /* transmission-phase ACK management */
565 ktime_t acks_latest_ts; /* Timestamp of latest ACK received */ 570 ktime_t acks_latest_ts; /* Timestamp of latest ACK received */
@@ -728,8 +733,10 @@ extern const char rxrpc_rtt_rx_traces[rxrpc_rtt_rx__nr_trace][5];
728enum rxrpc_timer_trace { 733enum rxrpc_timer_trace {
729 rxrpc_timer_begin, 734 rxrpc_timer_begin,
730 rxrpc_timer_init_for_reply, 735 rxrpc_timer_init_for_reply,
736 rxrpc_timer_init_for_send_reply,
731 rxrpc_timer_expired, 737 rxrpc_timer_expired,
732 rxrpc_timer_set_for_ack, 738 rxrpc_timer_set_for_ack,
739 rxrpc_timer_set_for_ping,
733 rxrpc_timer_set_for_resend, 740 rxrpc_timer_set_for_resend,
734 rxrpc_timer_set_for_send, 741 rxrpc_timer_set_for_send,
735 rxrpc_timer__nr_trace 742 rxrpc_timer__nr_trace
@@ -743,6 +750,7 @@ enum rxrpc_propose_ack_trace {
743 rxrpc_propose_ack_ping_for_lost_ack, 750 rxrpc_propose_ack_ping_for_lost_ack,
744 rxrpc_propose_ack_ping_for_lost_reply, 751 rxrpc_propose_ack_ping_for_lost_reply,
745 rxrpc_propose_ack_ping_for_params, 752 rxrpc_propose_ack_ping_for_params,
753 rxrpc_propose_ack_processing_op,
746 rxrpc_propose_ack_respond_to_ack, 754 rxrpc_propose_ack_respond_to_ack,
747 rxrpc_propose_ack_respond_to_ping, 755 rxrpc_propose_ack_respond_to_ping,
748 rxrpc_propose_ack_retry_tx, 756 rxrpc_propose_ack_retry_tx,
@@ -777,7 +785,7 @@ extern const char rxrpc_congest_modes[NR__RXRPC_CONGEST_MODES][10];
777extern const char rxrpc_congest_changes[rxrpc_congest__nr_change][9]; 785extern const char rxrpc_congest_changes[rxrpc_congest__nr_change][9];
778 786
779extern const char *const rxrpc_pkts[]; 787extern const char *const rxrpc_pkts[];
780extern const char const rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4]; 788extern const char rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4];
781 789
782#include <trace/events/rxrpc.h> 790#include <trace/events/rxrpc.h>
783 791
@@ -805,6 +813,7 @@ int rxrpc_reject_call(struct rxrpc_sock *);
805/* 813/*
806 * call_event.c 814 * call_event.c
807 */ 815 */
816void __rxrpc_set_timer(struct rxrpc_call *, enum rxrpc_timer_trace, ktime_t);
808void rxrpc_set_timer(struct rxrpc_call *, enum rxrpc_timer_trace, ktime_t); 817void rxrpc_set_timer(struct rxrpc_call *, enum rxrpc_timer_trace, ktime_t);
809void rxrpc_propose_ACK(struct rxrpc_call *, u8, u16, u32, bool, bool, 818void rxrpc_propose_ACK(struct rxrpc_call *, u8, u16, u32, bool, bool,
810 enum rxrpc_propose_ack_trace); 819 enum rxrpc_propose_ack_trace);
@@ -1068,7 +1077,8 @@ extern const s8 rxrpc_ack_priority[];
1068/* 1077/*
1069 * output.c 1078 * output.c
1070 */ 1079 */
1071int rxrpc_send_call_packet(struct rxrpc_call *, u8); 1080int rxrpc_send_ack_packet(struct rxrpc_call *, bool);
1081int rxrpc_send_abort_packet(struct rxrpc_call *);
1072int rxrpc_send_data_packet(struct rxrpc_call *, struct sk_buff *, bool); 1082int rxrpc_send_data_packet(struct rxrpc_call *, struct sk_buff *, bool);
1073void rxrpc_reject_packets(struct rxrpc_local *); 1083void rxrpc_reject_packets(struct rxrpc_local *);
1074 1084
diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c
index 3cac231d8405..832d854c2d5c 100644
--- a/net/rxrpc/call_accept.c
+++ b/net/rxrpc/call_accept.c
@@ -337,7 +337,7 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local,
337 337
338 /* Get the socket providing the service */ 338 /* Get the socket providing the service */
339 rx = rcu_dereference(local->service); 339 rx = rcu_dereference(local->service);
340 if (service_id == rx->srx.srx_service) 340 if (rx && service_id == rx->srx.srx_service)
341 goto found_service; 341 goto found_service;
342 342
343 trace_rxrpc_abort("INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, 343 trace_rxrpc_abort("INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq,
@@ -565,7 +565,7 @@ out_discard:
565 write_unlock_bh(&call->state_lock); 565 write_unlock_bh(&call->state_lock);
566 write_unlock(&rx->call_lock); 566 write_unlock(&rx->call_lock);
567 if (abort) { 567 if (abort) {
568 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 568 rxrpc_send_abort_packet(call);
569 rxrpc_release_call(rx, call); 569 rxrpc_release_call(rx, call);
570 rxrpc_put_call(call, rxrpc_call_put); 570 rxrpc_put_call(call, rxrpc_call_put);
571 } 571 }
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 4f00476630b9..97a17ada4431 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -24,19 +24,20 @@
24/* 24/*
25 * Set the timer 25 * Set the timer
26 */ 26 */
27void rxrpc_set_timer(struct rxrpc_call *call, enum rxrpc_timer_trace why, 27void __rxrpc_set_timer(struct rxrpc_call *call, enum rxrpc_timer_trace why,
28 ktime_t now) 28 ktime_t now)
29{ 29{
30 unsigned long t_j, now_j = jiffies; 30 unsigned long t_j, now_j = jiffies;
31 ktime_t t; 31 ktime_t t;
32 bool queue = false; 32 bool queue = false;
33 33
34 read_lock_bh(&call->state_lock);
35
36 if (call->state < RXRPC_CALL_COMPLETE) { 34 if (call->state < RXRPC_CALL_COMPLETE) {
37 t = call->expire_at; 35 t = call->expire_at;
38 if (!ktime_after(t, now)) 36 if (!ktime_after(t, now)) {
37 trace_rxrpc_timer(call, why, now, now_j);
38 queue = true;
39 goto out; 39 goto out;
40 }
40 41
41 if (!ktime_after(call->resend_at, now)) { 42 if (!ktime_after(call->resend_at, now)) {
42 call->resend_at = call->expire_at; 43 call->resend_at = call->expire_at;
@@ -54,6 +55,14 @@ void rxrpc_set_timer(struct rxrpc_call *call, enum rxrpc_timer_trace why,
54 t = call->ack_at; 55 t = call->ack_at;
55 } 56 }
56 57
58 if (!ktime_after(call->ping_at, now)) {
59 call->ping_at = call->expire_at;
60 if (!test_and_set_bit(RXRPC_CALL_EV_PING, &call->events))
61 queue = true;
62 } else if (ktime_before(call->ping_at, t)) {
63 t = call->ping_at;
64 }
65
57 t_j = nsecs_to_jiffies(ktime_to_ns(ktime_sub(t, now))); 66 t_j = nsecs_to_jiffies(ktime_to_ns(ktime_sub(t, now)));
58 t_j += jiffies; 67 t_j += jiffies;
59 68
@@ -68,16 +77,46 @@ void rxrpc_set_timer(struct rxrpc_call *call, enum rxrpc_timer_trace why,
68 mod_timer(&call->timer, t_j); 77 mod_timer(&call->timer, t_j);
69 trace_rxrpc_timer(call, why, now, now_j); 78 trace_rxrpc_timer(call, why, now, now_j);
70 } 79 }
71
72 if (queue)
73 rxrpc_queue_call(call);
74 } 80 }
75 81
76out: 82out:
83 if (queue)
84 rxrpc_queue_call(call);
85}
86
87/*
88 * Set the timer
89 */
90void rxrpc_set_timer(struct rxrpc_call *call, enum rxrpc_timer_trace why,
91 ktime_t now)
92{
93 read_lock_bh(&call->state_lock);
94 __rxrpc_set_timer(call, why, now);
77 read_unlock_bh(&call->state_lock); 95 read_unlock_bh(&call->state_lock);
78} 96}
79 97
80/* 98/*
99 * Propose a PING ACK be sent.
100 */
101static void rxrpc_propose_ping(struct rxrpc_call *call,
102 bool immediate, bool background)
103{
104 if (immediate) {
105 if (background &&
106 !test_and_set_bit(RXRPC_CALL_EV_PING, &call->events))
107 rxrpc_queue_call(call);
108 } else {
109 ktime_t now = ktime_get_real();
110 ktime_t ping_at = ktime_add_ms(now, rxrpc_idle_ack_delay);
111
112 if (ktime_before(ping_at, call->ping_at)) {
113 call->ping_at = ping_at;
114 rxrpc_set_timer(call, rxrpc_timer_set_for_ping, now);
115 }
116 }
117}
118
119/*
81 * propose an ACK be sent 120 * propose an ACK be sent
82 */ 121 */
83static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason, 122static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason,
@@ -90,6 +129,14 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason,
90 ktime_t now, ack_at; 129 ktime_t now, ack_at;
91 s8 prior = rxrpc_ack_priority[ack_reason]; 130 s8 prior = rxrpc_ack_priority[ack_reason];
92 131
132 /* Pings are handled specially because we don't want to accidentally
133 * lose a ping response by subsuming it into a ping.
134 */
135 if (ack_reason == RXRPC_ACK_PING) {
136 rxrpc_propose_ping(call, immediate, background);
137 goto trace;
138 }
139
93 /* Update DELAY, IDLE, REQUESTED and PING_RESPONSE ACK serial 140 /* Update DELAY, IDLE, REQUESTED and PING_RESPONSE ACK serial
94 * numbers, but we don't alter the timeout. 141 * numbers, but we don't alter the timeout.
95 */ 142 */
@@ -125,7 +172,6 @@ static void __rxrpc_propose_ACK(struct rxrpc_call *call, u8 ack_reason,
125 expiry = rxrpc_soft_ack_delay; 172 expiry = rxrpc_soft_ack_delay;
126 break; 173 break;
127 174
128 case RXRPC_ACK_PING:
129 case RXRPC_ACK_IDLE: 175 case RXRPC_ACK_IDLE:
130 if (rxrpc_idle_ack_delay < expiry) 176 if (rxrpc_idle_ack_delay < expiry)
131 expiry = rxrpc_idle_ack_delay; 177 expiry = rxrpc_idle_ack_delay;
@@ -253,7 +299,7 @@ static void rxrpc_resend(struct rxrpc_call *call, ktime_t now)
253 goto out; 299 goto out;
254 rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, 0, true, false, 300 rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, 0, true, false,
255 rxrpc_propose_ack_ping_for_lost_ack); 301 rxrpc_propose_ack_ping_for_lost_ack);
256 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ACK); 302 rxrpc_send_ack_packet(call, true);
257 goto out; 303 goto out;
258 } 304 }
259 305
@@ -328,12 +374,13 @@ void rxrpc_process_call(struct work_struct *work)
328 374
329recheck_state: 375recheck_state:
330 if (test_and_clear_bit(RXRPC_CALL_EV_ABORT, &call->events)) { 376 if (test_and_clear_bit(RXRPC_CALL_EV_ABORT, &call->events)) {
331 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 377 rxrpc_send_abort_packet(call);
332 goto recheck_state; 378 goto recheck_state;
333 } 379 }
334 380
335 if (call->state == RXRPC_CALL_COMPLETE) { 381 if (call->state == RXRPC_CALL_COMPLETE) {
336 del_timer_sync(&call->timer); 382 del_timer_sync(&call->timer);
383 rxrpc_notify_socket(call);
337 goto out_put; 384 goto out_put;
338 } 385 }
339 386
@@ -345,13 +392,17 @@ recheck_state:
345 } 392 }
346 393
347 if (test_and_clear_bit(RXRPC_CALL_EV_ACK, &call->events)) { 394 if (test_and_clear_bit(RXRPC_CALL_EV_ACK, &call->events)) {
348 call->ack_at = call->expire_at;
349 if (call->ackr_reason) { 395 if (call->ackr_reason) {
350 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ACK); 396 rxrpc_send_ack_packet(call, false);
351 goto recheck_state; 397 goto recheck_state;
352 } 398 }
353 } 399 }
354 400
401 if (test_and_clear_bit(RXRPC_CALL_EV_PING, &call->events)) {
402 rxrpc_send_ack_packet(call, true);
403 goto recheck_state;
404 }
405
355 if (test_and_clear_bit(RXRPC_CALL_EV_RESEND, &call->events)) { 406 if (test_and_clear_bit(RXRPC_CALL_EV_RESEND, &call->events)) {
356 rxrpc_resend(call, now); 407 rxrpc_resend(call, now);
357 goto recheck_state; 408 goto recheck_state;
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 364b42dc3dce..4353a29f3b57 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -205,6 +205,7 @@ static void rxrpc_start_call_timer(struct rxrpc_call *call)
205 expire_at = ktime_add_ms(now, rxrpc_max_call_lifetime); 205 expire_at = ktime_add_ms(now, rxrpc_max_call_lifetime);
206 call->expire_at = expire_at; 206 call->expire_at = expire_at;
207 call->ack_at = expire_at; 207 call->ack_at = expire_at;
208 call->ping_at = expire_at;
208 call->resend_at = expire_at; 209 call->resend_at = expire_at;
209 call->timer.expires = jiffies + LONG_MAX / 2; 210 call->timer.expires = jiffies + LONG_MAX / 2;
210 rxrpc_set_timer(call, rxrpc_timer_begin, now); 211 rxrpc_set_timer(call, rxrpc_timer_begin, now);
@@ -498,7 +499,7 @@ void rxrpc_release_calls_on_socket(struct rxrpc_sock *rx)
498 struct rxrpc_call, sock_link); 499 struct rxrpc_call, sock_link);
499 rxrpc_get_call(call, rxrpc_call_got); 500 rxrpc_get_call(call, rxrpc_call_got);
500 rxrpc_abort_call("SKT", call, 0, RX_CALL_DEAD, ECONNRESET); 501 rxrpc_abort_call("SKT", call, 0, RX_CALL_DEAD, ECONNRESET);
501 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 502 rxrpc_send_abort_packet(call);
502 rxrpc_release_call(rx, call); 503 rxrpc_release_call(rx, call);
503 rxrpc_put_call(call, rxrpc_call_put); 504 rxrpc_put_call(call, rxrpc_call_put);
504 } 505 }
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 3ad9f75031e3..44fb8d893c7d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -625,9 +625,9 @@ static void rxrpc_input_ping_response(struct rxrpc_call *call,
625 rxrpc_serial_t ping_serial; 625 rxrpc_serial_t ping_serial;
626 ktime_t ping_time; 626 ktime_t ping_time;
627 627
628 ping_time = call->ackr_ping_time; 628 ping_time = call->ping_time;
629 smp_rmb(); 629 smp_rmb();
630 ping_serial = call->ackr_ping; 630 ping_serial = call->ping_serial;
631 631
632 if (!test_bit(RXRPC_CALL_PINGING, &call->flags) || 632 if (!test_bit(RXRPC_CALL_PINGING, &call->flags) ||
633 before(orig_serial, ping_serial)) 633 before(orig_serial, ping_serial))
@@ -847,7 +847,8 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb,
847 847
848 if (call->rxtx_annotations[call->tx_top & RXRPC_RXTX_BUFF_MASK] & 848 if (call->rxtx_annotations[call->tx_top & RXRPC_RXTX_BUFF_MASK] &
849 RXRPC_TX_ANNO_LAST && 849 RXRPC_TX_ANNO_LAST &&
850 summary.nr_acks == call->tx_top - hard_ack) 850 summary.nr_acks == call->tx_top - hard_ack &&
851 rxrpc_is_client_call(call))
851 rxrpc_propose_ACK(call, RXRPC_ACK_PING, skew, sp->hdr.serial, 852 rxrpc_propose_ACK(call, RXRPC_ACK_PING, skew, sp->hdr.serial,
852 false, true, 853 false, true,
853 rxrpc_propose_ack_ping_for_lost_reply); 854 rxrpc_propose_ack_ping_for_lost_reply);
@@ -938,6 +939,33 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
938} 939}
939 940
940/* 941/*
942 * Handle a new call on a channel implicitly completing the preceding call on
943 * that channel.
944 *
945 * TODO: If callNumber > call_id + 1, renegotiate security.
946 */
947static void rxrpc_input_implicit_end_call(struct rxrpc_connection *conn,
948 struct rxrpc_call *call)
949{
950 switch (call->state) {
951 case RXRPC_CALL_SERVER_AWAIT_ACK:
952 rxrpc_call_completed(call);
953 break;
954 case RXRPC_CALL_COMPLETE:
955 break;
956 default:
957 if (rxrpc_abort_call("IMP", call, 0, RX_CALL_DEAD, ESHUTDOWN)) {
958 set_bit(RXRPC_CALL_EV_ABORT, &call->events);
959 rxrpc_queue_call(call);
960 }
961 break;
962 }
963
964 __rxrpc_disconnect_call(conn, call);
965 rxrpc_notify_socket(call);
966}
967
968/*
941 * post connection-level events to the connection 969 * post connection-level events to the connection
942 * - this includes challenges, responses, some aborts and call terminal packet 970 * - this includes challenges, responses, some aborts and call terminal packet
943 * retransmission. 971 * retransmission.
@@ -1145,6 +1173,16 @@ void rxrpc_data_ready(struct sock *udp_sk)
1145 } 1173 }
1146 1174
1147 call = rcu_dereference(chan->call); 1175 call = rcu_dereference(chan->call);
1176
1177 if (sp->hdr.callNumber > chan->call_id) {
1178 if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) {
1179 rcu_read_unlock();
1180 goto reject_packet;
1181 }
1182 if (call)
1183 rxrpc_input_implicit_end_call(conn, call);
1184 call = NULL;
1185 }
1148 } else { 1186 } else {
1149 skew = 0; 1187 skew = 0;
1150 call = NULL; 1188 call = NULL;
diff --git a/net/rxrpc/misc.c b/net/rxrpc/misc.c
index 9d1c721bc4e8..6dee55fad2d3 100644
--- a/net/rxrpc/misc.c
+++ b/net/rxrpc/misc.c
@@ -93,10 +93,9 @@ const s8 rxrpc_ack_priority[] = {
93 [RXRPC_ACK_EXCEEDS_WINDOW] = 6, 93 [RXRPC_ACK_EXCEEDS_WINDOW] = 6,
94 [RXRPC_ACK_NOSPACE] = 7, 94 [RXRPC_ACK_NOSPACE] = 7,
95 [RXRPC_ACK_PING_RESPONSE] = 8, 95 [RXRPC_ACK_PING_RESPONSE] = 8,
96 [RXRPC_ACK_PING] = 9,
97}; 96};
98 97
99const char const rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4] = { 98const char rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4] = {
100 "---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY", 99 "---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY",
101 "IDL", "-?-" 100 "IDL", "-?-"
102}; 101};
@@ -196,7 +195,9 @@ const char rxrpc_timer_traces[rxrpc_timer__nr_trace][8] = {
196 [rxrpc_timer_begin] = "Begin ", 195 [rxrpc_timer_begin] = "Begin ",
197 [rxrpc_timer_expired] = "*EXPR*", 196 [rxrpc_timer_expired] = "*EXPR*",
198 [rxrpc_timer_init_for_reply] = "IniRpl", 197 [rxrpc_timer_init_for_reply] = "IniRpl",
198 [rxrpc_timer_init_for_send_reply] = "SndRpl",
199 [rxrpc_timer_set_for_ack] = "SetAck", 199 [rxrpc_timer_set_for_ack] = "SetAck",
200 [rxrpc_timer_set_for_ping] = "SetPng",
200 [rxrpc_timer_set_for_send] = "SetTx ", 201 [rxrpc_timer_set_for_send] = "SetTx ",
201 [rxrpc_timer_set_for_resend] = "SetRTx", 202 [rxrpc_timer_set_for_resend] = "SetRTx",
202}; 203};
@@ -207,6 +208,7 @@ const char rxrpc_propose_ack_traces[rxrpc_propose_ack__nr_trace][8] = {
207 [rxrpc_propose_ack_ping_for_lost_ack] = "LostAck", 208 [rxrpc_propose_ack_ping_for_lost_ack] = "LostAck",
208 [rxrpc_propose_ack_ping_for_lost_reply] = "LostRpl", 209 [rxrpc_propose_ack_ping_for_lost_reply] = "LostRpl",
209 [rxrpc_propose_ack_ping_for_params] = "Params ", 210 [rxrpc_propose_ack_ping_for_params] = "Params ",
211 [rxrpc_propose_ack_processing_op] = "ProcOp ",
210 [rxrpc_propose_ack_respond_to_ack] = "Rsp2Ack", 212 [rxrpc_propose_ack_respond_to_ack] = "Rsp2Ack",
211 [rxrpc_propose_ack_respond_to_ping] = "Rsp2Png", 213 [rxrpc_propose_ack_respond_to_ping] = "Rsp2Png",
212 [rxrpc_propose_ack_retry_tx] = "RetryTx", 214 [rxrpc_propose_ack_retry_tx] = "RetryTx",
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 0d47db886f6e..5dab1ff3a6c2 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -19,26 +19,27 @@
19#include <net/af_rxrpc.h> 19#include <net/af_rxrpc.h>
20#include "ar-internal.h" 20#include "ar-internal.h"
21 21
22struct rxrpc_pkt_buffer { 22struct rxrpc_ack_buffer {
23 struct rxrpc_wire_header whdr; 23 struct rxrpc_wire_header whdr;
24 union { 24 struct rxrpc_ackpacket ack;
25 struct { 25 u8 acks[255];
26 struct rxrpc_ackpacket ack; 26 u8 pad[3];
27 u8 acks[255];
28 u8 pad[3];
29 };
30 __be32 abort_code;
31 };
32 struct rxrpc_ackinfo ackinfo; 27 struct rxrpc_ackinfo ackinfo;
33}; 28};
34 29
30struct rxrpc_abort_buffer {
31 struct rxrpc_wire_header whdr;
32 __be32 abort_code;
33};
34
35/* 35/*
36 * Fill out an ACK packet. 36 * Fill out an ACK packet.
37 */ 37 */
38static size_t rxrpc_fill_out_ack(struct rxrpc_call *call, 38static size_t rxrpc_fill_out_ack(struct rxrpc_call *call,
39 struct rxrpc_pkt_buffer *pkt, 39 struct rxrpc_ack_buffer *pkt,
40 rxrpc_seq_t *_hard_ack, 40 rxrpc_seq_t *_hard_ack,
41 rxrpc_seq_t *_top) 41 rxrpc_seq_t *_top,
42 u8 reason)
42{ 43{
43 rxrpc_serial_t serial; 44 rxrpc_serial_t serial;
44 rxrpc_seq_t hard_ack, top, seq; 45 rxrpc_seq_t hard_ack, top, seq;
@@ -58,10 +59,10 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_call *call,
58 pkt->ack.firstPacket = htonl(hard_ack + 1); 59 pkt->ack.firstPacket = htonl(hard_ack + 1);
59 pkt->ack.previousPacket = htonl(call->ackr_prev_seq); 60 pkt->ack.previousPacket = htonl(call->ackr_prev_seq);
60 pkt->ack.serial = htonl(serial); 61 pkt->ack.serial = htonl(serial);
61 pkt->ack.reason = call->ackr_reason; 62 pkt->ack.reason = reason;
62 pkt->ack.nAcks = top - hard_ack; 63 pkt->ack.nAcks = top - hard_ack;
63 64
64 if (pkt->ack.reason == RXRPC_ACK_PING) 65 if (reason == RXRPC_ACK_PING)
65 pkt->whdr.flags |= RXRPC_REQUEST_ACK; 66 pkt->whdr.flags |= RXRPC_REQUEST_ACK;
66 67
67 if (after(top, hard_ack)) { 68 if (after(top, hard_ack)) {
@@ -91,22 +92,19 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_call *call,
91} 92}
92 93
93/* 94/*
94 * Send an ACK or ABORT call packet. 95 * Send an ACK call packet.
95 */ 96 */
96int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type) 97int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping)
97{ 98{
98 struct rxrpc_connection *conn = NULL; 99 struct rxrpc_connection *conn = NULL;
99 struct rxrpc_pkt_buffer *pkt; 100 struct rxrpc_ack_buffer *pkt;
100 struct msghdr msg; 101 struct msghdr msg;
101 struct kvec iov[2]; 102 struct kvec iov[2];
102 rxrpc_serial_t serial; 103 rxrpc_serial_t serial;
103 rxrpc_seq_t hard_ack, top; 104 rxrpc_seq_t hard_ack, top;
104 size_t len, n; 105 size_t len, n;
105 bool ping = false; 106 int ret;
106 int ioc, ret; 107 u8 reason;
107 u32 abort_code;
108
109 _enter("%u,%s", call->debug_id, rxrpc_pkts[type]);
110 108
111 spin_lock_bh(&call->lock); 109 spin_lock_bh(&call->lock);
112 if (call->conn) 110 if (call->conn)
@@ -131,68 +129,44 @@ int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type)
131 pkt->whdr.cid = htonl(call->cid); 129 pkt->whdr.cid = htonl(call->cid);
132 pkt->whdr.callNumber = htonl(call->call_id); 130 pkt->whdr.callNumber = htonl(call->call_id);
133 pkt->whdr.seq = 0; 131 pkt->whdr.seq = 0;
134 pkt->whdr.type = type; 132 pkt->whdr.type = RXRPC_PACKET_TYPE_ACK;
135 pkt->whdr.flags = conn->out_clientflag; 133 pkt->whdr.flags = RXRPC_SLOW_START_OK | conn->out_clientflag;
136 pkt->whdr.userStatus = 0; 134 pkt->whdr.userStatus = 0;
137 pkt->whdr.securityIndex = call->security_ix; 135 pkt->whdr.securityIndex = call->security_ix;
138 pkt->whdr._rsvd = 0; 136 pkt->whdr._rsvd = 0;
139 pkt->whdr.serviceId = htons(call->service_id); 137 pkt->whdr.serviceId = htons(call->service_id);
140 138
141 iov[0].iov_base = pkt; 139 spin_lock_bh(&call->lock);
142 iov[0].iov_len = sizeof(pkt->whdr); 140 if (ping) {
143 len = sizeof(pkt->whdr); 141 reason = RXRPC_ACK_PING;
144 142 } else {
145 switch (type) { 143 reason = call->ackr_reason;
146 case RXRPC_PACKET_TYPE_ACK:
147 spin_lock_bh(&call->lock);
148 if (!call->ackr_reason) { 144 if (!call->ackr_reason) {
149 spin_unlock_bh(&call->lock); 145 spin_unlock_bh(&call->lock);
150 ret = 0; 146 ret = 0;
151 goto out; 147 goto out;
152 } 148 }
153 ping = (call->ackr_reason == RXRPC_ACK_PING);
154 n = rxrpc_fill_out_ack(call, pkt, &hard_ack, &top);
155 call->ackr_reason = 0; 149 call->ackr_reason = 0;
150 }
151 n = rxrpc_fill_out_ack(call, pkt, &hard_ack, &top, reason);
156 152
157 spin_unlock_bh(&call->lock); 153 spin_unlock_bh(&call->lock);
158
159
160 pkt->whdr.flags |= RXRPC_SLOW_START_OK;
161
162 iov[0].iov_len += sizeof(pkt->ack) + n;
163 iov[1].iov_base = &pkt->ackinfo;
164 iov[1].iov_len = sizeof(pkt->ackinfo);
165 len += sizeof(pkt->ack) + n + sizeof(pkt->ackinfo);
166 ioc = 2;
167 break;
168
169 case RXRPC_PACKET_TYPE_ABORT:
170 abort_code = call->abort_code;
171 pkt->abort_code = htonl(abort_code);
172 iov[0].iov_len += sizeof(pkt->abort_code);
173 len += sizeof(pkt->abort_code);
174 ioc = 1;
175 break;
176 154
177 default: 155 iov[0].iov_base = pkt;
178 BUG(); 156 iov[0].iov_len = sizeof(pkt->whdr) + sizeof(pkt->ack) + n;
179 ret = -ENOANO; 157 iov[1].iov_base = &pkt->ackinfo;
180 goto out; 158 iov[1].iov_len = sizeof(pkt->ackinfo);
181 } 159 len = iov[0].iov_len + iov[1].iov_len;
182 160
183 serial = atomic_inc_return(&conn->serial); 161 serial = atomic_inc_return(&conn->serial);
184 pkt->whdr.serial = htonl(serial); 162 pkt->whdr.serial = htonl(serial);
185 switch (type) { 163 trace_rxrpc_tx_ack(call, serial,
186 case RXRPC_PACKET_TYPE_ACK: 164 ntohl(pkt->ack.firstPacket),
187 trace_rxrpc_tx_ack(call, serial, 165 ntohl(pkt->ack.serial),
188 ntohl(pkt->ack.firstPacket), 166 pkt->ack.reason, pkt->ack.nAcks);
189 ntohl(pkt->ack.serial),
190 pkt->ack.reason, pkt->ack.nAcks);
191 break;
192 }
193 167
194 if (ping) { 168 if (ping) {
195 call->ackr_ping = serial; 169 call->ping_serial = serial;
196 smp_wmb(); 170 smp_wmb();
197 /* We need to stick a time in before we send the packet in case 171 /* We need to stick a time in before we send the packet in case
198 * the reply gets back before kernel_sendmsg() completes - but 172 * the reply gets back before kernel_sendmsg() completes - but
@@ -201,19 +175,19 @@ int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type)
201 * the packet transmission is more likely to happen towards the 175 * the packet transmission is more likely to happen towards the
202 * end of the kernel_sendmsg() call. 176 * end of the kernel_sendmsg() call.
203 */ 177 */
204 call->ackr_ping_time = ktime_get_real(); 178 call->ping_time = ktime_get_real();
205 set_bit(RXRPC_CALL_PINGING, &call->flags); 179 set_bit(RXRPC_CALL_PINGING, &call->flags);
206 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial); 180 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial);
207 } 181 }
208 ret = kernel_sendmsg(conn->params.local->socket, 182
209 &msg, iov, ioc, len); 183 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
210 if (ping) 184 if (ping)
211 call->ackr_ping_time = ktime_get_real(); 185 call->ping_time = ktime_get_real();
212 186
213 if (type == RXRPC_PACKET_TYPE_ACK && 187 if (call->state < RXRPC_CALL_COMPLETE) {
214 call->state < RXRPC_CALL_COMPLETE) {
215 if (ret < 0) { 188 if (ret < 0) {
216 clear_bit(RXRPC_CALL_PINGING, &call->flags); 189 if (ping)
190 clear_bit(RXRPC_CALL_PINGING, &call->flags);
217 rxrpc_propose_ACK(call, pkt->ack.reason, 191 rxrpc_propose_ACK(call, pkt->ack.reason,
218 ntohs(pkt->ack.maxSkew), 192 ntohs(pkt->ack.maxSkew),
219 ntohl(pkt->ack.serial), 193 ntohl(pkt->ack.serial),
@@ -236,6 +210,56 @@ out:
236} 210}
237 211
238/* 212/*
213 * Send an ABORT call packet.
214 */
215int rxrpc_send_abort_packet(struct rxrpc_call *call)
216{
217 struct rxrpc_connection *conn = NULL;
218 struct rxrpc_abort_buffer pkt;
219 struct msghdr msg;
220 struct kvec iov[1];
221 rxrpc_serial_t serial;
222 int ret;
223
224 spin_lock_bh(&call->lock);
225 if (call->conn)
226 conn = rxrpc_get_connection_maybe(call->conn);
227 spin_unlock_bh(&call->lock);
228 if (!conn)
229 return -ECONNRESET;
230
231 msg.msg_name = &call->peer->srx.transport;
232 msg.msg_namelen = call->peer->srx.transport_len;
233 msg.msg_control = NULL;
234 msg.msg_controllen = 0;
235 msg.msg_flags = 0;
236
237 pkt.whdr.epoch = htonl(conn->proto.epoch);
238 pkt.whdr.cid = htonl(call->cid);
239 pkt.whdr.callNumber = htonl(call->call_id);
240 pkt.whdr.seq = 0;
241 pkt.whdr.type = RXRPC_PACKET_TYPE_ABORT;
242 pkt.whdr.flags = conn->out_clientflag;
243 pkt.whdr.userStatus = 0;
244 pkt.whdr.securityIndex = call->security_ix;
245 pkt.whdr._rsvd = 0;
246 pkt.whdr.serviceId = htons(call->service_id);
247 pkt.abort_code = htonl(call->abort_code);
248
249 iov[0].iov_base = &pkt;
250 iov[0].iov_len = sizeof(pkt);
251
252 serial = atomic_inc_return(&conn->serial);
253 pkt.whdr.serial = htonl(serial);
254
255 ret = kernel_sendmsg(conn->params.local->socket,
256 &msg, iov, 1, sizeof(pkt));
257
258 rxrpc_put_connection(conn);
259 return ret;
260}
261
262/*
239 * send a packet through the transport endpoint 263 * send a packet through the transport endpoint
240 */ 264 */
241int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, 265int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
@@ -283,11 +307,12 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
283 /* If our RTT cache needs working on, request an ACK. Also request 307 /* If our RTT cache needs working on, request an ACK. Also request
284 * ACKs if a DATA packet appears to have been lost. 308 * ACKs if a DATA packet appears to have been lost.
285 */ 309 */
286 if (retrans || 310 if (!(sp->hdr.flags & RXRPC_LAST_PACKET) &&
287 call->cong_mode == RXRPC_CALL_SLOW_START || 311 (retrans ||
288 (call->peer->rtt_usage < 3 && sp->hdr.seq & 1) || 312 call->cong_mode == RXRPC_CALL_SLOW_START ||
289 ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), 313 (call->peer->rtt_usage < 3 && sp->hdr.seq & 1) ||
290 ktime_get_real())) 314 ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000),
315 ktime_get_real())))
291 whdr.flags |= RXRPC_REQUEST_ACK; 316 whdr.flags |= RXRPC_REQUEST_ACK;
292 317
293 if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) { 318 if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) {
diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
index f05ea0a88076..c29362d50a92 100644
--- a/net/rxrpc/recvmsg.c
+++ b/net/rxrpc/recvmsg.c
@@ -143,7 +143,7 @@ static void rxrpc_end_rx_phase(struct rxrpc_call *call, rxrpc_serial_t serial)
143 if (call->state == RXRPC_CALL_CLIENT_RECV_REPLY) { 143 if (call->state == RXRPC_CALL_CLIENT_RECV_REPLY) {
144 rxrpc_propose_ACK(call, RXRPC_ACK_IDLE, 0, serial, true, false, 144 rxrpc_propose_ACK(call, RXRPC_ACK_IDLE, 0, serial, true, false,
145 rxrpc_propose_ack_terminal_ack); 145 rxrpc_propose_ack_terminal_ack);
146 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ACK); 146 rxrpc_send_ack_packet(call, false);
147 } 147 }
148 148
149 write_lock_bh(&call->state_lock); 149 write_lock_bh(&call->state_lock);
@@ -151,17 +151,21 @@ static void rxrpc_end_rx_phase(struct rxrpc_call *call, rxrpc_serial_t serial)
151 switch (call->state) { 151 switch (call->state) {
152 case RXRPC_CALL_CLIENT_RECV_REPLY: 152 case RXRPC_CALL_CLIENT_RECV_REPLY:
153 __rxrpc_call_completed(call); 153 __rxrpc_call_completed(call);
154 write_unlock_bh(&call->state_lock);
154 break; 155 break;
155 156
156 case RXRPC_CALL_SERVER_RECV_REQUEST: 157 case RXRPC_CALL_SERVER_RECV_REQUEST:
157 call->tx_phase = true; 158 call->tx_phase = true;
158 call->state = RXRPC_CALL_SERVER_ACK_REQUEST; 159 call->state = RXRPC_CALL_SERVER_ACK_REQUEST;
160 call->ack_at = call->expire_at;
161 write_unlock_bh(&call->state_lock);
162 rxrpc_propose_ACK(call, RXRPC_ACK_DELAY, 0, serial, false, true,
163 rxrpc_propose_ack_processing_op);
159 break; 164 break;
160 default: 165 default:
166 write_unlock_bh(&call->state_lock);
161 break; 167 break;
162 } 168 }
163
164 write_unlock_bh(&call->state_lock);
165} 169}
166 170
167/* 171/*
@@ -212,7 +216,7 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call)
212 true, false, 216 true, false,
213 rxrpc_propose_ack_rotate_rx); 217 rxrpc_propose_ack_rotate_rx);
214 if (call->ackr_reason) 218 if (call->ackr_reason)
215 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ACK); 219 rxrpc_send_ack_packet(call, false);
216 } 220 }
217} 221}
218 222
@@ -652,7 +656,7 @@ excess_data:
652 goto out; 656 goto out;
653call_complete: 657call_complete:
654 *_abort = call->abort_code; 658 *_abort = call->abort_code;
655 ret = call->error; 659 ret = -call->error;
656 if (call->completion == RXRPC_CALL_SUCCEEDED) { 660 if (call->completion == RXRPC_CALL_SUCCEEDED) {
657 ret = 1; 661 ret = 1;
658 if (size > 0) 662 if (size > 0)
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index 627abed5f999..4374e7b9c7bf 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -381,7 +381,7 @@ static int rxkad_verify_packet_1(struct rxrpc_call *call, struct sk_buff *skb,
381 return 0; 381 return 0;
382 382
383protocol_error: 383protocol_error:
384 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 384 rxrpc_send_abort_packet(call);
385 _leave(" = -EPROTO"); 385 _leave(" = -EPROTO");
386 return -EPROTO; 386 return -EPROTO;
387 387
@@ -471,7 +471,7 @@ static int rxkad_verify_packet_2(struct rxrpc_call *call, struct sk_buff *skb,
471 return 0; 471 return 0;
472 472
473protocol_error: 473protocol_error:
474 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 474 rxrpc_send_abort_packet(call);
475 _leave(" = -EPROTO"); 475 _leave(" = -EPROTO");
476 return -EPROTO; 476 return -EPROTO;
477 477
@@ -523,7 +523,7 @@ static int rxkad_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
523 523
524 if (cksum != expected_cksum) { 524 if (cksum != expected_cksum) {
525 rxrpc_abort_call("VCK", call, seq, RXKADSEALEDINCON, EPROTO); 525 rxrpc_abort_call("VCK", call, seq, RXKADSEALEDINCON, EPROTO);
526 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 526 rxrpc_send_abort_packet(call);
527 _leave(" = -EPROTO [csum failed]"); 527 _leave(" = -EPROTO [csum failed]");
528 return -EPROTO; 528 return -EPROTO;
529 } 529 }
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 3322543d460a..b214a4d4a641 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -130,6 +130,11 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,
130 break; 130 break;
131 case RXRPC_CALL_SERVER_ACK_REQUEST: 131 case RXRPC_CALL_SERVER_ACK_REQUEST:
132 call->state = RXRPC_CALL_SERVER_SEND_REPLY; 132 call->state = RXRPC_CALL_SERVER_SEND_REPLY;
133 call->ack_at = call->expire_at;
134 if (call->ackr_reason == RXRPC_ACK_DELAY)
135 call->ackr_reason = 0;
136 __rxrpc_set_timer(call, rxrpc_timer_init_for_send_reply,
137 ktime_get_real());
133 if (!last) 138 if (!last)
134 break; 139 break;
135 case RXRPC_CALL_SERVER_SEND_REPLY: 140 case RXRPC_CALL_SERVER_SEND_REPLY:
@@ -197,7 +202,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
197 do { 202 do {
198 /* Check to see if there's a ping ACK to reply to. */ 203 /* Check to see if there's a ping ACK to reply to. */
199 if (call->ackr_reason == RXRPC_ACK_PING_RESPONSE) 204 if (call->ackr_reason == RXRPC_ACK_PING_RESPONSE)
200 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ACK); 205 rxrpc_send_ack_packet(call, false);
201 206
202 if (!skb) { 207 if (!skb) {
203 size_t size, chunk, max, space; 208 size_t size, chunk, max, space;
@@ -514,8 +519,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
514 } else if (cmd == RXRPC_CMD_SEND_ABORT) { 519 } else if (cmd == RXRPC_CMD_SEND_ABORT) {
515 ret = 0; 520 ret = 0;
516 if (rxrpc_abort_call("CMD", call, 0, abort_code, ECONNABORTED)) 521 if (rxrpc_abort_call("CMD", call, 0, abort_code, ECONNABORTED))
517 ret = rxrpc_send_call_packet(call, 522 ret = rxrpc_send_abort_packet(call);
518 RXRPC_PACKET_TYPE_ABORT);
519 } else if (cmd != RXRPC_CMD_SEND_DATA) { 523 } else if (cmd != RXRPC_CMD_SEND_DATA) {
520 ret = -EINVAL; 524 ret = -EINVAL;
521 } else if (rxrpc_is_client_call(call) && 525 } else if (rxrpc_is_client_call(call) &&
@@ -597,7 +601,7 @@ void rxrpc_kernel_abort_call(struct socket *sock, struct rxrpc_call *call,
597 lock_sock(sock->sk); 601 lock_sock(sock->sk);
598 602
599 if (rxrpc_abort_call(why, call, 0, abort_code, error)) 603 if (rxrpc_abort_call(why, call, 0, abort_code, error))
600 rxrpc_send_call_packet(call, RXRPC_PACKET_TYPE_ABORT); 604 rxrpc_send_abort_packet(call);
601 605
602 release_sock(sock->sk); 606 release_sock(sock->sk);
603 _leave(""); 607 _leave("");