xen-netfront: transmit fully GSO-sized packets
Subsystems (3)
PATCH 1/1 xen-netfront: transmit fully GSO-sized packets
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s 6c09fa09d) in determining when to split an skb into two is
sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default gso_max_size of 65536 as this already accommodates the size of the header.
Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/xen-netfront.c +0 -2
@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;netif_carrier_off (netdev);
Signature · 1 line
1.9.1
Quoted 35 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-0
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 8 lines
drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;netif_carrier_off (netdev);
Hmm, this partially reverts commit9ecd1a75d977e2e8c48139c7d3efed183f898d94
Why xennet_change_mtu() is not changed by your patch ?
Quoted 35 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-0
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 8 lines
drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;netif_carrier_off (netdev);
Hmm, this partially reverts commit9ecd1a75d977e2e8c48139c7d3efed183f898d94
Why xennet_change_mtu() is not changed by your patch ?
Hello.
Quoted 6 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
c/s == commit?
Please also specify that commit's summary line in parens.
Quoted 5 lines
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two is
Likewise.
Quoted 9 lines
sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.
Quoted 5 lines
Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
Ah, here's the summary for the first mentioned commit...
Quoted 1 line
Signed-off-by Jonathan Davies <[email protected]>
WBR, Sergei
Hello.
Quoted 6 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
c/s == commit?
Please also specify that commit's summary line in parens.
Quoted 5 lines
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two is
Likewise.
Quoted 9 lines
sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.
Quoted 5 lines
Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")
Ah, here's the summary for the first mentioned commit...
Quoted 1 line
Signed-off-by Jonathan Davies <[email protected]>
WBR, Sergei
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;
Quoted 8 lines
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 1 line
drivers/net/xen-netfront.c +0
-0netif_carrier_off (netdev);Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94Why
xennet_change_mtu()is not changed by your patch ?
I think you are right: the mtu calculation suffers from the same problem. I believe the value of mtu relates to the size of the whole packet, including the header (which is why the value of dev->mtu is normally 1500 rather than 1448).
Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header"), do you agree that the max mtu formula should not need to subtract MAX_TCP_HEADER?
Regards,
Jonathan
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;
Quoted 8 lines
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 1 line
drivers/net/xen-netfront.c +0
-0netif_carrier_off (netdev);Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94Why
xennet_change_mtu()is not changed by your patch ?
I think you are right: the mtu calculation suffers from the same problem. I believe the value of mtu relates to the size of the whole packet, including the header (which is why the value of dev->mtu is normally 1500 rather than 1448).
Wei, as the author of commit 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header"), do you agree that the max mtu formula should not need to subtract MAX_TCP_HEADER?
Regards,
Jonathan
Quoted 54 lines · Jonathan Davies
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;Quoted 8 lines
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 1 line
drivers/net/xen-netfront.c +0
-0netif_carrier_off (netdev);Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94Why
xennet_change_mtu()is not changed by your patch ?
Quoted 9 lines
I think you are right: the mtu calculation suffers from the same problem. I believe the value of mtu relates to the size of the whole packet, including the header (which is why the value of
dev->mtuis normally 1500 rather than 1448).Wei, as the author of commit
9ecd1a75d977("xen-netfront: reducegso_max_sizeto account for max TCP header"), do you agree that the max mtu formula should not need to subtractMAX_TCP_HEADER?
IIRC at the time I wrote that patch I needed to subtract MAX_TCP_HEADER otherwise netfront would generate oversized packets then get marked as malicious by backend.
I think your reasoning is straightforward. Probably other core driver changes have somehow mitigated the issues I saw.
Presuming you tested this change and saw no problems, I'm of course happy with making netfront more efficient. :-)
Wei.
Quoted 2 lines
Regards,
Jonathan
Quoted 54 lines · Jonathan Davies
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;Quoted 8 lines
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 1 line
drivers/net/xen-netfront.c +0
-0netif_carrier_off (netdev);Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94Why
xennet_change_mtu()is not changed by your patch ?
Quoted 9 lines
I think you are right: the mtu calculation suffers from the same problem. I believe the value of mtu relates to the size of the whole packet, including the header (which is why the value of
dev->mtuis normally 1500 rather than 1448).Wei, as the author of commit
9ecd1a75d977("xen-netfront: reducegso_max_sizeto account for max TCP header"), do you agree that the max mtu formula should not need to subtractMAX_TCP_HEADER?
IIRC at the time I wrote that patch I needed to subtract MAX_TCP_HEADER otherwise netfront would generate oversized packets then get marked as malicious by backend.
I think your reasoning is straightforward. Probably other core driver changes have somehow mitigated the issues I saw.
Presuming you tested this change and saw no problems, I'm of course happy with making netfront more efficient. :-)
Wei.
Quoted 2 lines
Regards,
Jonathan
Quoted 69 lines · Wei Liu
Quoted 54 lines · Jonathan Davies
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;Quoted 8 lines
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 1 line
drivers/net/xen-netfront.c +0
-0netif_carrier_off (netdev);Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94Why
xennet_change_mtu()is not changed by your patch ?Quoted 9 lines
I think you are right: the mtu calculation suffers from the same problem. I believe the value of mtu relates to the size of the whole packet, including the header (which is why the value of
dev->mtuis normally 1500 rather than 1448).Wei, as the author of commit
9ecd1a75d977("xen-netfront: reducegso_max_sizeto account for max TCP header"), do you agree that the max mtu formula should not need to subtractMAX_TCP_HEADER?IIRC at the time I wrote that patch I needed to subtract
MAX_TCP_HEADERotherwise netfront would generate oversized packets then get marked as malicious by backend.
Quoted 5 lines
I think your reasoning is straightforward. Probably other core driver changes have somehow mitigated the issues I saw.
Presuming you tested this change and saw no problems, I'm of course happy with making netfront more efficient. :-)
Okay, thanks for confirming.
I'll post a v2 including the change to xennet_change_mtu.
Jonathan
Quoted 69 lines · Wei Liu
Quoted 54 lines · Jonathan Davies
Quoted 43 lines · Eric Dumazet
Quoted 42 lines · Jonathan Davies
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s
9ecd1a75d, xen-netfront setsgso_max_sizeto
XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER,
whereXEN_NETIF_MAX_TX_SIZEis 65535 bytes.The calculation used by
tcp_tso_autosize(and alsotcp_xmit_size_goalsince c/s6c09fa09d) in determining when to split an skb into two issk->sk_gso_max_size - 1 - MAX_TCP_HEADER.So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE-MAX_TCP_HEADER) - 1 -MAX_TCP_HEADER.Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default
gso_max_sizeof 65536 as this already accommodates the size of the header.Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Fixes 9ecd1a75d977 ("xen-netfront: reduce gso_max_size to account for max TCP header")Signed-off-by Jonathan Davies <[email protected]>--- drivers/net/xen-netfront.c | 2 -- 1 file changed, 2 deletions(-)drivers/net/xen-netfront.c +0
-2@@ -1279,8 +1279,6 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) netdev->ethtool_ops = &xennet_ethtool_ops;SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;Quoted 8 lines
drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1284
Quoted 1 line
drivers/net/xen-netfront.c +0
-0netif_carrier_off (netdev);Hmm, this partially reverts commit
9ecd1a75d977e2e8c48139c7d3efed183f898d94Why
xennet_change_mtu()is not changed by your patch ?Quoted 9 lines
I think you are right: the mtu calculation suffers from the same problem. I believe the value of mtu relates to the size of the whole packet, including the header (which is why the value of
dev->mtuis normally 1500 rather than 1448).Wei, as the author of commit
9ecd1a75d977("xen-netfront: reducegso_max_sizeto account for max TCP header"), do you agree that the max mtu formula should not need to subtractMAX_TCP_HEADER?IIRC at the time I wrote that patch I needed to subtract
MAX_TCP_HEADERotherwise netfront would generate oversized packets then get marked as malicious by backend.
Quoted 5 lines
I think your reasoning is straightforward. Probably other core driver changes have somehow mitigated the issues I saw.
Presuming you tested this change and saw no problems, I'm of course happy with making netfront more efficient. :-)
Okay, thanks for confirming.
I'll post a v2 including the change to xennet_change_mtu.
Jonathan