Skip to content

Commit b034684

Browse files
committed
rxrpc: Transmit ACKs at the point of generation
For ACKs generated inside the I/O thread, transmit the ACK at the point of generation. Where the ACK is generated outside of the I/O thread, it's offloaded to the I/O thread to transmit it. Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: [email protected]
1 parent a2cf326 commit b034684

File tree

9 files changed

+5
-75
lines changed

9 files changed

+5
-75
lines changed

include/trace/events/rxrpc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
EM(rxrpc_local_put_peer, "PUT peer ") \
6464
EM(rxrpc_local_put_prealloc_conn, "PUT conn-pre") \
6565
EM(rxrpc_local_put_release_sock, "PUT rel-sock") \
66-
EM(rxrpc_local_see_tx_ack, "SEE tx-ack ") \
6766
EM(rxrpc_local_stop, "STOP ") \
6867
EM(rxrpc_local_stopped, "STOPPED ") \
6968
EM(rxrpc_local_unuse_bind, "UNU bind ") \
@@ -156,7 +155,6 @@
156155
EM(rxrpc_call_get_recvmsg, "GET recvmsg ") \
157156
EM(rxrpc_call_get_release_sock, "GET rel-sock") \
158157
EM(rxrpc_call_get_sendmsg, "GET sendmsg ") \
159-
EM(rxrpc_call_get_send_ack, "GET send-ack") \
160158
EM(rxrpc_call_get_userid, "GET user-id ") \
161159
EM(rxrpc_call_new_client, "NEW client ") \
162160
EM(rxrpc_call_new_prealloc_service, "NEW prealloc") \
@@ -168,7 +166,6 @@
168166
EM(rxrpc_call_put_recvmsg, "PUT recvmsg ") \
169167
EM(rxrpc_call_put_release_sock, "PUT rls-sock") \
170168
EM(rxrpc_call_put_release_sock_tba, "PUT rls-sk-a") \
171-
EM(rxrpc_call_put_send_ack, "PUT send-ack") \
172169
EM(rxrpc_call_put_sendmsg, "PUT sendmsg ") \
173170
EM(rxrpc_call_put_unnotify, "PUT unnotify") \
174171
EM(rxrpc_call_put_userid_exists, "PUT u-exists") \

