Cc: Kyle Mestery <kmest...@cisco.com> Signed-off-by: Simon Horman <ho...@verge.net.au> --- include/linux/openvswitch.h | 11 +++++++++++ lib/odp-util.c | 12 ++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h index 1ce021c..bf0b8f1 100644 --- a/include/linux/openvswitch.h +++ b/include/linux/openvswitch.h @@ -370,6 +370,17 @@ struct ovs_key_ipv4_tunnel { __u8 ipv4_ttl; }; +static inline int +ovs_key_ipv4_tunnel_equal(const struct ovs_key_ipv4_tunnel *a, + const struct ovs_key_ipv4_tunnel *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; +} + /** * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow diff --git a/lib/odp-util.c b/lib/odp-util.c index cdb5bb7..7eca81c 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -1892,16 +1892,16 @@ commit_set_action(struct ofpbuf *odp_actions, enum ovs_key_attr key_type, } 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 (ovs_key_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 @@ -2072,7 +2072,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 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev