-/* Modifies 'rule' so that it matches only packets with an 802.1Q header whose
- * PCP equals the low 3 bits of 'dl_vlan_pcp'. */
-void
-cls_rule_set_dl_vlan_pcp(struct cls_rule *rule, uint8_t dl_vlan_pcp)
-{
- flow_set_vlan_pcp(&rule->flow, dl_vlan_pcp);
- rule->wc.vlan_tci_mask |= htons(VLAN_CFI | VLAN_PCP_MASK);
-}
-
-void
-cls_rule_set_tp_src(struct cls_rule *rule, ovs_be16 tp_src)
-{
- cls_rule_set_tp_src_masked(rule, tp_src, htons(UINT16_MAX));
-}
-
-void
-cls_rule_set_tp_src_masked(struct cls_rule *rule, ovs_be16 port, ovs_be16 mask)
-{
- rule->flow.tp_src = port & mask;
- rule->wc.tp_src_mask = mask;
-}
-
-void
-cls_rule_set_tp_dst(struct cls_rule *rule, ovs_be16 tp_dst)
-{
- cls_rule_set_tp_dst_masked(rule, tp_dst, htons(UINT16_MAX));
-}
-
-void
-cls_rule_set_tp_dst_masked(struct cls_rule *rule, ovs_be16 port, ovs_be16 mask)
-{
- rule->flow.tp_dst = port & mask;
- rule->wc.tp_dst_mask = mask;
-}
-
-void
-cls_rule_set_nw_proto(struct cls_rule *rule, uint8_t nw_proto)
-{
- rule->wc.wildcards &= ~FWW_NW_PROTO;
- rule->flow.nw_proto = nw_proto;
-}
-
-void
-cls_rule_set_nw_src(struct cls_rule *rule, ovs_be32 nw_src)
-{
- rule->flow.nw_src = nw_src;
- rule->wc.nw_src_mask = htonl(UINT32_MAX);
-}
-
-void
-cls_rule_set_nw_src_masked(struct cls_rule *rule,
- ovs_be32 nw_src, ovs_be32 mask)
-{
- rule->flow.nw_src = nw_src & mask;
- rule->wc.nw_src_mask = mask;
-}
-
-void
-cls_rule_set_nw_dst(struct cls_rule *rule, ovs_be32 nw_dst)
-{
- rule->flow.nw_dst = nw_dst;
- rule->wc.nw_dst_mask = htonl(UINT32_MAX);
-}
-
-void
-cls_rule_set_nw_dst_masked(struct cls_rule *rule, ovs_be32 ip, ovs_be32 mask)
-{
- rule->flow.nw_dst = ip & mask;
- rule->wc.nw_dst_mask = mask;
-}
-
-void
-cls_rule_set_nw_dscp(struct cls_rule *rule, uint8_t nw_dscp)
-{
- rule->wc.wildcards &= ~FWW_NW_DSCP;
- rule->flow.nw_tos &= ~IP_DSCP_MASK;
- rule->flow.nw_tos |= nw_dscp & IP_DSCP_MASK;
-}
-
-void
-cls_rule_set_nw_ecn(struct cls_rule *rule, uint8_t nw_ecn)
-{
- rule->wc.wildcards &= ~FWW_NW_ECN;
- rule->flow.nw_tos &= ~IP_ECN_MASK;
- rule->flow.nw_tos |= nw_ecn & IP_ECN_MASK;
-}
-
-void
-cls_rule_set_nw_ttl(struct cls_rule *rule, uint8_t nw_ttl)
-{
- rule->wc.wildcards &= ~FWW_NW_TTL;
- rule->flow.nw_ttl = nw_ttl;
-}
-
-void
-cls_rule_set_nw_frag(struct cls_rule *rule, uint8_t nw_frag)
-{
- rule->wc.nw_frag_mask |= FLOW_NW_FRAG_MASK;
- rule->flow.nw_frag = nw_frag;
-}
-
-void
-cls_rule_set_nw_frag_masked(struct cls_rule *rule,
- uint8_t nw_frag, uint8_t mask)
-{
- rule->flow.nw_frag = nw_frag & mask;
- rule->wc.nw_frag_mask = mask;
-}
-
-void
-cls_rule_set_icmp_type(struct cls_rule *rule, uint8_t icmp_type)
-{
- cls_rule_set_tp_src(rule, htons(icmp_type));
-}
-
-void
-cls_rule_set_icmp_code(struct cls_rule *rule, uint8_t icmp_code)
-{
- cls_rule_set_tp_dst(rule, htons(icmp_code));
-}
-
-void
-cls_rule_set_arp_sha(struct cls_rule *rule, const uint8_t sha[ETH_ADDR_LEN])
-{
- cls_rule_set_eth(sha, rule->flow.arp_sha, rule->wc.arp_sha_mask);
-}
-
-void
-cls_rule_set_arp_sha_masked(struct cls_rule *rule,
- const uint8_t arp_sha[ETH_ADDR_LEN],
- const uint8_t mask[ETH_ADDR_LEN])
-{
- cls_rule_set_eth_masked(arp_sha, mask,
- rule->flow.arp_sha, rule->wc.arp_sha_mask);
-}
-
-void
-cls_rule_set_arp_tha(struct cls_rule *rule, const uint8_t tha[ETH_ADDR_LEN])
-{
- cls_rule_set_eth(tha, rule->flow.arp_tha, rule->wc.arp_tha_mask);
-}
-
-void
-cls_rule_set_arp_tha_masked(struct cls_rule *rule,
- const uint8_t arp_tha[ETH_ADDR_LEN],
- const uint8_t mask[ETH_ADDR_LEN])
-{
- cls_rule_set_eth_masked(arp_tha, mask,
- rule->flow.arp_tha, rule->wc.arp_tha_mask);
-}