On Tue, Dec 18, 2012 at 5:57 AM, Jarno Rajahalme <jarno.rajaha...@nsn.com> wrote: > v2 addresses comments by Jesse. > > Signed-off-by: Jarno Rajahalme <jarno.rajaha...@nsn.com>
It's helpful if you add comments about changes between patches below a separator of --- so git will automatically trim them out when the patch is applied. > diff --git a/lib/odp-util.c b/lib/odp-util.c > index f1075e3..1ba241d 100644 > --- a/lib/odp-util.c > +++ b/lib/odp-util.c > 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->tunnel.tun_id == flow->tunnel.tun_id) { > + if (!memcmp(&base->tunnel, &flow->tunnel, sizeof base->tunnel)) { > return; > } > - base->tunnel.tun_id = flow->tunnel.tun_id; > + memcpy(&base->tunnel, &flow->tunnel, sizeof base->tunnel); > > - commit_set_action(odp_actions, OVS_KEY_ATTR_TUN_ID, > - &base->tunnel.tun_id, sizeof(base->tunnel.tun_id)); > + /* A valid IPV4_TUNNEL must have non-zero ip_dst. */ > + if (flow->tunnel.ip_dst) { > + struct ovs_key_ipv4_tunnel ipv4_tun_key; > + > + ipv4_tun_key.tun_id = base->tunnel.tun_id; > + ipv4_tun_key.tun_flags = flow_to_odp_flags(base->tunnel.flags); > + ipv4_tun_key.ipv4_src = base->tunnel.ip_src; > + ipv4_tun_key.ipv4_dst = base->tunnel.ip_dst; > + ipv4_tun_key.ipv4_tos = base->tunnel.ip_tos; > + ipv4_tun_key.ipv4_ttl = base->tunnel.ip_ttl; > + memset(&ipv4_tun_key.pad, 0, sizeof ipv4_tun_key.pad); > + > + commit_set_action(odp_actions, OVS_KEY_ATTR_IPV4_TUNNEL, > + &ipv4_tun_key, sizeof ipv4_tun_key); > + } else if (base->tunnel.tun_id != htonll(0)) { > + commit_set_action(odp_actions, OVS_KEY_ATTR_TUN_ID, > + &base->tunnel.tun_id, sizeof base->tunnel.tun_id); I think this check for tun_id introduces a bug. This sequence is possible: set(tun_id(1)),output,set(tun_id(0)),output However, here we would drop the second set action. We already know that some thing has changed at this point, so we can just make it an unconditional else. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev