David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 1 | /* Miscellaneous bits |
| 2 | * |
| 3 | * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 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. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/kernel.h> |
| 13 | #include <net/sock.h> |
| 14 | #include <net/af_rxrpc.h> |
| 15 | #include "ar-internal.h" |
| 16 | |
| 17 | /* |
David Howells | 0e119b4 | 2016-06-10 22:30:37 +0100 | [diff] [blame] | 18 | * The maximum listening backlog queue size that may be set on a socket by |
| 19 | * listen(). |
| 20 | */ |
| 21 | unsigned int rxrpc_max_backlog __read_mostly = 10; |
| 22 | |
| 23 | /* |
David Howells | df0adc7 | 2016-09-26 22:12:49 +0100 | [diff] [blame] | 24 | * Maximum lifetime of a call (in mx). |
| 25 | */ |
| 26 | unsigned int rxrpc_max_call_lifetime = 60 * 1000; |
| 27 | |
| 28 | /* |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 29 | * How long to wait before scheduling ACK generation after seeing a |
David Howells | df0adc7 | 2016-09-26 22:12:49 +0100 | [diff] [blame] | 30 | * packet with RXRPC_REQUEST_ACK set (in ms). |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 31 | */ |
| 32 | unsigned int rxrpc_requested_ack_delay = 1; |
| 33 | |
| 34 | /* |
David Howells | df0adc7 | 2016-09-26 22:12:49 +0100 | [diff] [blame] | 35 | * How long to wait before scheduling an ACK with subtype DELAY (in ms). |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 36 | * |
| 37 | * We use this when we've received new data packets. If those packets aren't |
| 38 | * all consumed within this time we will send a DELAY ACK if an ACK was not |
| 39 | * requested to let the sender know it doesn't need to resend. |
| 40 | */ |
David Howells | df0adc7 | 2016-09-26 22:12:49 +0100 | [diff] [blame] | 41 | unsigned int rxrpc_soft_ack_delay = 1 * 1000; |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 42 | |
| 43 | /* |
David Howells | df0adc7 | 2016-09-26 22:12:49 +0100 | [diff] [blame] | 44 | * How long to wait before scheduling an ACK with subtype IDLE (in ms). |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 45 | * |
| 46 | * We use this when we've consumed some previously soft-ACK'd packets when |
| 47 | * further packets aren't immediately received to decide when to send an IDLE |
| 48 | * ACK let the other end know that it can free up its Tx buffer space. |
| 49 | */ |
David Howells | df0adc7 | 2016-09-26 22:12:49 +0100 | [diff] [blame] | 50 | unsigned int rxrpc_idle_ack_delay = 0.5 * 1000; |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 51 | |
| 52 | /* |
| 53 | * Receive window size in packets. This indicates the maximum number of |
| 54 | * unconsumed received packets we're willing to retain in memory. Once this |
| 55 | * limit is hit, we should generate an EXCEEDS_WINDOW ACK and discard further |
| 56 | * packets. |
| 57 | */ |
David Howells | 75e42126 | 2016-09-13 22:36:22 +0100 | [diff] [blame] | 58 | unsigned int rxrpc_rx_window_size = RXRPC_INIT_RX_WINDOW_SIZE; |
| 59 | #if (RXRPC_RXTX_BUFF_SIZE - 1) < RXRPC_INIT_RX_WINDOW_SIZE |
| 60 | #error Need to reduce RXRPC_INIT_RX_WINDOW_SIZE |
| 61 | #endif |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 62 | |
| 63 | /* |
| 64 | * Maximum Rx MTU size. This indicates to the sender the size of jumbo packet |
| 65 | * made by gluing normal packets together that we're willing to handle. |
| 66 | */ |
| 67 | unsigned int rxrpc_rx_mtu = 5692; |
| 68 | |
| 69 | /* |
| 70 | * The maximum number of fragments in a received jumbo packet that we tell the |
| 71 | * sender that we're willing to handle. |
| 72 | */ |
| 73 | unsigned int rxrpc_rx_jumbo_max = 4; |
| 74 | |
David Howells | 0b58b8a | 2016-09-02 22:39:45 +0100 | [diff] [blame] | 75 | /* |
David Howells | 50235c4 | 2016-09-22 00:29:31 +0100 | [diff] [blame] | 76 | * Time till packet resend (in milliseconds). |
David Howells | 0b58b8a | 2016-09-02 22:39:45 +0100 | [diff] [blame] | 77 | */ |
David Howells | 50235c4 | 2016-09-22 00:29:31 +0100 | [diff] [blame] | 78 | unsigned int rxrpc_resend_timeout = 4 * 1000; |
David Howells | 0b58b8a | 2016-09-02 22:39:45 +0100 | [diff] [blame] | 79 | |
David Howells | 5b3e87f | 2016-04-07 17:23:23 +0100 | [diff] [blame] | 80 | const char *const rxrpc_pkts[] = { |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 81 | "?00", |
| 82 | "DATA", "ACK", "BUSY", "ABORT", "ACKALL", "CHALL", "RESP", "DEBUG", |
| 83 | "?09", "?10", "?11", "?12", "VERSION", "?14", "?15" |
| 84 | }; |
| 85 | |
| 86 | const s8 rxrpc_ack_priority[] = { |
| 87 | [0] = 0, |
| 88 | [RXRPC_ACK_DELAY] = 1, |
| 89 | [RXRPC_ACK_REQUESTED] = 2, |
| 90 | [RXRPC_ACK_IDLE] = 3, |
David Howells | 8e83134 | 2016-09-22 00:29:31 +0100 | [diff] [blame] | 91 | [RXRPC_ACK_DUPLICATE] = 4, |
| 92 | [RXRPC_ACK_OUT_OF_SEQUENCE] = 5, |
| 93 | [RXRPC_ACK_EXCEEDS_WINDOW] = 6, |
| 94 | [RXRPC_ACK_NOSPACE] = 7, |
| 95 | [RXRPC_ACK_PING_RESPONSE] = 8, |
David Howells | 8e688d9 | 2016-04-07 17:23:16 +0100 | [diff] [blame] | 96 | }; |
| 97 | |
David Howells | 19c0dbd | 2016-10-06 08:11:48 +0100 | [diff] [blame] | 98 | const char rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4] = { |
David Howells | 9c7ad43 | 2016-09-23 13:50:40 +0100 | [diff] [blame] | 99 | "---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY", |
| 100 | "IDL", "-?-" |
| 101 | }; |
David Howells | 363deea | 2016-09-17 10:49:14 +0100 | [diff] [blame] | 102 | |
David Howells | 71f3ca4 | 2016-09-17 10:49:14 +0100 | [diff] [blame] | 103 | const char rxrpc_skb_traces[rxrpc_skb__nr_trace][7] = { |
| 104 | [rxrpc_skb_rx_cleaned] = "Rx CLN", |
| 105 | [rxrpc_skb_rx_freed] = "Rx FRE", |
| 106 | [rxrpc_skb_rx_got] = "Rx GOT", |
| 107 | [rxrpc_skb_rx_lost] = "Rx *L*", |
| 108 | [rxrpc_skb_rx_received] = "Rx RCV", |
| 109 | [rxrpc_skb_rx_purged] = "Rx PUR", |
| 110 | [rxrpc_skb_rx_rotated] = "Rx ROT", |
| 111 | [rxrpc_skb_rx_seen] = "Rx SEE", |
| 112 | [rxrpc_skb_tx_cleaned] = "Tx CLN", |
| 113 | [rxrpc_skb_tx_freed] = "Tx FRE", |
| 114 | [rxrpc_skb_tx_got] = "Tx GOT", |
David Howells | 71f3ca4 | 2016-09-17 10:49:14 +0100 | [diff] [blame] | 115 | [rxrpc_skb_tx_new] = "Tx NEW", |
| 116 | [rxrpc_skb_tx_rotated] = "Tx ROT", |
| 117 | [rxrpc_skb_tx_seen] = "Tx SEE", |
| 118 | }; |
| 119 | |
David Howells | 363deea | 2016-09-17 10:49:14 +0100 | [diff] [blame] | 120 | const char rxrpc_conn_traces[rxrpc_conn__nr_trace][4] = { |
| 121 | [rxrpc_conn_new_client] = "NWc", |
| 122 | [rxrpc_conn_new_service] = "NWs", |
| 123 | [rxrpc_conn_queued] = "QUE", |
| 124 | [rxrpc_conn_seen] = "SEE", |
| 125 | [rxrpc_conn_got] = "GOT", |
| 126 | [rxrpc_conn_put_client] = "PTc", |
| 127 | [rxrpc_conn_put_service] = "PTs", |
| 128 | }; |
| 129 | |
| 130 | const char rxrpc_client_traces[rxrpc_client__nr_trace][7] = { |
| 131 | [rxrpc_client_activate_chans] = "Activa", |
| 132 | [rxrpc_client_alloc] = "Alloc ", |
| 133 | [rxrpc_client_chan_activate] = "ChActv", |
| 134 | [rxrpc_client_chan_disconnect] = "ChDisc", |
| 135 | [rxrpc_client_chan_pass] = "ChPass", |
| 136 | [rxrpc_client_chan_unstarted] = "ChUnst", |
| 137 | [rxrpc_client_cleanup] = "Clean ", |
| 138 | [rxrpc_client_count] = "Count ", |
| 139 | [rxrpc_client_discard] = "Discar", |
| 140 | [rxrpc_client_duplicate] = "Duplic", |
| 141 | [rxrpc_client_exposed] = "Expose", |
| 142 | [rxrpc_client_replace] = "Replac", |
| 143 | [rxrpc_client_to_active] = "->Actv", |
| 144 | [rxrpc_client_to_culled] = "->Cull", |
| 145 | [rxrpc_client_to_idle] = "->Idle", |
| 146 | [rxrpc_client_to_inactive] = "->Inac", |
| 147 | [rxrpc_client_to_waiting] = "->Wait", |
| 148 | [rxrpc_client_uncount] = "Uncoun", |
| 149 | }; |
David Howells | a124fe3 | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 150 | |
| 151 | const char rxrpc_transmit_traces[rxrpc_transmit__nr_trace][4] = { |
| 152 | [rxrpc_transmit_wait] = "WAI", |
| 153 | [rxrpc_transmit_queue] = "QUE", |
David Howells | a124fe3 | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 154 | [rxrpc_transmit_queue_last] = "QLS", |
| 155 | [rxrpc_transmit_rotate] = "ROT", |
David Howells | 70790db | 2016-09-23 12:39:22 +0100 | [diff] [blame] | 156 | [rxrpc_transmit_rotate_last] = "RLS", |
| 157 | [rxrpc_transmit_await_reply] = "AWR", |
David Howells | a124fe3 | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 158 | [rxrpc_transmit_end] = "END", |
| 159 | }; |
David Howells | 58dc63c | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 160 | |
| 161 | const char rxrpc_receive_traces[rxrpc_receive__nr_trace][4] = { |
| 162 | [rxrpc_receive_incoming] = "INC", |
| 163 | [rxrpc_receive_queue] = "QUE", |
| 164 | [rxrpc_receive_queue_last] = "QLS", |
| 165 | [rxrpc_receive_front] = "FRN", |
| 166 | [rxrpc_receive_rotate] = "ROT", |
| 167 | [rxrpc_receive_end] = "END", |
| 168 | }; |
David Howells | 8499790 | 2016-09-17 11:13:31 +0100 | [diff] [blame] | 169 | |
| 170 | const char rxrpc_recvmsg_traces[rxrpc_recvmsg__nr_trace][5] = { |
| 171 | [rxrpc_recvmsg_enter] = "ENTR", |
| 172 | [rxrpc_recvmsg_wait] = "WAIT", |
| 173 | [rxrpc_recvmsg_dequeue] = "DEQU", |
| 174 | [rxrpc_recvmsg_hole] = "HOLE", |
| 175 | [rxrpc_recvmsg_next] = "NEXT", |
| 176 | [rxrpc_recvmsg_cont] = "CONT", |
| 177 | [rxrpc_recvmsg_full] = "FULL", |
| 178 | [rxrpc_recvmsg_data_return] = "DATA", |
| 179 | [rxrpc_recvmsg_terminal] = "TERM", |
| 180 | [rxrpc_recvmsg_to_be_accepted] = "TBAC", |
| 181 | [rxrpc_recvmsg_return] = "RETN", |
| 182 | }; |
David Howells | cf1a647 | 2016-09-22 00:41:53 +0100 | [diff] [blame] | 183 | |
| 184 | const char rxrpc_rtt_tx_traces[rxrpc_rtt_tx__nr_trace][5] = { |
| 185 | [rxrpc_rtt_tx_ping] = "PING", |
David Howells | 50235c4 | 2016-09-22 00:29:31 +0100 | [diff] [blame] | 186 | [rxrpc_rtt_tx_data] = "DATA", |
David Howells | cf1a647 | 2016-09-22 00:41:53 +0100 | [diff] [blame] | 187 | }; |
| 188 | |
| 189 | const char rxrpc_rtt_rx_traces[rxrpc_rtt_rx__nr_trace][5] = { |
| 190 | [rxrpc_rtt_rx_ping_response] = "PONG", |
David Howells | 50235c4 | 2016-09-22 00:29:31 +0100 | [diff] [blame] | 191 | [rxrpc_rtt_rx_requested_ack] = "RACK", |
David Howells | cf1a647 | 2016-09-22 00:41:53 +0100 | [diff] [blame] | 192 | }; |
David Howells | fc7ab6d | 2016-09-23 15:22:36 +0100 | [diff] [blame] | 193 | |
| 194 | const char rxrpc_timer_traces[rxrpc_timer__nr_trace][8] = { |
| 195 | [rxrpc_timer_begin] = "Begin ", |
| 196 | [rxrpc_timer_expired] = "*EXPR*", |
David Howells | dd7c1ee | 2016-09-24 18:05:27 +0100 | [diff] [blame] | 197 | [rxrpc_timer_init_for_reply] = "IniRpl", |
David Howells | 9749fd2 | 2016-10-06 08:11:50 +0100 | [diff] [blame] | 198 | [rxrpc_timer_init_for_send_reply] = "SndRpl", |
David Howells | fc7ab6d | 2016-09-23 15:22:36 +0100 | [diff] [blame] | 199 | [rxrpc_timer_set_for_ack] = "SetAck", |
David Howells | a5af7e1 | 2016-10-06 08:11:49 +0100 | [diff] [blame] | 200 | [rxrpc_timer_set_for_ping] = "SetPng", |
David Howells | fc7ab6d | 2016-09-23 15:22:36 +0100 | [diff] [blame] | 201 | [rxrpc_timer_set_for_send] = "SetTx ", |
| 202 | [rxrpc_timer_set_for_resend] = "SetRTx", |
| 203 | }; |
David Howells | 9c7ad43 | 2016-09-23 13:50:40 +0100 | [diff] [blame] | 204 | |
| 205 | const char rxrpc_propose_ack_traces[rxrpc_propose_ack__nr_trace][8] = { |
David Howells | 0d96796 | 2016-09-24 18:05:27 +0100 | [diff] [blame] | 206 | [rxrpc_propose_ack_client_tx_end] = "ClTxEnd", |
David Howells | 9c7ad43 | 2016-09-23 13:50:40 +0100 | [diff] [blame] | 207 | [rxrpc_propose_ack_input_data] = "DataIn ", |
David Howells | 5749434 | 2016-09-24 18:05:27 +0100 | [diff] [blame] | 208 | [rxrpc_propose_ack_ping_for_lost_ack] = "LostAck", |
David Howells | 0d96796 | 2016-09-24 18:05:27 +0100 | [diff] [blame] | 209 | [rxrpc_propose_ack_ping_for_lost_reply] = "LostRpl", |
David Howells | 9c7ad43 | 2016-09-23 13:50:40 +0100 | [diff] [blame] | 210 | [rxrpc_propose_ack_ping_for_params] = "Params ", |
David Howells | 9749fd2 | 2016-10-06 08:11:50 +0100 | [diff] [blame] | 211 | [rxrpc_propose_ack_processing_op] = "ProcOp ", |
David Howells | 9c7ad43 | 2016-09-23 13:50:40 +0100 | [diff] [blame] | 212 | [rxrpc_propose_ack_respond_to_ack] = "Rsp2Ack", |
| 213 | [rxrpc_propose_ack_respond_to_ping] = "Rsp2Png", |
| 214 | [rxrpc_propose_ack_retry_tx] = "RetryTx", |
David Howells | 805b21b | 2016-09-24 18:05:26 +0100 | [diff] [blame] | 215 | [rxrpc_propose_ack_rotate_rx] = "RxAck ", |
David Howells | 9c7ad43 | 2016-09-23 13:50:40 +0100 | [diff] [blame] | 216 | [rxrpc_propose_ack_terminal_ack] = "ClTerm ", |
| 217 | }; |
| 218 | |
| 219 | const char *const rxrpc_propose_ack_outcomes[rxrpc_propose_ack__nr_outcomes] = { |
| 220 | [rxrpc_propose_ack_use] = "", |
| 221 | [rxrpc_propose_ack_update] = " Update", |
| 222 | [rxrpc_propose_ack_subsume] = " Subsume", |
| 223 | }; |
David Howells | 5749434 | 2016-09-24 18:05:27 +0100 | [diff] [blame] | 224 | |
| 225 | const char rxrpc_congest_modes[NR__RXRPC_CONGEST_MODES][10] = { |
| 226 | [RXRPC_CALL_SLOW_START] = "SlowStart", |
| 227 | [RXRPC_CALL_CONGEST_AVOIDANCE] = "CongAvoid", |
| 228 | [RXRPC_CALL_PACKET_LOSS] = "PktLoss ", |
| 229 | [RXRPC_CALL_FAST_RETRANSMIT] = "FastReTx ", |
| 230 | }; |
| 231 | |
| 232 | const char rxrpc_congest_changes[rxrpc_congest__nr_change][9] = { |
| 233 | [rxrpc_cong_begin_retransmission] = " Retrans", |
| 234 | [rxrpc_cong_cleared_nacks] = " Cleared", |
| 235 | [rxrpc_cong_new_low_nack] = " NewLowN", |
| 236 | [rxrpc_cong_no_change] = "", |
| 237 | [rxrpc_cong_progress] = " Progres", |
| 238 | [rxrpc_cong_retransmit_again] = " ReTxAgn", |
| 239 | [rxrpc_cong_rtt_window_end] = " RttWinE", |
| 240 | [rxrpc_cong_saw_nack] = " SawNack", |
| 241 | }; |