[PATCH 4/5] ibmveth: Add support for Large Receive Offload

Thomas Falcon tlfalcon at linux.vnet.ibm.com
Wed Apr 15 06:35:03 AEST 2015


Enables receiving large packets from other LPARs. These packets
have a -1 IP header checksum, so we must recalculate to have
a valid checksum.

Signed-off-by: Brian King <brking at linux.vnet.ibm.com>
Signed-off-by: Thomas Falcon <tlfalcon at linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmveth.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 08970c7..05eaca6a 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1092,6 +1092,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
 	struct net_device *netdev = adapter->netdev;
 	int frames_processed = 0;
 	unsigned long lpar_rc;
+	struct iphdr *iph;
 
 restart_poll:
 	while (frames_processed < budget) {
@@ -1134,8 +1135,20 @@ restart_poll:
 			skb_put(skb, length);
 			skb->protocol = eth_type_trans(skb, netdev);
 
-			if (csum_good)
+			if (csum_good) {
 				skb->ip_summed = CHECKSUM_UNNECESSARY;
+				if (be16_to_cpu(skb->protocol) == ETH_P_IP) {
+					skb_set_network_header(skb, 0);
+					skb_set_transport_header(skb, sizeof(struct iphdr));
+					iph = ip_hdr(skb);
+
+					/* If the IP checksum is not offloaded and if the packet
+					 *  is large send, the checksum must be rebuilt.
+					 */
+					if (iph->check == 0xffff)
+						iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+				}
+			}
 
 			napi_gro_receive(napi, skb);	/* send it up */
 
-- 
1.8.3.1



More information about the Linuxppc-dev mailing list