rule->flow.regs[reg_idx] = value & mask;
}
+void
+cls_rule_set_metadata(struct cls_rule *rule, ovs_be64 metadata)
+{
+ cls_rule_set_metadata_masked(rule, metadata, htonll(UINT64_MAX));
+}
+
+void
+cls_rule_set_metadata_masked(struct cls_rule *rule, ovs_be64 metadata,
+ ovs_be64 mask)
+{
+ rule->wc.metadata_mask = mask;
+ rule->flow.metadata = metadata & mask;
+}
+
void
cls_rule_set_tun_id(struct cls_rule *rule, ovs_be64 tun_id)
{
cls_rule_set_dl_vlan(struct cls_rule *rule, ovs_be16 dl_vlan)
{
flow_set_vlan_vid(&rule->flow, dl_vlan);
- if (dl_vlan == htons(OFP_VLAN_NONE)) {
+ if (dl_vlan == htons(OFP10_VLAN_NONE)) {
rule->wc.vlan_tci_mask = htons(UINT16_MAX);
} else {
rule->wc.vlan_tci_mask |= htons(VLAN_VID_MASK | VLAN_CFI);
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 11);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 12);
if (rule->priority != OFP_DEFAULT_PRIORITY) {
ds_put_format(s, "priority=%d,", rule->priority);
ntohll(f->tun_id), ntohll(wc->tun_id_mask));
break;
}
+ switch (wc->metadata_mask) {
+ case 0:
+ break;
+ case CONSTANT_HTONLL(UINT64_MAX):
+ ds_put_format(s, "metadata=%#"PRIx64",", ntohll(f->metadata));
+ break;
+ default:
+ ds_put_format(s, "metadata=%#"PRIx64"/%#"PRIx64",",
+ ntohll(f->metadata), ntohll(wc->metadata_mask));
+ break;
+ }
if (!(w & FWW_IN_PORT)) {
ds_put_format(s, "in_port=%"PRIu16",", f->in_port);
}
const flow_wildcards_t wc = wildcards->wildcards;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 11);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 12);
for (i = 0; i < FLOW_N_REGS; i++) {
if ((a->regs[i] ^ b->regs[i]) & wildcards->reg_masks[i]) {
}
return (!((a->tun_id ^ b->tun_id) & wildcards->tun_id_mask)
+ && !((a->metadata ^ b->metadata) & wildcards->metadata_mask)
&& !((a->nw_src ^ b->nw_src) & wildcards->nw_src_mask)
&& !((a->nw_dst ^ b->nw_dst) & wildcards->nw_dst_mask)
&& (wc & FWW_IN_PORT || a->in_port == b->in_port)
&& (wc & FWW_DL_TYPE || a->dl_type == b->dl_type)
&& !((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,
- wildcards->dl_src_mask)
- && !eth_addr_equal_except(a->dl_dst, b->dl_dst,
- wildcards->dl_dst_mask)
+ && eth_addr_equal_except(a->dl_src, b->dl_src,
+ wildcards->dl_src_mask)
+ && eth_addr_equal_except(a->dl_dst, b->dl_dst,
+ wildcards->dl_dst_mask)
&& (wc & FWW_NW_PROTO || a->nw_proto == b->nw_proto)
&& (wc & FWW_NW_TTL || a->nw_ttl == b->nw_ttl)
&& (wc & FWW_NW_DSCP || !((a->nw_tos ^ b->nw_tos) & IP_DSCP_MASK))