net/rxrpc/ar-internal.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ struct rxrpc_local {
287287
struct hlist_node link;
288288
struct socket *socket; /* my UDP socket */
289289
struct task_struct *io_thread;
290-
struct list_head ack_tx_queue; /* List of ACKs that need sending */
291-
spinlock_t ack_tx_lock; /* ACK list lock */
292290
struct rxrpc_sock __rcu *service; /* Service(s) listening on this endpoint */
293291
struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */
294292
struct sk_buff_head rx_queue; /* Received packets */
@@ -762,7 +760,6 @@ struct rxrpc_txbuf {
762760
struct rcu_head rcu;
763761
struct list_head call_link; /* Link in call->tx_sendmsg/tx_buffer */
764762
struct list_head tx_link; /* Link in live Enc queue or Tx queue */
765-
struct rxrpc_call *call; /* Call to which belongs */
766763
ktime_t last_sent; /* Time at which last transmitted */
767764
refcount_t ref;
768765
rxrpc_seq_t seq; /* Sequence number of this packet */
@@ -1047,7 +1044,7 @@ static inline struct rxrpc_net *rxrpc_net(struct net *net)
10471044
/*
10481045
* output.c
10491046
*/
1050-
void rxrpc_transmit_ack_packets(struct rxrpc_local *);
1047+
int rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb);
10511048
int rxrpc_send_abort_packet(struct rxrpc_call *);
10521049
int rxrpc_send_data_packet(struct rxrpc_call *, struct rxrpc_txbuf *);
10531050
void rxrpc_reject_packet(struct rxrpc_local *local, struct sk_buff *skb);

net/rxrpc/call_event.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ void rxrpc_propose_delay_ACK(struct rxrpc_call *call, rxrpc_serial_t serial,
6969
void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason,
7070
rxrpc_serial_t serial, enum rxrpc_propose_ack_trace why)
7171
{
72-
struct rxrpc_local *local = call->conn->local;
7372
struct rxrpc_txbuf *txb;
7473

7574
if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
@@ -96,17 +95,9 @@ void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason,
9695
txb->ack.reason = ack_reason;
9796
txb->ack.nAcks = 0;
9897

99-
if (!rxrpc_try_get_call(call, rxrpc_call_get_send_ack)) {
100-
rxrpc_put_txbuf(txb, rxrpc_txbuf_put_nomem);
101-
return;
102-
}
103-
104-
spin_lock(&local->ack_tx_lock);
105-
list_add_tail(&txb->tx_link, &local->ack_tx_queue);
106-
spin_unlock(&local->ack_tx_lock);
10798
trace_rxrpc_send_ack(call, why, ack_reason, serial);
108-
109-
rxrpc_wake_up_io_thread(local);
99+
rxrpc_send_ack_packet(call, txb);
100+
rxrpc_put_txbuf(txb, rxrpc_txbuf_put_ack_tx);
110101
}
111102

112103
/*
@@ -294,10 +285,6 @@ static void rxrpc_decant_prepared_tx(struct rxrpc_call *call)
294285

295286
rxrpc_transmit_one(call, txb);
296287

297-
// TODO: Drain the transmission buffers. Do this somewhere better
298-
if (after(call->acks_hard_ack, call->tx_bottom + 16))
299-
rxrpc_shrink_call_tx_buffer(call);
300-
301288
if (!rxrpc_tx_window_has_space(call))
302289
break;
303290
}

net/rxrpc/io_thread.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,6 @@ int rxrpc_io_thread(void *data)
447447
continue;
448448
}
449449

450-
if (!list_empty(&local->ack_tx_queue)) {
451-
rxrpc_transmit_ack_packets(local);
452-
continue;
453-
}
454-
455450
/* Process received packets and errors. */
456451
if ((skb = __skb_dequeue(&rx_queue))) {
457452
switch (skb->mark) {

net/rxrpc/local_object.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet,
9696
atomic_set(&local->active_users, 1);
9797
local->rxnet = rxnet;
9898
INIT_HLIST_NODE(&local->link);
99-
INIT_LIST_HEAD(&local->ack_tx_queue);
100-
spin_lock_init(&local->ack_tx_lock);
10199
init_rwsem(&local->defrag_sem);
102100
skb_queue_head_init(&local->rx_queue);
103101
INIT_LIST_HEAD(&local->call_attend_q);

net/rxrpc/output.c

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,11 @@ static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call,
203203
}
204204

205205
/*
206-
* Send an ACK call packet.
206+
* Transmit an ACK packet.
207207
*/
208-
static int rxrpc_send_ack_packet(struct rxrpc_local *local, struct rxrpc_txbuf *txb)
208+
int rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb)
209209
{
210210
struct rxrpc_connection *conn;
211-
struct rxrpc_call *call = txb->call;
212211
struct msghdr msg;
213212
struct kvec iov[1];
214213
rxrpc_serial_t serial;
@@ -271,43 +270,6 @@ static int rxrpc_send_ack_packet(struct rxrpc_local *local, struct rxrpc_txbuf *
271270
return ret;
272271
}
273272

274-
/*
275-
* ACK transmitter for a local endpoint. The UDP socket locks around each
276-
* transmission, so we can only transmit one packet at a time, ACK, DATA or
277-
* otherwise.
278-
*/
279-
void rxrpc_transmit_ack_packets(struct rxrpc_local *local)
280-
{
281-
LIST_HEAD(queue);
282-
int ret;
283-
284-
rxrpc_see_local(local, rxrpc_local_see_tx_ack);
285-
286-
if (list_empty(&local->ack_tx_queue))
287-
return;
288-
289-
spin_lock(&local->ack_tx_lock);
290-
list_splice_tail_init(&local->ack_tx_queue, &queue);
291-
spin_unlock(&local->ack_tx_lock);
292-
293-
while (!list_empty(&queue)) {
294-
struct rxrpc_txbuf *txb =
295-
list_entry(queue.next, struct rxrpc_txbuf, tx_link);
296-
297-
ret = rxrpc_send_ack_packet(local, txb);
298-
if (ret < 0 && ret != -ECONNRESET) {
299-
spin_lock(&local->ack_tx_lock);
300-
list_splice_init(&queue, &local->ack_tx_queue);
301-
spin_unlock(&local->ack_tx_lock);
302-
break;
303-
}
304-
305-
list_del_init(&txb->tx_link);
306-
rxrpc_put_call(txb->call, rxrpc_call_put_send_ack);
307-
rxrpc_put_txbuf(txb, rxrpc_txbuf_put_ack_tx);
308-
}
309-
}
310-
311273
/*
312274
* Send an ABORT call packet.
313275
*/

net/rxrpc/recvmsg.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static int rxrpc_recvmsg_data(struct socket *sock, struct rxrpc_call *call,
320320
ret = ret2;
321321
goto out;
322322
}
323-
rxrpc_transmit_ack_packets(call->peer->local);
324323
} else {
325324
trace_rxrpc_recvdata(call, rxrpc_recvmsg_cont, seq,
326325
rx_pkt_offset, rx_pkt_len, 0);
@@ -502,7 +501,6 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
502501
if (ret == -EAGAIN)
503502
ret = 0;
504503

505-
rxrpc_transmit_ack_packets(call->peer->local);
506504
if (!skb_queue_empty(&call->recvmsg_queue))
507505
rxrpc_notify_socket(call);
508506
break;
@@ -632,7 +630,6 @@ int rxrpc_kernel_recv_data(struct socket *sock, struct rxrpc_call *call,
632630
read_phase_complete:
633631
ret = 1;
634632
out:
635-
rxrpc_transmit_ack_packets(call->peer->local);
636633
if (_service)
637634
*_service = call->dest_srx.srx_service;
638635
mutex_unlock(&call->user_mutex);

net/rxrpc/sendmsg.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
276276
rxrpc_see_txbuf(txb, rxrpc_txbuf_see_send_more);
277277

278278
do {
279-
rxrpc_transmit_ack_packets(call->peer->local);
280-
281279
if (!txb) {
282280
size_t remain, bufsize, chunk, offset;
283281

net/rxrpc/txbuf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ struct rxrpc_txbuf *rxrpc_alloc_txbuf(struct rxrpc_call *call, u8 packet_type,
2626
INIT_LIST_HEAD(&txb->call_link);
2727
INIT_LIST_HEAD(&txb->tx_link);
2828
refcount_set(&txb->ref, 1);
29-
txb->call = call;
3029
txb->call_debug_id = call->debug_id;
3130
txb->debug_id = atomic_inc_return(&rxrpc_txbuf_debug_ids);
3231
txb->space = sizeof(txb->data);

0 commit comments

Comments
 (0)