Skip to contentSkip to conversation

: Collect all scattered sysctl variables into sysctl.c

PATCH In review Gerrit Renker 2 participants 2 messages Oct 18, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 : Collect all scattered sysctl variables into sysctl.c

This is an update with regard to the latest netdev-2.6 tree, the main change is that the sysctl_dccp_sync_ratelimit is also moved into sysctl.c (the sysctl variables are now from 4 different files, previously 3).

Ian please check if you are still okay with the Signed-off.

--------------------> Patch v2 <------------------------------------- [DCCP]: Collect all scattered sysctl variables into sysctl.c

This
1. organizes the sysctl variables which are scattered over many DCCP source

    files into sysctl.c - so that they can easier be found;

2. wraps the compilation of the CONFIG_SYSCTL part into a conditional define
- if not enabled, then only the variables will be `compiled';
3. shortens the definitions of init/exit dummy functions in the header file.

Hence mainly a tidy-up action. Code was found to compile and work cleanly with various Kconfig configurations for SYSCTL.

---
 net/dccp/Makefile  |    5 ++---
 net/dccp/dccp.h    |   10 ++--------
 net/dccp/input.c   |    3 ---
 net/dccp/options.c |    7 -------
 net/dccp/proto.c   |    3 ---
 net/dccp/sysctl.c  |   23 ++++++++++++++++++++---
 net/dccp/timer.c   |    5 -----
 7 files changed, 24 insertions(+), 32 deletions(-)
net/dccp/proto.c +0 -3
@@ -52,9 +52,6 @@ struct inet_hashinfo __cacheline_aligned
 
 EXPORT_SYMBOL_GPL(dccp_hashinfo);
 
-/* the maximum queue length for tx in packets. 0 is no limit */
-int sysctl_dccp_tx_qlen __read_mostly = 5;
-
 void dccp_set_state(struct sock *sk, const int state)
 {
 	const int oldstate = sk->sk_state;
net/dccp/input.c +0 -3
@@ -19,9 +19,6 @@
 #include "ccid.h"
 #include "dccp.h"
 
-/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
-int sysctl_dccp_sync_ratelimit	__read_mostly = HZ / 8;
-
 static void dccp_fin(struct sock *sk, struct sk_buff *skb)
 {
 	sk->sk_shutdown |= RCV_SHUTDOWN;
net/dccp/timer.c +0 -5
@@ -15,11 +15,6 @@
 
 #include "dccp.h"
 
-/* sysctl variables governing numbers of retransmission attempts */
-int  sysctl_dccp_request_retries	__read_mostly = TCP_SYN_RETRIES;
-int  sysctl_dccp_retries1		__read_mostly = TCP_RETR1;
-int  sysctl_dccp_retries2		__read_mostly = TCP_RETR2;
-
 static void dccp_write_err(struct sock *sk)
 {
 	sk->sk_err = sk->sk_err_soft ? : ETIMEDOUT;
net/dccp/options.c +0 -7
@@ -23,13 +23,6 @@
 #include "dccp.h"
 #include "feat.h"
 
-int sysctl_dccp_feat_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW;
-int sysctl_dccp_feat_rx_ccid	      = DCCPF_INITIAL_CCID;
-int sysctl_dccp_feat_tx_ccid	      = DCCPF_INITIAL_CCID;
-int sysctl_dccp_feat_ack_ratio	      = DCCPF_INITIAL_ACK_RATIO;
-int sysctl_dccp_feat_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR;
-int sysctl_dccp_feat_send_ndp_count  = DCCPF_INITIAL_SEND_NDP_COUNT;
-
 static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len)
 {
 	u32 value = 0;
net/dccp/sysctl.c +20 -3
@@ -14,10 +14,26 @@
 #include "dccp.h"
 #include "feat.h"
 
-#ifndef CONFIG_SYSCTL
-#error This file should not be compiled without CONFIG_SYSCTL defined
-#endif
+/* sysctls related to initialisation of option values */
+int sysctl_dccp_feat_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW;
+int sysctl_dccp_feat_rx_ccid	     = DCCPF_INITIAL_CCID;
+int sysctl_dccp_feat_tx_ccid	     = DCCPF_INITIAL_CCID;
+int sysctl_dccp_feat_ack_ratio	     = DCCPF_INITIAL_ACK_RATIO;
+int sysctl_dccp_feat_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR;
+int sysctl_dccp_feat_send_ndp_count  = DCCPF_INITIAL_SEND_NDP_COUNT;
+
+/* the maximum queue length for tx in packets. 0 is no limit */
+int sysctl_dccp_tx_qlen		__read_mostly = 5;
+
+/* sysctl variables governing numbers of retransmission attempts */
+int sysctl_dccp_request_retries	__read_mostly = TCP_SYN_RETRIES;
+int sysctl_dccp_retries1	__read_mostly = TCP_RETR1;
+int sysctl_dccp_retries2	__read_mostly = TCP_RETR2;
+
+/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
+int sysctl_dccp_sync_ratelimit	__read_mostly = HZ / 8;
 
+#ifdef CONFIG_SYSCTL
 static struct ctl_table dccp_default_table[] = {
 	{
 		.procname	= "seq_window",
@@ -146,3 +162,4 @@ void dccp_sysctl_exit(void)
 		dccp_table_header = NULL;
 	}
 }
+#endif
net/dccp/Makefile +2 -3
@@ -1,6 +1,7 @@
 obj-$(CONFIG_IP_DCCP) += dccp.o dccp_ipv4.o
 
-dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o
+dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o \
+	  sysctl.o
 
 dccp_ipv4-y := ipv4.o
 
@@ -13,8 +14,6 @@ dccp-$(CONFIG_IP_DCCP_ACKVEC) += ackvec.
 obj-$(CONFIG_INET_DCCP_DIAG) += dccp_diag.o
 obj-$(CONFIG_NET_DCCPPROBE) += dccp_probe.o
 
-dccp-$(CONFIG_SYSCTL) += sysctl.o
-
 dccp_diag-y := diag.o
 dccp_probe-y := probe.o
 
net/dccp/dccp.h +2 -8
@@ -430,14 +430,8 @@ extern int dccp_insert_option(struct soc
 extern int dccp_sysctl_init(void);
 extern void dccp_sysctl_exit(void);
 #else
-static inline int dccp_sysctl_init(void)
-{
-	return 0;
-}
-
-static inline void dccp_sysctl_exit(void)
-{
-}
+#define dccp_sysctl_init(void)	(0)
+#define dccp_sysctl_exit(void)
 #endif
 
 #endif /* _DCCP_H */
#1 lore raw
Quoted 5 lines · Gerrit Renker

This is an update with regard to the latest netdev-2.6 tree, the main change is that the sysctl_dccp_sync_ratelimit is also moved into sysctl.c (the sysctl variables are now from 4 different files, previously 3).

Ian please check if you are still okay with the Signed-off.

Yes I am.