Skip to contentSkip to conversation

xen-netfront: convert to GRO API and advertise this feature

PATCH In review Wei Liu 8 participants 28 messages Sep 21, 2013 – Sep 30, 2013

Subsystems (3)
lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xen-netfront: convert to GRO API and advertise this feature

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

---
 drivers/net/xen-netfront.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +5 -2
index 36808bf..5664165 100644
@@ -952,7 +952,7 @@ static int handle_incoming_queue(struct net_device *dev,
 		u64_stats_update_end(&stats->syncp);
 
 		/* Pass it up. */
-		netif_receive_skb(skb);
+		napi_gro_receive(&np->napi, skb);
 	}
 
 	return packets_dropped;
@@ -1051,6 +1051,8 @@ err:
 	if (work_done < budget) {
 		int more_to_do = 0;
 
+		napi_gro_flush(napi, false);
+
 		local_irq_save(flags);
 
 		RING_FINAL_CHECK_FOR_RESPONSES(&np->rx, more_to_do);
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;
 
 	/*
          * Assume that all hw features are available for now. This set
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive a MTU size packet, for a card that does not support GRO in host? Doing GRO twice may introduce extra overheads.

Thanks

#2 lore raw
In reply to Wei Liu
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive a MTU size packet, for a card that does not support GRO in host? Doing GRO twice may introduce extra overheads.

Thanks

author
#3 lore raw
Quoted 11 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Wei.

Quoted 1 line

Thanks

author
#4 lore raw
In reply to Jason Wang
Quoted 11 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Wei.

Quoted 1 line

Thanks

#5 lore raw
Quoted 24 lines · Wei Liu
Quoted 11 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 7 lines
Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

#6 lore raw
In reply to Wei Liu
Quoted 24 lines · Wei Liu
Quoted 11 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 7 lines
Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

#7 lore raw
Quoted 25 lines · Anirban Chakraborty
Quoted 23 lines · Wei Liu
Quoted 10 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

Quoted 8 lines
Quoted 4 lines

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

In this case, even if you still want to do GRO. It's better to find the root cause of why the GSO packet were segmented (maybe GSO were not enabled for netback?), since it introduces extra overheads.

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw
In reply to Anirban Chakraborty
Quoted 25 lines · Anirban Chakraborty
Quoted 23 lines · Wei Liu
Quoted 10 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

Quoted 8 lines
Quoted 4 lines

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

In this case, even if you still want to do GRO. It's better to find the root cause of why the GSO packet were segmented (maybe GSO were not enabled for netback?), since it introduces extra overheads.

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw
Quoted 30 lines · Jason Wang
Quoted 29 lines · Anirban Chakraborty
Quoted 27 lines · Wei Liu
Quoted 10 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Quoted 6 lines
Quoted 4 lines

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

In this case, even if you still want to do GRO. It's better to find the root cause of why the GSO packet were segmented

Totally agree, we need to find the cause why large packets is segmented only in different host case.

Quoted 2 lines

(maybe GSO were not
enabled for netback?), since it introduces extra overheads.

From Anirban's feedback, large packets can be seen on vif interface, and even on guests running on the same host.

Thanks
Annie

#10 lore raw
In reply to Jason Wang
Quoted 30 lines · Jason Wang
Quoted 29 lines · Anirban Chakraborty
Quoted 27 lines · Wei Liu
Quoted 10 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Quoted 6 lines
Quoted 4 lines

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

In this case, even if you still want to do GRO. It's better to find the root cause of why the GSO packet were segmented

Totally agree, we need to find the cause why large packets is segmented only in different host case.

Quoted 2 lines

(maybe GSO were not
enabled for netback?), since it introduces extra overheads.

From Anirban's feedback, large packets can be seen on vif interface, and even on guests running on the same host.

Thanks
Annie

#11 lore raw
Quoted 32 lines · annie li
Quoted 30 lines · Jason Wang
Quoted 29 lines · Anirban Chakraborty
Quoted 27 lines · Wei Liu
Quoted 10 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

In this case, even if you still want to do GRO. It's better to find the root cause of why the GSO packet were segmented

Totally agree, we need to find the cause why large packets is segmented only in different host case.

It appears (from looking at the netback code) that although GSO is turned on at the netback, the guest receives large packet:
1. if it is a local packet (vm to vm on the same host), in which case netfront does a LRO or,
2. via turning on GRO explicitly (with this patch).

-Anirban

#12 lore raw
In reply to annie li
Quoted 32 lines · annie li
Quoted 30 lines · Jason Wang
Quoted 29 lines · Anirban Chakraborty
Quoted 27 lines · Wei Liu
Quoted 10 lines · Jason Wang
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Maybe a dumb question: doesn't Xen depends on the driver of host card to do GRO and pass it to netfront? What the case that netfront can receive

The would be the ideal situation. Netback pushes large packets to netfront and netfront sees large packets.

Quoted 1 line

a MTU size packet, for a card that does not support GRO in host? Doing

However Anirban saw the case when backend interface receives large packets but netfront sees MTU size packets, so my thought is there is certain configuration that leads to this issue. As we cannot tell users what to enable and what not to enable so I would like to solve this within our driver.

Quoted 2 lines

GRO twice may introduce extra overheads.

AIUI if the packet that frontend sees is large already then the GRO path is quite short which will not introduce heavy penalty, while on the other hand if packet is segmented doing GRO improves throughput.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Thanks Wei, for explaining and submitting the patch. I would like add following to what you have already mentioned.
In my configuration, I was seeing netback was pushing large packets to the guest (Centos 6.4) but the netfront was receiving MTU sized packets. With this patch on, I do see large packets received on the guest interface. As a result there was substantial throughput improvement in the guest side (2.8 Gbps to 3.8 Gbps). Also, note that the host NIC driver was enabled for GRO already.

-Anirban

In this case, even if you still want to do GRO. It's better to find the root cause of why the GSO packet were segmented

Totally agree, we need to find the cause why large packets is segmented only in different host case.

It appears (from looking at the netback code) that although GSO is turned on at the netback, the guest receives large packet:
1. if it is a local packet (vm to vm on the same host), in which case netfront does a LRO or,
2. via turning on GRO explicitly (with this patch).

-Anirban

#13 lore raw
In reply to Wei Liu

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

#14 lore raw
In reply to Wei Liu

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

#15 lore raw
Quoted 11 lines · Eric Dumazet

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

Shouldn't the flag be set? In dev_gro_receive() we do check if this flag is set or not:

        if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
               goto normal;

-Anirban

#16 lore raw
In reply to Eric Dumazet
Quoted 11 lines · Eric Dumazet

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

Shouldn't the flag be set? In dev_gro_receive() we do check if this flag is set or not:

        if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
               goto normal;

-Anirban

#17 lore raw
Quoted 14 lines · Anirban Chakraborty
Quoted 11 lines · Eric Dumazet

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

Quoted 4 lines

Shouldn't the flag be set? In dev_gro_receive() we do check if this flag is set or not:

        if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
               goto normal;

Drivers do not set NETIF_F_GRO themselves, they do not need to.

Look at other drivers which are GRO ready : NETIF_F_GRO is enabled by default by core networking stack, in register_netdevice()

dev->hw_features |= NETIF_F_SOFT_FEATURES;
dev->features |= NETIF_F_SOFT_FEATURES;

#18 lore raw
In reply to Anirban Chakraborty
Quoted 14 lines · Anirban Chakraborty
Quoted 11 lines · Eric Dumazet

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

Quoted 4 lines

Shouldn't the flag be set? In dev_gro_receive() we do check if this flag is set or not:

        if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
               goto normal;

Drivers do not set NETIF_F_GRO themselves, they do not need to.

Look at other drivers which are GRO ready : NETIF_F_GRO is enabled by default by core networking stack, in register_netdevice()

dev->hw_features |= NETIF_F_SOFT_FEATURES;
dev->features |= NETIF_F_SOFT_FEATURES;

#19 lore raw
Quoted 20 lines · Eric Dumazet
Quoted 14 lines · Anirban Chakraborty
Quoted 11 lines · Eric Dumazet

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

drivers/net/xen-netfront.c +2 -1
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

This part is not needed.

Quoted 4 lines

Shouldn't the flag be set? In dev_gro_receive() we do check if this flag is set or not:

       if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
              goto normal;
Quoted 8 lines

Drivers do not set NETIF_F_GRO themselves, they do not need to.

Look at other drivers which are GRO ready : NETIF_F_GRO is enabled by default by core networking stack, in register_netdevice()

dev->hw_features |= NETIF_F_SOFT_FEATURES;
dev->features |= NETIF_F_SOFT_FEATURES;

I didn't realize that the drivers no longer need to set the GRO flag explicitly. It looks like it has been changed since 3.2. I was looking at the kernel version 2.6.32.43 (which corresponds to the dom0 kernel) where the problem is happening.

-Anirban

Acked-by on v1 1/1
#20 lore raw
In reply to Wei Liu
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Quoted 44 lines
---
 drivers/net/xen-netfront.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +5 -2
index 36808bf..5664165 100644
@@ -952,7 +952,7 @@ static int handle_incoming_queue(struct net_device *dev,
 		u64_stats_update_end(&stats->syncp);
 
 		/* Pass it up. */
-		netif_receive_skb(skb);
+		napi_gro_receive(&np->napi, skb);
 	}
 
 	return packets_dropped;
