Looks good thanks. Ethan
On Fri, Jul 20, 2012 at 4:25 PM, Ben Pfaff <b...@nicira.com> wrote: > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/classifier.c | 12 ++++++------ > lib/flow.c | 29 +++++++++++++++++------------ > lib/flow.h | 14 +++++++------- > lib/meta-flow.c | 12 +++++++----- > lib/nx-match.c | 15 +++++++-------- > lib/ofp-util.c | 17 ++++++++--------- > tests/test-classifier.c | 7 ++++++- > 7 files changed, 58 insertions(+), 48 deletions(-) > > diff --git a/lib/classifier.c b/lib/classifier.c > index c032815..07a7c4e 100644 > --- a/lib/classifier.c > +++ b/lib/classifier.c > @@ -156,7 +156,7 @@ cls_rule_set_in_port(struct cls_rule *rule, uint16_t > ofp_port) > void > cls_rule_set_dl_type(struct cls_rule *rule, ovs_be16 dl_type) > { > - rule->wc.wildcards &= ~FWW_DL_TYPE; > + rule->wc.dl_type_mask = htons(UINT16_MAX); > rule->flow.dl_type = dl_type; > } > > @@ -582,13 +582,13 @@ cls_rule_format(const struct cls_rule *rule, struct ds > *s) > > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > if (rule->priority != OFP_DEFAULT_PRIORITY) { > ds_put_format(s, "priority=%d,", rule->priority); > } > > - if (!(w & FWW_DL_TYPE)) { > + if (wc->dl_type_mask) { > skip_type = true; > if (f->dl_type == htons(ETH_TYPE_IP)) { > if (wc->nw_proto_mask) { > @@ -692,7 +692,7 @@ cls_rule_format(const struct cls_rule *rule, struct ds *s) > } > format_eth_masked(s, "dl_src", f->dl_src, wc->dl_src_mask); > format_eth_masked(s, "dl_dst", f->dl_dst, wc->dl_dst_mask); > - if (!skip_type && !(w & FWW_DL_TYPE)) { > + if (!skip_type && wc->dl_type_mask) { > ds_put_format(s, "dl_type=0x%04"PRIx16",", ntohs(f->dl_type)); > } > if (f->dl_type == htons(ETH_TYPE_IPV6)) { > @@ -1266,7 +1266,7 @@ flow_equal_except(const struct flow *a, const struct > flow *b, > const flow_wildcards_t wc = wildcards->wildcards; > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > for (i = 0; i < FLOW_N_REGS; i++) { > if ((a->regs[i] ^ b->regs[i]) & wildcards->reg_masks[i]) { > @@ -1280,7 +1280,7 @@ flow_equal_except(const struct flow *a, const struct > flow *b, > && !((a->nw_dst ^ b->nw_dst) & wildcards->nw_dst_mask) > && (wc & FWW_IN_PORT || a->in_port == b->in_port) > && !((a->vlan_tci ^ b->vlan_tci) & wildcards->vlan_tci_mask) > - && (wc & FWW_DL_TYPE || a->dl_type == b->dl_type) > + && !((a->dl_type ^ b->dl_type) & wildcards->dl_type_mask) > && !((a->tp_src ^ b->tp_src) & wildcards->tp_src_mask) > && !((a->tp_dst ^ b->tp_dst) & wildcards->tp_dst_mask) > && eth_addr_equal_except(a->dl_src, b->dl_src, > diff --git a/lib/flow.c b/lib/flow.c > index 2fd1c7d..bd92e87 100644 > --- a/lib/flow.c > +++ b/lib/flow.c > @@ -444,7 +444,7 @@ flow_zero_wildcards(struct flow *flow, const struct > flow_wildcards *wildcards) > const flow_wildcards_t wc = wildcards->wildcards; > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > for (i = 0; i < FLOW_N_REGS; i++) { > flow->regs[i] &= wildcards->reg_masks[i]; > @@ -457,9 +457,7 @@ flow_zero_wildcards(struct flow *flow, const struct > flow_wildcards *wildcards) > flow->in_port = 0; > } > flow->vlan_tci &= wildcards->vlan_tci_mask; > - if (wc & FWW_DL_TYPE) { > - flow->dl_type = htons(0); > - } > + flow->dl_type &= wildcards->dl_type_mask; > flow->tp_src &= wildcards->tp_src_mask; > flow->tp_dst &= wildcards->tp_dst_mask; > eth_addr_bitand(flow->dl_src, wildcards->dl_src_mask, flow->dl_src); > @@ -484,7 +482,7 @@ flow_zero_wildcards(struct flow *flow, const struct > flow_wildcards *wildcards) > void > flow_get_metadata(const struct flow *flow, struct flow_metadata *fmd) > { > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > fmd->tun_id = flow->tun_id; > fmd->tun_id_mask = htonll(UINT64_MAX); > @@ -578,7 +576,7 @@ flow_print(FILE *stream, const struct flow *flow) > void > flow_wildcards_init_catchall(struct flow_wildcards *wc) > { > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > wc->wildcards = FWW_ALL; > wc->tun_id_mask = htonll(0); > @@ -592,6 +590,7 @@ flow_wildcards_init_catchall(struct flow_wildcards *wc) > wc->metadata_mask = htonll(0); > wc->vlan_tci_mask = htons(0); > wc->nw_frag_mask = 0; > + wc->dl_type_mask = htons(0); > wc->tp_src_mask = htons(0); > wc->tp_dst_mask = htons(0); > memset(wc->dl_src_mask, 0, ETH_ADDR_LEN); > @@ -609,7 +608,7 @@ flow_wildcards_init_catchall(struct flow_wildcards *wc) > void > flow_wildcards_init_exact(struct flow_wildcards *wc) > { > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > wc->wildcards = 0; > wc->tun_id_mask = htonll(UINT64_MAX); > @@ -623,6 +622,7 @@ flow_wildcards_init_exact(struct flow_wildcards *wc) > wc->metadata_mask = htonll(UINT64_MAX); > wc->vlan_tci_mask = htons(UINT16_MAX); > wc->nw_frag_mask = UINT8_MAX; > + wc->dl_type_mask = htons(UINT16_MAX); > wc->tp_src_mask = htons(UINT16_MAX); > wc->tp_dst_mask = htons(UINT16_MAX); > memset(wc->dl_src_mask, 0xff, ETH_ADDR_LEN); > @@ -642,7 +642,7 @@ flow_wildcards_is_exact(const struct flow_wildcards *wc) > { > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > if (wc->wildcards > || wc->tun_id_mask != htonll(UINT64_MAX) > @@ -652,6 +652,7 @@ flow_wildcards_is_exact(const struct flow_wildcards *wc) > || wc->tp_dst_mask != htons(UINT16_MAX) > || wc->vlan_tci_mask != htons(UINT16_MAX) > || wc->metadata_mask != htonll(UINT64_MAX) > + || wc->dl_type_mask != htons(UINT16_MAX) > || !eth_mask_is_exact(wc->dl_src_mask) > || !eth_mask_is_exact(wc->dl_dst_mask) > || !eth_mask_is_exact(wc->arp_sha_mask) > @@ -683,7 +684,7 @@ flow_wildcards_is_catchall(const struct flow_wildcards > *wc) > { > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > if (wc->wildcards != FWW_ALL > || wc->tun_id_mask != htonll(0) > @@ -693,6 +694,7 @@ flow_wildcards_is_catchall(const struct flow_wildcards > *wc) > || wc->tp_dst_mask != htons(0) > || wc->vlan_tci_mask != htons(0) > || wc->metadata_mask != htonll(0) > + || wc->dl_type_mask != htons(0) > || !eth_addr_is_zero(wc->dl_src_mask) > || !eth_addr_is_zero(wc->dl_dst_mask) > || !eth_addr_is_zero(wc->arp_sha_mask) > @@ -727,7 +729,7 @@ flow_wildcards_combine(struct flow_wildcards *dst, > { > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > dst->wildcards = src1->wildcards | src2->wildcards; > dst->tun_id_mask = src1->tun_id_mask & src2->tun_id_mask; > @@ -745,6 +747,7 @@ flow_wildcards_combine(struct flow_wildcards *dst, > } > dst->metadata_mask = src1->metadata_mask & src2->metadata_mask; > dst->vlan_tci_mask = src1->vlan_tci_mask & src2->vlan_tci_mask; > + dst->dl_type_mask = src1->dl_type_mask & src2->dl_type_mask; > dst->tp_src_mask = src1->tp_src_mask & src2->tp_src_mask; > dst->tp_dst_mask = src1->tp_dst_mask & src2->tp_dst_mask; > dst->nw_frag_mask = src1->nw_frag_mask & src2->nw_frag_mask; > @@ -776,7 +779,7 @@ flow_wildcards_equal(const struct flow_wildcards *a, > { > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > if (a->wildcards != b->wildcards > || a->tun_id_mask != b->tun_id_mask > @@ -784,6 +787,7 @@ flow_wildcards_equal(const struct flow_wildcards *a, > || a->nw_dst_mask != b->nw_dst_mask > || a->vlan_tci_mask != b->vlan_tci_mask > || a->metadata_mask != b->metadata_mask > + || a->dl_type_mask != b->dl_type_mask > || !ipv6_addr_equals(&a->ipv6_src_mask, &b->ipv6_src_mask) > || !ipv6_addr_equals(&a->ipv6_dst_mask, &b->ipv6_dst_mask) > || a->ipv6_label_mask != b->ipv6_label_mask > @@ -820,7 +824,7 @@ flow_wildcards_has_extra(const struct flow_wildcards *a, > uint8_t eth_masked[ETH_ADDR_LEN]; > struct in6_addr ipv6_masked; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > for (i = 0; i < FLOW_N_REGS; i++) { > if ((a->reg_masks[i] & b->reg_masks[i]) != b->reg_masks[i]) { > @@ -870,6 +874,7 @@ flow_wildcards_has_extra(const struct flow_wildcards *a, > || (a->ipv6_label_mask & b->ipv6_label_mask) != > b->ipv6_label_mask > || (a->vlan_tci_mask & b->vlan_tci_mask) != b->vlan_tci_mask > || (a->metadata_mask & b->metadata_mask) != b->metadata_mask > + || (a->dl_type_mask & b->dl_type_mask) != b->dl_type_mask > || (a->tp_src_mask & b->tp_src_mask) != b->tp_src_mask > || (a->tp_dst_mask & b->tp_dst_mask) != b->tp_dst_mask > || (a->nw_proto_mask & b->nw_proto_mask) != b->nw_proto_mask > diff --git a/lib/flow.h b/lib/flow.h > index 3da8c12..d5abe61 100644 > --- a/lib/flow.h > +++ b/lib/flow.h > @@ -34,7 +34,7 @@ struct ofpbuf; > /* This sequence number should be incremented whenever anything involving > flows > * or the wildcarding of flows changes. This will cause build assertion > * failures in places which likely need to be updated. */ > -#define FLOW_WC_SEQ 16 > +#define FLOW_WC_SEQ 17 > > #define FLOW_N_REGS 8 > BUILD_ASSERT_DECL(FLOW_N_REGS <= NXM_NX_MAX_REGS); > @@ -103,7 +103,7 @@ BUILD_ASSERT_DECL(sizeof(((struct flow *)0)->nw_frag) == > 1); > BUILD_ASSERT_DECL(sizeof(struct flow) == FLOW_SIG_SIZE + FLOW_PAD_SIZE); > > /* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */ > -BUILD_ASSERT_DECL(FLOW_SIG_SIZE == 150 && FLOW_WC_SEQ == 16); > +BUILD_ASSERT_DECL(FLOW_SIG_SIZE == 150 && FLOW_WC_SEQ == 17); > > void flow_extract(struct ofpbuf *, uint32_t priority, ovs_be64 tun_id, > uint16_t in_port, struct flow *); > @@ -149,11 +149,10 @@ flow_hash(const struct flow *flow, uint32_t basis) > typedef unsigned int OVS_BITWISE flow_wildcards_t; > > #define FWW_IN_PORT ((OVS_FORCE flow_wildcards_t) (1 << 0)) > -#define FWW_DL_TYPE ((OVS_FORCE flow_wildcards_t) (1 << 1)) > -#define FWW_ALL ((OVS_FORCE flow_wildcards_t) (((1 << 2)) - 1)) > +#define FWW_ALL ((OVS_FORCE flow_wildcards_t) (((1 << 1)) - 1)) > > /* Remember to update FLOW_WC_SEQ when adding or removing FWW_*. */ > -BUILD_ASSERT_DECL(FWW_ALL == ((1 << 2) - 1) && FLOW_WC_SEQ == 16); > +BUILD_ASSERT_DECL(FWW_ALL == ((1 << 1) - 1) && FLOW_WC_SEQ == 17); > > /* Information on wildcards for a flow, as a supplement to "struct flow". > * > @@ -172,6 +171,7 @@ struct flow_wildcards { > nd_target bit. */ > ovs_be32 ipv6_label_mask; /* 1 bit in each significant ipv6_label bit. > */ > ovs_be16 vlan_tci_mask; /* 1-bit in each significant vlan_tci bit. */ > + ovs_be16 dl_type_mask; /* 1-bit in each significant dl_type bit. */ > ovs_be16 tp_src_mask; /* 1-bit in each significant tp_src bit. */ > ovs_be16 tp_dst_mask; /* 1-bit in each significant tp_dst bit. */ > uint8_t nw_proto_mask; /* 1-bit in each significant nw_proto bit. */ > @@ -182,11 +182,11 @@ struct flow_wildcards { > uint8_t arp_tha_mask[6]; /* 1-bit in each significant dl_dst bit. */ > uint8_t nw_tos_mask; /* 1-bit in each significant nw_tos bit. */ > uint8_t nw_ttl_mask; /* 1-bit in each significant nw_ttl bit. */ > - uint8_t zeros[6]; /* Padding field set to zero. */ > + uint8_t zeros[4]; /* Padding field set to zero. */ > }; > > /* Remember to update FLOW_WC_SEQ when updating struct flow_wildcards. */ > -BUILD_ASSERT_DECL(sizeof(struct flow_wildcards) == 152 && FLOW_WC_SEQ == 16); > +BUILD_ASSERT_DECL(sizeof(struct flow_wildcards) == 152 && FLOW_WC_SEQ == 17); > > void flow_wildcards_init_catchall(struct flow_wildcards *); > void flow_wildcards_init_exact(struct flow_wildcards *); > diff --git a/lib/meta-flow.c b/lib/meta-flow.c > index ce49239..cc4ae24 100644 > --- a/lib/meta-flow.c > +++ b/lib/meta-flow.c > @@ -139,7 +139,7 @@ static const struct mf_field mf_fields[MFF_N_IDS] = { > }, { > MFF_ETH_TYPE, "eth_type", "dl_type", > MF_FIELD_SIZES(be16), > - MFM_NONE, FWW_DL_TYPE, > + MFM_NONE, 0, > MFS_HEXADECIMAL, > MFP_NONE, > false, > @@ -556,7 +556,6 @@ mf_is_all_wild(const struct mf_field *mf, const struct > flow_wildcards *wc) > { > switch (mf->id) { > case MFF_IN_PORT: > - case MFF_ETH_TYPE: > assert(mf->fww_bit != 0); > return (wc->wildcards & mf->fww_bit) != 0; > > @@ -572,6 +571,8 @@ mf_is_all_wild(const struct mf_field *mf, const struct > flow_wildcards *wc) > return eth_addr_is_zero(wc->dl_src_mask); > case MFF_ETH_DST: > return eth_addr_is_zero(wc->dl_dst_mask); > + case MFF_ETH_TYPE: > + return !wc->dl_type_mask; > > case MFF_ARP_SHA: > case MFF_ND_SLL: > @@ -652,7 +653,6 @@ mf_get_mask(const struct mf_field *mf, const struct > flow_wildcards *wc, > { > switch (mf->id) { > case MFF_IN_PORT: > - case MFF_ETH_TYPE: > assert(mf->fww_bit != 0); > memset(mask, wc->wildcards & mf->fww_bit ? 0x00 : 0xff, mf->n_bytes); > break; > @@ -671,10 +671,12 @@ mf_get_mask(const struct mf_field *mf, const struct > flow_wildcards *wc, > case MFF_ETH_DST: > memcpy(mask->mac, wc->dl_dst_mask, ETH_ADDR_LEN); > break; > - > case MFF_ETH_SRC: > memcpy(mask->mac, wc->dl_src_mask, ETH_ADDR_LEN); > break; > + case MFF_ETH_TYPE: > + mask->be16 = wc->dl_type_mask; > + break; > > case MFF_VLAN_TCI: > mask->be16 = wc->vlan_tci_mask; > @@ -1383,8 +1385,8 @@ mf_set_wild(const struct mf_field *mf, struct cls_rule > *rule) > break; > > case MFF_ETH_TYPE: > - rule->wc.wildcards |= FWW_DL_TYPE; > rule->flow.dl_type = htons(0); > + rule->wc.dl_type_mask = htons(0); > break; > > case MFF_VLAN_TCI: > diff --git a/lib/nx-match.c b/lib/nx-match.c > index b342111..16cac92 100644 > --- a/lib/nx-match.c > +++ b/lib/nx-match.c > @@ -492,7 +492,7 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct > cls_rule *cr, > int match_len; > int i; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > /* Metadata. */ > if (!(wc & FWW_IN_PORT)) { > @@ -509,10 +509,9 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct > cls_rule *cr, > flow->dl_src, cr->wc.dl_src_mask); > nxm_put_eth_masked(b, oxm ? OXM_OF_ETH_DST : NXM_OF_ETH_DST, > flow->dl_dst, cr->wc.dl_dst_mask); > - if (!(wc & FWW_DL_TYPE)) { > - nxm_put_16(b, oxm ? OXM_OF_ETH_TYPE : NXM_OF_ETH_TYPE, > - ofputil_dl_type_to_openflow(flow->dl_type)); > - } > + nxm_put_16m(b, oxm ? OXM_OF_ETH_TYPE : NXM_OF_ETH_TYPE, > + ofputil_dl_type_to_openflow(flow->dl_type), > + cr->wc.dl_type_mask); > > /* 802.1Q. > * > @@ -520,7 +519,7 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct > cls_rule *cr, > nxm_put_16m(b, NXM_OF_VLAN_TCI, flow->vlan_tci, cr->wc.vlan_tci_mask); > > /* L3. */ > - if (!(wc & FWW_DL_TYPE) && flow->dl_type == htons(ETH_TYPE_IP)) { > + if (flow->dl_type == htons(ETH_TYPE_IP)) { > /* IP. */ > nxm_put_32m(b, oxm ? OXM_OF_IPV4_SRC : NXM_OF_IP_SRC, > flow->nw_src, cr->wc.nw_src_mask); > @@ -529,7 +528,7 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct > cls_rule *cr, > nxm_put_ip(b, cr, IPPROTO_ICMP, > oxm ? OXM_OF_ICMPV4_TYPE : NXM_OF_ICMP_TYPE, > oxm ? OXM_OF_ICMPV4_CODE : NXM_OF_ICMP_CODE, oxm); > - } else if (!(wc & FWW_DL_TYPE) && flow->dl_type == htons(ETH_TYPE_IPV6)) > { > + } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) { > /* IPv6. */ > nxm_put_ipv6(b, oxm ? OXM_OF_IPV6_SRC : NXM_NX_IPV6_SRC, > &flow->ipv6_src, &cr->wc.ipv6_src_mask); > @@ -556,7 +555,7 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct > cls_rule *cr, > flow->arp_tha, cr->wc.arp_tha_mask); > } > } > - } else if (!(wc & FWW_DL_TYPE) && flow->dl_type == htons(ETH_TYPE_ARP)) { > + } else if (flow->dl_type == htons(ETH_TYPE_ARP)) { > /* ARP. */ > if (cr->wc.nw_proto_mask) { > nxm_put_16(b, oxm ? OXM_OF_ARP_OP : NXM_OF_ARP_OP, > diff --git a/lib/ofp-util.c b/lib/ofp-util.c > index 9b0da8f..d87573c 100644 > --- a/lib/ofp-util.c > +++ b/lib/ofp-util.c > @@ -83,7 +83,7 @@ ofputil_netmask_to_wcbits(ovs_be32 netmask) > void > ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct flow_wildcards *wc) > { > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > /* Initialize most of rule->wc. */ > flow_wildcards_init_catchall(wc); > @@ -92,9 +92,6 @@ ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct > flow_wildcards *wc) > if (ofpfw & OFPFW10_IN_PORT) { > wc->wildcards |= FWW_IN_PORT; > } > - if (ofpfw & OFPFW10_DL_TYPE) { > - wc->wildcards |= FWW_DL_TYPE; > - } > > if (!(ofpfw & OFPFW10_NW_TOS)) { > wc->nw_tos_mask |= IP_DSCP_MASK; > @@ -119,6 +116,9 @@ ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct > flow_wildcards *wc) > if (!(ofpfw & OFPFW10_DL_DST)) { > memset(wc->dl_dst_mask, 0xff, ETH_ADDR_LEN); > } > + if (!(ofpfw & OFPFW10_DL_TYPE)) { > + wc->dl_type_mask = htons(UINT16_MAX); > + } > > /* VLAN TCI mask. */ > if (!(ofpfw & OFPFW10_DL_VLAN_PCP)) { > @@ -192,7 +192,7 @@ ofputil_cls_rule_to_ofp10_match(const struct cls_rule > *rule, > if (wc->wildcards & FWW_IN_PORT) { > ofpfw |= OFPFW10_IN_PORT; > } > - if (wc->wildcards & FWW_DL_TYPE) { > + if (!wc->dl_type_mask) { > ofpfw |= OFPFW10_DL_TYPE; > } > if (!wc->nw_proto_mask) { > @@ -466,7 +466,7 @@ ofputil_cls_rule_to_ofp11_match(const struct cls_rule > *rule, > } > } > > - if (rule->wc.wildcards & FWW_DL_TYPE) { > + if (!rule->wc.dl_type_mask) { > wc |= OFPFW11_DL_TYPE; > } else { > match->dl_type = ofputil_dl_type_to_openflow(rule->flow.dl_type); > @@ -1455,7 +1455,7 @@ ofputil_usable_protocols(const struct cls_rule *rule) > { > const struct flow_wildcards *wc = &rule->wc; > > - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 16); > + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17); > > /* NXM and OF1.1+ supports bitwise matching on ethernet addresses. */ > if (!eth_mask_is_exact(wc->dl_src_mask) > @@ -1479,8 +1479,7 @@ ofputil_usable_protocols(const struct cls_rule *rule) > } > > /* Only NXM supports matching IPv6 traffic. */ > - if (!(wc->wildcards & FWW_DL_TYPE) > - && (rule->flow.dl_type == htons(ETH_TYPE_IPV6))) { > + if (rule->flow.dl_type == htons(ETH_TYPE_IPV6)) { > return OFPUTIL_P_NXM_ANY; > } > > diff --git a/tests/test-classifier.c b/tests/test-classifier.c > index 2fd9b98..97e8f3f 100644 > --- a/tests/test-classifier.c > +++ b/tests/test-classifier.c > @@ -50,7 +50,7 @@ > CLS_FIELD(0, nw_dst, NW_DST) \ > CLS_FIELD(FWW_IN_PORT, in_port, IN_PORT) \ > CLS_FIELD(0, vlan_tci, VLAN_TCI) \ > - CLS_FIELD(FWW_DL_TYPE, dl_type, DL_TYPE) \ > + CLS_FIELD(0, dl_type, DL_TYPE) \ > CLS_FIELD(0, tp_src, TP_SRC) \ > CLS_FIELD(0, tp_dst, TP_DST) \ > CLS_FIELD(0, dl_src, DL_SRC) \ > @@ -223,6 +223,9 @@ match(const struct cls_rule *wild, const struct flow > *fixed) > } else if (f_idx == CLS_F_IDX_NW_PROTO) { > eq = !((fixed->nw_proto ^ wild->flow.nw_proto) > & wild->wc.nw_proto_mask); > + } else if (f_idx == CLS_F_IDX_DL_TYPE) { > + eq = !((fixed->dl_type ^ wild->flow.dl_type) > + & wild->wc.dl_type_mask); > } else { > NOT_REACHED(); > } > @@ -507,6 +510,8 @@ make_rule(int wc_fields, unsigned int priority, int > value_pat) > rule->cls_rule.wc.nw_tos_mask |= IP_DSCP_MASK; > } else if (f_idx == CLS_F_IDX_NW_PROTO) { > rule->cls_rule.wc.nw_proto_mask = UINT8_MAX; > + } else if (f_idx == CLS_F_IDX_DL_TYPE) { > + rule->cls_rule.wc.dl_type_mask = htons(UINT16_MAX); > } else { > NOT_REACHED(); > } > -- > 1.7.2.5 > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev