Skip to content

Commit 72f0c6f

Browse files
committed
rxrpc: Allocate ACK records at proposal and queue for transmission
Allocate rxrpc_txbuf records for ACKs and put onto a queue for the transmitter thread to dispatch. Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: [email protected]
1 parent 02a1935 commit 72f0c6f

File tree

10 files changed

+285
-268
lines changed

10 files changed

+285
-268
lines changed

include/trace/events/rxrpc.h

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
EM(rxrpc_local_new, "NEW") \
3535
EM(rxrpc_local_processing, "PRO") \
3636
EM(rxrpc_local_put, "PUT") \
37-
E_(rxrpc_local_queued, "QUE")
37+
EM(rxrpc_local_queued, "QUE") \
38+
E_(rxrpc_local_tx_ack, "TAK")
3839

3940
#define rxrpc_peer_traces \
4041
EM(rxrpc_peer_got, "GOT") \
@@ -258,7 +259,9 @@
258259
EM(rxrpc_txbuf_free, "FREE ") \
259260
EM(rxrpc_txbuf_get_trans, "GET TRANS ") \
260261
EM(rxrpc_txbuf_get_retrans, "GET RETRANS") \
262+
EM(rxrpc_txbuf_put_ack_tx, "PUT ACK TX ") \
261263
EM(rxrpc_txbuf_put_cleaned, "PUT CLEANED") \
264+
EM(rxrpc_txbuf_put_nomem, "PUT NOMEM ") \
262265
EM(rxrpc_txbuf_put_rotated, "PUT ROTATED") \
263266
EM(rxrpc_txbuf_put_send_aborted, "PUT SEND-X ") \
264267
EM(rxrpc_txbuf_see_send_more, "SEE SEND+ ") \
@@ -1095,19 +1098,16 @@ TRACE_EVENT(rxrpc_rx_lose,
10951098

10961099
TRACE_EVENT(rxrpc_propose_ack,
10971100
TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
1098-
u8 ack_reason, rxrpc_serial_t serial, bool immediate,
1099-
bool background, enum rxrpc_propose_ack_outcome outcome),
1101+
u8 ack_reason, rxrpc_serial_t serial,
1102+
enum rxrpc_propose_ack_outcome outcome),
11001103

1101-
TP_ARGS(call, why, ack_reason, serial, immediate, background,
1102-
outcome),
1104+
TP_ARGS(call, why, ack_reason, serial, outcome),
11031105

11041106
TP_STRUCT__entry(
11051107
__field(unsigned int, call )
11061108
__field(enum rxrpc_propose_ack_trace, why )
11071109
__field(rxrpc_serial_t, serial )
11081110
__field(u8, ack_reason )
1109-
__field(bool, immediate )
1110-
__field(bool, background )
11111111
__field(enum rxrpc_propose_ack_outcome, outcome )
11121112
),
11131113

@@ -1116,21 +1116,44 @@ TRACE_EVENT(rxrpc_propose_ack,
11161116
__entry->why = why;
11171117
__entry->serial = serial;
11181118
__entry->ack_reason = ack_reason;
1119-
__entry->immediate = immediate;
1120-
__entry->background = background;
11211119
__entry->outcome = outcome;
11221120
),
11231121

1124-
TP_printk("c=%08x %s %s r=%08x i=%u b=%u%s",
1122+
TP_printk("c=%08x %s %s r=%08x%s",
11251123
__entry->call,
11261124
__print_symbolic(__entry->why, rxrpc_propose_ack_traces),
11271125
__print_symbolic(__entry->ack_reason, rxrpc_ack_names),
11281126
__entry->serial,
1129-
__entry->immediate,
1130-
__entry->background,
11311127
__print_symbolic(__entry->outcome, rxrpc_propose_ack_outcomes))
11321128
);
11331129

1130+
TRACE_EVENT(rxrpc_send_ack,
1131+
TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
1132+
u8 ack_reason, rxrpc_serial_t serial),
1133+
1134+
TP_ARGS(call, why, ack_reason, serial),
1135+
1136+
TP_STRUCT__entry(
1137+
__field(unsigned int, call )
1138+
__field(enum rxrpc_propose_ack_trace, why )
1139+
__field(rxrpc_serial_t, serial )
1140+
__field(u8, ack_reason )
1141+
),
1142+
1143+
TP_fast_assign(
1144+
__entry->call = call->debug_id;
1145+
__entry->why = why;
1146+
__entry->serial = serial;
1147+
__entry->ack_reason = ack_reason;
1148+
),
1149+
1150+
TP_printk("c=%08x %s %s r=%08x",
1151+
__entry->call,
1152+
__print_symbolic(__entry->why, rxrpc_propose_ack_traces),
1153+
__print_symbolic(__entry->ack_reason, rxrpc_ack_names),
1154+
__entry->serial)
1155+
);
1156+
11341157
TRACE_EVENT(rxrpc_retransmit,
11351158
TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation,
11361159
s64 expiry),

