These seem slightly nicer than e.g. htons(UINT16_MAX).
Signed-off-by: Ben Pfaff <blp@nicira.com>
14 files changed:
typedef __be16 ovs_be16;
typedef __be32 ovs_be32;
typedef __be64 ovs_be64;
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)
\f
/* These types help with a few funny situations:
*
\f
/* These types help with a few funny situations:
*
fm->cookie = htonll(0);
fm->cookie_mask = htonll(0);
fm->new_cookie = htonll(learn->cookie);
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;
fm->table_id = learn->table_id;
fm->command = OFPFC_MODIFY_STRICT;
fm->idle_timeout = learn->idle_timeout;
void
match_set_metadata(struct match *match, ovs_be64 metadata)
{
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
match_set_tun_id(struct match *match, ovs_be64 tun_id)
{
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
match_set_tun_src(struct match *match, ovs_be32 src)
{
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
match_set_tun_dst(struct match *match, ovs_be32 dst)
{
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
match_set_dl_type(struct match *match, ovs_be16 dl_type)
{
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;
}
match->flow.dl_type = dl_type;
}
{
flow_set_dl_vlan(&match->flow, dl_vlan);
if (dl_vlan == htons(OFP10_VLAN_NONE)) {
{
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);
}
} else {
match->wc.masks.vlan_tci |= htons(VLAN_VID_MASK | VLAN_CFI);
}
void
match_set_tp_src(struct match *match, ovs_be16 tp_src)
{
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
match_set_tp_dst(struct match *match, ovs_be16 tp_dst)
{
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);
match_set_nw_src(struct match *match, ovs_be32 nw_src)
{
match->flow.nw_src = nw_src;
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;
match_set_nw_dst(struct match *match, ovs_be32 nw_dst)
{
match->flow.nw_dst = nw_dst;
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
match_set_ipv6_label(struct match *match, ovs_be32 ipv6_label)
{
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;
}
match->flow.ipv6_label = ipv6_label;
}
{
if (mask != htons(0)) {
ds_put_format(s, "%s=", 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,
ds_put_format(s, "%"PRIu16, ntohs(value));
} else {
ds_put_format(s, "0x%"PRIx16"/0x%"PRIx16,
switch (wc->masks.tunnel.tun_id) {
case 0:
break;
switch (wc->masks.tunnel.tun_id) {
case 0:
break;
- case CONSTANT_HTONLL(UINT64_MAX):
ds_put_format(s, "tun_id=%#"PRIx64",", ntohll(tnl->tun_id));
break;
default:
ds_put_format(s, "tun_id=%#"PRIx64",", ntohll(tnl->tun_id));
break;
default:
switch (wc->masks.metadata) {
case 0:
break;
switch (wc->masks.metadata) {
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",", ntohll(f->metadata));
break;
default:
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) {
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 {
ds_put_format(s, "ipv6_label=0x%05"PRIx32",",
ntohl(f->ipv6_label));
} else {
return xasprintf("%s: network prefix bits not between 1 and "
"32", s);
} else if (prefix == 32) {
return xasprintf("%s: network prefix bits not between 1 and "
"32", s);
} else if (prefix == 32) {
- *mask = htonl(UINT32_MAX);
} else {
*mask = htonl(((1u << prefix) - 1) << (32 - prefix));
}
} else if (sscanf(s, IP_SCAN_FMT, IP_SCAN_ARGS(ip)) == IP_SCAN_COUNT) {
} 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);
} else {
return xasprintf("%s: invalid IP address", s);
}
} else {
return xasprintf("%s: invalid IP address", s);
}
if (ofputil_port_from_string(s, &port)) {
*valuep = htons(ofp_to_u16(port));
if (ofputil_port_from_string(s, &port)) {
*valuep = htons(ofp_to_u16(port));
- *maskp = htons(UINT16_MAX);
return NULL;
}
return xasprintf("%s: port value out of range for %s", s, mf->name);
return NULL;
}
return xasprintf("%s: port value out of range for %s", s, mf->name);
ovs_assert(mf->n_bytes == sizeof(ovs_be32));
if (ofputil_port_from_string(s, &port)) {
*valuep = ofputil_port_to_ofp11(port);
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);
return NULL;
}
return xasprintf("%s: port value out of range for %s", s, mf->name);
return NULL;
}
return xasprintf("%s: port value out of range for %s", s, mf->name);
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)) {
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);
- ip_format_masked(value->be32, mask ? mask->be32 : htonl(UINT32_MAX),
- s);
+ ip_format_masked(value->be32, mask ? mask->be32 : OVS_BE32_MAX, s);
if (NXM_HASMASK(header)) {
memcpy(cookie_mask, p + 4 + width, width);
} else {
if (NXM_HASMASK(header)) {
memcpy(cookie_mask, p + 4 + width, width);
} else {
- *cookie_mask = htonll(UINT64_MAX);
+ *cookie_mask = OVS_BE64_MAX;
- case CONSTANT_HTONS(UINT16_MAX):
nxm_put_16(b, header, value);
break;
nxm_put_16(b, header, value);
break;
- case CONSTANT_HTONL(UINT32_MAX):
nxm_put_32(b, header, value);
break;
nxm_put_32(b, header, value);
break;
- case CONSTANT_HTONLL(UINT64_MAX):
nxm_put_64(b, header, value);
break;
nxm_put_64(b, header, value);
break;
(pcp << VLAN_PCP_SHIFT) |
VLAN_CFI));
if (mask) {
(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",
}
return n;
} else if (mask && (sscanf(s, "vlan(vid=%"SCNi16"/%"SCNi16",pcp=%i/%i,cfi=%i/%i)%n",
(pcp << VLAN_PCP_SHIFT) |
(cfi ? VLAN_CFI : 0)));
if (mask) {
(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);
} 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) {
} 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);
if (mask) {
mpls = nl_msg_put_unspec_uninit(mask, OVS_KEY_ATTR_MPLS,
sizeof *mpls);
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;
if (flow->vlan_tci != htons(0) || flow->dl_type == htons(ETH_TYPE_VLAN)) {
if (is_mask) {
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));
}
} else {
nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_TYPE_VLAN));
}
* 802.3 SNAP packet with valid eth_type).
*/
if (is_mask) {
* 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);
ovs_instruction_name_from_type(
OVSINST_OFPIT11_WRITE_METADATA),
ntohll(metadata->metadata));
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;
ds_put_format(s, "/%#"PRIx64, ntohll(metadata->mask));
}
break;
- om->mask = htonll(UINT64_MAX);
+ om->mask = OVS_BE64_MAX;
}
return str_to_be64(arg, &om->metadata);
}
return str_to_be64(arg, &om->metadata);
fm->cookie_mask = htonll(0);
if (command == OFPFC_MODIFY || command == OFPFC_MODIFY_STRICT) {
/* For modify, by default, don't update the cookie. */
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);
}
} else{
fm->new_cookie = htonll(0);
}
*usable_protocols &= OFPUTIL_P_NXM_OXM_ANY;
}
}
*usable_protocols &= OFPUTIL_P_NXM_OXM_ANY;
}
}
- 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
&& (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
if (ds_last(s) != ' ') {
ds_put_char(s, ' ');
}
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)) {
ds_put_format(s, "cookie:0x%"PRIx64" ", ntohll(fm.new_cookie));
}
if (fm.cookie_mask != htonll(0)) {
>> OFPFW10_NW_DST_SHIFT);
if (!(ofpfw & OFPFW10_TP_SRC)) {
>> 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)) {
}
if (!(ofpfw & OFPFW10_TP_DST)) {
- wc->masks.tp_dst = htons(UINT16_MAX);
+ wc->masks.tp_dst = OVS_BE16_MAX;
}
if (!(ofpfw & OFPFW10_DL_SRC)) {
}
if (!(ofpfw & OFPFW10_DL_SRC)) {
memset(wc->masks.dl_dst, 0xff, ETH_ADDR_LEN);
}
if (!(ofpfw & OFPFW10_DL_TYPE)) {
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;
if (ofmatch->dl_vlan == htons(OFPVID11_NONE)) {
/* Match only packets without a VLAN tag. */
match->flow.vlan_tci = htons(0);
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. */
} else {
if (ofmatch->dl_vlan == htons(OFPVID11_ANY)) {
/* Match any packet with a VLAN tag regardless of VID. */
} else {
fm->cookie = ofm->cookie;
fm->cookie_mask = ofm->cookie_mask;
} 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;
}
fm->modify_cookie = false;
fm->command = ofm->command;
- 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;
if (protocol & OFPUTIL_P_TID) {
fm->command = command & 0xff;
fm->table_id = command >> 8;
rr->role = ntohl(orr->role);
if (raw == OFPRAW_OFPT12_ROLE_REQUEST
? orr->role == htonl(OFPCR12_ROLE_NOCHANGE)
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 {
rr->have_generation_id = false;
rr->generation_id = 0;
} else {
qs13->duration_sec = htonl(oqs->duration_sec);
qs13->duration_nsec = htonl(oqs->duration_nsec);
} else {
qs13->duration_sec = htonl(oqs->duration_sec);
qs13->duration_nsec = htonl(oqs->duration_nsec);
} else {
- qs13->duration_sec = htonl(UINT32_MAX);
- qs13->duration_nsec = htonl(UINT32_MAX);
+ qs13->duration_sec = OVS_BE32_MAX;
+ qs13->duration_nsec = OVS_BE32_MAX;
ip_format_masked(ovs_be32 ip, ovs_be32 mask, struct ds *s)
{
ds_put_format(s, IP_FMT, IP_ARGS(ip));
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 {
if (ip_is_cidr(mask)) {
ds_put_format(s, "/%d", ip_count_cidr_bits(mask));
} else {
ots[i].apply_actions = htonl(OFPAT11_OUTPUT);
ots[i].write_setfields = htonll(OFPXMT13_MASK);
ots[i].apply_setfields = htonll(OFPXMT13_MASK);
ots[i].apply_actions = htonl(OFPAT11_OUTPUT);
ots[i].write_setfields = htonll(OFPXMT13_MASK);
ots[i].apply_setfields = htonll(OFPXMT13_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. */
ots[i].instructions = htonl(OFPIT11_ALL);
ots[i].config = htonl(OFPTC11_TABLE_MISS_MASK);
ots[i].max_entries = htonl(1000000); /* An arbitrary big number. */
- if (criteria->cookie_mask == htonll(UINT64_MAX)) {
+ if (criteria->cookie_mask == OVS_BE64_MAX) {
struct rule *rule;
HINDEX_FOR_EACH_WITH_HASH (rule, cookie_node,
struct rule *rule;
HINDEX_FOR_EACH_WITH_HASH (rule, cookie_node,
- if (criteria->cookie_mask == htonll(UINT64_MAX)) {
+ if (criteria->cookie_mask == OVS_BE64_MAX) {
struct rule *rule;
HINDEX_FOR_EACH_WITH_HASH (rule, cookie_node,
struct rule *rule;
HINDEX_FOR_EACH_WITH_HASH (rule, cookie_node,
op = ofoperation_create(group, rule, type, 0);
op = ofoperation_create(group, rule, type, 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 (type == OFOPERATION_REPLACE) {
ofproto_rule_change_cookie(ofproto, rule, fm->new_cookie);
}
if (type == OFOPERATION_REPLACE) {
struct ofputil_flow_mod *fm, const struct ofp_header *request)
OVS_REQUIRES(ofproto_mutex)
{
struct ofputil_flow_mod *fm, const struct ofp_header *request)
OVS_REQUIRES(ofproto_mutex)
{
- 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);
return 0;
}
return add_flow(ofproto, ofconn, fm, request);
values[f_idx][value_idx], f->len);
if (f_idx == CLS_F_IDX_NW_SRC) {
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) {
} 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) {
} 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) {
} 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) {
} 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) {
} 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) {
} 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) {
} 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 {
} else if (f_idx == CLS_F_IDX_IN_PORT) {
match.wc.masks.in_port.ofp_port = u16_to_ofp(UINT16_MAX);
} else {
ovs_be64 expect;
if (n_bits == 64) {
ovs_be64 expect;
if (n_bits == 64) {
- expect = htonll(UINT64_MAX);
} else {
uint64_t mask = (UINT64_C(1) << n_bits) - 1;
expect = orig_dst | htonll(mask << dst_ofs);
} else {
uint64_t mask = (UINT64_C(1) << n_bits) - 1;
expect = orig_dst | htonll(mask << dst_ofs);