18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/* Miscellaneous bits
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
58c2ecf20Sopenharmony_ci * Written by David Howells (dhowells@redhat.com)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/kernel.h>
98c2ecf20Sopenharmony_ci#include <net/sock.h>
108c2ecf20Sopenharmony_ci#include <net/af_rxrpc.h>
118c2ecf20Sopenharmony_ci#include "ar-internal.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * The maximum listening backlog queue size that may be set on a socket by
158c2ecf20Sopenharmony_ci * listen().
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ciunsigned int rxrpc_max_backlog __read_mostly = 10;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * How long to wait before scheduling ACK generation after seeing a
218c2ecf20Sopenharmony_ci * packet with RXRPC_REQUEST_ACK set (in jiffies).
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ciunsigned long rxrpc_requested_ack_delay = 1;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * How long to wait before scheduling an ACK with subtype DELAY (in jiffies).
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * We use this when we've received new data packets.  If those packets aren't
298c2ecf20Sopenharmony_ci * all consumed within this time we will send a DELAY ACK if an ACK was not
308c2ecf20Sopenharmony_ci * requested to let the sender know it doesn't need to resend.
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ciunsigned long rxrpc_soft_ack_delay = HZ;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * How long to wait before scheduling an ACK with subtype IDLE (in jiffies).
368c2ecf20Sopenharmony_ci *
378c2ecf20Sopenharmony_ci * We use this when we've consumed some previously soft-ACK'd packets when
388c2ecf20Sopenharmony_ci * further packets aren't immediately received to decide when to send an IDLE
398c2ecf20Sopenharmony_ci * ACK let the other end know that it can free up its Tx buffer space.
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ciunsigned long rxrpc_idle_ack_delay = HZ / 2;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * Receive window size in packets.  This indicates the maximum number of
458c2ecf20Sopenharmony_ci * unconsumed received packets we're willing to retain in memory.  Once this
468c2ecf20Sopenharmony_ci * limit is hit, we should generate an EXCEEDS_WINDOW ACK and discard further
478c2ecf20Sopenharmony_ci * packets.
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_ciunsigned int rxrpc_rx_window_size = RXRPC_INIT_RX_WINDOW_SIZE;
508c2ecf20Sopenharmony_ci#if (RXRPC_RXTX_BUFF_SIZE - 1) < RXRPC_INIT_RX_WINDOW_SIZE
518c2ecf20Sopenharmony_ci#error Need to reduce RXRPC_INIT_RX_WINDOW_SIZE
528c2ecf20Sopenharmony_ci#endif
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*
558c2ecf20Sopenharmony_ci * Maximum Rx MTU size.  This indicates to the sender the size of jumbo packet
568c2ecf20Sopenharmony_ci * made by gluing normal packets together that we're willing to handle.
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ciunsigned int rxrpc_rx_mtu = 5692;
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/*
618c2ecf20Sopenharmony_ci * The maximum number of fragments in a received jumbo packet that we tell the
628c2ecf20Sopenharmony_ci * sender that we're willing to handle.
638c2ecf20Sopenharmony_ci */
648c2ecf20Sopenharmony_ciunsigned int rxrpc_rx_jumbo_max = 4;
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciconst s8 rxrpc_ack_priority[] = {
678c2ecf20Sopenharmony_ci	[0]				= 0,
688c2ecf20Sopenharmony_ci	[RXRPC_ACK_DELAY]		= 1,
698c2ecf20Sopenharmony_ci	[RXRPC_ACK_REQUESTED]		= 2,
708c2ecf20Sopenharmony_ci	[RXRPC_ACK_IDLE]		= 3,
718c2ecf20Sopenharmony_ci	[RXRPC_ACK_DUPLICATE]		= 4,
728c2ecf20Sopenharmony_ci	[RXRPC_ACK_OUT_OF_SEQUENCE]	= 5,
738c2ecf20Sopenharmony_ci	[RXRPC_ACK_EXCEEDS_WINDOW]	= 6,
748c2ecf20Sopenharmony_ci	[RXRPC_ACK_NOSPACE]		= 7,
758c2ecf20Sopenharmony_ci	[RXRPC_ACK_PING_RESPONSE]	= 8,
768c2ecf20Sopenharmony_ci};
77