netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fw: [Bug 54491] New: UFO (UDP fragmentation offload) does not work if the payload size specified is within the range ( (MTU-28)  to (MTU-8) )
@ 2013-02-26 15:46 Stephen Hemminger
  2013-02-27  3:20 ` Cong Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2013-02-26 15:46 UTC (permalink / raw)
  To: netdev



Begin forwarded message:

Date: Tue, 26 Feb 2013 00:52:33 -0800
From: "bugzilla-daemon@bugzilla.kernel.org" <bugzilla-daemon@bugzilla.kernel.org>
To: "stephen@networkplumber.org" <stephen@networkplumber.org>
Subject: [Bug 54491] New: UFO (UDP fragmentation offload) does not work if the payload size specified is within the range ( (MTU-28)  to (MTU-8) )


https://bugzilla.kernel.org/show_bug.cgi?id=54491

           Summary: UFO (UDP fragmentation offload) does not work if the
                    payload size specified is within the range ( (MTU-28)
                    to (MTU-8) )
           Product: Networking
           Version: 2.5
    Kernel Version: 3.3.4
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: IPV4
        AssignedTo: shemminger@linux-foundation.org
        ReportedBy: hnk437@gmail.com
        Regression: No


For IPv4/UDP if the payload size specified is within the range ( (MTU-28) 
to (MTU-8) ) packet gets segmented in kernel even if the following netdev
features are set:

NETIF_F_SG 
NETIF_F_GEN_CSUM 
NETIF_F_UFO 
NETIF_F_TSO 
NETIF_F_GSO 
NETIF_F_GSO_ROBUST

Analysis:
udp_sendmsg() computes packet length by adding UDP header size to payload size:
“ulen += sizeof(struct udphdr)”
Then the function calls ip_make_skb(), however IP header size is not added to
the packet length.
ip_make_skb() in turn calls __ip_append_data(). The same packet length is used
here. 
__ip_append_data() compares the packet length with MTU. The packet length still
does not include IP header size (20 bytes).
In result, when payload size “is within the range ( (MTU-28) to (MTU-8) )”
standard branch is taken rather than ip_ufo_append_data(). Gso_size is not
computed, therefore IP fragmentation is triggered from ip_finish_output().

The issue was reproduced on 3.4.3 as well

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fw: [Bug 54491] New: UFO (UDP fragmentation offload) does not work if the payload size specified is within the range ( (MTU-28)  to (MTU-8) )
  2013-02-26 15:46 Fw: [Bug 54491] New: UFO (UDP fragmentation offload) does not work if the payload size specified is within the range ( (MTU-28) to (MTU-8) ) Stephen Hemminger
@ 2013-02-27  3:20 ` Cong Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Cong Wang @ 2013-02-27  3:20 UTC (permalink / raw)
  To: netdev

On Tue, 26 Feb 2013 at 15:46 GMT, Stephen Hemminger <stephen@networkplumber.org> wrote:
> For IPv4/UDP if the payload size specified is within the range ( (MTU-28) 
> to (MTU-8) ) packet gets segmented in kernel even if the following netdev
> features are set:
>
> NETIF_F_SG 
> NETIF_F_GEN_CSUM 
> NETIF_F_UFO 
> NETIF_F_TSO 
> NETIF_F_GSO 
> NETIF_F_GSO_ROBUST
>
> Analysis:
> udp_sendmsg() computes packet length by adding UDP header size to payload size:
> “ulen += sizeof(struct udphdr)”
> Then the function calls ip_make_skb(), however IP header size is not added to
> the packet length.
> ip_make_skb() in turn calls __ip_append_data(). The same packet length is used
> here. 
> __ip_append_data() compares the packet length with MTU. The packet length still
> does not include IP header size (20 bytes).
> In result, when payload size “is within the range ( (MTU-28) to (MTU-8) )”
> standard branch is taken rather than ip_ufo_append_data(). Gso_size is not
> computed, therefore IP fragmentation is triggered from ip_finish_output().
>

I haven't looked into this deeply, it sounds like we need this fix:

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 5e12dca..3ccb704 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -845,7 +845,7 @@ static int __ip_append_data(struct sock *sk,
                csummode = CHECKSUM_PARTIAL;
		 
	         cork->length += length;
 -       if (((length > mtu) || (skb &&skb_is_gso(skb))) &&
 +       if (((length + fragheaderlen > mtu) || (skb &&skb_is_gso(skb))) &&
            (sk->sk_protocol == IPPROTO_UDP) &&
	                (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) {
                err = ip_ufo_append_data(sk, queue, getfrag, from,length,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-27  3:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26 15:46 Fw: [Bug 54491] New: UFO (UDP fragmentation offload) does not work if the payload size specified is within the range ( (MTU-28) to (MTU-8) ) Stephen Hemminger
2013-02-27  3:20 ` Cong Wang

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).