Unfortunately this and the last patch of the series does not apply to master, 
so you’d need to rebase these.

  Jarno

> On Aug 30, 2016, at 6:47 PM, Daniele Di Proietto <diproiet...@vmware.com> 
> wrote:
> 
> I think it makes the code more readable. No functional change.
> 
> Signed-off-by: Daniele Di Proietto <diproiet...@vmware.com>
> ---
> lib/bfd.c                    | 36 ++++++++++++----------------
> lib/cfm.c                    |  9 +++----
> lib/flow.c                   | 42 ++++++++++++++++----------------
> lib/flow.h                   | 47 +++++++++++++-----------------------
> lib/odp-util.c               |  2 +-
> lib/tnl-neigh-cache.c        |  6 ++---
> lib/tnl-ports.c              |  2 +-
> ofproto/netflow.c            |  6 ++---
> ofproto/ofproto-dpif-xlate.c | 57 +++++++++++++++++++-------------------------
> ofproto/tunnel.c             |  2 +-
> 10 files changed, 92 insertions(+), 117 deletions(-)
> 
> diff --git a/lib/bfd.c b/lib/bfd.c
> index 87f3322..203a56e 100644
> --- a/lib/bfd.c
> +++ b/lib/bfd.c
> @@ -648,30 +648,24 @@ bfd_should_process_flow(const struct bfd *bfd_, const 
> struct flow *flow,
> {
>     struct bfd *bfd = CONST_CAST(struct bfd *, bfd_);
> 
> -    if (!eth_addr_is_zero(bfd->rmt_eth_dst)) {
> -        memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
> -
> -        if (!eth_addr_equals(bfd->rmt_eth_dst, flow->dl_dst)) {
> -            return false;
> -        }
> +    if (!eth_addr_is_zero(bfd->rmt_eth_dst)
> +        && !eth_addr_equals(bfd->rmt_eth_dst,
> +                            FLOW_WC_GET_AND_MASK_WC(flow, wc, dl_dst))) {
> +        return false;
>     }
> 
> -    if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -        memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -        if (flow->nw_proto == IPPROTO_UDP && !(flow->nw_frag & 
> FLOW_NW_FRAG_LATER)) {
> -            memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
> -            if (flow->tp_dst == htons(BFD_DEST_PORT)) {
> -                bool check_tnl_key;
> -
> -                atomic_read_relaxed(&bfd->check_tnl_key, &check_tnl_key);
> -                if (check_tnl_key) {
> -                    memset(&wc->masks.tunnel.tun_id, 0xff,
> -                           sizeof wc->masks.tunnel.tun_id);
> -                    return flow->tunnel.tun_id == htonll(0);
> -                }
> -                return true;
> -            }
> +    if (flow->dl_type == htons(ETH_TYPE_IP)
> +        && FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == IPPROTO_UDP
> +        && !(flow->nw_frag & FLOW_NW_FRAG_LATER)
> +        && FLOW_WC_GET_AND_MASK_WC(flow, wc, tp_dst) == 
> htons(BFD_DEST_PORT)) {
> +        bool check_tnl_key;
> +
> +        atomic_read_relaxed(&bfd->check_tnl_key, &check_tnl_key);
> +        if (check_tnl_key) {
> +            return FLOW_WC_GET_AND_MASK_WC(flow, wc, tunnel.tun_id)
> +                   == htonll(0);
>         }
> +        return true;
>     }
>     return false;
> }
> diff --git a/lib/cfm.c b/lib/cfm.c
> index 7bc22e3..3c55333 100644
> --- a/lib/cfm.c
> +++ b/lib/cfm.c
> @@ -731,16 +731,17 @@ cfm_should_process_flow(const struct cfm *cfm_, const 
> struct flow *flow,
>         return false;
>     }
> 
> -    memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
> -    if (OVS_UNLIKELY(!eth_addr_equals(flow->dl_dst, cfm_ccm_addr(cfm)))) {
> +    if (OVS_UNLIKELY(
> +        !eth_addr_equals(FLOW_WC_GET_AND_MASK_WC(flow, wc, dl_dst),
> +                         cfm_ccm_addr(cfm)))) {
>         return false;
>     }
> 
>     atomic_read_relaxed(&cfm->check_tnl_key, &check_tnl_key);
> 
>     if (check_tnl_key) {
> -        memset(&wc->masks.tunnel.tun_id, 0xff, sizeof 
> wc->masks.tunnel.tun_id);
> -        return flow->tunnel.tun_id == htonll(0);
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, tunnel.tun_id)
> +               == htonll(0);
>     }
>     return true;
> }
> diff --git a/lib/flow.c b/lib/flow.c
> index ba4f8c7..8f052ba 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -855,8 +855,8 @@ void
> flow_unwildcard_tp_ports(const struct flow *flow, struct flow_wildcards *wc)
> {
>     if (flow->nw_proto != IPPROTO_ICMP) {
> -        memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> -        memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
> +        WC_MASK_FIELD(wc, tp_src);
> +        WC_MASK_FIELD(wc, tp_dst);
>     } else {
>         wc->masks.tp_src = htons(0xff);
>         wc->masks.tp_dst = htons(0xff);
> @@ -1478,8 +1478,8 @@ flow_wildcards_clear_non_packet_fields(struct 
> flow_wildcards *wc)
>     /* Update this function whenever struct flow changes. */
>     BUILD_ASSERT_DECL(FLOW_WC_SEQ == 36);
> 
> -    memset(&wc->masks.metadata, 0, sizeof wc->masks.metadata);
> -    memset(&wc->masks.regs, 0, sizeof wc->masks.regs);
> +    WC_UNMASK_FIELD(wc, metadata);
> +    WC_UNMASK_FIELD(wc, regs);
>     wc->masks.actset_output = 0;
>     wc->masks.conj_id = 0;
> }
> @@ -1834,21 +1834,21 @@ flow_mask_hash_fields(const struct flow *flow, struct 
> flow_wildcards *wc,
> {
>     switch (fields) {
>     case NX_HASH_FIELDS_ETH_SRC:
> -        memset(&wc->masks.dl_src, 0xff, sizeof wc->masks.dl_src);
> +        WC_MASK_FIELD(wc, dl_src);
>         break;
> 
>     case NX_HASH_FIELDS_SYMMETRIC_L4:
> -        memset(&wc->masks.dl_src, 0xff, sizeof wc->masks.dl_src);
> -        memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
> +        WC_MASK_FIELD(wc, dl_src);
> +        WC_MASK_FIELD(wc, dl_dst);
>         if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -            memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
> -            memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
> +            WC_MASK_FIELD(wc, nw_src);
> +            WC_MASK_FIELD(wc, nw_dst);
>         } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
> -            memset(&wc->masks.ipv6_src, 0xff, sizeof wc->masks.ipv6_src);
> -            memset(&wc->masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst);
> +            WC_MASK_FIELD(wc, ipv6_src);
> +            WC_MASK_FIELD(wc, ipv6_dst);
>         }
>         if (is_ip_any(flow)) {
> -            memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> +            WC_MASK_FIELD(wc, nw_proto);
>             flow_unwildcard_tp_ports(flow, wc);
>         }
>         wc->masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI);
> @@ -1856,25 +1856,25 @@ flow_mask_hash_fields(const struct flow *flow, struct 
> flow_wildcards *wc,
> 
>     case NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP:
>         if (is_ip_any(flow) && flow->nw_proto == IPPROTO_UDP) {
> -            memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> -            memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
> +            WC_MASK_FIELD(wc, tp_src);
> +            WC_MASK_FIELD(wc, tp_dst);
>         }
>         /* no break */
>     case NX_HASH_FIELDS_SYMMETRIC_L3L4:
>         if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -            memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
> -            memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
> +            WC_MASK_FIELD(wc, nw_src);
> +            WC_MASK_FIELD(wc, nw_dst);
>         } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
> -            memset(&wc->masks.ipv6_src, 0xff, sizeof wc->masks.ipv6_src);
> -            memset(&wc->masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst);
> +            WC_MASK_FIELD(wc, ipv6_src);
> +            WC_MASK_FIELD(wc, ipv6_dst);
>         } else {
>             break; /* non-IP flow */
>         }
> 
> -        memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> +        WC_MASK_FIELD(wc, nw_proto);
>         if (flow->nw_proto == IPPROTO_TCP || flow->nw_proto == IPPROTO_SCTP) {
> -            memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> -            memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
> +            WC_MASK_FIELD(wc, tp_src);
> +            WC_MASK_FIELD(wc, tp_dst);
>         }
>         break;
> 
> diff --git a/lib/flow.h b/lib/flow.h
> index ea24e28..fb5e006 100644
> --- a/lib/flow.h
> +++ b/lib/flow.h
> @@ -861,13 +861,18 @@ pkt_metadata_from_flow(struct pkt_metadata *md, const 
> struct flow *flow)
> #define FLOW_WC_GET_AND_MASK_WC(FLOW, WC, FIELD) \
>     (((WC) ? WC_MASK_FIELD(WC, FIELD) : NULL), ((FLOW)->FIELD))
> 
> +/* Like the above, but only unwildcards the set bits in 'MASK'.  'MASK' is 
> also
> + * applied to the returned value. */
> +
> +#define FLOW_WC_GET_AND_MASK_WC_MASKED(FLOW, WC, FIELD, MASK) \
> +    (((WC) ? WC_MASK_FIELD_MASK(WC, FIELD, MASK) : 0), \
> +     (((FLOW)->FIELD) & (MASK)))
> +
> static inline bool is_vlan(const struct flow *flow,
>                            struct flow_wildcards *wc)
> {
> -    if (wc) {
> -        WC_MASK_FIELD_MASK(wc, vlan_tci, htons(VLAN_CFI));
> -    }
> -    return (flow->vlan_tci & htons(VLAN_CFI)) != 0;
> +    return FLOW_WC_GET_AND_MASK_WC_MASKED(flow, wc, vlan_tci,
> +                                          htons(VLAN_CFI)) != 0;
> }
> 
> static inline bool is_ip_any(const struct flow *flow)
> @@ -879,10 +884,7 @@ static inline bool is_ip_proto(const struct flow *flow, 
> uint8_t ip_proto,
>                                struct flow_wildcards *wc)
> {
>     if (is_ip_any(flow)) {
> -        if (wc) {
> -            WC_MASK_FIELD(wc, nw_proto);
> -        }
> -        return flow->nw_proto == ip_proto;
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == ip_proto;
>     }
>     return false;
> }
> @@ -909,10 +911,7 @@ static inline bool is_icmpv4(const struct flow *flow,
>                              struct flow_wildcards *wc)
> {
>     if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -        if (wc) {
> -            memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -        }
> -        return flow->nw_proto == IPPROTO_ICMP;
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == IPPROTO_ICMP;
>     }
>     return false;
> }
> @@ -921,10 +920,7 @@ static inline bool is_icmpv6(const struct flow *flow,
>                              struct flow_wildcards *wc)
> {
>     if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
> -        if (wc) {
> -            memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -        }
> -        return flow->nw_proto == IPPROTO_ICMPV6;
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == IPPROTO_ICMPV6;
>     }
>     return false;
> }
> @@ -933,15 +929,12 @@ static inline bool is_nd(const struct flow *flow,
>                          struct flow_wildcards *wc)
> {
>     if (is_icmpv6(flow, wc)) {
> -        if (wc) {
> -            memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
> -        }
> -        if (flow->tp_dst != htons(0)) {
> +        if (FLOW_WC_GET_AND_MASK_WC(flow, wc, tp_dst) != htons(0)) {
>             return false;
>         }
> 
>         if (wc) {
> -            memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> +            WC_MASK_FIELD(wc, tp_src);
>         }
>         return (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT) ||
>                 flow->tp_src == htons(ND_NEIGHBOR_ADVERT));
> @@ -952,10 +945,7 @@ static inline bool is_nd(const struct flow *flow,
> static inline bool is_igmp(const struct flow *flow, struct flow_wildcards *wc)
> {
>     if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -        if (wc) {
> -            memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -        }
> -        return flow->nw_proto == IPPROTO_IGMP;
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == IPPROTO_IGMP;
>     }
>     return false;
> }
> @@ -965,7 +955,7 @@ static inline bool is_mld(const struct flow *flow,
> {
>     if (is_icmpv6(flow, wc)) {
>         if (wc) {
> -            memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> +            WC_MASK_FIELD(wc, tp_src);
>         }
>         return (flow->tp_src == htons(MLD_QUERY)
>                 || flow->tp_src == htons(MLD_REPORT)
> @@ -979,10 +969,7 @@ static inline bool is_mld_query(const struct flow *flow,
>                                 struct flow_wildcards *wc)
> {
>     if (is_icmpv6(flow, wc)) {
> -        if (wc) {
> -            memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> -        }
> -        return flow->tp_src == htons(MLD_QUERY);
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, tp_src) == htons(MLD_QUERY);
>     }
>     return false;
> }
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 6d29b67..c1f22fc 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -5493,7 +5493,7 @@ static void
> pop_vlan(struct flow *base,
>          struct ofpbuf *odp_actions, struct flow_wildcards *wc)
> {
> -    memset(&wc->masks.vlan_tci, 0xff, sizeof wc->masks.vlan_tci);
> +    WC_MASK_FIELD(wc, vlan_tci);
> 
>     if (base->vlan_tci & htons(VLAN_CFI)) {
>         nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_VLAN);
> diff --git a/lib/tnl-neigh-cache.c b/lib/tnl-neigh-cache.c
> index 499efff..37900e2 100644
> --- a/lib/tnl-neigh-cache.c
> +++ b/lib/tnl-neigh-cache.c
> @@ -178,9 +178,9 @@ tnl_nd_snoop(const struct flow *flow, struct 
> flow_wildcards *wc,
>         return EINVAL;
>     }
> 
> -    memset(&wc->masks.ipv6_src, 0xff, sizeof wc->masks.ipv6_src);
> -    memset(&wc->masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst);
> -    memset(&wc->masks.nd_target, 0xff, sizeof wc->masks.nd_target);
> +    WC_MASK_FIELD(wc, ipv6_src);
> +    WC_MASK_FIELD(wc, ipv6_dst);
> +    WC_MASK_FIELD(wc, nd_target);
> 
>     tnl_neigh_set__(name, &flow->nd_target, flow->arp_tha);
>     return 0;
> diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c
> index ffa1389..9d928f4 100644
> --- a/lib/tnl-ports.c
> +++ b/lib/tnl-ports.c
> @@ -137,7 +137,7 @@ map_insert(odp_port_t port, struct eth_addr mac, struct 
> in6_addr *addr,
>             match.wc.masks.ipv6_dst = in6addr_exact;
>         }
>         match.wc.masks.vlan_tci = OVS_BE16_MAX;
> -        memset(&match.wc.masks.dl_dst, 0xff, sizeof (struct eth_addr));
> +        WC_MASK_FIELD(&match.wc, dl_dst);
> 
>         cls_rule_init(&p->cr, &match, 0); /* Priority == 0. */
>         ovs_refcount_init(&p->ref_cnt);
> diff --git a/ofproto/netflow.c b/ofproto/netflow.c
> index 55f7814..cd2b932 100644
> --- a/ofproto/netflow.c
> +++ b/ofproto/netflow.c
> @@ -95,9 +95,9 @@ netflow_mask_wc(const struct flow *flow, struct 
> flow_wildcards *wc)
>     if (flow->dl_type != htons(ETH_TYPE_IP)) {
>         return;
>     }
> -    memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -    memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
> -    memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
> +    WC_MASK_FIELD(wc, nw_proto);
> +    WC_MASK_FIELD(wc, nw_src);
> +    WC_MASK_FIELD(wc, nw_dst);
>     flow_unwildcard_tp_ports(flow, wc);
>     wc->masks.nw_tos |= IP_DSCP_MASK;
> }
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index 0403c98..573e639 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -1393,7 +1393,7 @@ static bool
> stp_should_process_flow(const struct flow *flow, struct flow_wildcards *wc)
> {
>     /* is_stp() also checks dl_type, but dl_type is always set in 'wc'. */
> -    memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
> +    WC_MASK_FIELD(wc, dl_dst);
>     return is_stp(flow);
> }
> 
> @@ -1969,19 +1969,15 @@ is_gratuitous_arp(const struct flow *flow, struct 
> flow_wildcards *wc)
>         return false;
>     }
> 
> -    memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
> -    if (!eth_addr_is_broadcast(flow->dl_dst)) {
> +    if (!eth_addr_is_broadcast(FLOW_WC_GET_AND_MASK_WC(flow, wc, dl_dst))) {
>         return false;
>     }
> 
> -    memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -    if (flow->nw_proto == ARP_OP_REPLY) {
> +    if (FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == ARP_OP_REPLY) {
>         return true;
> -    } else if (flow->nw_proto == ARP_OP_REQUEST) {
> -        memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
> -        memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
> -
> -        return flow->nw_src == flow->nw_dst;
> +    } else if (FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_proto) == 
> ARP_OP_REQUEST) {
> +        return FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_src)
> +               == FLOW_WC_GET_AND_MASK_WC(flow, wc, nw_dst);
>     } else {
>         return false;
>     }
> @@ -2408,10 +2404,10 @@ static bool
> is_ip_local_multicast(const struct flow *flow, struct flow_wildcards *wc)
> {
>     if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -        memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
> -        return ip_is_local_multicast(flow->nw_dst);
> +        return ip_is_local_multicast(FLOW_WC_GET_AND_MASK_WC(flow, wc,
> +                                                             nw_dst));
>     } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
> -        memset(&wc->masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst);
> +        WC_MASK_FIELD(wc, ipv6_dst);
>         return ipv6_is_all_hosts(&flow->ipv6_dst);
>     } else {
>         return false;
> @@ -2430,8 +2426,8 @@ xlate_normal(struct xlate_ctx *ctx)
>     uint16_t vlan;
>     uint16_t vid;
> 
> -    memset(&wc->masks.dl_src, 0xff, sizeof wc->masks.dl_src);
> -    memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
> +    WC_MASK_FIELD(wc, dl_src);
> +    WC_MASK_FIELD(wc, dl_dst);
>     wc->masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI);
> 
>     in_xbundle = lookup_input_bundle(ctx->xbridge, flow->in_port.ofp_port,
> @@ -2502,7 +2498,7 @@ xlate_normal(struct xlate_ctx *ctx)
>         struct mcast_group *grp = NULL;
> 
>         if (is_igmp(flow, wc)) {
> -            memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> +            WC_MASK_FIELD(wc, tp_src);
>             if (mcast_snooping_is_membership(flow->tp_src) ||
>                 mcast_snooping_is_query(flow->tp_src)) {
>                 if (ctx->xin->may_learn && ctx->xin->packet) {
> @@ -3151,7 +3147,7 @@ compose_output_action__(struct xlate_ctx *ctx, 
> ofp_port_t ofp_port,
>     flow_nw_tos = flow->nw_tos;
> 
>     if (count_skb_priorities(xport)) {
> -        memset(&wc->masks.skb_priority, 0xff, sizeof wc->masks.skb_priority);
> +        WC_MASK_FIELD(wc, skb_priority);
>         if (dscp_from_skb_priority(xport, flow->skb_priority, &dscp)) {
>             wc->masks.nw_tos |= IP_DSCP_MASK;
>             flow->nw_tos &= ~IP_DSCP_MASK;
> @@ -4787,8 +4783,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
>             break;
> 
>         case OFPACT_ENQUEUE:
> -            memset(&wc->masks.skb_priority, 0xff,
> -                   sizeof wc->masks.skb_priority);
> +            WC_MASK_FIELD(wc, skb_priority);
>             xlate_enqueue_action(ctx, ofpact_get_ENQUEUE(a));
>             break;
> 
> @@ -4813,13 +4808,13 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
>             break;
> 
>         case OFPACT_STRIP_VLAN:
> -            memset(&wc->masks.vlan_tci, 0xff, sizeof wc->masks.vlan_tci);
> +            WC_MASK_FIELD(wc, vlan_tci);
>             flow->vlan_tci = htons(0);
>             break;
> 
>         case OFPACT_PUSH_VLAN:
>             /* XXX 802.1AD(QinQ) */
> -            memset(&wc->masks.vlan_tci, 0xff, sizeof wc->masks.vlan_tci);
> +            WC_MASK_FIELD(wc, vlan_tci);
>             flow->vlan_tci = htons(VLAN_CFI);
>             break;
> 
> @@ -4835,14 +4830,14 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
> 
>         case OFPACT_SET_IPV4_SRC:
>             if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -                memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
> +                WC_MASK_FIELD(wc, nw_src);
>                 flow->nw_src = ofpact_get_SET_IPV4_SRC(a)->ipv4;
>             }
>             break;
> 
>         case OFPACT_SET_IPV4_DST:
>             if (flow->dl_type == htons(ETH_TYPE_IP)) {
> -                memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
> +                WC_MASK_FIELD(wc, nw_dst);
>                 flow->nw_dst = ofpact_get_SET_IPV4_DST(a)->ipv4;
>             }
>             break;
> @@ -4872,16 +4867,16 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
> 
>         case OFPACT_SET_L4_SRC_PORT:
>             if (is_ip_any(flow) && !(flow->nw_frag & FLOW_NW_FRAG_LATER)) {
> -                memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -                memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
> +                WC_MASK_FIELD(wc, nw_proto);
> +                WC_MASK_FIELD(wc, tp_src);
>                 flow->tp_src = htons(ofpact_get_SET_L4_SRC_PORT(a)->port);
>             }
>             break;
> 
>         case OFPACT_SET_L4_DST_PORT:
>             if (is_ip_any(flow) && !(flow->nw_frag & FLOW_NW_FRAG_LATER)) {
> -                memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> -                memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
> +                WC_MASK_FIELD(wc, nw_proto);
> +                WC_MASK_FIELD(wc, tp_dst);
>                 flow->tp_dst = htons(ofpact_get_SET_L4_DST_PORT(a)->port);
>             }
>             break;
> @@ -4902,14 +4897,12 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
>             break;
> 
>         case OFPACT_SET_QUEUE:
> -            memset(&wc->masks.skb_priority, 0xff,
> -                   sizeof wc->masks.skb_priority);
> +            WC_MASK_FIELD(wc, skb_priority);
>             xlate_set_queue_action(ctx, ofpact_get_SET_QUEUE(a)->queue_id);
>             break;
> 
>         case OFPACT_POP_QUEUE:
> -            memset(&wc->masks.skb_priority, 0xff,
> -                   sizeof wc->masks.skb_priority);
> +            WC_MASK_FIELD(wc, skb_priority);
>             flow->skb_priority = ctx->orig_skb_priority;
>             break;
> 
> @@ -5024,7 +5017,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
>             break;
>         }
>         case OFPACT_FIN_TIMEOUT:
> -            memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
> +            WC_MASK_FIELD(wc, nw_proto);
>             xlate_fin_timeout(ctx, ofpact_get_FIN_TIMEOUT(a));
>             break;
> 
> diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
> index 9a69071..4b48c37 100644
> --- a/ofproto/tunnel.c
> +++ b/ofproto/tunnel.c
> @@ -383,7 +383,7 @@ tnl_wc_init(struct flow *flow, struct flow_wildcards *wc)
>         wc->masks.tunnel.tp_src = 0;
>         wc->masks.tunnel.tp_dst = 0;
> 
> -        memset(&wc->masks.pkt_mark, 0xff, sizeof wc->masks.pkt_mark);
> +        WC_MASK_FIELD(wc, pkt_mark);
> 
>         if (is_ip_any(flow)
>             && IP_ECN_is_ce(flow->tunnel.ip_tos)) {
> -- 
> 2.9.3
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to