Skip to contentSkip to conversation

: Initialisation and type-checking of feature sysctls

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

lore
Share & tools
lore
#0 lore raw

PATCH 13/14 : Initialisation and type-checking of feature sysctls

[DCCP]: Initialisation and type-checking of feature sysctls

The number of feature sysctls is now smaller (it is instead now possible to set values on a per-connection basis via sockops); this patch takes care of their initialisation and some rudimentary type-checking:

* Sequence Window uses the specified Wmin2, the maximum is ulong (4 bytes), I have tested and confirmed that it works up to 4294967295 - let's use it for Gbps;
* Ack Ratio is between 0 .. 0xFFFF (2-byte unsigned integer);
* CCIDs are between 0 .. 255 (FIXME: write handler for available ones);
* request_retries, retries1, retries2 also between 0..255 for good measure;
* tx_qlen is checked to be non-negative;
* sync_ratelimit remains as before.

The sysctls are initialised with the known default values for each feature at boot or module load time; for the type-checking the value constraints from RFC 4340 have been used. Type checking is important since some of the sysctls now directly act on the feature-negotiation process.

---
 include/linux/dccp.h |    7 -------
 net/dccp/dccp.h      |    4 ----
 net/dccp/feat.c      |   12 ++++++++++++
 net/dccp/feat.h      |   10 ++++++++++
 net/dccp/sysctl.c    |   44 ++++++++++++++++++++++++++++++++------------
 5 files changed, 54 insertions(+), 23 deletions(-)
net/dccp/dccp.h +0 -4
@@ -95,10 +95,6 @@ extern void dccp_time_wait(struct sock *
 extern int  sysctl_dccp_request_retries;
 extern int  sysctl_dccp_retries1;
 extern int  sysctl_dccp_retries2;
-extern int  sysctl_dccp_feat_sequence_window;
-extern int  sysctl_dccp_feat_rx_ccid;
-extern int  sysctl_dccp_feat_tx_ccid;
-extern int  sysctl_dccp_feat_ack_ratio;
 extern int  sysctl_dccp_tx_qlen;
 extern int  sysctl_dccp_sync_ratelimit;
 
include/linux/dccp.h +0 -7
@@ -368,13 +368,6 @@ static inline unsigned int dccp_hdr_len(
 }
 
 
-/* initial values for each feature */
-#define DCCPF_INITIAL_SEQUENCE_WINDOW		100
-#define DCCPF_INITIAL_ACK_RATIO			2
-#define DCCPF_INITIAL_CCID			DCCPC_CCID2
-/* FIXME: for now we're default to 1 but it should really be 0 */
-#define DCCPF_INITIAL_SEND_NDP_COUNT		1
-
 /**
   * struct dccp_minisock - Minimal DCCP connection representation
   *
net/dccp/feat.h +10 -0
@@ -88,6 +88,15 @@ struct ccid_dependency {
 	u8	val;
 };
 
+/*
+ *	Sysctls which determine global values for feature negotiation
+ */
+extern unsigned long sysctl_dccp_feat_sequence_window;
+extern int sysctl_dccp_feat_ack_ratio;
+extern int sysctl_dccp_feat_rx_ccid;
+extern int sysctl_dccp_feat_tx_ccid;
+extern int sysctl_dccp_feat_send_ndp_count;
+
 #ifdef CONFIG_IP_DCCP_DEBUG
 extern const char *dccp_feat_typename(const u8 type);
 extern const char *dccp_feat_name(const u8 feat);
@@ -102,6 +111,7 @@ static inline void dccp_feat_debug(const
 #endif /* CONFIG_IP_DCCP_DEBUG */
 
 extern int  dccp_feat_init(struct sock *sk);
+extern void dccp_feat_initialise_sysctls(void);
 extern int  dccp_feat_register_change(struct sock *sk, u8 feat,
 				      u8 is_local, u8 *val, u8 len);
 extern int  dccp_feat_parse_options(struct sock *, struct dccp_request_sock *,
net/dccp/feat.c +12 -0
@@ -1016,6 +1016,18 @@ int dccp_feat_parse_options(struct sock 
 	return 0;	/* ignore FN options in all other states */
 }
 
+/* initialise sysctls with default values from the table */
+void __init dccp_feat_initialise_sysctls(void)
+{
+#define DCCP_FEAT_SYSCTL_INIT(var, feat) \
+	sysctl_dccp_feat_ ##var = dccp_feat_default_value(DCCPF_ ##feat)
+
+	DCCP_FEAT_SYSCTL_INIT(sequence_window, SEQUENCE_WINDOW);
+	DCCP_FEAT_SYSCTL_INIT(rx_ccid, CCID);
+	DCCP_FEAT_SYSCTL_INIT(tx_ccid, CCID);
+	DCCP_FEAT_SYSCTL_INIT(ack_ratio, ACK_RATIO);
+}
+
 /**
  * dccp_feat_init  -  Seed feature negotiation with host-specific defaults
  * This initialises global defaults, depending on the value of the sysctls.
net/dccp/sysctl.c +32 -12

110 lines not on this page · raw message

Acked-by on v1 13/14
#1 lore raw
Quoted 14 lines · Gerrit Renker

[DCCP]: Initialisation and type-checking of feature sysctls

The number of feature sysctls is now smaller (it is instead now possible to set values on a per-connection basis via sockops); this patch takes care of their initialisation and some rudimentary type-checking:

* Sequence Window uses the specified Wmin2, the maximum is ulong (4 bytes), I have tested and confirmed that it works up to 4294967295 - let's use it for Gbps;
* Ack Ratio is between 0 .. 0xFFFF (2-byte unsigned integer);
* CCIDs are between 0 .. 255 (FIXME: write handler for available ones);
* request_retries, retries1, retries2 also between 0..255 for good measure;
* tx_qlen is checked to be non-negative;
* sync_ratelimit remains as before.

Quoted 6 lines

The sysctls are initialised with the known default values for each feature at boot or module load time; for the type-checking the value constraints from RFC 4340 have been used. Type checking is important since some of the sysctls now directly act on the feature-negotiation process.