Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
cc1ff32a
Commit
cc1ff32a
authored
Jun 21, 2003
by
Jon Grimm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP] Change sysctl settable timers to ms granularity (rmlayer@us.ibm.com)
parent
247d0d19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
28 deletions
+81
-28
include/net/sctp/sctp.h
include/net/sctp/sctp.h
+8
-2
net/sctp/sysctl.c
net/sctp/sysctl.c
+73
-26
No files found.
include/net/sctp/sctp.h
View file @
cc1ff32a
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
* Daisy Chang <daisyc@us.ibm.com>
* Daisy Chang <daisyc@us.ibm.com>
* Sridhar Samudrala <sri@us.ibm.com>
* Sridhar Samudrala <sri@us.ibm.com>
* Ardelle Fan <ardelle.fan@intel.com>
* Ardelle Fan <ardelle.fan@intel.com>
* Ryan Layer <rmlayer@us.ibm.com>
*
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
* be incorporated into the next SCTP release.
...
@@ -311,6 +312,11 @@ void sctp_sysctl_unregister(void);
...
@@ -311,6 +312,11 @@ void sctp_sysctl_unregister(void);
#else
#else
static
inline
void
sctp_sysctl_register
(
void
)
{
return
;
}
static
inline
void
sctp_sysctl_register
(
void
)
{
return
;
}
static
inline
void
sctp_sysctl_unregister
(
void
)
{
return
;
}
static
inline
void
sctp_sysctl_unregister
(
void
)
{
return
;
}
static
inline
int
sctp_sysctl_jiffies_ms
(
ctl_table
*
table
,
int
__user
*
name
,
int
nlen
,
void
__user
*
oldval
,
size_t
__user
*
oldlenp
,
void
__user
*
newval
,
size_t
newlen
,
void
**
context
)
{
return
-
ENOSYS
;
}
#endif
#endif
/* Size of Supported Address Parameter for 'x' address types. */
/* Size of Supported Address Parameter for 'x' address types. */
...
@@ -470,7 +476,7 @@ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
...
@@ -470,7 +476,7 @@ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
WORD_ROUND(ntohs(err->length));\
WORD_ROUND(ntohs(err->length));\
err = (sctp_errhdr_t *)((void *)err + \
err = (sctp_errhdr_t *)((void *)err + \
WORD_ROUND(ntohs(err->length))))
WORD_ROUND(ntohs(err->length))))
/* Round an int up to the next multiple of 4. */
/* Round an int up to the next multiple of 4. */
#define WORD_ROUND(s) (((s)+3)&~3)
#define WORD_ROUND(s) (((s)+3)&~3)
...
@@ -592,7 +598,7 @@ int static inline __sctp_style(const struct sock *sk, sctp_socket_type_t style)
...
@@ -592,7 +598,7 @@ int static inline __sctp_style(const struct sock *sk, sctp_socket_type_t style)
/* Is the association in this state? */
/* Is the association in this state? */
#define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))
#define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state))
int
static
inline
__sctp_state
(
const
struct
sctp_association
*
asoc
,
int
static
inline
__sctp_state
(
const
struct
sctp_association
*
asoc
,
sctp_state_t
state
)
sctp_state_t
state
)
{
{
return
asoc
->
state
==
state
;
return
asoc
->
state
==
state
;
...
...
net/sctp/sysctl.c
View file @
cc1ff32a
/* SCTP kernel reference Implementation
/* SCTP kernel reference Implementation
* Copyright (c) 2002 International Business Machines Corp.
* Copyright (c) 2002 International Business Machines Corp.
* Copyright (c) 2002 Intel Corp.
* Copyright (c) 2002 Intel Corp.
*
*
* This file is part of the SCTP kernel reference Implementation
* This file is part of the SCTP kernel reference Implementation
*
*
* Sysctl related interfaces for SCTP.
* Sysctl related interfaces for SCTP.
*
*
* The SCTP reference implementation is free software;
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* any later version.
*
*
* The SCTP reference implementation is distributed in the hope that it
* The SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Boston, MA 02111-1307, USA.
*
*
* Please send any bug reports or fixes you make to the
* Please send any bug reports or fixes you make to the
* email address(es):
* email address(es):
* lksctp developers <lksctp-developers@lists.sourceforge.net>
* lksctp developers <lksctp-developers@lists.sourceforge.net>
*
*
* Or submit a bug report through the following website:
* Or submit a bug report through the following website:
* http://www.sf.net/projects/lksctp
* http://www.sf.net/projects/lksctp
*
*
* Written or modified by:
* Written or modified by:
* Mingqin Liu <liuming@us.ibm.com>
* Mingqin Liu <liuming@us.ibm.com>
* Jon Grimm <jgrimm@us.ibm.com>
* Jon Grimm <jgrimm@us.ibm.com>
* Ardelle Fan <ardelle.fan@intel.com>
* Ardelle Fan <ardelle.fan@intel.com>
* Ryan Layer <rmlayer@us.ibm.com>
*
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
* be incorporated into the next SCTP release.
...
@@ -42,42 +43,54 @@
...
@@ -42,42 +43,54 @@
#include <net/sctp/structs.h>
#include <net/sctp/structs.h>
#include <linux/sysctl.h>
#include <linux/sysctl.h>
static
ctl_handler
sctp_sysctl_jiffies_ms
;
static
long
rto_timer_min
=
0
;
static
long
rto_timer_max
=
86400000
;
/* One day */
static
ctl_table
sctp_table
[]
=
{
static
ctl_table
sctp_table
[]
=
{
{
{
.
ctl_name
=
NET_SCTP_RTO_INITIAL
,
.
ctl_name
=
NET_SCTP_RTO_INITIAL
,
.
procname
=
"rto_initial"
,
.
procname
=
"rto_initial"
,
.
data
=
&
sctp_rto_initial
,
.
data
=
&
sctp_rto_initial
,
.
maxlen
=
sizeof
(
int
),
.
maxlen
=
sizeof
(
long
),
.
mode
=
0644
,
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
.
proc_handler
=
&
proc_doulongvec_ms_jiffies_minmax
,
.
strategy
=
&
sysctl_jiffies
.
strategy
=
&
sctp_sysctl_jiffies_ms
,
.
extra1
=
&
rto_timer_min
,
.
extra2
=
&
rto_timer_max
},
},
{
{
.
ctl_name
=
NET_SCTP_RTO_MIN
,
.
ctl_name
=
NET_SCTP_RTO_MIN
,
.
procname
=
"rto_min"
,
.
procname
=
"rto_min"
,
.
data
=
&
sctp_rto_min
,
.
data
=
&
sctp_rto_min
,
.
maxlen
=
sizeof
(
int
),
.
maxlen
=
sizeof
(
long
),
.
mode
=
0644
,
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
.
proc_handler
=
&
proc_doulongvec_ms_jiffies_minmax
,
.
strategy
=
&
sysctl_jiffies
.
strategy
=
&
sctp_sysctl_jiffies_ms
,
.
extra1
=
&
rto_timer_min
,
.
extra2
=
&
rto_timer_max
},
},
{
{
.
ctl_name
=
NET_SCTP_RTO_MAX
,
.
ctl_name
=
NET_SCTP_RTO_MAX
,
.
procname
=
"rto_max"
,
.
procname
=
"rto_max"
,
.
data
=
&
sctp_rto_max
,
.
data
=
&
sctp_rto_max
,
.
maxlen
=
sizeof
(
int
),
.
maxlen
=
sizeof
(
long
),
.
mode
=
0644
,
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
.
proc_handler
=
&
proc_doulongvec_ms_jiffies_minmax
,
.
strategy
=
&
sysctl_jiffies
.
strategy
=
&
sctp_sysctl_jiffies_ms
,
.
extra1
=
&
rto_timer_min
,
.
extra2
=
&
rto_timer_max
},
},
{
{
.
ctl_name
=
NET_SCTP_VALID_COOKIE_LIFE
,
.
ctl_name
=
NET_SCTP_VALID_COOKIE_LIFE
,
.
procname
=
"valid_cookie_life"
,
.
procname
=
"valid_cookie_life"
,
.
data
=
&
sctp_valid_cookie_life
,
.
data
=
&
sctp_valid_cookie_life
,
.
maxlen
=
sizeof
(
int
),
.
maxlen
=
sizeof
(
long
),
.
mode
=
0644
,
.
mode
=
0644
,
.
proc_handler
=
&
proc_dointvec_jiffies
,
.
proc_handler
=
&
proc_doulongvec_ms_jiffies_minmax
,
.
strategy
=
&
sysctl_jiffies
.
strategy
=
&
sctp_sysctl_jiffies_ms
,
.
extra1
=
&
rto_timer_min
,
.
extra2
=
&
rto_timer_max
},
},
{
{
.
ctl_name
=
NET_SCTP_MAX_BURST
,
.
ctl_name
=
NET_SCTP_MAX_BURST
,
...
@@ -183,3 +196,37 @@ void sctp_sysctl_unregister(void)
...
@@ -183,3 +196,37 @@ void sctp_sysctl_unregister(void)
{
{
unregister_sysctl_table
(
sctp_sysctl_header
);
unregister_sysctl_table
(
sctp_sysctl_header
);
}
}
/* Strategy function to convert jiffies to milliseconds. */
static
int
sctp_sysctl_jiffies_ms
(
ctl_table
*
table
,
int
__user
*
name
,
int
nlen
,
void
__user
*
oldval
,
size_t
__user
*
oldlenp
,
void
__user
*
newval
,
size_t
newlen
,
void
**
context
)
{
if
(
oldval
)
{
size_t
olen
;
if
(
oldlenp
)
{
if
(
get_user
(
olen
,
oldlenp
))
return
-
EFAULT
;
if
(
olen
!=
sizeof
(
int
))
return
-
EINVAL
;
}
if
(
put_user
((
*
(
int
*
)(
table
->
data
)
/
HZ
)
*
1000
,
(
int
*
)
oldval
)
||
(
oldlenp
&&
put_user
(
sizeof
(
int
),
oldlenp
)))
return
-
EFAULT
;
}
if
(
newval
&&
newlen
)
{
int
new
;
if
(
newlen
!=
sizeof
(
int
))
return
-
EINVAL
;
if
(
get_user
(
new
,
(
int
*
)
newval
))
return
-
EFAULT
;
*
(
int
*
)(
table
->
data
)
=
(
new
*
HZ
)
*
1000
;
}
return
1
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment