This is in preparation for switching over to flow-based tunneling.
The set_tunnel action includes the functionality of the set_tun_id action.

Cc: Kyle Mestery <kmest...@cisco.com>
Signed-off-by: Simon Horman <ho...@verge.net.au>

---

v5
* Fix ipv4_tunnel_equal()

v4
* No change

v3
* Initial posting
---
 lib/odp-util.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index ef495b9..4fc6a95 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1895,17 +1895,27 @@ commit_set_action(struct ofpbuf *odp_actions, enum 
ovs_key_attr key_type,
     nl_msg_end_nested(odp_actions, offset);
 }
 
+static inline int
+ipv4_tunnel_equal(const struct flow_tun_key *a, const struct flow_tun_key *b)
+{
+        return a->ipv4_dst == b->ipv4_dst &&
+                a->tun_id == b->tun_id &&
+                a->ipv4_src == b->ipv4_src &&
+                a->ipv4_tos == b->ipv4_tos &&
+                a->ipv4_ttl == b->ipv4_ttl;
+}
+
 static void
-commit_set_tun_id_action(const struct flow *flow, struct flow *base,
+commit_set_tunnel_action(const struct flow *flow, struct flow *base,
                          struct ofpbuf *odp_actions)
 {
-    if (base->tun_key.tun_id == flow->tun_key.tun_id) {
+    if (ipv4_tunnel_equal(&base->tun_key, &flow->tun_key)) {
         return;
     }
-    base->tun_key.tun_id = flow->tun_key.tun_id;
+    base->tun_key = flow->tun_key;
 
-    commit_set_action(odp_actions, OVS_KEY_ATTR_TUN_ID,
-                      &base->tun_key.tun_id, sizeof(base->tun_key.tun_id));
+    commit_set_action(odp_actions, OVS_KEY_ATTR_IPV4_TUNNEL,
+                      &base->tun_key, sizeof(base->tun_key));
 }
 
 static void
@@ -2076,7 +2086,7 @@ void
 commit_odp_actions(const struct flow *flow, struct flow *base,
                    struct ofpbuf *odp_actions)
 {
-    commit_set_tun_id_action(flow, base, odp_actions);
+    commit_set_tunnel_action(flow, base, odp_actions);
     commit_set_ether_addr_action(flow, base, odp_actions);
     commit_vlan_action(flow, base, odp_actions);
     commit_set_nw_action(flow, base, odp_actions);
-- 
1.7.10.2.484.gcd07cc5

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

Reply via email to