X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fodp-util.c;h=257d7a7accee67434dd9123ef9ac5bda7836db2f;hb=66e7d7a2cd928a5f1c64c7289b042d2fe2ebc21e;hp=8693d3c81baf635d64b789ec20bd6ec85c0141e7;hpb=9d3ee0bc635063f277754d9d31fe634967f8473c;p=openvswitch diff --git a/lib/odp-util.c b/lib/odp-util.c index 8693d3c8..257d7a7a 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#include #include +#include #include "odp-util.h" #include #include @@ -1246,7 +1246,10 @@ ovs_to_odp_frag(uint8_t nw_frag) : OVS_FRAG_TYPE_LATER); } -/* Appends a representation of 'flow' as OVS_KEY_ATTR_* attributes to 'buf'. */ +/* Appends a representation of 'flow' as OVS_KEY_ATTR_* attributes to 'buf'. + * + * 'buf' must have at least ODPUTIL_FLOW_KEY_BYTES bytes of space, or be + * capable of being expanded to allow for that much space. */ void odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow) { @@ -1257,8 +1260,8 @@ odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow) nl_msg_put_u32(buf, OVS_KEY_ATTR_PRIORITY, flow->skb_priority); } - if (flow->tun_id != htonll(0)) { - nl_msg_put_be64(buf, OVS_KEY_ATTR_TUN_ID, flow->tun_id); + if (flow->tunnel.tun_id != htonll(0)) { + nl_msg_put_be64(buf, OVS_KEY_ATTR_TUN_ID, flow->tunnel.tun_id); } if (flow->in_port != OFPP_NONE && flow->in_port != OFPP_CONTROLLER) { @@ -1750,7 +1753,7 @@ odp_flow_key_to_flow(const struct nlattr *key, size_t key_len, } if (present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_TUN_ID)) { - flow->tun_id = nl_attr_get_be64(attrs[OVS_KEY_ATTR_TUN_ID]); + flow->tunnel.tun_id = nl_attr_get_be64(attrs[OVS_KEY_ATTR_TUN_ID]); expected_attrs |= UINT64_C(1) << OVS_KEY_ATTR_TUN_ID; } @@ -1845,13 +1848,13 @@ static void commit_set_tun_id_action(const struct flow *flow, struct flow *base, struct ofpbuf *odp_actions) { - if (base->tun_id == flow->tun_id) { + if (base->tunnel.tun_id == flow->tunnel.tun_id) { return; } - base->tun_id = flow->tun_id; + base->tunnel.tun_id = flow->tunnel.tun_id; commit_set_action(odp_actions, OVS_KEY_ATTR_TUN_ID, - &base->tun_id, sizeof(base->tun_id)); + &base->tunnel.tun_id, sizeof(base->tunnel.tun_id)); } static void @@ -1973,7 +1976,7 @@ static void commit_set_port_action(const struct flow *flow, struct flow *base, struct ofpbuf *odp_actions) { - if (!base->tp_src || !base->tp_dst) { + if (!base->tp_src && !base->tp_dst) { return; }