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
44551947
Commit
44551947
authored
Jun 20, 2004
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] move tcp_memory_free to sk_stream_memory_free
Signed-off-by:
Arnaldo Carvalho de Melo
<
acme@conectiva.com.br
>
parent
86adf644
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
include/net/sock.h
include/net/sock.h
+5
-0
net/ipv4/tcp.c
net/ipv4/tcp.c
+5
-10
No files found.
include/net/sock.h
View file @
44551947
...
...
@@ -429,6 +429,11 @@ static inline int sk_stream_wspace(struct sock *sk)
extern
void
sk_stream_write_space
(
struct
sock
*
sk
);
static
inline
int
sk_stream_memory_free
(
struct
sock
*
sk
)
{
return
sk
->
sk_wmem_queued
<
sk
->
sk_sndbuf
;
}
/* The per-socket spinlock must be held here. */
#define sk_add_backlog(__sk, __skb) \
do { if (!(__sk)->sk_backlog.tail) { \
...
...
net/ipv4/tcp.c
View file @
44551947
...
...
@@ -670,11 +670,6 @@ static int wait_for_tcp_connect(struct sock *sk, int flags, long *timeo_p)
return
0
;
}
static
inline
int
tcp_memory_free
(
struct
sock
*
sk
)
{
return
sk
->
sk_wmem_queued
<
sk
->
sk_sndbuf
;
}
/*
* Wait for more memory for a socket
*/
...
...
@@ -686,7 +681,7 @@ static int wait_for_tcp_memory(struct sock *sk, long *timeo)
long
current_timeo
=
*
timeo
;
DEFINE_WAIT
(
wait
);
if
(
tcp
_memory_free
(
sk
))
if
(
sk_stream
_memory_free
(
sk
))
current_timeo
=
vm_wait
=
(
net_random
()
%
(
HZ
/
5
))
+
2
;
for
(;;)
{
...
...
@@ -701,13 +696,13 @@ static int wait_for_tcp_memory(struct sock *sk, long *timeo)
if
(
signal_pending
(
current
))
goto
do_interrupted
;
clear_bit
(
SOCK_ASYNC_NOSPACE
,
&
sk
->
sk_socket
->
flags
);
if
(
tcp
_memory_free
(
sk
)
&&
!
vm_wait
)
if
(
sk_stream
_memory_free
(
sk
)
&&
!
vm_wait
)
break
;
set_bit
(
SOCK_NOSPACE
,
&
sk
->
sk_socket
->
flags
);
tp
->
write_pending
++
;
release_sock
(
sk
);
if
(
!
tcp
_memory_free
(
sk
)
||
vm_wait
)
if
(
!
sk_stream
_memory_free
(
sk
)
||
vm_wait
)
current_timeo
=
schedule_timeout
(
current_timeo
);
lock_sock
(
sk
);
tp
->
write_pending
--
;
...
...
@@ -838,7 +833,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
if
(
!
tp
->
send_head
||
(
copy
=
mss_now
-
skb
->
len
)
<=
0
)
{
new_segment:
if
(
!
tcp
_memory_free
(
sk
))
if
(
!
sk_stream
_memory_free
(
sk
))
goto
wait_for_sndbuf
;
skb
=
tcp_alloc_pskb
(
sk
,
0
,
tp
->
mss_cache
,
...
...
@@ -1005,7 +1000,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
/* Allocate new segment. If the interface is SG,
* allocate skb fitting to single page.
*/
if
(
!
tcp
_memory_free
(
sk
))
if
(
!
sk_stream
_memory_free
(
sk
))
goto
wait_for_sndbuf
;
skb
=
tcp_alloc_pskb
(
sk
,
select_size
(
sk
,
tp
),
...
...
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