[ovs-dev] [RFC PATCH kernel 05/10] openvswitch: tunnel: use tos and ttl also for ipv6

Jiri Benc jbenc at redhat.com
Thu May 14 18:10:47 UTC 2015


Rename the ipv4_tos and ipv4_ttl fields to just 'tos' and 'ttl', as they'll
be used with IPv6 tunnels, too.

Signed-off-by: Jiri Benc <jbenc at redhat.com>
---
 net/openvswitch/flow.h         |  8 ++++----
 net/openvswitch/flow_netlink.c | 10 +++++-----
 net/openvswitch/vport-geneve.c |  4 ++--
 net/openvswitch/vport-gre.c    |  2 +-
 net/openvswitch/vport-vxlan.c  |  2 +-
 net/openvswitch/vport.c        |  4 ++--
 net/openvswitch/vport.h        |  2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index 78e96a120120..d36cc6ce5332 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -47,8 +47,8 @@ struct ovs_key_ip_tunnel {
 	struct in6_addr ipv6_src;
 	struct in6_addr ipv6_dst;
 	__be16 tun_flags;
-	u8   ipv4_tos;
-	u8   ipv4_ttl;
+	u8   tos;	/* TOS for IPv4, TC for IPv6 */
+	u8   ttl;	/* TTL for IPv4, HL for IPv6 */
 	__be16 tp_src;
 	__be16 tp_dst;
 };
@@ -84,8 +84,8 @@ static inline void __ovs_flow_tun_info_init(struct ovs_tunnel_info *tun_info,
 	memset(&tun_info->tunnel.ipv6_src, 0,
 	       offsetof(struct ovs_key_ip_tunnel, tun_flags) -
 	       offsetof(struct ovs_key_ip_tunnel, ipv6_src));
-	tun_info->tunnel.ipv4_tos = tos;
-	tun_info->tunnel.ipv4_ttl = ttl;
+	tun_info->tunnel.tos = tos;
+	tun_info->tunnel.ttl = ttl;
 	tun_info->tunnel.tun_flags = tun_flags;
 
 	/* For the tunnel types on the top of IPsec, the tp_src and tp_dst of
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 890a6cf4ec67..14d804ff6656 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -559,11 +559,11 @@ static int ip_tun_from_nlattr(const struct nlattr *attr,
 			ipv6 = true;
 			break;
 		case OVS_TUNNEL_KEY_ATTR_TOS:
-			SW_FLOW_KEY_PUT(match, tun_key.ipv4_tos,
+			SW_FLOW_KEY_PUT(match, tun_key.tos,
 					nla_get_u8(a), is_mask);
 			break;
 		case OVS_TUNNEL_KEY_ATTR_TTL:
-			SW_FLOW_KEY_PUT(match, tun_key.ipv4_ttl,
+			SW_FLOW_KEY_PUT(match, tun_key.ttl,
 					nla_get_u8(a), is_mask);
 			ttl = true;
 			break;
@@ -693,10 +693,10 @@ static int __ip_tun_to_nlattr(struct sk_buff *skb,
 	    nla_put_in6_addr(skb, OVS_TUNNEL_KEY_ATTR_IPV6_DST,
 			     &output->ipv6_dst))
 		return -EMSGSIZE;
-	if (output->ipv4_tos &&
-	    nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->ipv4_tos))
+	if (output->tos &&
+	    nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->tos))
 		return -EMSGSIZE;
-	if (nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TTL, output->ipv4_ttl))
+	if (nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TTL, output->ttl))
 		return -EMSGSIZE;
 	if ((output->tun_flags & TUNNEL_DONT_FRAGMENT) &&
 	    nla_put_flag(skb, OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT))
diff --git a/net/openvswitch/vport-geneve.c b/net/openvswitch/vport-geneve.c
index 893f03b3f864..d22078012aca 100644
--- a/net/openvswitch/vport-geneve.c
+++ b/net/openvswitch/vport-geneve.c
@@ -209,8 +209,8 @@ static int geneve_tnl_send(struct vport *vport, struct sk_buff *skb)
 	}
 
 	err = geneve_xmit_skb(geneve_port->gs, rt, skb, fl.saddr,
-			      tun_key->ipv4_dst, tun_key->ipv4_tos,
-			      tun_key->ipv4_ttl, df, sport, dport,
+			      tun_key->ipv4_dst, tun_key->tos,
+			      tun_key->ttl, df, sport, dport,
 			      tun_key->tun_flags, vni, opts_len, opts,
 			      !!(tun_key->tun_flags & TUNNEL_CSUM), false);
 	if (err < 0)
diff --git a/net/openvswitch/vport-gre.c b/net/openvswitch/vport-gre.c
index a34a2da15d43..45c7cde96867 100644
--- a/net/openvswitch/vport-gre.c
+++ b/net/openvswitch/vport-gre.c
@@ -190,7 +190,7 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff *skb)
 
 	return iptunnel_xmit(skb->sk, rt, skb, fl.saddr,
 			     tun_key->ipv4_dst, IPPROTO_GRE,
-			     tun_key->ipv4_tos, tun_key->ipv4_ttl, df, false);
+			     tun_key->tos, tun_key->ttl, df, false);
 err_free_rt:
 	ip_rt_put(rt);
 err_free_skb:
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
index 2a3e5a663e08..a01bc2343d35 100644
--- a/net/openvswitch/vport-vxlan.c
+++ b/net/openvswitch/vport-vxlan.c
@@ -262,7 +262,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
 		      (tun_key->tun_flags & TUNNEL_CSUM ? VXLAN_F_UDP_CSUM : 0);
 
 	err = vxlan_xmit_skb(rt, sk, skb, fl.saddr, tun_key->ipv4_dst,
-			     tun_key->ipv4_tos, tun_key->ipv4_ttl, df,
+			     tun_key->tos, tun_key->ttl, df,
 			     src_port, dst_port,
 			     &md, false, vxflags);
 	if (err < 0)
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 83668f7f073b..a1af8a9a9f5d 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -604,8 +604,8 @@ int ovs_tunnel_get_egress_info(struct ovs_tunnel_info *egress_tun_info,
 	 */
 	__ovs_flow_tun_info_init(egress_tun_info,
 				 fl.saddr, tun_key->ipv4_dst,
-				 tun_key->ipv4_tos,
-				 tun_key->ipv4_ttl,
+				 tun_key->tos,
+				 tun_key->ttl,
 				 tp_src, tp_dst,
 				 tun_key->tun_id,
 				 tun_key->tun_flags,
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index a28b15df190b..b22d45775eb5 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -252,7 +252,7 @@ static inline struct rtable *ovs_tunnel_route_lookup(struct net *net,
 	memset(fl, 0, sizeof(*fl));
 	fl->daddr = key->ipv4_dst;
 	fl->saddr = key->ipv4_src;
-	fl->flowi4_tos = RT_TOS(key->ipv4_tos);
+	fl->flowi4_tos = RT_TOS(key->tos);
 	fl->flowi4_mark = mark;
 	fl->flowi4_proto = protocol;
 
-- 
1.8.3.1




More information about the dev mailing list