/* Miscellaneous bits
 *
 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public Licence
 * as published by the Free Software Foundation; either version
 * 2 of the Licence, or (at your option) any later version.
 */

#include <linux/kernel.h>
#include <net/sock.h>
#include <net/af_rxrpc.h>
#include "ar-internal.h"

/*
 * The maximum listening backlog queue size that may be set on a socket by
 * listen().
 */
unsigned int rxrpc_max_backlog __read_mostly = 10;

/*
 * How long to wait before scheduling ACK generation after seeing a
 * packet with RXRPC_REQUEST_ACK set (in jiffies).
 */
unsigned int rxrpc_requested_ack_delay = 1;

/*
 * How long to wait before scheduling an ACK with subtype DELAY (in jiffies).
 *
 * We use this when we've received new data packets.  If those packets aren't
 * all consumed within this time we will send a DELAY ACK if an ACK was not
 * requested to let the sender know it doesn't need to resend.
 */
unsigned int rxrpc_soft_ack_delay = 1 * HZ;

/*
 * How long to wait before scheduling an ACK with subtype IDLE (in jiffies).
 *
 * We use this when we've consumed some previously soft-ACK'd packets when
 * further packets aren't immediately received to decide when to send an IDLE
 * ACK let the other end know that it can free up its Tx buffer space.
 */
unsigned int rxrpc_idle_ack_delay = 0.5 * HZ;

/*
 * Receive window size in packets.  This indicates the maximum number of
 * unconsumed received packets we're willing to retain in memory.  Once this
 * limit is hit, we should generate an EXCEEDS_WINDOW ACK and discard further
 * packets.
 */
unsigned int rxrpc_rx_window_size = RXRPC_INIT_RX_WINDOW_SIZE;
#if (RXRPC_RXTX_BUFF_SIZE - 1) < RXRPC_INIT_RX_WINDOW_SIZE
#error Need to reduce RXRPC_INIT_RX_WINDOW_SIZE
#endif

/*
 * Maximum Rx MTU size.  This indicates to the sender the size of jumbo packet
 * made by gluing normal packets together that we're willing to handle.
 */
unsigned int rxrpc_rx_mtu = 5692;

/*
 * The maximum number of fragments in a received jumbo packet that we tell the
 * sender that we're willing to handle.
 */
unsigned int rxrpc_rx_jumbo_max = 4;

/*
 * Time till packet resend (in milliseconds).
 */
unsigned int rxrpc_resend_timeout = 4 * 1000;

const char *const rxrpc_pkts[] = {
	"?00",
	"DATA", "ACK", "BUSY", "ABORT", "ACKALL", "CHALL", "RESP", "DEBUG",
	"?09", "?10", "?11", "?12", "VERSION", "?14", "?15"
};

const s8 rxrpc_ack_priority[] = {
	[0]				= 0,
	[RXRPC_ACK_DELAY]		= 1,
	[RXRPC_ACK_REQUESTED]		= 2,
	[RXRPC_ACK_IDLE]		= 3,
	[RXRPC_ACK_DUPLICATE]		= 4,
	[RXRPC_ACK_OUT_OF_SEQUENCE]	= 5,
	[RXRPC_ACK_EXCEEDS_WINDOW]	= 6,
	[RXRPC_ACK_NOSPACE]		= 7,
	[RXRPC_ACK_PING_RESPONSE]	= 8,
	[RXRPC_ACK_PING]		= 9,
};

const char const rxrpc_ack_names[RXRPC_ACK__INVALID + 1][4] = {
	"---", "REQ", "DUP", "OOS", "WIN", "MEM", "PNG", "PNR", "DLY",
	"IDL", "-?-"
};

const char rxrpc_skb_traces[rxrpc_skb__nr_trace][7] = {
	[rxrpc_skb_rx_cleaned]		= "Rx CLN",
	[rxrpc_skb_rx_freed]		= "Rx FRE",
	[rxrpc_skb_rx_got]		= "Rx GOT",
	[rxrpc_skb_rx_lost]		= "Rx *L*",
	[rxrpc_skb_rx_received]		= "Rx RCV",
	[rxrpc_skb_rx_purged]		= "Rx PUR",
	[rxrpc_skb_rx_rotated]		= "Rx ROT",
	[rxrpc_skb_rx_seen]		= "Rx SEE",
	[rxrpc_skb_tx_cleaned]		= "Tx CLN",
	[rxrpc_skb_tx_freed]		= "Tx FRE",
	[rxrpc_skb_tx_got]		= "Tx GOT",
	[rxrpc_skb_tx_new]		= "Tx NEW",
	[rxrpc_skb_tx_rotated]		= "Tx ROT",
	[rxrpc_skb_tx_seen]		= "Tx SEE",
};

const char rxrpc_conn_traces[rxrpc_conn__nr_trace][4] = {
	[rxrpc_conn_new_client]		= "NWc",
	[rxrpc_conn_new_service]	= "NWs",
	[rxrpc_conn_queued]		= "QUE",
	[rxrpc_conn_seen]		= "SEE",
	[rxrpc_conn_got]		= "GOT",
	[rxrpc_conn_put_client]		= "PTc",
	[rxrpc_conn_put_service]	= "PTs",
};

