These seem slightly nicer than e.g. htons(UINT16_MAX).
Signed-off-by: Ben Pfaff <[email protected]>
---
include/openvswitch/types.h | 4 ++++
lib/learn.c | 2 +-
lib/match.c | 30 +++++++++++++++---------------
lib/meta-flow.c | 13 ++++++-------
lib/nx-match.c | 8 ++++----
lib/odp-util.c | 13 ++++++-------
lib/ofp-actions.c | 2 +-
lib/ofp-parse.c | 6 +++---
lib/ofp-print.c | 2 +-
lib/ofp-util.c | 18 +++++++++---------
lib/packets.c | 2 +-
ofproto/ofproto.c | 12 ++++++------
tests/test-classifier.c | 16 ++++++++--------
tests/test-util.c | 2 +-
14 files changed, 66 insertions(+), 64 deletions(-)
diff --git a/include/openvswitch/types.h b/include/openvswitch/types.h
index d07c1e8..8bfb218 100644
--- a/include/openvswitch/types.h
+++ b/include/openvswitch/types.h
@@ -38,6 +38,10 @@
typedef __be16 ovs_be16;
typedef __be32 ovs_be32;
typedef __be64 ovs_be64;
+
+#define OVS_BE16_MAX ((OVS_FORCE ovs_be16) 0xffff)
+#define OVS_BE32_MAX ((OVS_FORCE ovs_be32) 0xffffffff)
+#define OVS_BE64_MAX ((OVS_FORCE ovs_be64) 0xffffffffffffffffULL)
/* Netlink and OpenFlow both contain 64-bit values that are only guaranteed to
* be aligned on 32-bit boundaries. These types help.
diff --git a/lib/learn.c b/lib/learn.c
index 49d9efd..f4b827c 100644
--- a/lib/learn.c
+++ b/lib/learn.c
@@ -303,7 +303,7 @@ learn_execute(const struct ofpact_learn *learn, const
struct flow *flow,
fm->cookie = htonll(0);
fm->cookie_mask = htonll(0);
fm->new_cookie = htonll(learn->cookie);
- fm->modify_cookie = fm->new_cookie != htonll(UINT64_MAX);
+ fm->modify_cookie = fm->new_cookie != OVS_BE64_MAX;
fm->table_id = learn->table_id;
fm->command = OFPFC_MODIFY_STRICT;
fm->idle_timeout = learn->idle_timeout;
diff --git a/lib/match.c b/lib/match.c
index 6d66eba..bf82d6c 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -181,7 +181,7 @@ match_set_reg_masked(struct match *match, unsigned int
reg_idx,
void
match_set_metadata(struct match *match, ovs_be64 metadata)
{
- match_set_metadata_masked(match, metadata, htonll(UINT64_MAX));
+ match_set_metadata_masked(match, metadata, OVS_BE64_MAX);
}
void
@@ -195,7 +195,7 @@ match_set_metadata_masked(struct match *match,
void
match_set_tun_id(struct match *match, ovs_be64 tun_id)
{
- match_set_tun_id_masked(match, tun_id, htonll(UINT64_MAX));
+ match_set_tun_id_masked(match, tun_id, OVS_BE64_MAX);
}
void
@@ -208,7 +208,7 @@ match_set_tun_id_masked(struct match *match, ovs_be64
tun_id, ovs_be64 mask)
void
match_set_tun_src(struct match *match, ovs_be32 src)
{
- match_set_tun_src_masked(match, src, htonl(UINT32_MAX));
+ match_set_tun_src_masked(match, src, OVS_BE32_MAX);
}
void
@@ -221,7 +221,7 @@ match_set_tun_src_masked(struct match *match, ovs_be32 src,
ovs_be32 mask)
void
match_set_tun_dst(struct match *match, ovs_be32 dst)
{
- match_set_tun_dst_masked(match, dst, htonl(UINT32_MAX));
+ match_set_tun_dst_masked(match, dst, OVS_BE32_MAX);
}
void
@@ -294,7 +294,7 @@ match_set_skb_mark(struct match *match, uint32_t skb_mark)
void
match_set_dl_type(struct match *match, ovs_be16 dl_type)
{
- match->wc.masks.dl_type = htons(UINT16_MAX);
+ match->wc.masks.dl_type = OVS_BE16_MAX;
match->flow.dl_type = dl_type;
}
@@ -405,7 +405,7 @@ match_set_dl_vlan(struct match *match, ovs_be16 dl_vlan)
{
flow_set_dl_vlan(&match->flow, dl_vlan);
if (dl_vlan == htons(OFP10_VLAN_NONE)) {
- match->wc.masks.vlan_tci = htons(UINT16_MAX);
+ match->wc.masks.vlan_tci = OVS_BE16_MAX;
} else {
match->wc.masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI);
}
@@ -512,7 +512,7 @@ match_set_mpls_bos(struct match *match, uint8_t mpls_bos)
void
match_set_tp_src(struct match *match, ovs_be16 tp_src)
{
- match_set_tp_src_masked(match, tp_src, htons(UINT16_MAX));
+ match_set_tp_src_masked(match, tp_src, OVS_BE16_MAX);
}
void
@@ -525,7 +525,7 @@ match_set_tp_src_masked(struct match *match, ovs_be16 port,
ovs_be16 mask)
void
match_set_tp_dst(struct match *match, ovs_be16 tp_dst)
{
- match_set_tp_dst_masked(match, tp_dst, htons(UINT16_MAX));
+ match_set_tp_dst_masked(match, tp_dst, OVS_BE16_MAX);
}
void
@@ -546,7 +546,7 @@ void
match_set_nw_src(struct match *match, ovs_be32 nw_src)
{
match->flow.nw_src = nw_src;
- match->wc.masks.nw_src = htonl(UINT32_MAX);
+ match->wc.masks.nw_src = OVS_BE32_MAX;
}
void
@@ -561,7 +561,7 @@ void
match_set_nw_dst(struct match *match, ovs_be32 nw_dst)
{
match->flow.nw_dst = nw_dst;
- match->wc.masks.nw_dst = htonl(UINT32_MAX);
+ match->wc.masks.nw_dst = OVS_BE32_MAX;
}
void
@@ -686,7 +686,7 @@ match_set_ipv6_dst_masked(struct match *match, const struct
in6_addr *dst,
void
match_set_ipv6_label(struct match *match, ovs_be32 ipv6_label)
{
- match->wc.masks.ipv6_label = htonl(UINT32_MAX);
+ match->wc.masks.ipv6_label = OVS_BE32_MAX;
match->flow.ipv6_label = ipv6_label;
}
@@ -773,7 +773,7 @@ format_be16_masked(struct ds *s, const char *name,
{
if (mask != htons(0)) {
ds_put_format(s, "%s=", name);
- if (mask == htons(UINT16_MAX)) {
+ if (mask == OVS_BE16_MAX) {
ds_put_format(s, "%"PRIu16, ntohs(value));
} else {
ds_put_format(s, "0x%"PRIx16"/0x%"PRIx16,
@@ -792,7 +792,7 @@ format_flow_tunnel(struct ds *s, const struct match *match)
switch (wc->masks.tunnel.tun_id) {
case 0:
break;
- case CONSTANT_HTONLL(UINT64_MAX):
+ case OVS_BE64_MAX:
ds_put_format(s, "tun_id=%#"PRIx64",", ntohll(tnl->tun_id));
break;
default:
@@ -908,7 +908,7 @@ match_format(const struct match *match, struct ds *s,
unsigned int priority)
switch (wc->masks.metadata) {
case 0:
break;
- case CONSTANT_HTONLL(UINT64_MAX):
+ case OVS_BE64_MAX:
ds_put_format(s, "metadata=%#"PRIx64",", ntohll(f->metadata));
break;
default:
@@ -954,7 +954,7 @@ match_format(const struct match *match, struct ds *s,
unsigned int priority)
format_ipv6_netmask(s, "ipv6_src", &f->ipv6_src, &wc->masks.ipv6_src);
format_ipv6_netmask(s, "ipv6_dst", &f->ipv6_dst, &wc->masks.ipv6_dst);
if (wc->masks.ipv6_label) {
- if (wc->masks.ipv6_label == htonl(UINT32_MAX)) {
+ if (wc->masks.ipv6_label == OVS_BE32_MAX) {
ds_put_format(s, "ipv6_label=0x%05"PRIx32",",
ntohl(f->ipv6_label));
} else {
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 6b3b5eb..9153edf 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -2145,12 +2145,12 @@ mf_from_ipv4_string(const struct mf_field *mf, const
char *s,
return xasprintf("%s: network prefix bits not between 1 and "
"32", s);
} else if (prefix == 32) {
- *mask = htonl(UINT32_MAX);
+ *mask = OVS_BE32_MAX;
} else {
*mask = htonl(((1u << prefix) - 1) << (32 - prefix));
}
} else if (sscanf(s, IP_SCAN_FMT, IP_SCAN_ARGS(ip)) == IP_SCAN_COUNT) {
- *mask = htonl(UINT32_MAX);
+ *mask = OVS_BE32_MAX;
} else {
return xasprintf("%s: invalid IP address", s);
}
@@ -2208,7 +2208,7 @@ mf_from_ofp_port_string(const struct mf_field *mf, const
char *s,
if (ofputil_port_from_string(s, &port)) {
*valuep = htons(ofp_to_u16(port));
- *maskp = htons(UINT16_MAX);
+ *maskp = OVS_BE16_MAX;
return NULL;
}
return xasprintf("%s: port value out of range for %s", s, mf->name);
@@ -2223,7 +2223,7 @@ mf_from_ofp_port_string32(const struct mf_field *mf,
const char *s,
ovs_assert(mf->n_bytes == sizeof(ovs_be32));
if (ofputil_port_from_string(s, &port)) {
*valuep = ofputil_port_to_ofp11(port);
- *maskp = htonl(UINT32_MAX);
+ *maskp = OVS_BE32_MAX;
return NULL;
}
return xasprintf("%s: port value out of range for %s", s, mf->name);
@@ -2328,7 +2328,7 @@ static char *
mf_from_tun_flags_string(const char *s, ovs_be16 *valuep, ovs_be16 *maskp)
{
if (!parse_flow_tun_flags(s, flow_tun_flag_to_string, valuep)) {
- *maskp = htons(UINT16_MAX);
+ *maskp = OVS_BE16_MAX;
return NULL;
}
@@ -2496,8 +2496,7 @@ mf_format(const struct mf_field *mf,
break;
case MFS_IPV4:
- ip_format_masked(value->be32, mask ? mask->be32 : htonl(UINT32_MAX),
- s);
+ ip_format_masked(value->be32, mask ? mask->be32 : OVS_BE32_MAX, s);
break;
case MFS_IPV6:
diff --git a/lib/nx-match.c b/lib/nx-match.c
index 3a6d7cc..5e40b8a 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -183,7 +183,7 @@ nx_pull_raw(const uint8_t *p, unsigned int match_len, bool
strict,
if (NXM_HASMASK(header)) {
memcpy(cookie_mask, p + 4 + width, width);
} else {
- *cookie_mask = htonll(UINT64_MAX);
+ *cookie_mask = OVS_BE64_MAX;
}
error = 0;
}
@@ -361,7 +361,7 @@ nxm_put_16m(struct ofpbuf *b, uint32_t header, ovs_be16
value, ovs_be16 mask)
case 0:
break;
- case CONSTANT_HTONS(UINT16_MAX):
+ case OVS_BE16_MAX:
nxm_put_16(b, header, value);
break;
@@ -393,7 +393,7 @@ nxm_put_32m(struct ofpbuf *b, uint32_t header, ovs_be32
value, ovs_be32 mask)
case 0:
break;
- case CONSTANT_HTONL(UINT32_MAX):
+ case OVS_BE32_MAX:
nxm_put_32(b, header, value);
break;
@@ -425,7 +425,7 @@ nxm_put_64m(struct ofpbuf *b, uint32_t header, ovs_be64
value, ovs_be64 mask)
case 0:
break;
- case CONSTANT_HTONLL(UINT64_MAX):
+ case OVS_BE64_MAX:
nxm_put_64(b, header, value);
break;
diff --git a/lib/odp-util.c b/lib/odp-util.c
index b233cbe..7d4920a 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1694,7 +1694,7 @@ parse_odp_key_mask_attr(const char *s, const struct simap
*port_names,
(pcp << VLAN_PCP_SHIFT) |
VLAN_CFI));
if (mask) {
- nl_msg_put_be16(mask, OVS_KEY_ATTR_VLAN, htons(UINT16_MAX));
+ nl_msg_put_be16(mask, OVS_KEY_ATTR_VLAN, OVS_BE16_MAX);
}
return n;
} else if (mask && (sscanf(s,
"vlan(vid=%"SCNi16"/%"SCNi16",pcp=%i/%i,cfi=%i/%i)%n",
@@ -1715,7 +1715,7 @@ parse_odp_key_mask_attr(const char *s, const struct simap
*port_names,
(pcp << VLAN_PCP_SHIFT) |
(cfi ? VLAN_CFI : 0)));
if (mask) {
- nl_msg_put_be16(mask, OVS_KEY_ATTR_VLAN, htons(UINT16_MAX));
+ nl_msg_put_be16(mask, OVS_KEY_ATTR_VLAN, OVS_BE16_MAX);
}
return n;
}
@@ -1736,8 +1736,7 @@ parse_odp_key_mask_attr(const char *s, const struct simap
*port_names,
} else if (sscanf(s, "eth_type(%i)%n", ð_type, &n) > 0 && n > 0) {
nl_msg_put_be16(key, OVS_KEY_ATTR_ETHERTYPE, htons(eth_type));
if (mask) {
- nl_msg_put_be16(mask, OVS_KEY_ATTR_ETHERTYPE,
- htons(UINT16_MAX));
+ nl_msg_put_be16(mask, OVS_KEY_ATTR_ETHERTYPE, OVS_BE16_MAX);
}
return n;
}
@@ -1772,7 +1771,7 @@ parse_odp_key_mask_attr(const char *s, const struct simap
*port_names,
if (mask) {
mpls = nl_msg_put_unspec_uninit(mask, OVS_KEY_ATTR_MPLS,
sizeof *mpls);
- mpls->mpls_lse = htonl(UINT32_MAX);
+ mpls->mpls_lse = OVS_BE32_MAX;
}
return n;
}
@@ -2347,7 +2346,7 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct
flow *data,
if (flow->vlan_tci != htons(0) || flow->dl_type == htons(ETH_TYPE_VLAN)) {
if (is_mask) {
- nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(UINT16_MAX));
+ nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, OVS_BE16_MAX);
} else {
nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_TYPE_VLAN));
}
@@ -2373,7 +2372,7 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct
flow *data,
* 802.3 SNAP packet with valid eth_type).
*/
if (is_mask) {
- nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(UINT16_MAX));
+ nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, OVS_BE16_MAX);
}
goto unencap;
}
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 899928a..43bac31 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -2365,7 +2365,7 @@ ofpact_format(const struct ofpact *a, struct ds *s)
ovs_instruction_name_from_type(
OVSINST_OFPIT11_WRITE_METADATA),
ntohll(metadata->metadata));
- if (metadata->mask != htonll(UINT64_MAX)) {
+ if (metadata->mask != OVS_BE64_MAX) {
ds_put_format(s, "/%#"PRIx64, ntohll(metadata->mask));
}
break;
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 618290b..e776725 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -540,7 +540,7 @@ parse_metadata(struct ofpbuf *b, char *arg)
return error;
}
} else {
- om->mask = htonll(UINT64_MAX);
+ om->mask = OVS_BE64_MAX;
}
return str_to_be64(arg, &om->metadata);
@@ -1121,7 +1121,7 @@ parse_ofp_str__(struct ofputil_flow_mod *fm, int command,
char *string)
fm->cookie_mask = htonll(0);
if (command == OFPFC_MODIFY || command == OFPFC_MODIFY_STRICT) {
/* For modify, by default, don't update the cookie. */
- fm->new_cookie = htonll(UINT64_MAX);
+ fm->new_cookie = OVS_BE64_MAX;
} else{
fm->new_cookie = htonll(0);
}
@@ -1234,7 +1234,7 @@ parse_ofp_str__(struct ofputil_flow_mod *fm, int command,
char *string)
}
}
}
- if (!fm->cookie_mask && fm->new_cookie == htonll(UINT64_MAX)
+ if (!fm->cookie_mask && fm->new_cookie == OVS_BE64_MAX
&& (command == OFPFC_MODIFY || command == OFPFC_MODIFY_STRICT)) {
/* On modifies without a mask, we are supposed to add a flow if
* one does not exist. If a cookie wasn't been specified, use a
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 76bd09c..c6a9a3e 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -814,7 +814,7 @@ ofp_print_flow_mod(struct ds *s, const struct ofp_header
*oh, int verbosity)
if (ds_last(s) != ' ') {
ds_put_char(s, ' ');
}
- if (fm.new_cookie != htonll(0) && fm.new_cookie != htonll(UINT64_MAX)) {
+ if (fm.new_cookie != htonll(0) && fm.new_cookie != OVS_BE64_MAX) {
ds_put_format(s, "cookie:0x%"PRIx64" ", ntohll(fm.new_cookie));
}
if (fm.cookie_mask != htonll(0)) {
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 8921592..93e3294 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -106,10 +106,10 @@ ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct
flow_wildcards *wc)
>> OFPFW10_NW_DST_SHIFT);
if (!(ofpfw & OFPFW10_TP_SRC)) {
- wc->masks.tp_src = htons(UINT16_MAX);
+ wc->masks.tp_src = OVS_BE16_MAX;
}
if (!(ofpfw & OFPFW10_TP_DST)) {
- wc->masks.tp_dst = htons(UINT16_MAX);
+ wc->masks.tp_dst = OVS_BE16_MAX;
}
if (!(ofpfw & OFPFW10_DL_SRC)) {
@@ -119,7 +119,7 @@ ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct
flow_wildcards *wc)
memset(wc->masks.dl_dst, 0xff, ETH_ADDR_LEN);
}
if (!(ofpfw & OFPFW10_DL_TYPE)) {
- wc->masks.dl_type = htons(UINT16_MAX);
+ wc->masks.dl_type = OVS_BE16_MAX;
}
/* VLAN TCI mask. */
@@ -335,7 +335,7 @@ ofputil_match_from_ofp11_match(const struct ofp11_match
*ofmatch,
if (ofmatch->dl_vlan == htons(OFPVID11_NONE)) {
/* Match only packets without a VLAN tag. */
match->flow.vlan_tci = htons(0);
- match->wc.masks.vlan_tci = htons(UINT16_MAX);
+ match->wc.masks.vlan_tci = OVS_BE16_MAX;
} else {
if (ofmatch->dl_vlan == htons(OFPVID11_ANY)) {
/* Match any packet with a VLAN tag regardless of VID. */
@@ -1220,8 +1220,8 @@ ofputil_usable_protocols(const struct match *match)
}
/* NXM and OXM support bitwise matching on transport port. */
- if ((wc->masks.tp_src && wc->masks.tp_src != htons(UINT16_MAX)) ||
- (wc->masks.tp_dst && wc->masks.tp_dst != htons(UINT16_MAX))) {
+ if ((wc->masks.tp_src && wc->masks.tp_src != OVS_BE16_MAX) ||
+ (wc->masks.tp_dst && wc->masks.tp_dst != OVS_BE16_MAX)) {
return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM
| OFPUTIL_P_OF13_OXM;
}
@@ -1607,7 +1607,7 @@ ofputil_decode_flow_mod(struct ofputil_flow_mod *fm,
} else {
fm->cookie = ofm->cookie;
fm->cookie_mask = ofm->cookie_mask;
- fm->new_cookie = htonll(UINT64_MAX);
+ fm->new_cookie = OVS_BE64_MAX;
}
fm->modify_cookie = false;
fm->command = ofm->command;
@@ -1707,7 +1707,7 @@ ofputil_decode_flow_mod(struct ofputil_flow_mod *fm,
: OFPERR_OFPFMFC_TABLE_FULL);
}
- fm->modify_cookie = fm->new_cookie != htonll(UINT64_MAX);
+ fm->modify_cookie = fm->new_cookie != OVS_BE64_MAX;
if (protocol & OFPUTIL_P_TID) {
fm->command = command & 0xff;
fm->table_id = command >> 8;
@@ -3881,7 +3881,7 @@ ofputil_decode_role_message(const struct ofp_header *oh,
rr->role = ntohl(orr->role);
if (raw == OFPRAW_OFPT12_ROLE_REQUEST
? orr->role == htonl(OFPCR12_ROLE_NOCHANGE)
- : orr->generation_id == htonll(UINT64_MAX)) {
+ : orr->generation_id == OVS_BE64_MAX) {
rr->have_generation_id = false;
rr->generation_id = 0;
} else {
diff --git a/lib/packets.c b/lib/packets.c
index 7fe6513..985bf6c 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -449,7 +449,7 @@ void
ip_format_masked(ovs_be32 ip, ovs_be32 mask, struct ds *s)
{
ds_put_format(s, IP_FMT, IP_ARGS(ip));
- if (mask != htonl(UINT32_MAX)) {
+ if (mask != OVS_BE32_MAX) {
if (ip_is_cidr(mask)) {
ds_put_format(s, "/%d", ip_count_cidr_bits(mask));
} else {
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 3f4b8a7..922fe09 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -2608,8 +2608,8 @@ handle_table_stats_request(struct ofconn *ofconn,
ots[i].apply_actions = htonl(OFPAT11_OUTPUT);
ots[i].write_setfields = htonll(OFPXMT12_MASK);
ots[i].apply_setfields = htonll(OFPXMT12_MASK);
- ots[i].metadata_match = htonll(UINT64_MAX);
- ots[i].metadata_write = htonll(UINT64_MAX);
+ ots[i].metadata_match = OVS_BE64_MAX;
+ ots[i].metadata_write = OVS_BE64_MAX;
ots[i].instructions = htonl(OFPIT11_ALL);
ots[i].config = htonl(OFPTC11_TABLE_MISS_MASK);
ots[i].max_entries = htonl(1000000); /* An arbitrary big number. */
@@ -2851,7 +2851,7 @@ collect_rules_loose(struct ofproto *ofproto, uint8_t
table_id,
list_init(rules);
cls_rule_init(&cr, match, 0);
- if (cookie_mask == htonll(UINT64_MAX)) {
+ if (cookie_mask == OVS_BE64_MAX) {
struct rule *rule;
HINDEX_FOR_EACH_WITH_HASH (rule, cookie_node, hash_cookie(cookie),
@@ -2928,7 +2928,7 @@ collect_rules_strict(struct ofproto *ofproto, uint8_t
table_id,
list_init(rules);
cls_rule_init(&cr, match, priority);
- if (cookie_mask == htonll(UINT64_MAX)) {
+ if (cookie_mask == OVS_BE64_MAX) {
struct rule *rule;
HINDEX_FOR_EACH_WITH_HASH (rule, cookie_node, hash_cookie(cookie),
@@ -3481,7 +3481,7 @@ modify_flows__(struct ofproto *ofproto, struct ofconn
*ofconn,
op = ofoperation_create(group, rule, OFOPERATION_MODIFY, 0);
- if (fm->modify_cookie && fm->new_cookie != htonll(UINT64_MAX)) {
+ if (fm->modify_cookie && fm->new_cookie != OVS_BE64_MAX) {
ofproto_rule_change_cookie(ofproto, rule, fm->new_cookie);
}
if (actions_changed) {
@@ -3505,7 +3505,7 @@ static enum ofperr
modify_flows_add(struct ofproto *ofproto, struct ofconn *ofconn,
struct ofputil_flow_mod *fm, const struct ofp_header *request)
{
- if (fm->cookie_mask != htonll(0) || fm->new_cookie == htonll(UINT64_MAX)) {
+ if (fm->cookie_mask != htonll(0) || fm->new_cookie == OVS_BE64_MAX) {
return 0;
}
return add_flow(ofproto, ofconn, fm, request);
diff --git a/tests/test-classifier.c b/tests/test-classifier.c
index 7fb1447..b179644 100644
--- a/tests/test-classifier.c
+++ b/tests/test-classifier.c
@@ -525,29 +525,29 @@ make_rule(int wc_fields, unsigned int priority, int
value_pat)
values[f_idx][value_idx], f->len);
if (f_idx == CLS_F_IDX_NW_SRC) {
- match.wc.masks.nw_src = htonl(UINT32_MAX);
+ match.wc.masks.nw_src = OVS_BE32_MAX;
} else if (f_idx == CLS_F_IDX_NW_DST) {
- match.wc.masks.nw_dst = htonl(UINT32_MAX);
+ match.wc.masks.nw_dst = OVS_BE32_MAX;
} else if (f_idx == CLS_F_IDX_TP_SRC) {
- match.wc.masks.tp_src = htons(UINT16_MAX);
+ match.wc.masks.tp_src = OVS_BE16_MAX;
} else if (f_idx == CLS_F_IDX_TP_DST) {
- match.wc.masks.tp_dst = htons(UINT16_MAX);
+ match.wc.masks.tp_dst = OVS_BE16_MAX;
} else if (f_idx == CLS_F_IDX_DL_SRC) {
memset(match.wc.masks.dl_src, 0xff, ETH_ADDR_LEN);
} else if (f_idx == CLS_F_IDX_DL_DST) {
memset(match.wc.masks.dl_dst, 0xff, ETH_ADDR_LEN);
} else if (f_idx == CLS_F_IDX_VLAN_TCI) {
- match.wc.masks.vlan_tci = htons(UINT16_MAX);
+ match.wc.masks.vlan_tci = OVS_BE16_MAX;
} else if (f_idx == CLS_F_IDX_TUN_ID) {
- match.wc.masks.tunnel.tun_id = htonll(UINT64_MAX);
+ match.wc.masks.tunnel.tun_id = OVS_BE64_MAX;
} else if (f_idx == CLS_F_IDX_METADATA) {
- match.wc.masks.metadata = htonll(UINT64_MAX);
+ match.wc.masks.metadata = OVS_BE64_MAX;
} else if (f_idx == CLS_F_IDX_NW_DSCP) {
match.wc.masks.nw_tos |= IP_DSCP_MASK;
} else if (f_idx == CLS_F_IDX_NW_PROTO) {
match.wc.masks.nw_proto = UINT8_MAX;
} else if (f_idx == CLS_F_IDX_DL_TYPE) {
- match.wc.masks.dl_type = htons(UINT16_MAX);
+ match.wc.masks.dl_type = OVS_BE16_MAX;
} else if (f_idx == CLS_F_IDX_IN_PORT) {
match.wc.masks.in_port.ofp_port = u16_to_ofp(UINT16_MAX);
} else {
diff --git a/tests/test-util.c b/tests/test-util.c
index 5afe2f7..3b94254 100644
--- a/tests/test-util.c
+++ b/tests/test-util.c
@@ -256,7 +256,7 @@ test_bitwise_one(int argc OVS_UNUSED, char *argv[]
OVS_UNUSED)
ovs_be64 expect;
if (n_bits == 64) {
- expect = htonll(UINT64_MAX);
+ expect = OVS_BE64_MAX;
} else {
uint64_t mask = (UINT64_C(1) << n_bits) - 1;
expect = orig_dst | htonll(mask << dst_ofs);
--
1.7.2.5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev