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
Kirill Smelkov
linux
Commits
89865dbb
Commit
89865dbb
authored
Mar 07, 2003
by
James Morris
Committed by
David S. Miller
Mar 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TCP]: Commonize duplicated code into a new function, tcp_bucket_destroy.
parent
a163900d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
include/net/tcp.h
include/net/tcp.h
+1
-0
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_ipv4.c
+12
-6
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_minisocks.c
+1
-6
No files found.
include/net/tcp.h
View file @
89865dbb
...
@@ -144,6 +144,7 @@ extern kmem_cache_t *tcp_sk_cachep;
...
@@ -144,6 +144,7 @@ extern kmem_cache_t *tcp_sk_cachep;
extern
kmem_cache_t
*
tcp_bucket_cachep
;
extern
kmem_cache_t
*
tcp_bucket_cachep
;
extern
struct
tcp_bind_bucket
*
tcp_bucket_create
(
struct
tcp_bind_hashbucket
*
head
,
extern
struct
tcp_bind_bucket
*
tcp_bucket_create
(
struct
tcp_bind_hashbucket
*
head
,
unsigned
short
snum
);
unsigned
short
snum
);
extern
void
tcp_bucket_destroy
(
struct
tcp_bind_bucket
*
tb
);
extern
void
tcp_bucket_unlock
(
struct
sock
*
sk
);
extern
void
tcp_bucket_unlock
(
struct
sock
*
sk
);
extern
int
tcp_port_rover
;
extern
int
tcp_port_rover
;
extern
struct
sock
*
tcp_v4_lookup_listener
(
u32
addr
,
unsigned
short
hnum
,
int
dif
);
extern
struct
sock
*
tcp_v4_lookup_listener
(
u32
addr
,
unsigned
short
hnum
,
int
dif
);
...
...
net/ipv4/tcp_ipv4.c
View file @
89865dbb
...
@@ -142,6 +142,17 @@ struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head,
...
@@ -142,6 +142,17 @@ struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head,
return
tb
;
return
tb
;
}
}
/* Caller must hold hashbucket lock for this tb with local BH disabled */
void
tcp_bucket_destroy
(
struct
tcp_bind_bucket
*
tb
)
{
if
(
!
tb
->
owners
)
{
if
(
tb
->
next
)
tb
->
next
->
pprev
=
tb
->
pprev
;
*
(
tb
->
pprev
)
=
tb
->
next
;
kmem_cache_free
(
tcp_bucket_cachep
,
tb
);
}
}
/* Caller must disable local BH processing. */
/* Caller must disable local BH processing. */
static
__inline__
void
__tcp_inherit_port
(
struct
sock
*
sk
,
struct
sock
*
child
)
static
__inline__
void
__tcp_inherit_port
(
struct
sock
*
sk
,
struct
sock
*
child
)
{
{
...
@@ -300,12 +311,7 @@ static void __tcp_put_port(struct sock *sk)
...
@@ -300,12 +311,7 @@ static void __tcp_put_port(struct sock *sk)
*
(
sk
->
bind_pprev
)
=
sk
->
bind_next
;
*
(
sk
->
bind_pprev
)
=
sk
->
bind_next
;
sk
->
prev
=
NULL
;
sk
->
prev
=
NULL
;
inet
->
num
=
0
;
inet
->
num
=
0
;
if
(
!
tb
->
owners
)
{
tcp_bucket_destroy
(
tb
);
if
(
tb
->
next
)
tb
->
next
->
pprev
=
tb
->
pprev
;
*
(
tb
->
pprev
)
=
tb
->
next
;
kmem_cache_free
(
tcp_bucket_cachep
,
tb
);
}
spin_unlock
(
&
head
->
lock
);
spin_unlock
(
&
head
->
lock
);
}
}
...
...
net/ipv4/tcp_minisocks.c
View file @
89865dbb
...
@@ -81,12 +81,7 @@ void tcp_timewait_kill(struct tcp_tw_bucket *tw)
...
@@ -81,12 +81,7 @@ void tcp_timewait_kill(struct tcp_tw_bucket *tw)
tw
->
bind_next
->
bind_pprev
=
tw
->
bind_pprev
;
tw
->
bind_next
->
bind_pprev
=
tw
->
bind_pprev
;
*
(
tw
->
bind_pprev
)
=
tw
->
bind_next
;
*
(
tw
->
bind_pprev
)
=
tw
->
bind_next
;
tw
->
tb
=
NULL
;
tw
->
tb
=
NULL
;
if
(
tb
->
owners
==
NULL
)
{
tcp_bucket_destroy
(
tb
);
if
(
tb
->
next
)
tb
->
next
->
pprev
=
tb
->
pprev
;
*
(
tb
->
pprev
)
=
tb
->
next
;
kmem_cache_free
(
tcp_bucket_cachep
,
tb
);
}
spin_unlock
(
&
bhead
->
lock
);
spin_unlock
(
&
bhead
->
lock
);
#ifdef INET_REFCNT_DEBUG
#ifdef INET_REFCNT_DEBUG
...
...
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