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
a001d116
Commit
a001d116
authored
Jan 06, 2003
by
Ravikiran G. Thirumalai
Committed by
David S. Miller
Jan 06, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SCTP]: Convert mibstats to use kmalloc_percpu
parent
7f86066b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
include/net/sctp/sctp.h
include/net/sctp/sctp.h
+1
-1
net/sctp/protocol.c
net/sctp/protocol.c
+43
-1
No files found.
include/net/sctp/sctp.h
View file @
a001d116
...
...
@@ -203,7 +203,7 @@ extern void sctp_hash_digest(const char *secret, const int secret_len,
#define SCTP_SOCK_SLEEP_POST(sk) SOCK_SLEEP_POST(sk)
/* SCTP SNMP MIB stats handlers */
extern
struct
sctp_mib
sctp_statistics
[
NR_CPUS
*
2
]
;
DECLARE_SNMP_STAT
(
struct
sctp_mib
,
sctp_statistics
)
;
#define SCTP_INC_STATS(field) SNMP_INC_STATS(sctp_statistics, field)
#define SCTP_INC_STATS_BH(field) SNMP_INC_STATS_BH(sctp_statistics, field)
#define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field)
...
...
net/sctp/protocol.c
View file @
a001d116
...
...
@@ -60,7 +60,7 @@
/* Global data structures. */
sctp_protocol_t
sctp_proto
;
struct
proc_dir_entry
*
proc_net_sctp
;
struct
sctp_mib
sctp_statistics
[
NR_CPUS
*
2
]
;
DEFINE_SNMP_STAT
(
struct
sctp_mib
,
sctp_statistics
)
;
/* This is the global socket data structure used for responding to
* the Out-of-the-blue (OOTB) packets. A control sock will be created
...
...
@@ -653,6 +653,40 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family)
return
1
;
}
static
int
__init
init_sctp_mibs
(
void
)
{
int
i
;
sctp_statistics
[
0
]
=
kmalloc_percpu
(
sizeof
(
struct
sctp_mib
),
GFP_KERNEL
);
if
(
!
sctp_statistics
[
0
])
return
-
ENOMEM
;
sctp_statistics
[
1
]
=
kmalloc_percpu
(
sizeof
(
struct
sctp_mib
),
GFP_KERNEL
);
if
(
!
sctp_statistics
[
1
])
{
kfree_percpu
(
sctp_statistics
[
0
]);
return
-
ENOMEM
;
}
/* Zero all percpu versions of the mibs */
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
{
if
(
cpu_possible
(
i
))
{
memset
(
per_cpu_ptr
(
sctp_statistics
[
0
],
i
),
0
,
sizeof
(
struct
sctp_mib
));
memset
(
per_cpu_ptr
(
sctp_statistics
[
1
],
i
),
0
,
sizeof
(
struct
sctp_mib
));
}
}
return
0
;
}
static
void
cleanup_sctp_mibs
(
void
)
{
kfree_percpu
(
sctp_statistics
[
0
]);
kfree_percpu
(
sctp_statistics
[
1
]);
}
/* Initialize the universe into something sensible. */
int
sctp_init
(
void
)
{
...
...
@@ -666,6 +700,11 @@ int sctp_init(void)
/* Add SCTP to inetsw linked list. */
inet_register_protosw
(
&
sctp_protosw
);
/* Allocate and initialise sctp mibs. */
status
=
init_sctp_mibs
();
if
(
status
)
goto
err_init_mibs
;
/* Initialize proc fs directory. */
sctp_proc_init
();
...
...
@@ -805,6 +844,8 @@ int sctp_init(void)
err_ahash_alloc:
sctp_dbg_objcnt_exit
();
sctp_proc_exit
();
cleanup_sctp_mibs
();
err_init_mibs:
inet_del_protocol
(
&
sctp_protocol
,
IPPROTO_SCTP
);
inet_unregister_protosw
(
&
sctp_protosw
);
return
status
;
...
...
@@ -836,6 +877,7 @@ void sctp_exit(void)
sctp_dbg_objcnt_exit
();
sctp_proc_exit
();
cleanup_sctp_mibs
();
inet_del_protocol
(
&
sctp_protocol
,
IPPROTO_SCTP
);
inet_unregister_protosw
(
&
sctp_protosw
);
...
...
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