[ovs-dev] [PATCH] datapath: Rename ipv6_tos to ipv6_tclass.

Justin Pettit jpettit at nicira.com
Wed Nov 9 19:50:12 UTC 2011


IPv6 uses the term "traffic class" for what IPv4 calls
"type-of-service".  This commit renames the the "ipv6_tos" field to
"ipv6_tclass" in the "ovs-key_ipv6" struct to be more consistent with
the IPv6 terminology.

Suggested-by: Jesse Gross <jesse at nicira.com>
Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 datapath/flow.c             |    4 ++--
 include/linux/openvswitch.h |    2 +-
 lib/odp-util.c              |   12 ++++++------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index 61e7e43..c732d04 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -978,7 +978,7 @@ int flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
 				goto invalid;
 			swkey->ipv6.label = ipv6_key->ipv6_label;
 			swkey->ip.proto = ipv6_key->ipv6_proto;
-			swkey->ip.tos = ipv6_key->ipv6_tos;
+			swkey->ip.tos = ipv6_key->ipv6_tclass;
 			swkey->ip.ttl = ipv6_key->ipv6_hop_limit;
 			swkey->ip.frag = ipv6_key->ipv6_frag;
 			memcpy(&swkey->ipv6.addr.src, ipv6_key->ipv6_src,
@@ -1263,7 +1263,7 @@ int flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
 				sizeof(ipv6_key->ipv6_dst));
 		ipv6_key->ipv6_label = swkey->ipv6.label;
 		ipv6_key->ipv6_proto = swkey->ip.proto;
-		ipv6_key->ipv6_tos = swkey->ip.tos;
+		ipv6_key->ipv6_tclass = swkey->ip.tos;
 		ipv6_key->ipv6_hop_limit = swkey->ip.ttl;
 		ipv6_key->ipv6_frag = swkey->ip.frag;
 	} else if (swkey->eth.type == htons(ETH_P_ARP)) {
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index cb6e6bb..6251ba8 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -325,7 +325,7 @@ struct ovs_key_ipv6 {
 	__be32 ipv6_dst[4];
 	__be32 ipv6_label;	/* 20-bits in least-significant bits. */
 	__u8   ipv6_proto;
-	__u8   ipv6_tos;
+	__u8   ipv6_tclass;
 	__u8   ipv6_hop_limit;
 	__u8   ipv6_frag;	/* One of OVS_FRAG_TYPE_*. */
 };
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 8ced2d4..04c0828 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -389,7 +389,7 @@ format_odp_key_attr(const struct nlattr *a, struct ds *ds)
         ds_put_format(ds, "ipv6(src=%s,dst=%s,label=%#"PRIx32",proto=%"PRIu8
                       ",tos=%#"PRIx8",ttl=%"PRIu8",frag=%s)",
                       src_str, dst_str, ntohl(ipv6_key->ipv6_label),
-                      ipv6_key->ipv6_proto, ipv6_key->ipv6_tos,
+                      ipv6_key->ipv6_proto, ipv6_key->ipv6_tclass,
                       ipv6_key->ipv6_hop_limit,
                       ovs_frag_type_to_string(ipv6_key->ipv6_frag));
         break;
@@ -638,7 +638,7 @@ parse_odp_key_attr(const char *s, struct ofpbuf *key)
         char ipv6_dst_s[IPV6_SCAN_LEN + 1];
         int ipv6_label;
         int ipv6_proto;
-        int ipv6_tos;
+        int ipv6_tclass;
         int ipv6_hop_limit;
         char frag[8];
         enum ovs_frag_type ipv6_frag;
@@ -647,7 +647,7 @@ parse_odp_key_attr(const char *s, struct ofpbuf *key)
         if (sscanf(s, "ipv6(src="IPV6_SCAN_FMT",dst="IPV6_SCAN_FMT","
                    "label=%i,proto=%i,tos=%i,ttl=%i,frag=%7[a-z])%n",
                    ipv6_src_s, ipv6_dst_s, &ipv6_label,
-                   &ipv6_proto, &ipv6_tos, &ipv6_hop_limit, frag, &n) > 0
+                   &ipv6_proto, &ipv6_tclass, &ipv6_hop_limit, frag, &n) > 0
             && n > 0
             && ovs_frag_type_from_string(frag, &ipv6_frag)) {
             struct ovs_key_ipv6 ipv6_key;
@@ -658,7 +658,7 @@ parse_odp_key_attr(const char *s, struct ofpbuf *key)
             }
             ipv6_key.ipv6_label = htonl(ipv6_label);
             ipv6_key.ipv6_proto = ipv6_proto;
-            ipv6_key.ipv6_tos = ipv6_tos;
+            ipv6_key.ipv6_tclass = ipv6_tclass;
             ipv6_key.ipv6_hop_limit = ipv6_hop_limit;
             ipv6_key.ipv6_frag = ipv6_frag;
             nl_msg_put_unspec(key, OVS_KEY_ATTR_IPV6,
@@ -891,7 +891,7 @@ odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow)
         memcpy(ipv6_key->ipv6_dst, &flow->ipv6_dst, sizeof ipv6_key->ipv6_dst);
         ipv6_key->ipv6_label = flow->ipv6_label;
         ipv6_key->ipv6_proto = flow->nw_proto;
-        ipv6_key->ipv6_tos = flow->tos;
+        ipv6_key->ipv6_tclass = flow->tos;
         ipv6_key->ipv6_hop_limit = flow->nw_ttl;
         ipv6_key->ipv6_frag = ovs_to_odp_frag(flow->frag);
     } else if (flow->dl_type == htons(ETH_TYPE_ARP)) {
@@ -1080,7 +1080,7 @@ odp_flow_key_to_flow(const struct nlattr *key, size_t key_len,
             memcpy(&flow->ipv6_dst, ipv6_key->ipv6_dst, sizeof flow->ipv6_dst);
             flow->ipv6_label = ipv6_key->ipv6_label;
             flow->nw_proto = ipv6_key->ipv6_proto;
-            flow->tos = ipv6_key->ipv6_tos;
+            flow->tos = ipv6_key->ipv6_tclass;
             flow->nw_ttl = ipv6_key->ipv6_hop_limit;
             if (!odp_to_ovs_frag(ipv6_key->ipv6_frag, flow)) {
                 return EINVAL;
-- 
1.7.1




More information about the dev mailing list