Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /* sysctls for configuring RxRPC operating parameters
0003  *
0004  * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
0005  * Written by David Howells (dhowells@redhat.com)
0006  */
0007 
0008 #include <linux/sysctl.h>
0009 #include <net/sock.h>
0010 #include <net/af_rxrpc.h>
0011 #include "ar-internal.h"
0012 
0013 static struct ctl_table_header *rxrpc_sysctl_reg_table;
0014 static const unsigned int four = 4;
0015 static const unsigned int max_backlog = RXRPC_BACKLOG_MAX - 1;
0016 static const unsigned int n_65535 = 65535;
0017 static const unsigned int n_max_acks = RXRPC_RXTX_BUFF_SIZE - 1;
0018 static const unsigned long one_jiffy = 1;
0019 static const unsigned long max_jiffies = MAX_JIFFY_OFFSET;
0020 
0021 /*
0022  * RxRPC operating parameters.
0023  *
0024  * See Documentation/networking/rxrpc.rst and the variable definitions for more
0025  * information on the individual parameters.
0026  */
0027 static struct ctl_table rxrpc_sysctl_table[] = {
0028     /* Values measured in milliseconds but used in jiffies */
0029     {
0030         .procname   = "req_ack_delay",
0031         .data       = &rxrpc_requested_ack_delay,
0032         .maxlen     = sizeof(unsigned long),
0033         .mode       = 0644,
0034         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0035         .extra1     = (void *)&one_jiffy,
0036         .extra2     = (void *)&max_jiffies,
0037     },
0038     {
0039         .procname   = "soft_ack_delay",
0040         .data       = &rxrpc_soft_ack_delay,
0041         .maxlen     = sizeof(unsigned long),
0042         .mode       = 0644,
0043         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0044         .extra1     = (void *)&one_jiffy,
0045         .extra2     = (void *)&max_jiffies,
0046     },
0047     {
0048         .procname   = "idle_ack_delay",
0049         .data       = &rxrpc_idle_ack_delay,
0050         .maxlen     = sizeof(unsigned long),
0051         .mode       = 0644,
0052         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0053         .extra1     = (void *)&one_jiffy,
0054         .extra2     = (void *)&max_jiffies,
0055     },
0056     {
0057         .procname   = "idle_conn_expiry",
0058         .data       = &rxrpc_conn_idle_client_expiry,
0059         .maxlen     = sizeof(unsigned long),
0060         .mode       = 0644,
0061         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0062         .extra1     = (void *)&one_jiffy,
0063         .extra2     = (void *)&max_jiffies,
0064     },
0065     {
0066         .procname   = "idle_conn_fast_expiry",
0067         .data       = &rxrpc_conn_idle_client_fast_expiry,
0068         .maxlen     = sizeof(unsigned long),
0069         .mode       = 0644,
0070         .proc_handler   = proc_doulongvec_ms_jiffies_minmax,
0071         .extra1     = (void *)&one_jiffy,
0072         .extra2     = (void *)&max_jiffies,
0073     },
0074 
0075     /* Non-time values */
0076     {
0077         .procname   = "reap_client_conns",
0078         .data       = &rxrpc_reap_client_connections,
0079         .maxlen     = sizeof(unsigned int),
0080         .mode       = 0644,
0081         .proc_handler   = proc_dointvec_minmax,
0082         .extra1     = (void *)SYSCTL_ONE,
0083         .extra2     = (void *)&n_65535,
0084     },
0085     {
0086         .procname   = "max_backlog",
0087         .data       = &rxrpc_max_backlog,
0088         .maxlen     = sizeof(unsigned int),
0089         .mode       = 0644,
0090         .proc_handler   = proc_dointvec_minmax,
0091         .extra1     = (void *)&four,
0092         .extra2     = (void *)&max_backlog,
0093     },
0094     {
0095         .procname   = "rx_window_size",
0096         .data       = &rxrpc_rx_window_size,
0097         .maxlen     = sizeof(unsigned int),
0098         .mode       = 0644,
0099         .proc_handler   = proc_dointvec_minmax,
0100         .extra1     = (void *)SYSCTL_ONE,
0101         .extra2     = (void *)&n_max_acks,
0102     },
0103     {
0104         .procname   = "rx_mtu",
0105         .data       = &rxrpc_rx_mtu,
0106         .maxlen     = sizeof(unsigned int),
0107         .mode       = 0644,
0108         .proc_handler   = proc_dointvec_minmax,
0109         .extra1     = (void *)SYSCTL_ONE,
0110         .extra2     = (void *)&n_65535,
0111     },
0112     {
0113         .procname   = "rx_jumbo_max",
0114         .data       = &rxrpc_rx_jumbo_max,
0115         .maxlen     = sizeof(unsigned int),
0116         .mode       = 0644,
0117         .proc_handler   = proc_dointvec_minmax,
0118         .extra1     = (void *)SYSCTL_ONE,
0119         .extra2     = (void *)&four,
0120     },
0121 
0122     { }
0123 };
0124 
0125 int __init rxrpc_sysctl_init(void)
0126 {
0127     rxrpc_sysctl_reg_table = register_net_sysctl(&init_net, "net/rxrpc",
0128                              rxrpc_sysctl_table);
0129     if (!rxrpc_sysctl_reg_table)
0130         return -ENOMEM;
0131     return 0;
0132 }
0133 
0134 void rxrpc_sysctl_exit(void)
0135 {
0136     if (rxrpc_sysctl_reg_table)
0137         unregister_net_sysctl_table(rxrpc_sysctl_reg_table);
0138 }