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
0d072115
Commit
0d072115
authored
Jun 22, 2004
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] Move sndmsg_page and sndmsg_off to struct sock
Yeah, the poor cousins will use this as well :-)
parent
a09a8386
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
29 deletions
+34
-29
include/linux/ip.h
include/linux/ip.h
+0
-2
include/net/sock.h
include/net/sock.h
+5
-1
net/core/sock.c
net/core/sock.c
+11
-0
net/ipv4/ip_output.c
net/ipv4/ip_output.c
+8
-8
net/ipv4/tcp.c
net/ipv4/tcp.c
+2
-2
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_ipv4.c
+0
-4
net/ipv6/ip6_output.c
net/ipv6/ip6_output.c
+8
-8
net/ipv6/tcp_ipv6.c
net/ipv6/tcp_ipv6.c
+0
-4
No files found.
include/linux/ip.h
View file @
0d072115
...
@@ -129,8 +129,6 @@ struct inet_opt {
...
@@ -129,8 +129,6 @@ struct inet_opt {
int
mc_index
;
/* Multicast device index */
int
mc_index
;
/* Multicast device index */
__u32
mc_addr
;
__u32
mc_addr
;
struct
ip_mc_socklist
*
mc_list
;
/* Group array */
struct
ip_mc_socklist
*
mc_list
;
/* Group array */
struct
page
*
sndmsg_page
;
/* Cached page for sendmsg */
u32
sndmsg_off
;
/* Cached offset for sendmsg */
/*
/*
* Following members are used to retain the infomation to build
* Following members are used to retain the infomation to build
* an ip header on each ip fragmentation while the socket is corked.
* an ip header on each ip fragmentation while the socket is corked.
...
...
include/net/sock.h
View file @
0d072115
...
@@ -167,6 +167,8 @@ struct sock_common {
...
@@ -167,6 +167,8 @@ struct sock_common {
* @sk_socket - Identd and reporting IO signals
* @sk_socket - Identd and reporting IO signals
* @sk_user_data - RPC layer private data
* @sk_user_data - RPC layer private data
* @sk_owner - module that owns this socket
* @sk_owner - module that owns this socket
* @sk_sndmsg_page - cached page for sendmsg
* @sk_sndmsg_off - cached offset for sendmsg
* @sk_send_head - front of stuff to transmit
* @sk_send_head - front of stuff to transmit
* @sk_write_pending - a write to stream socket waits to start
* @sk_write_pending - a write to stream socket waits to start
* @sk_queue_shrunk - write queue has been shrunk recently
* @sk_queue_shrunk - write queue has been shrunk recently
...
@@ -249,8 +251,10 @@ struct sock {
...
@@ -249,8 +251,10 @@ struct sock {
struct
timeval
sk_stamp
;
struct
timeval
sk_stamp
;
struct
socket
*
sk_socket
;
struct
socket
*
sk_socket
;
void
*
sk_user_data
;
void
*
sk_user_data
;
struct
sk_buff
*
sk_send_head
;
struct
module
*
sk_owner
;
struct
module
*
sk_owner
;
struct
page
*
sk_sndmsg_page
;
__u32
sk_sndmsg_off
;
struct
sk_buff
*
sk_send_head
;
int
sk_write_pending
;
int
sk_write_pending
;
void
*
sk_security
;
void
*
sk_security
;
__u8
sk_queue_shrunk
;
__u8
sk_queue_shrunk
;
...
...
net/core/sock.c
View file @
0d072115
...
@@ -650,6 +650,14 @@ void sk_free(struct sock *sk)
...
@@ -650,6 +650,14 @@ void sk_free(struct sock *sk)
printk
(
KERN_DEBUG
"%s: optmem leakage (%d bytes) detected.
\n
"
,
printk
(
KERN_DEBUG
"%s: optmem leakage (%d bytes) detected.
\n
"
,
__FUNCTION__
,
atomic_read
(
&
sk
->
sk_omem_alloc
));
__FUNCTION__
,
atomic_read
(
&
sk
->
sk_omem_alloc
));
/*
* If sendmsg cached page exists, toss it.
*/
if
(
sk
->
sk_sndmsg_page
)
{
__free_page
(
sk
->
sk_sndmsg_page
);
sk
->
sk_sndmsg_page
=
NULL
;
}
security_sk_free
(
sk
);
security_sk_free
(
sk
);
kmem_cache_free
(
sk
->
sk_slab
,
sk
);
kmem_cache_free
(
sk
->
sk_slab
,
sk
);
module_put
(
owner
);
module_put
(
owner
);
...
@@ -1175,6 +1183,9 @@ void sock_init_data(struct socket *sock, struct sock *sk)
...
@@ -1175,6 +1183,9 @@ void sock_init_data(struct socket *sock, struct sock *sk)
sk
->
sk_error_report
=
sock_def_error_report
;
sk
->
sk_error_report
=
sock_def_error_report
;
sk
->
sk_destruct
=
sock_def_destruct
;
sk
->
sk_destruct
=
sock_def_destruct
;
sk
->
sk_sndmsg_page
=
NULL
;
sk
->
sk_sndmsg_off
=
0
;
sk
->
sk_peercred
.
pid
=
0
;
sk
->
sk_peercred
.
pid
=
0
;
sk
->
sk_peercred
.
uid
=
-
1
;
sk
->
sk_peercred
.
uid
=
-
1
;
sk
->
sk_peercred
.
gid
=
-
1
;
sk
->
sk_peercred
.
gid
=
-
1
;
...
...
net/ipv4/ip_output.c
View file @
0d072115
...
@@ -766,8 +766,8 @@ int ip_append_data(struct sock *sk,
...
@@ -766,8 +766,8 @@ int ip_append_data(struct sock *sk,
inet
->
cork
.
fragsize
=
mtu
=
dst_pmtu
(
&
rt
->
u
.
dst
);
inet
->
cork
.
fragsize
=
mtu
=
dst_pmtu
(
&
rt
->
u
.
dst
);
inet
->
cork
.
rt
=
rt
;
inet
->
cork
.
rt
=
rt
;
inet
->
cork
.
length
=
0
;
inet
->
cork
.
length
=
0
;
inet
->
sndmsg_page
=
NULL
;
sk
->
sk_
sndmsg_page
=
NULL
;
inet
->
sndmsg_off
=
0
;
sk
->
sk_
sndmsg_off
=
0
;
if
((
exthdrlen
=
rt
->
u
.
dst
.
header_len
)
!=
0
)
{
if
((
exthdrlen
=
rt
->
u
.
dst
.
header_len
)
!=
0
)
{
length
+=
exthdrlen
;
length
+=
exthdrlen
;
transhdrlen
+=
exthdrlen
;
transhdrlen
+=
exthdrlen
;
...
@@ -915,8 +915,8 @@ int ip_append_data(struct sock *sk,
...
@@ -915,8 +915,8 @@ int ip_append_data(struct sock *sk,
}
else
{
}
else
{
int
i
=
skb_shinfo
(
skb
)
->
nr_frags
;
int
i
=
skb_shinfo
(
skb
)
->
nr_frags
;
skb_frag_t
*
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
-
1
];
skb_frag_t
*
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
-
1
];
struct
page
*
page
=
inet
->
sndmsg_page
;
struct
page
*
page
=
sk
->
sk_
sndmsg_page
;
int
off
=
inet
->
sndmsg_off
;
int
off
=
sk
->
sk_
sndmsg_off
;
unsigned
int
left
;
unsigned
int
left
;
if
(
page
&&
(
left
=
PAGE_SIZE
-
off
)
>
0
)
{
if
(
page
&&
(
left
=
PAGE_SIZE
-
off
)
>
0
)
{
...
@@ -928,7 +928,7 @@ int ip_append_data(struct sock *sk,
...
@@ -928,7 +928,7 @@ int ip_append_data(struct sock *sk,
goto
error
;
goto
error
;
}
}
get_page
(
page
);
get_page
(
page
);
skb_fill_page_desc
(
skb
,
i
,
page
,
inet
->
sndmsg_off
,
0
);
skb_fill_page_desc
(
skb
,
i
,
page
,
sk
->
sk_
sndmsg_off
,
0
);
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
}
}
}
else
if
(
i
<
MAX_SKB_FRAGS
)
{
}
else
if
(
i
<
MAX_SKB_FRAGS
)
{
...
@@ -939,8 +939,8 @@ int ip_append_data(struct sock *sk,
...
@@ -939,8 +939,8 @@ int ip_append_data(struct sock *sk,
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
error
;
goto
error
;
}
}
inet
->
sndmsg_page
=
page
;
sk
->
sk_
sndmsg_page
=
page
;
inet
->
sndmsg_off
=
0
;
sk
->
sk_
sndmsg_off
=
0
;
skb_fill_page_desc
(
skb
,
i
,
page
,
0
,
0
);
skb_fill_page_desc
(
skb
,
i
,
page
,
0
,
0
);
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
...
@@ -954,7 +954,7 @@ int ip_append_data(struct sock *sk,
...
@@ -954,7 +954,7 @@ int ip_append_data(struct sock *sk,
err
=
-
EFAULT
;
err
=
-
EFAULT
;
goto
error
;
goto
error
;
}
}
inet
->
sndmsg_off
+=
copy
;
sk
->
sk_
sndmsg_off
+=
copy
;
frag
->
size
+=
copy
;
frag
->
size
+=
copy
;
skb
->
len
+=
copy
;
skb
->
len
+=
copy
;
skb
->
data_len
+=
copy
;
skb
->
data_len
+=
copy
;
...
...
net/ipv4/tcp.c
View file @
0d072115
...
@@ -816,8 +816,8 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
...
@@ -816,8 +816,8 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
return
res
;
return
res
;
}
}
#define TCP_PAGE(sk) (
inet_sk(sk)->
sndmsg_page)
#define TCP_PAGE(sk) (
sk->sk_
sndmsg_page)
#define TCP_OFF(sk) (
inet_sk(sk)->
sndmsg_off)
#define TCP_OFF(sk) (
sk->sk_
sndmsg_off)
static
inline
int
select_size
(
struct
sock
*
sk
,
struct
tcp_opt
*
tp
)
static
inline
int
select_size
(
struct
sock
*
sk
,
struct
tcp_opt
*
tp
)
{
{
...
...
net/ipv4/tcp_ipv4.c
View file @
0d072115
...
@@ -2113,10 +2113,6 @@ static int tcp_v4_destroy_sock(struct sock *sk)
...
@@ -2113,10 +2113,6 @@ static int tcp_v4_destroy_sock(struct sock *sk)
if
(
tp
->
bind_hash
)
if
(
tp
->
bind_hash
)
tcp_put_port
(
sk
);
tcp_put_port
(
sk
);
/* If sendmsg cached page exists, toss it. */
if
(
inet_sk
(
sk
)
->
sndmsg_page
)
__free_page
(
inet_sk
(
sk
)
->
sndmsg_page
);
atomic_dec
(
&
tcp_sockets_allocated
);
atomic_dec
(
&
tcp_sockets_allocated
);
return
0
;
return
0
;
...
...
net/ipv6/ip6_output.c
View file @
0d072115
...
@@ -854,8 +854,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -854,8 +854,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
np
->
cork
.
hop_limit
=
hlimit
;
np
->
cork
.
hop_limit
=
hlimit
;
inet
->
cork
.
fragsize
=
mtu
=
dst_pmtu
(
&
rt
->
u
.
dst
);
inet
->
cork
.
fragsize
=
mtu
=
dst_pmtu
(
&
rt
->
u
.
dst
);
inet
->
cork
.
length
=
0
;
inet
->
cork
.
length
=
0
;
inet
->
sndmsg_page
=
NULL
;
sk
->
sk_
sndmsg_page
=
NULL
;
inet
->
sndmsg_off
=
0
;
sk
->
sk_
sndmsg_off
=
0
;
exthdrlen
=
rt
->
u
.
dst
.
header_len
+
(
opt
?
opt
->
opt_flen
:
0
);
exthdrlen
=
rt
->
u
.
dst
.
header_len
+
(
opt
?
opt
->
opt_flen
:
0
);
length
+=
exthdrlen
;
length
+=
exthdrlen
;
transhdrlen
+=
exthdrlen
;
transhdrlen
+=
exthdrlen
;
...
@@ -971,8 +971,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -971,8 +971,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
}
else
{
}
else
{
int
i
=
skb_shinfo
(
skb
)
->
nr_frags
;
int
i
=
skb_shinfo
(
skb
)
->
nr_frags
;
skb_frag_t
*
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
-
1
];
skb_frag_t
*
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
-
1
];
struct
page
*
page
=
inet
->
sndmsg_page
;
struct
page
*
page
=
sk
->
sk_
sndmsg_page
;
int
off
=
inet
->
sndmsg_off
;
int
off
=
sk
->
sk_
sndmsg_off
;
unsigned
int
left
;
unsigned
int
left
;
if
(
page
&&
(
left
=
PAGE_SIZE
-
off
)
>
0
)
{
if
(
page
&&
(
left
=
PAGE_SIZE
-
off
)
>
0
)
{
...
@@ -984,7 +984,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -984,7 +984,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
goto
error
;
goto
error
;
}
}
get_page
(
page
);
get_page
(
page
);
skb_fill_page_desc
(
skb
,
i
,
page
,
inet
->
sndmsg_off
,
0
);
skb_fill_page_desc
(
skb
,
i
,
page
,
sk
->
sk_
sndmsg_off
,
0
);
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
}
}
}
else
if
(
i
<
MAX_SKB_FRAGS
)
{
}
else
if
(
i
<
MAX_SKB_FRAGS
)
{
...
@@ -995,8 +995,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -995,8 +995,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
error
;
goto
error
;
}
}
inet
->
sndmsg_page
=
page
;
sk
->
sk_
sndmsg_page
=
page
;
inet
->
sndmsg_off
=
0
;
sk
->
sk_
sndmsg_off
=
0
;
skb_fill_page_desc
(
skb
,
i
,
page
,
0
,
0
);
skb_fill_page_desc
(
skb
,
i
,
page
,
0
,
0
);
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
frag
=
&
skb_shinfo
(
skb
)
->
frags
[
i
];
...
@@ -1010,7 +1010,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -1010,7 +1010,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
err
=
-
EFAULT
;
err
=
-
EFAULT
;
goto
error
;
goto
error
;
}
}
inet
->
sndmsg_off
+=
copy
;
sk
->
sk_
sndmsg_off
+=
copy
;
frag
->
size
+=
copy
;
frag
->
size
+=
copy
;
skb
->
len
+=
copy
;
skb
->
len
+=
copy
;
skb
->
data_len
+=
copy
;
skb
->
data_len
+=
copy
;
...
...
net/ipv6/tcp_ipv6.c
View file @
0d072115
...
@@ -1911,10 +1911,6 @@ static int tcp_v6_destroy_sock(struct sock *sk)
...
@@ -1911,10 +1911,6 @@ static int tcp_v6_destroy_sock(struct sock *sk)
if
(
tcp_sk
(
sk
)
->
bind_hash
)
if
(
tcp_sk
(
sk
)
->
bind_hash
)
tcp_put_port
(
sk
);
tcp_put_port
(
sk
);
/* If sendmsg cached page exists, toss it. */
if
(
inet
->
sndmsg_page
!=
NULL
)
__free_page
(
inet
->
sndmsg_page
);
atomic_dec
(
&
tcp_sockets_allocated
);
atomic_dec
(
&
tcp_sockets_allocated
);
return
inet6_destroy_sock
(
sk
);
return
inet6_destroy_sock
(
sk
);
...
...
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