const char rxrpc_client_traces[rxrpc_client__nr_trace][7] = {
	[rxrpc_client_activate_chans]	= "Activa",
	[rxrpc_client_alloc]		= "Alloc ",
	[rxrpc_client_chan_activate]	= "ChActv",
	[rxrpc_client_chan_disconnect]	= "ChDisc",
	[rxrpc_client_chan_pass]	= "ChPass",
	[rxrpc_client_chan_unstarted]	= "ChUnst",
	[rxrpc_client_cleanup]		= "Clean ",
	[rxrpc_client_count]		= "Count ",
	[rxrpc_client_discard]		= "Discar",
	[rxrpc_client_duplicate]	= "Duplic",
	[rxrpc_client_exposed]		= "Expose",
	[rxrpc_client_replace]		= "Replac",
	[rxrpc_client_to_active]	= "->Actv",
	[rxrpc_client_to_culled]	= "->Cull",
	[rxrpc_client_to_idle]		= "->Idle",
	[rxrpc_client_to_inactive]	= "->Inac",
	[rxrpc_client_to_waiting]	= "->Wait",
	[rxrpc_client_uncount]		= "Uncoun",
};

const char rxrpc_transmit_traces[rxrpc_transmit__nr_trace][4] = {
	[rxrpc_transmit_wait]		= "WAI",
	[rxrpc_transmit_queue]		= "QUE",
	[rxrpc_transmit_queue_last]	= "QLS",
	[rxrpc_transmit_rotate]		= "ROT",
	[rxrpc_transmit_rotate_last]	= "RLS",
	[rxrpc_transmit_await_reply]	= "AWR",
	[rxrpc_transmit_end]		= "END",
};

const char rxrpc_receive_traces[rxrpc_receive__nr_trace][4] = {
	[rxrpc_receive_incoming]	= "INC",
	[rxrpc_receive_queue]		= "QUE",
	[rxrpc_receive_queue_last]	= "QLS",
	[rxrpc_receive_front]		= "FRN",
	[rxrpc_receive_rotate]		= "ROT",
	[rxrpc_receive_end]		= "END",
};

const char rxrpc_recvmsg_traces[rxrpc_recvmsg__nr_trace][5] = {
	[rxrpc_recvmsg_enter]		= "ENTR",
	[rxrpc_recvmsg_wait]		= "WAIT",
	[rxrpc_recvmsg_dequeue]		= "DEQU",
	[rxrpc_recvmsg_hole]		= "HOLE",
	[rxrpc_recvmsg_next]		= "NEXT",
	[rxrpc_recvmsg_cont]		= "CONT",
	[rxrpc_recvmsg_full]		= "FULL",
	[rxrpc_recvmsg_data_return]	= "DATA",
	[rxrpc_recvmsg_terminal]	= "TERM",
	[rxrpc_recvmsg_to_be_accepted]	= "TBAC",
	[rxrpc_recvmsg_return]		= "RETN",
};

const char rxrpc_rtt_tx_traces[rxrpc_rtt_tx__nr_trace][5] = {
	[rxrpc_rtt_tx_ping]		= "PING",
	[rxrpc_rtt_tx_data]		= "DATA",
};

const char rxrpc_rtt_rx_traces[rxrpc_rtt_rx__nr_trace][5] = {
	[rxrpc_rtt_rx_ping_response]	= "PONG",
	[rxrpc_rtt_rx_requested_ack]	= "RACK",
};

const char rxrpc_timer_traces[rxrpc_timer__nr_trace][8] = {
	[rxrpc_timer_begin]			= "Begin ",
	[rxrpc_timer_expired]			= "*EXPR*",
	[rxrpc_timer_init_for_reply]		= "IniRpl",
	[rxrpc_timer_set_for_ack]		= "SetAck",
	[rxrpc_timer_set_for_send]		= "SetTx ",
	[rxrpc_timer_set_for_resend]		= "SetRTx",
};

const char rxrpc_propose_ack_traces[rxrpc_propose_ack__nr_trace][8] = {
	[rxrpc_propose_ack_client_tx_end]	= "ClTxEnd",
	[rxrpc_propose_ack_input_data]		= "DataIn ",
	[rxrpc_propose_ack_ping_for_lost_ack]	= "LostAck",
	[rxrpc_propose_ack_ping_for_lost_reply]	= "LostRpl",
	[rxrpc_propose_ack_ping_for_params]	= "Params ",
	[rxrpc_propose_ack_respond_to_ack]	= "Rsp2Ack",
	[rxrpc_propose_ack_respond_to_ping]	= "Rsp2Png",
	[rxrpc_propose_ack_retry_tx]		= "RetryTx",
	[rxrpc_propose_ack_rotate_rx]		= "RxAck  ",
	[rxrpc_propose_ack_terminal_ack]	= "ClTerm ",
};

const char *const rxrpc_propose_ack_outcomes[rxrpc_propose_ack__nr_outcomes] = {
	[rxrpc_propose_ack_use]			= "",
	[rxrpc_propose_ack_update]		= " Update",
	[rxrpc_propose_ack_subsume]		= " Subsume",
};

const char rxrpc_congest_modes[NR__RXRPC_CONGEST_MODES][10] = {
	[RXRPC_CALL_SLOW_START]		= "SlowStart",
	[RXRPC_CALL_CONGEST_AVOIDANCE]	= "CongAvoid",
	[RXRPC_CALL_PACKET_LOSS]	= "PktLoss  ",
	[RXRPC_CALL_FAST_RETRANSMIT]	= "FastReTx ",
};

const char rxrpc_congest_changes[rxrpc_congest__nr_change][9] = {
	[rxrpc_cong_begin_retransmission]	= " Retrans",
	[rxrpc_cong_cleared_nacks]		= " Cleared",
	[rxrpc_cong_new_low_nack]		= " NewLowN",
	[rxrpc_cong_no_change]			= "",
	[rxrpc_cong_progress]			= " Progres",
	[rxrpc_cong_retransmit_again]		= " ReTxAgn",
	[rxrpc_cong_rtt_window_end]		= " RttWinE",
	[rxrpc_cong_saw_nack]			= " SawNack",
};
