[ovs-dev] [PATCH 1/3] datapath: Factor out common code from *_build_header() to ovs_tnl_send().

Jarno Rajahalme jarno.rajahalme at nsn.com
Mon Mar 25 19:03:37 UTC 2013


Signed-off-by: Jarno Rajahalme <jarno.rajahalme at nsn.com>
---
 datapath/tunnel.c      |    9 +++++++++
 datapath/vport-gre.c   |   10 ----------
 datapath/vport-lisp.c  |    9 ---------
 datapath/vport-vxlan.c |    9 ---------
 4 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index 83d2c41..8d5a6d4 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -280,6 +280,15 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
 		/* Push Tunnel header. */
 		tnl_vport->tnl_ops->build_header(vport, skb, tunnel_hlen);
 
+		/*
+		 * Allow our local IP stack to fragment the outer packet even
+		 * if the DF bit is set as a last resort.  We also need to
+		 * force selection of an IP ID here because Linux will
+		 * otherwise leave it at 0 if the packet originally had DF set.
+		 */
+		skb->local_df = 1;
+		__ip_select_ident(ip_hdr(skb), skb_dst(skb), 0);
+
 		/* Push IP header. */
 		iph = ip_hdr(skb);
 		iph->version	= 4;
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index c252dcf..40b96cf 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -95,8 +95,6 @@ static void __gre_build_header(struct sk_buff *skb,
 	__be32 *options = (__be32 *)(skb_network_header(skb) + tunnel_hlen
 			- GRE_HEADER_SECTION);
 	struct gre_base_hdr *greh = (struct gre_base_hdr *) skb_transport_header(skb);
-	struct dst_entry *dst = skb_dst(skb);
-
 	greh->protocol = htons(ETH_P_TEB);
 	greh->flags = 0;
 
@@ -121,14 +119,6 @@ static void __gre_build_header(struct sk_buff *skb,
 						skb->len - skb_transport_offset(skb),
 						0));
 	}
-	/*
-	 * Allow our local IP stack to fragment the outer packet even if the
-	 * DF bit is set as a last resort.  We also need to force selection of
-	 * an IP ID here because Linux will otherwise leave it at 0 if the
-	 * packet originally had DF set.
-	 */
-	skb->local_df = 1;
-	__ip_select_ident(ip_hdr(skb), dst, 0);
 }
 
 static void gre_build_header(const struct vport *vport,
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index ad37c54..1fff5ae 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -207,15 +207,6 @@ static void lisp_build_header(const struct vport *vport,
 
 	tunnel_id_to_instance_id(tun_key->tun_id, &lisph->u2.word2.instance_id[0]);
 	lisph->u2.word2.locator_status_bits = 1;
-
-	/*
-	 * Allow our local IP stack to fragment the outer packet even if the
-	 * DF bit is set as a last resort.  We also need to force selection of
-	 * an IP ID here because Linux will otherwise leave it at 0 if the
-	 * packet originally had DF set.
-	 */
-	skb->local_df = 1;
-	__ip_select_ident(ip_hdr(skb), skb_dst(skb), 0);
 }
 
 /* Called with rcu_read_lock and BH disabled. */
diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
index 9f8874a..1850fc2 100644
--- a/datapath/vport-vxlan.c
+++ b/datapath/vport-vxlan.c
@@ -106,15 +106,6 @@ static void vxlan_build_header(const struct vport *vport,
 
 	vxh->vx_flags = htonl(VXLAN_FLAGS);
 	vxh->vx_vni = htonl(be64_to_cpu(tun_key->tun_id) << 8);
-
-	/*
-	 * Allow our local IP stack to fragment the outer packet even if the
-	 * DF bit is set as a last resort.  We also need to force selection of
-	 * an IP ID here because Linux will otherwise leave it at 0 if the
-	 * packet originally had DF set.
-	 */
-	skb->local_df = 1;
-	__ip_select_ident(ip_hdr(skb), skb_dst(skb), 0);
 }
 
 /* Called with rcu_read_lock and BH disabled. */
-- 
1.7.10.4




More information about the dev mailing list