diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2011-02-28 21:36:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-01 15:35:03 -0500 |
commit | 1c32c5ad6fac8cee1a77449f5abf211e911ff830 (patch) | |
tree | 6a7384abb34068adb298beb1967b11201d52ed48 /include/net | |
parent | 1470ddf7f8cecf776921e5ccee72e3d2b3d60cbc (diff) |
inet: Add ip_make_skb and ip_finish_skb
This patch adds the helper ip_make_skb which is like ip_append_data
and ip_push_pending_frames all rolled into one, except that it does
not send the skb produced. The sending part is carried out by
ip_send_skb, which the transport protocol can call after it has
tweaked the skb.
It is meant to be called in cases where corking is not used should
have a one-to-one correspondence to sendmsg.
This patch also adds the helper ip_finish_skb which is meant to
be replace ip_push_pending_frames when corking is required.
Previously the protocol stack would peek at the socket write
queue and add its header to the first packet. With ip_finish_skb,
the protocol stack can directly operate on the final skb instead,
just like the non-corking case with ip_make_skb.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ip.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 67fac78a186b..a4f631108c54 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -116,8 +116,24 @@ extern int ip_append_data(struct sock *sk, | |||
116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); | 116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); |
117 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, | 117 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, |
118 | int offset, size_t size, int flags); | 118 | int offset, size_t size, int flags); |
119 | extern struct sk_buff *__ip_make_skb(struct sock *sk, | ||
120 | struct sk_buff_head *queue, | ||
121 | struct inet_cork *cork); | ||
122 | extern int ip_send_skb(struct sk_buff *skb); | ||
119 | extern int ip_push_pending_frames(struct sock *sk); | 123 | extern int ip_push_pending_frames(struct sock *sk); |
120 | extern void ip_flush_pending_frames(struct sock *sk); | 124 | extern void ip_flush_pending_frames(struct sock *sk); |
125 | extern struct sk_buff *ip_make_skb(struct sock *sk, | ||
126 | int getfrag(void *from, char *to, int offset, int len, | ||
127 | int odd, struct sk_buff *skb), | ||
128 | void *from, int length, int transhdrlen, | ||
129 | struct ipcm_cookie *ipc, | ||
130 | struct rtable **rtp, | ||
131 | unsigned int flags); | ||
132 | |||
133 | static inline struct sk_buff *ip_finish_skb(struct sock *sk) | ||
134 | { | ||
135 | return __ip_make_skb(sk, &sk->sk_write_queue, &inet_sk(sk)->cork); | ||
136 | } | ||
121 | 137 | ||
122 | /* datagram.c */ | 138 | /* datagram.c */ |
123 | extern int ip4_datagram_connect(struct sock *sk, | 139 | extern int ip4_datagram_connect(struct sock *sk, |