@@ -1051,6 +1051,8 @@ err:
 	if (work_done < budget) {
 		int more_to_do = 0;
 
+		napi_gro_flush(napi, false);
+
 		local_irq_save(flags);
 
 		RING_FINAL_CHECK_FOR_RESPONSES(&np->rx, more_to_do);
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;
 
 	/*
          * Assume that all hw features are available for now. This set
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 1/1
#21 lore raw
In reply to Wei Liu
Quoted 7 lines · Wei Liu

Anirban was seeing netfront received MTU size packets, which downgraded throughput. The following patch makes netfront use GRO API which improves throughput for that case.

Quoted 44 lines
---
 drivers/net/xen-netfront.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +5 -2
index 36808bf..5664165 100644
@@ -952,7 +952,7 @@ static int handle_incoming_queue(struct net_device *dev,
 		u64_stats_update_end(&stats->syncp);
 
 		/* Pass it up. */
-		netif_receive_skb(skb);
+		napi_gro_receive(&np->napi, skb);
 	}
 
 	return packets_dropped;
@@ -1051,6 +1051,8 @@ err:
 	if (work_done < budget) {
 		int more_to_do = 0;
 
+		napi_gro_flush(napi, false);
+
 		local_irq_save(flags);
 
 		RING_FINAL_CHECK_FOR_RESPONSES(&np->rx, more_to_do);
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;
 
 	/*
          * Assume that all hw features are available for now. This set
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
maintainer
#22 lore raw
In reply to Wei Liu

From: Wei Liu <[email protected]>
Date: Sat, 21 Sep 2013 17:05:43 +0100

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines
drivers/net/xen-netfront.c +2 -1
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

Please post a new version of this patch with the feedback you've been given integrated, in particular with this part removed because it is not necessary.

Ian, please review the patch when Wei posts it.

Thanks.

maintainer
#23 lore raw
In reply to Wei Liu

From: Wei Liu <[email protected]>
Date: Sat, 21 Sep 2013 17:05:43 +0100

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines
drivers/net/xen-netfront.c +2 -1
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

Please post a new version of this patch with the feedback you've been given integrated, in particular with this part removed because it is not necessary.

Ian, please review the patch when Wei posts it.

Thanks.

#24 lore raw
Quoted 15 lines · David Miller

From: Wei Liu <[email protected]>
Date: Sat, 21 Sep 2013 17:05:43 +0100

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines
drivers/net/xen-netfront.c +2 -1
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

Please post a new version of this patch with the feedback you've been given integrated, in particular with this part removed because it is not necessary.

Quoted 1 line

Ian, please review the patch when Wei posts it.

I will, but note:

        $ ./scripts/get_maintainer.pl -f drivers/net/xen-netfront.c 
        Konrad Rzeszutek Wilk <[email protected]> (supporter:XEN HYPERVISOR IN...)
        Jeremy Fitzhardinge <[email protected]> (supporter:XEN HYPERVISOR IN...)
        [email protected] (moderated list:XEN HYPERVISOR IN...)
        [email protected] (open list:XEN HYPERVISOR IN...)
        [email protected] (open list:NETWORKING DRIVERS)
        [email protected] (open list)

Strictly speaking I maintain netback not front, so Wei please remember to CC the right people (mainly Konrad) as well as me.

BTW I think this separation is a good thing since it keeps changes to the protocol "honest". Doesn't matter so much for this particular patch since don't think it actually touches the protocol.

Ian.

#25 lore raw
In reply to David Miller
Quoted 15 lines · David Miller

From: Wei Liu <[email protected]>
Date: Sat, 21 Sep 2013 17:05:43 +0100

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines
drivers/net/xen-netfront.c +2 -1
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

Please post a new version of this patch with the feedback you've been given integrated, in particular with this part removed because it is not necessary.

Quoted 1 line

Ian, please review the patch when Wei posts it.

I will, but note:

        $ ./scripts/get_maintainer.pl -f drivers/net/xen-netfront.c 
        Konrad Rzeszutek Wilk <[email protected]> (supporter:XEN HYPERVISOR IN...)
        Jeremy Fitzhardinge <[email protected]> (supporter:XEN HYPERVISOR IN...)
        [email protected] (moderated list:XEN HYPERVISOR IN...)
        [email protected] (open list:XEN HYPERVISOR IN...)
        [email protected] (open list:NETWORKING DRIVERS)
        [email protected] (open list)

Strictly speaking I maintain netback not front, so Wei please remember to CC the right people (mainly Konrad) as well as me.

BTW I think this separation is a good thing since it keeps changes to the protocol "honest". Doesn't matter so much for this particular patch since don't think it actually touches the protocol.

Ian.

#26 lore raw
Quoted 27 lines · Ian Campbell
Quoted 15 lines · David Miller

From: Wei Liu <[email protected]>
Date: Sat, 21 Sep 2013 17:05:43 +0100

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines
drivers/net/xen-netfront.c +2 -1
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

Please post a new version of this patch with the feedback you've been given integrated, in particular with this part removed because it is not necessary.

Quoted 1 line

Ian, please review the patch when Wei posts it.

I will, but note:

        $ ./scripts/get_maintainer.pl -f drivers/net/xen-netfront.c 
        Konrad Rzeszutek Wilk <[email protected]> (supporter:XEN HYPERVISOR IN...)
        Jeremy Fitzhardinge <[email protected]> (supporter:XEN HYPERVISOR IN...)
        [email protected] (moderated list:XEN HYPERVISOR IN...)
        [email protected] (open list:XEN HYPERVISOR IN...)
        [email protected] (open list:NETWORKING DRIVERS)
        [email protected] (open list)
Quoted 2 lines

Strictly speaking I maintain netback not front, so Wei please remember to CC the right people (mainly Konrad) as well as me.

Which was Acked:

http://mid.gmane.org/[email protected]

Quoted 12 lines

BTW I think this separation is a good thing since it keeps changes to the protocol "honest". Doesn't matter so much for this particular patch since don't think it actually touches the protocol.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#27 lore raw
In reply to Ian Campbell
Quoted 27 lines · Ian Campbell
Quoted 15 lines · David Miller

From: Wei Liu <[email protected]>
Date: Sat, 21 Sep 2013 17:05:43 +0100

drivers/net/xen-netfront.c static struct net_device *xennet_create_dev(struct xenbus_device *dev) · line 1377

Quoted 7 lines
drivers/net/xen-netfront.c +2 -1
@@ -1371,7 +1373,8 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev)
 	netif_napi_add(netdev, &np->napi, xennet_poll, 64);
 	netdev->features        = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
 				  NETIF_F_GSO_ROBUST;
-	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
+	netdev->hw_features	= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
+				  NETIF_F_GRO;

Please post a new version of this patch with the feedback you've been given integrated, in particular with this part removed because it is not necessary.

Quoted 1 line

Ian, please review the patch when Wei posts it.

I will, but note:

        $ ./scripts/get_maintainer.pl -f drivers/net/xen-netfront.c 
        Konrad Rzeszutek Wilk <[email protected]> (supporter:XEN HYPERVISOR IN...)
        Jeremy Fitzhardinge <[email protected]> (supporter:XEN HYPERVISOR IN...)
        [email protected] (moderated list:XEN HYPERVISOR IN...)
        [email protected] (open list:XEN HYPERVISOR IN...)
        [email protected] (open list:NETWORKING DRIVERS)
        [email protected] (open list)
Quoted 2 lines

Strictly speaking I maintain netback not front, so Wei please remember to CC the right people (mainly Konrad) as well as me.

Which was Acked:

http://mid.gmane.org/[email protected]

Quoted 12 lines

BTW I think this separation is a good thing since it keeps changes to the protocol "honest". Doesn't matter so much for this particular patch since don't think it actually touches the protocol.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel