The STT protocol's header includes a field for the offset
to the start of the l4 header. It seems that this
is the value of the transport_offset of the original SKB and
making that value available to the update_header callback avoids
STT needing to calculate the offset.

Signed-off-by: Simon Horman <ho...@verge.net.au>
---
 datapath/tunnel.c       |    4 +++-
 datapath/tunnel.h       |    3 ++-
 datapath/vport-capwap.c |    3 ++-
 datapath/vport-gre.c    |    3 ++-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index 5e93218..62d8ca3 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -1274,6 +1274,7 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
        while (skb) {
                struct iphdr *iph;
                struct sk_buff *next_skb = skb->next;
+               int l4_offset = skb_transport_offset(skb);
                skb->next = NULL;
 
                if (unlikely(vlan_deaccel_tag(skb)))
@@ -1306,7 +1307,8 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
                ip_select_ident(iph, &rt_dst(rt), NULL);
 
                skb = tnl_vport->tnl_ops->update_header(vport, mutable,
-                                                       &rt_dst(rt), skb);
+                                                       &rt_dst(rt), skb,
+                                                       l4_offset);
                if (unlikely(!skb))
                        goto next;
 
diff --git a/datapath/tunnel.h b/datapath/tunnel.h
index 835c709..8ddb559 100644
--- a/datapath/tunnel.h
+++ b/datapath/tunnel.h
@@ -154,7 +154,8 @@ struct tnl_ops {
         */
        struct sk_buff *(*update_header)(const struct vport *,
                                         const struct tnl_mutable_config *,
-                                        struct dst_entry *, struct sk_buff *);
+                                        struct dst_entry *, struct sk_buff *,
+                                        int l4_offset);
 };
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
diff --git a/datapath/vport-capwap.c b/datapath/vport-capwap.c
index 896c06b..66c35aa 100644
--- a/datapath/vport-capwap.c
+++ b/datapath/vport-capwap.c
@@ -210,7 +210,8 @@ static void capwap_build_header(const struct vport *vport,
 static struct sk_buff *capwap_update_header(const struct vport *vport,
                                            const struct tnl_mutable_config 
*mutable,
                                            struct dst_entry *dst,
-                                           struct sk_buff *skb)
+                                           struct sk_buff *skb,
+                                           int l4_offset)
 {
        struct udphdr *udph = udp_hdr(skb);
 
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index c6bb025..3619c51 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -96,7 +96,8 @@ static void gre_build_header(const struct vport *vport,
 static struct sk_buff *gre_update_header(const struct vport *vport,
                                         const struct tnl_mutable_config 
*mutable,
                                         struct dst_entry *dst,
-                                        struct sk_buff *skb)
+                                        struct sk_buff *skb,
+                                        int l4_offset)
 {
        __be32 *options = (__be32 *)(skb_network_header(skb) + 
mutable->tunnel_hlen
                                               - GRE_HEADER_SECTION);
-- 
1.7.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to