From a7f5fac9a63e5eca6f1c943c46854ef9dbb8ed3f Mon Sep 17 00:00:00 2001 From: Raja Sivaramakrishnan Date: Wed, 1 Apr 2015 13:03:08 -0700 Subject: [PATCH] Enable GSO on vhost0 interface. Avoid setting gso_size to 0 when trapping packets to the agent and truncate the packets if they are GSO packets. Change-Id: Iad65257fbe1c6a1129ac365f8a2d2c86c27af4b4 Closes-Bug: #1439370 --- dp-core/vr_interface.c | 4 ++++ include/vr_packet.h | 2 +- linux/vhost_dev.c | 3 +++ linux/vr_host_interface.c | 3 --- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dp-core/vr_interface.c b/dp-core/vr_interface.c index 68f58fba2..ec3b4fe5d 100644 --- a/dp-core/vr_interface.c +++ b/dp-core/vr_interface.c @@ -413,6 +413,10 @@ agent_send(struct vr_interface *vif, struct vr_packet *pkt, vr_preset(pkt); + if (pkt_is_gso(pkt)) { + truncate = true; + } + if ((params->trap_reason == AGENT_TRAP_HANDLE_DF) || (params->trap_reason == AGENT_TRAP_ZERO_TTL)) { if (pkt_len(pkt) > VR_AGENT_MIN_PACKET_LEN) diff --git a/include/vr_packet.h b/include/vr_packet.h index 897a0bf73..19f26c906 100644 --- a/include/vr_packet.h +++ b/include/vr_packet.h @@ -735,7 +735,7 @@ vr_init_forwarding_md(struct vr_forwarding_md *fmd) static inline bool pkt_is_gso(struct vr_packet *pkt) { - if (vr_pgso_size(pkt)) + if (vr_pgso_size && vr_pgso_size(pkt)) return true; return false; } diff --git a/linux/vhost_dev.c b/linux/vhost_dev.c index 6187056a6..8be7ea910 100644 --- a/linux/vhost_dev.c +++ b/linux/vhost_dev.c @@ -227,6 +227,9 @@ vhost_if_add(struct vr_interface *vif) vp->vp_vifp = vif; if (vif->vif_type == VIF_TYPE_HOST) { + dev->features |= (NETIF_F_GSO | NETIF_F_TSO | + NETIF_F_SG | NETIF_F_IP_CSUM); + if (vif->vif_bridge) { /* * if there already was an association, need to remove that diff --git a/linux/vr_host_interface.c b/linux/vr_host_interface.c index 225323cf7..afc028b13 100644 --- a/linux/vr_host_interface.c +++ b/linux/vr_host_interface.c @@ -321,9 +321,6 @@ linux_xmit(struct vr_interface *vif, struct sk_buff *skb, skb->ip_summed == CHECKSUM_NONE) skb->ip_summed = CHECKSUM_UNNECESSARY; - if (vif->vif_type == VIF_TYPE_AGENT) - skb_shinfo(skb)->gso_size = 0; - if ((type == VP_TYPE_IPOIP) && (skb->len > skb->dev->mtu + skb->dev->hard_header_len)) return linux_inet_fragment(vif, skb, type);