3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
12 #include <linux/kernel.h>
14 #include <net/af_rxrpc.h>
15 #include "ar-internal.h"
18 * The maximum listening backlog queue size that may be set on a socket by
21 unsigned int rxrpc_max_backlog __read_mostly
= 10;
24 * How long to wait before scheduling ACK generation after seeing a
25 * packet with RXRPC_REQUEST_ACK set (in jiffies).
27 unsigned int rxrpc_requested_ack_delay
= 1;
30 * How long to wait before scheduling an ACK with subtype DELAY (in jiffies).
32 * We use this when we've received new data packets. If those packets aren't
33 * all consumed within this time we will send a DELAY ACK if an ACK was not
34 * requested to let the sender know it doesn't need to resend.
36 unsigned int rxrpc_soft_ack_delay
= 1 * HZ
;
39 * How long to wait before scheduling an ACK with subtype IDLE (in jiffies).
41 * We use this when we've consumed some previously soft-ACK'd packets when
42 * further packets aren't immediately received to decide when to send an IDLE
43 * ACK let the other end know that it can free up its Tx buffer space.
45 unsigned int rxrpc_idle_ack_delay
= 0.5 * HZ
;
48 * Receive window size in packets. This indicates the maximum number of
49 * unconsumed received packets we're willing to retain in memory. Once this
50 * limit is hit, we should generate an EXCEEDS_WINDOW ACK and discard further
53 unsigned int rxrpc_rx_window_size
= RXRPC_INIT_RX_WINDOW_SIZE
;
54 #if (RXRPC_RXTX_BUFF_SIZE - 1) < RXRPC_INIT_RX_WINDOW_SIZE
55 #error Need to reduce RXRPC_INIT_RX_WINDOW_SIZE
59 * Maximum Rx MTU size. This indicates to the sender the size of jumbo packet
60 * made by gluing normal packets together that we're willing to handle.
62 unsigned int rxrpc_rx_mtu
= 5692;
65 * The maximum number of fragments in a received jumbo packet that we tell the
66 * sender that we're willing to handle.
68 unsigned int rxrpc_rx_jumbo_max
= 4;
71 * Time till packet resend (in milliseconds).
73 unsigned int rxrpc_resend_timeout
= 4 * 1000;
75 const char *const rxrpc_pkts
[] = {
77 "DATA", "ACK", "BUSY", "ABORT", "ACKALL", "CHALL", "RESP", "DEBUG",
78 "?09", "?10", "?11", "?12", "VERSION", "?14", "?15"
81 const s8 rxrpc_ack_priority
[] = {
83 [RXRPC_ACK_DELAY
] = 1,
84 [RXRPC_ACK_REQUESTED
] = 2,
86 [RXRPC_ACK_DUPLICATE
] = 4,
87 [RXRPC_ACK_OUT_OF_SEQUENCE
] = 5,
88 [RXRPC_ACK_EXCEEDS_WINDOW
] = 6,
89 [RXRPC_ACK_NOSPACE
] = 7,
90 [RXRPC_ACK_PING_RESPONSE
] = 8,
94 const char const rxrpc_ack_names
[RXRPC_ACK__INVALID
+ 1][4] = {
95 "---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY",
99 const char rxrpc_skb_traces
[rxrpc_skb__nr_trace
][7] = {
100 [rxrpc_skb_rx_cleaned
] = "Rx CLN",
101 [rxrpc_skb_rx_freed
] = "Rx FRE",
102 [rxrpc_skb_rx_got
] = "Rx GOT",
103 [rxrpc_skb_rx_lost
] = "Rx *L*",
104 [rxrpc_skb_rx_received
] = "Rx RCV",
105 [rxrpc_skb_rx_purged
] = "Rx PUR",
106 [rxrpc_skb_rx_rotated
] = "Rx ROT",
107 [rxrpc_skb_rx_seen
] = "Rx SEE",
108 [rxrpc_skb_tx_cleaned
] = "Tx CLN",
109 [rxrpc_skb_tx_freed
] = "Tx FRE",
110 [rxrpc_skb_tx_got
] = "Tx GOT",
111 [rxrpc_skb_tx_lost
] = "Tx *L*",
112 [rxrpc_skb_tx_new
] = "Tx NEW",
113 [rxrpc_skb_tx_rotated
] = "Tx ROT",
114 [rxrpc_skb_tx_seen
] = "Tx SEE",
117 const char rxrpc_conn_traces
[rxrpc_conn__nr_trace
][4] = {
118 [rxrpc_conn_new_client
] = "NWc",
119 [rxrpc_conn_new_service
] = "NWs",
120 [rxrpc_conn_queued
] = "QUE",
121 [rxrpc_conn_seen
] = "SEE",
122 [rxrpc_conn_got
] = "GOT",
123 [rxrpc_conn_put_client
] = "PTc",
124 [rxrpc_conn_put_service
] = "PTs",
127 const char rxrpc_client_traces
[rxrpc_client__nr_trace
][7] = {
128 [rxrpc_client_activate_chans
] = "Activa",
129 [rxrpc_client_alloc
] = "Alloc ",
130 [rxrpc_client_chan_activate
] = "ChActv",
131 [rxrpc_client_chan_disconnect
] = "ChDisc",
132 [rxrpc_client_chan_pass
] = "ChPass",
133 [rxrpc_client_chan_unstarted
] = "ChUnst",
134 [rxrpc_client_cleanup
] = "Clean ",
135 [rxrpc_client_count
] = "Count ",
136 [rxrpc_client_discard
] = "Discar",
137 [rxrpc_client_duplicate
] = "Duplic",
138 [rxrpc_client_exposed
] = "Expose",
139 [rxrpc_client_replace
] = "Replac",
140 [rxrpc_client_to_active
] = "->Actv",
141 [rxrpc_client_to_culled
] = "->Cull",
142 [rxrpc_client_to_idle
] = "->Idle",
143 [rxrpc_client_to_inactive
] = "->Inac",
144 [rxrpc_client_to_waiting
] = "->Wait",
145 [rxrpc_client_uncount
] = "Uncoun",
148 const char rxrpc_transmit_traces
[rxrpc_transmit__nr_trace
][4] = {
149 [rxrpc_transmit_wait
] = "WAI",
150 [rxrpc_transmit_queue
] = "QUE",
151 [rxrpc_transmit_queue_last
] = "QLS",
152 [rxrpc_transmit_rotate
] = "ROT",
153 [rxrpc_transmit_rotate_last
] = "RLS",
154 [rxrpc_transmit_await_reply
] = "AWR",
155 [rxrpc_transmit_end
] = "END",
158 const char rxrpc_receive_traces
[rxrpc_receive__nr_trace
][4] = {
159 [rxrpc_receive_incoming
] = "INC",
160 [rxrpc_receive_queue
] = "QUE",
161 [rxrpc_receive_queue_last
] = "QLS",
162 [rxrpc_receive_front
] = "FRN",
163 [rxrpc_receive_rotate
] = "ROT",
164 [rxrpc_receive_end
] = "END",
167 const char rxrpc_recvmsg_traces
[rxrpc_recvmsg__nr_trace
][5] = {
168 [rxrpc_recvmsg_enter
] = "ENTR",
169 [rxrpc_recvmsg_wait
] = "WAIT",
170 [rxrpc_recvmsg_dequeue
] = "DEQU",
171 [rxrpc_recvmsg_hole
] = "HOLE",
172 [rxrpc_recvmsg_next
] = "NEXT",
173 [rxrpc_recvmsg_cont
] = "CONT",
174 [rxrpc_recvmsg_full
] = "FULL",
175 [rxrpc_recvmsg_data_return
] = "DATA",
176 [rxrpc_recvmsg_terminal
] = "TERM",
177 [rxrpc_recvmsg_to_be_accepted
] = "TBAC",
178 [rxrpc_recvmsg_return
] = "RETN",
181 const char rxrpc_rtt_tx_traces
[rxrpc_rtt_tx__nr_trace
][5] = {
182 [rxrpc_rtt_tx_ping
] = "PING",
183 [rxrpc_rtt_tx_data
] = "DATA",
186 const char rxrpc_rtt_rx_traces
[rxrpc_rtt_rx__nr_trace
][5] = {
187 [rxrpc_rtt_rx_ping_response
] = "PONG",
188 [rxrpc_rtt_rx_requested_ack
] = "RACK",
191 const char rxrpc_timer_traces
[rxrpc_timer__nr_trace
][8] = {
192 [rxrpc_timer_begin
] = "Begin ",
193 [rxrpc_timer_expired
] = "*EXPR*",
194 [rxrpc_timer_init_for_reply
] = "IniRpl",
195 [rxrpc_timer_set_for_ack
] = "SetAck",
196 [rxrpc_timer_set_for_send
] = "SetTx ",
197 [rxrpc_timer_set_for_resend
] = "SetRTx",
200 const char rxrpc_propose_ack_traces
[rxrpc_propose_ack__nr_trace
][8] = {
201 [rxrpc_propose_ack_client_tx_end
] = "ClTxEnd",
202 [rxrpc_propose_ack_input_data
] = "DataIn ",
203 [rxrpc_propose_ack_ping_for_lost_ack
] = "LostAck",
204 [rxrpc_propose_ack_ping_for_lost_reply
] = "LostRpl",
205 [rxrpc_propose_ack_ping_for_params
] = "Params ",
206 [rxrpc_propose_ack_respond_to_ack
] = "Rsp2Ack",
207 [rxrpc_propose_ack_respond_to_ping
] = "Rsp2Png",
208 [rxrpc_propose_ack_retry_tx
] = "RetryTx",
209 [rxrpc_propose_ack_rotate_rx
] = "RxAck ",
210 [rxrpc_propose_ack_terminal_ack
] = "ClTerm ",
213 const char *const rxrpc_propose_ack_outcomes
[rxrpc_propose_ack__nr_outcomes
] = {
214 [rxrpc_propose_ack_use
] = "",
215 [rxrpc_propose_ack_update
] = " Update",
216 [rxrpc_propose_ack_subsume
] = " Subsume",
219 const char rxrpc_congest_modes
[NR__RXRPC_CONGEST_MODES
][10] = {
220 [RXRPC_CALL_SLOW_START
] = "SlowStart",
221 [RXRPC_CALL_CONGEST_AVOIDANCE
] = "CongAvoid",
222 [RXRPC_CALL_PACKET_LOSS
] = "PktLoss ",
223 [RXRPC_CALL_FAST_RETRANSMIT
] = "FastReTx ",
226 const char rxrpc_congest_changes
[rxrpc_congest__nr_change
][9] = {
227 [rxrpc_cong_begin_retransmission
] = " Retrans",
228 [rxrpc_cong_cleared_nacks
] = " Cleared",
229 [rxrpc_cong_new_low_nack
] = " NewLowN",
230 [rxrpc_cong_no_change
] = "",
231 [rxrpc_cong_progress
] = " Progres",
232 [rxrpc_cong_retransmit_again
] = " ReTxAgn",
233 [rxrpc_cong_rtt_window_end
] = " RttWinE",
234 [rxrpc_cong_saw_nack
] = " SawNack",