* [PATCH net-next] be2net: dont pull too much data in skb linear part
@ 2012-07-13 13:19 Eric Dumazet
2012-07-16 14:02 ` Padmanabh.Ratnakar
2012-07-17 6:03 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2012-07-13 13:19 UTC (permalink / raw)
To: Padmanabh Ratnakar; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
skb_fill_rx_data() pulls 64 byte of data in skb->data
Its too much for TCP (with no options) on IPv4, as total size of headers
is 14 + 40 = 54
This means tcp stack and splice() are suboptimal, since tcp payload
is in part in tcp->data, and in part in skb frag.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7e989d0..f18375c 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1228,16 +1228,16 @@ static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb,
/* Copy data in the first descriptor of this completion */
curr_frag_len = min(rxcp->pkt_size, rx_frag_size);
- /* Copy the header portion into skb_data */
- hdr_len = min(BE_HDR_LEN, curr_frag_len);
- memcpy(skb->data, start, hdr_len);
skb->len = curr_frag_len;
if (curr_frag_len <= BE_HDR_LEN) { /* tiny packet */
+ memcpy(skb->data, start, curr_frag_len);
/* Complete packet has now been moved to data */
put_page(page_info->page);
skb->data_len = 0;
skb->tail += curr_frag_len;
} else {
+ hdr_len = ETH_HLEN;
+ memcpy(skb->data, start, hdr_len);
skb_shinfo(skb)->nr_frags = 1;
skb_frag_set_page(skb, 0, page_info->page);
skb_shinfo(skb)->frags[0].page_offset =
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH net-next] be2net: dont pull too much data in skb linear part
2012-07-13 13:19 [PATCH net-next] be2net: dont pull too much data in skb linear part Eric Dumazet
@ 2012-07-16 14:02 ` Padmanabh.Ratnakar
2012-07-17 6:03 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Padmanabh.Ratnakar @ 2012-07-16 14:02 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, Sathya.Perla
> -----Original Message-----
> From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> Sent: Friday, July 13, 2012 6:50 PM
> To: Ratnakar, Padmanabh
> Cc: netdev
> Subject: [PATCH net-next] be2net: dont pull too much data in skb linear part
>
> From: Eric Dumazet <edumazet@google.com>
>
> skb_fill_rx_data() pulls 64 byte of data in skb->data
>
> Its too much for TCP (with no options) on IPv4, as total size of headers is 14 +
> 40 = 54
>
> This means tcp stack and splice() are suboptimal, since tcp payload is in part in
> tcp->data, and in part in skb frag.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> drivers/net/ethernet/emulex/benet/be_main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c
> b/drivers/net/ethernet/emulex/benet/be_main.c
> index 7e989d0..f18375c 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
> @@ -1228,16 +1228,16 @@ static void skb_fill_rx_data(struct be_rx_obj
> *rxo, struct sk_buff *skb,
> /* Copy data in the first descriptor of this completion */
> curr_frag_len = min(rxcp->pkt_size, rx_frag_size);
>
> - /* Copy the header portion into skb_data */
> - hdr_len = min(BE_HDR_LEN, curr_frag_len);
> - memcpy(skb->data, start, hdr_len);
> skb->len = curr_frag_len;
> if (curr_frag_len <= BE_HDR_LEN) { /* tiny packet */
> + memcpy(skb->data, start, curr_frag_len);
> /* Complete packet has now been moved to data */
> put_page(page_info->page);
> skb->data_len = 0;
> skb->tail += curr_frag_len;
> } else {
> + hdr_len = ETH_HLEN;
> + memcpy(skb->data, start, hdr_len);
> skb_shinfo(skb)->nr_frags = 1;
> skb_frag_set_page(skb, 0, page_info->page);
> skb_shinfo(skb)->frags[0].page_offset =
>
Change looks good to me. I tested this and it is working.
Thanks
Acked-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] be2net: dont pull too much data in skb linear part
2012-07-13 13:19 [PATCH net-next] be2net: dont pull too much data in skb linear part Eric Dumazet
2012-07-16 14:02 ` Padmanabh.Ratnakar
@ 2012-07-17 6:03 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-07-17 6:03 UTC (permalink / raw)
To: eric.dumazet; +Cc: padmanabh.ratnakar, netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 13 Jul 2012 15:19:41 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> skb_fill_rx_data() pulls 64 byte of data in skb->data
>
> Its too much for TCP (with no options) on IPv4, as total size of headers
> is 14 + 40 = 54
>
> This means tcp stack and splice() are suboptimal, since tcp payload
> is in part in tcp->data, and in part in skb frag.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-17 6:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-13 13:19 [PATCH net-next] be2net: dont pull too much data in skb linear part Eric Dumazet
2012-07-16 14:02 ` Padmanabh.Ratnakar
2012-07-17 6:03 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.