X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fmeta-flow.c;h=6ef564e2b6d89516fde66ec1450f185f6c610e10;hb=e3fbd9df396185a4dd5d9479bf20b94c6379ae2d;hp=a1682225aa681a07a9764f3c7b7871d6f926f554;hpb=8bfd0fdace852f2208b97430bd8de9aeadbf2fb0;p=sliver-openvswitch.git diff --git a/lib/meta-flow.c b/lib/meta-flow.c index a1682225a..6ef564e2b 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -52,6 +52,30 @@ const struct mf_field mf_fields[MFF_N_IDS] = { /* ## -------- ## */ { + MFF_DP_HASH, "dp_hash", NULL, + MF_FIELD_SIZES(be32), + MFM_FULLY, + MFS_HEXADECIMAL, + MFP_NONE, + false, + NXM_NX_DP_HASH, "NXM_NX_DP_HASH", + NXM_NX_DP_HASH, "NXM_NX_DP_HASH", + OFPUTIL_P_NXM_OXM_ANY, + OFPUTIL_P_NXM_OXM_ANY, + -1, + }, { + MFF_RECIRC_ID, "recirc_id", NULL, + MF_FIELD_SIZES(be32), + MFM_NONE, + MFS_DECIMAL, + MFP_NONE, + false, + NXM_NX_RECIRC_ID, "NXM_NX_RECIRC_ID", + NXM_NX_RECIRC_ID, "NXM_NX_RECIRC_ID", + OFPUTIL_P_NXM_OXM_ANY, + OFPUTIL_P_NXM_OXM_ANY, + -1, + }, { MFF_TUN_ID, "tun_id", "tunnel_id", MF_FIELD_SIZES(be64), MFM_FULLY, @@ -879,6 +903,10 @@ bool mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc) { switch (mf->id) { + case MFF_DP_HASH: + return !wc->masks.dp_hash; + case MFF_RECIRC_ID: + return !wc->masks.recirc_id; case MFF_TUN_SRC: return !wc->masks.tunnel.ip_src; case MFF_TUN_DST: @@ -1019,20 +1047,6 @@ mf_is_mask_valid(const struct mf_field *mf, const union mf_value *mask) OVS_NOT_REACHED(); } -static bool -is_icmpv4(const struct flow *flow) -{ - return (flow->dl_type == htons(ETH_TYPE_IP) - && flow->nw_proto == IPPROTO_ICMP); -} - -static bool -is_icmpv6(const struct flow *flow) -{ - return (flow->dl_type == htons(ETH_TYPE_IPV6) - && flow->nw_proto == IPPROTO_ICMPV6); -} - /* Returns true if 'flow' meets the prerequisites for 'mf', false otherwise. */ bool mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow) @@ -1138,6 +1152,8 @@ bool mf_is_value_valid(const struct mf_field *mf, const union mf_value *value) { switch (mf->id) { + case MFF_DP_HASH: + case MFF_RECIRC_ID: case MFF_TUN_ID: case MFF_TUN_SRC: case MFF_TUN_DST: @@ -1231,6 +1247,12 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow, union mf_value *value) { switch (mf->id) { + case MFF_DP_HASH: + value->be32 = htonl(flow->dp_hash); + break; + case MFF_RECIRC_ID: + value->be32 = htonl(flow->recirc_id); + break; case MFF_TUN_ID: value->be64 = flow->tunnel.tun_id; break; @@ -1312,7 +1334,6 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow, case MFF_MPLS_BOS: value->u8 = mpls_lse_to_bos(flow->mpls_lse[0]); break; - break; case MFF_IPV4_SRC: value->be32 = flow->nw_src; @@ -1424,6 +1445,12 @@ mf_set_value(const struct mf_field *mf, const union mf_value *value, struct match *match) { switch (mf->id) { + case MFF_DP_HASH: + match_set_dp_hash(match, ntohl(value->be32)); + break; + case MFF_RECIRC_ID: + match_set_recirc_id(match, ntohl(value->be32)); + break; case MFF_TUN_ID: match_set_tun_id(match, value->be64); break; @@ -1509,7 +1536,6 @@ mf_set_value(const struct mf_field *mf, case MFF_MPLS_BOS: match_set_mpls_bos(match, 0, value->u8); break; - break; case MFF_IPV4_SRC: match_set_nw_src(match, value->be32); @@ -1638,6 +1664,12 @@ mf_set_flow_value(const struct mf_field *mf, const union mf_value *value, struct flow *flow) { switch (mf->id) { + case MFF_DP_HASH: + flow->dp_hash = ntohl(value->be32); + break; + case MFF_RECIRC_ID: + flow->recirc_id = ntohl(value->be32); + break; case MFF_TUN_ID: flow->tunnel.tun_id = value->be64; break; @@ -1723,7 +1755,6 @@ mf_set_flow_value(const struct mf_field *mf, case MFF_MPLS_BOS: flow_set_mpls_bos(flow, 0, value->u8); break; - break; case MFF_IPV4_SRC: flow->nw_src = value->be32; @@ -1769,7 +1800,7 @@ mf_set_flow_value(const struct mf_field *mf, break; case MFF_IP_FRAG: - flow->nw_frag &= value->u8; + flow->nw_frag = value->u8 & FLOW_NW_FRAG_MASK; break; case MFF_ARP_OP: @@ -1851,6 +1882,14 @@ void mf_set_wild(const struct mf_field *mf, struct match *match) { switch (mf->id) { + case MFF_DP_HASH: + match->flow.dp_hash = 0; + match->wc.masks.dp_hash = 0; + break; + case MFF_RECIRC_ID: + match->flow.recirc_id = 0; + match->wc.masks.recirc_id = 0; + break; case MFF_TUN_ID: match_set_tun_id_masked(match, htonll(0), htonll(0)); break; @@ -1934,7 +1973,6 @@ mf_set_wild(const struct mf_field *mf, struct match *match) case MFF_MPLS_BOS: match_set_any_mpls_bos(match, 0); break; - break; case MFF_IPV4_SRC: case MFF_ARP_SPA: @@ -2064,6 +2102,7 @@ mf_set(const struct mf_field *mf, } switch (mf->id) { + case MFF_RECIRC_ID: case MFF_IN_PORT: case MFF_IN_PORT_OXM: case MFF_SKB_PRIORITY: @@ -2086,6 +2125,9 @@ mf_set(const struct mf_field *mf, case MFF_ICMPV6_CODE: return OFPUTIL_P_NONE; + case MFF_DP_HASH: + match_set_dp_hash_masked(match, ntohl(value->be32), ntohl(mask->be32)); + break; case MFF_TUN_ID: match_set_tun_id_masked(match, value->be64, mask->be64); break;