net/rxrpc/ar-internal.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ struct rxrpc_local {
292292
struct hlist_node link;
293293
struct socket *socket; /* my UDP socket */
294294
struct work_struct processor;
295+
struct list_head ack_tx_queue; /* List of ACKs that need sending */
296+
spinlock_t ack_tx_lock; /* ACK list lock */
295297
struct rxrpc_sock __rcu *service; /* Service(s) listening on this endpoint */
296298
struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */
297299
struct sk_buff_head reject_queue; /* packets awaiting rejection */
@@ -520,10 +522,8 @@ enum rxrpc_call_flag {
520522
* Events that can be raised on a call.
521523
*/
522524
enum rxrpc_call_event {
523-
RXRPC_CALL_EV_ACK, /* need to generate ACK */
524525
RXRPC_CALL_EV_ABORT, /* need to generate abort */
525526
RXRPC_CALL_EV_RESEND, /* Tx resend required */
526-
RXRPC_CALL_EV_PING, /* Ping send required */
527527
RXRPC_CALL_EV_EXPIRED, /* Expiry occurred */
528528
RXRPC_CALL_EV_ACK_LOST, /* ACK may be lost, send ping */
529529
};
@@ -782,13 +782,20 @@ struct rxrpc_txbuf {
782782
#define RXRPC_TXBUF_LAST 2 /* Set if last packet in Tx phase */
783783
#define RXRPC_TXBUF_RESENT 3 /* Set if has been resent */
784784
#define RXRPC_TXBUF_RETRANS 4 /* Set if should be retransmitted */
785+
u8 /*enum rxrpc_propose_ack_trace*/ ack_why; /* If ack, why */
785786
struct {
786787
/* The packet for encrypting and DMA'ing. We align it such
787788
* that data[] aligns correctly for any crypto blocksize.
788789
*/
789790
u8 pad[64 - sizeof(struct rxrpc_wire_header)];
790791
struct rxrpc_wire_header wire; /* Network-ready header */
791-
u8 data[RXRPC_JUMBO_DATALEN]; /* Data packet */
792+
union {
793+
u8 data[RXRPC_JUMBO_DATALEN]; /* Data packet */
794+
struct {
795+
struct rxrpc_ackpacket ack;
796+
u8 acks[0];
797+
};
798+
};
792799
} __aligned(64);
793800
};
794801

@@ -824,8 +831,10 @@ int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long);
824831
/*
825832
* call_event.c
826833
*/
827-
void rxrpc_propose_ACK(struct rxrpc_call *, u8, u32, bool, bool,
828-
enum rxrpc_propose_ack_trace);
834+
void rxrpc_propose_ping(struct rxrpc_call *call, u32 serial,
835+
enum rxrpc_propose_ack_trace why);
836+
void rxrpc_send_ACK(struct rxrpc_call *, u8, rxrpc_serial_t, enum rxrpc_propose_ack_trace);
837+
void rxrpc_propose_ACK(struct rxrpc_call *, u8, u32, enum rxrpc_propose_ack_trace);
829838
void rxrpc_process_call(struct work_struct *);
830839

831840
void rxrpc_reduce_call_timer(struct rxrpc_call *call,
@@ -1030,7 +1039,7 @@ static inline struct rxrpc_net *rxrpc_net(struct net *net)
10301039
/*
10311040
* output.c
10321041
*/
1033-
int rxrpc_send_ack_packet(struct rxrpc_call *, bool, rxrpc_serial_t *);
1042+
void rxrpc_transmit_ack_packets(struct rxrpc_local *);
10341043
int rxrpc_send_abort_packet(struct rxrpc_call *);
10351044
int rxrpc_send_data_packet(struct rxrpc_call *, struct sk_buff *, bool);
10361045
void rxrpc_reject_packets(struct rxrpc_local *);

net/rxrpc/call_accept.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,8 @@ static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb)
248248

249249
if (call->peer->rtt_count < 3 ||
250250
ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now))
251-
rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
252-
true, true,
253-
rxrpc_propose_ack_ping_for_params);
251+
rxrpc_send_ACK(call, RXRPC_ACK_PING, sp->hdr.serial,
252+
rxrpc_propose_ack_ping_for_params);
254253
}
255254

256255
/*

0 commit comments

Comments
 (0)