* [PATCH net-next] tcp: do not fake tcp headers in tcp_send_rcvq()
@ 2014-09-17 10:14 Eric Dumazet
2014-09-17 18:14 ` Neal Cardwell
2014-09-19 20:04 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2014-09-17 10:14 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Pavel Emelyanov, Neal Cardwell
From: Eric Dumazet <edumazet@google.com>
Now we no longer rely on having tcp headers for skbs in receive queue,
tcp repair do not need to build fake ones.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
Note: It seems we have no checks against too big sizes and alloc_skb()
could die hard ?
net/ipv4/tcp_input.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ea92f23ffaf1..02fb66d4a018 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4304,24 +4304,19 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int
int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
{
- struct sk_buff *skb = NULL;
- struct tcphdr *th;
+ struct sk_buff *skb;
bool fragstolen;
if (size == 0)
return 0;
- skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
+ skb = alloc_skb(size, sk->sk_allocation);
if (!skb)
goto err;
- if (tcp_try_rmem_schedule(sk, skb, size + sizeof(*th)))
+ if (tcp_try_rmem_schedule(sk, skb, skb->truesize))
goto err_free;
- th = (struct tcphdr *)skb_put(skb, sizeof(*th));
- skb_reset_transport_header(skb);
- memset(th, 0, sizeof(*th));
-
if (memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size))
goto err_free;
@@ -4329,7 +4324,7 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + size;
TCP_SKB_CB(skb)->ack_seq = tcp_sk(sk)->snd_una - 1;
- if (tcp_queue_rcv(sk, skb, sizeof(*th), &fragstolen)) {
+ if (tcp_queue_rcv(sk, skb, 0, &fragstolen)) {
WARN_ON_ONCE(fragstolen); /* should not happen */
__kfree_skb(skb);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tcp: do not fake tcp headers in tcp_send_rcvq()
2014-09-17 10:14 [PATCH net-next] tcp: do not fake tcp headers in tcp_send_rcvq() Eric Dumazet
@ 2014-09-17 18:14 ` Neal Cardwell
2014-09-19 20:04 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2014-09-17 18:14 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Pavel Emelyanov
On Wed, Sep 17, 2014 at 6:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Now we no longer rely on having tcp headers for skbs in receive queue,
> tcp repair do not need to build fake ones.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
neal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tcp: do not fake tcp headers in tcp_send_rcvq()
2014-09-17 10:14 [PATCH net-next] tcp: do not fake tcp headers in tcp_send_rcvq() Eric Dumazet
2014-09-17 18:14 ` Neal Cardwell
@ 2014-09-19 20:04 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-09-19 20:04 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, xemul, ncardwell
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 17 Sep 2014 03:14:42 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> Now we no longer rely on having tcp headers for skbs in receive queue,
> tcp repair do not need to build fake ones.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-19 20:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17 10:14 [PATCH net-next] tcp: do not fake tcp headers in tcp_send_rcvq() Eric Dumazet
2014-09-17 18:14 ` Neal Cardwell
2014-09-19 20:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).