void
cls_rule_set_nw_dscp(struct cls_rule *rule, uint8_t nw_dscp)
{
- rule->wc.tos_mask |= IP_DSCP_MASK;
- rule->flow.tos &= ~IP_DSCP_MASK;
- rule->flow.tos |= nw_dscp & IP_DSCP_MASK;
+ rule->wc.nw_tos_mask |= IP_DSCP_MASK;
+ 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.tos_mask |= IP_ECN_MASK;
- rule->flow.tos &= ~IP_ECN_MASK;
- rule->flow.tos |= nw_ecn & IP_ECN_MASK;
+ rule->wc.nw_tos_mask |= IP_ECN_MASK;
+ rule->flow.nw_tos &= ~IP_ECN_MASK;
+ rule->flow.nw_tos |= nw_ecn & IP_ECN_MASK;
}
void
}
void
-cls_rule_set_frag(struct cls_rule *rule, uint8_t frag)
+cls_rule_set_nw_frag(struct cls_rule *rule, uint8_t nw_frag)
{
- rule->wc.frag_mask |= FLOW_FRAG_MASK;
- rule->flow.frag = frag;
+ rule->wc.nw_frag_mask |= FLOW_NW_FRAG_MASK;
+ rule->flow.nw_frag = nw_frag;
}
void
-cls_rule_set_frag_masked(struct cls_rule *rule, uint8_t frag, uint8_t mask)
+cls_rule_set_nw_frag_masked(struct cls_rule *rule,
+ uint8_t nw_frag, uint8_t mask)
{
- rule->flow.frag = frag & mask;
- rule->wc.frag_mask = mask;
+ rule->flow.nw_frag = nw_frag & mask;
+ rule->wc.nw_frag_mask = mask;
}
void
ETH_ADDR_ARGS(f->arp_tha));
}
}
- if (wc->tos_mask & IP_DSCP_MASK) {
- ds_put_format(s, "nw_tos=%"PRIu8",", f->tos & IP_DSCP_MASK);
+ if (wc->nw_tos_mask & IP_DSCP_MASK) {
+ ds_put_format(s, "nw_tos=%"PRIu8",", f->nw_tos & IP_DSCP_MASK);
}
- if (wc->tos_mask & IP_ECN_MASK) {
- ds_put_format(s, "nw_ecn=%"PRIu8",", f->tos & IP_ECN_MASK);
+ if (wc->nw_tos_mask & IP_ECN_MASK) {
+ ds_put_format(s, "nw_ecn=%"PRIu8",", f->nw_tos & IP_ECN_MASK);
}
if (!(w & FWW_NW_TTL)) {
ds_put_format(s, "nw_ttl=%"PRIu8",", f->nw_ttl);
}
- switch (wc->frag_mask) {
- case FLOW_FRAG_ANY | FLOW_FRAG_LATER:
- ds_put_format(s, "frag=%s,",
- f->frag & FLOW_FRAG_ANY
- ? (f->frag & FLOW_FRAG_LATER ? "later" : "first")
- : (f->frag & FLOW_FRAG_LATER ? "<error>" : "no"));
+ switch (wc->nw_frag_mask) {
+ case FLOW_NW_FRAG_ANY | FLOW_NW_FRAG_LATER:
+ ds_put_format(s, "nw_frag=%s,",
+ f->nw_frag & FLOW_NW_FRAG_ANY
+ ? (f->nw_frag & FLOW_NW_FRAG_LATER ? "later" : "first")
+ : (f->nw_frag & FLOW_NW_FRAG_LATER ? "<error>" : "no"));
break;
- case FLOW_FRAG_ANY:
- ds_put_format(s, "frag=%s,",
- f->frag & FLOW_FRAG_ANY ? "yes" : "no");
+ case FLOW_NW_FRAG_ANY:
+ ds_put_format(s, "nw_frag=%s,",
+ f->nw_frag & FLOW_NW_FRAG_ANY ? "yes" : "no");
break;
- case FLOW_FRAG_LATER:
- ds_put_format(s, "frag=%s,",
- f->frag & FLOW_FRAG_LATER ? "later" : "not_later");
+ case FLOW_NW_FRAG_LATER:
+ ds_put_format(s, "nw_frag=%s,",
+ f->nw_frag & FLOW_NW_FRAG_LATER ? "later" : "not_later");
break;
}
if (f->nw_proto == IPPROTO_ICMP) {
|| !((a->dl_dst[0] ^ b->dl_dst[0]) & 0x01))
&& (wc & FWW_NW_PROTO || a->nw_proto == b->nw_proto)
&& (wc & FWW_NW_TTL || a->nw_ttl == b->nw_ttl)
- && !((a->tos ^ b->tos) & wildcards->tos_mask)
- && !((a->frag ^ b->frag) & wildcards->frag_mask)
+ && !((a->nw_tos ^ b->nw_tos) & wildcards->nw_tos_mask)
+ && !((a->nw_frag ^ b->nw_frag) & wildcards->nw_frag_mask)
&& (wc & FWW_ARP_SHA || eth_addr_equals(a->arp_sha, b->arp_sha))
&& (wc & FWW_ARP_THA || eth_addr_equals(a->arp_tha, b->arp_tha))
&& (wc & FWW_IPV6_LABEL || a->ipv6_label == b->ipv6_label)
void cls_rule_set_nw_dscp(struct cls_rule *, uint8_t);
void cls_rule_set_nw_ecn(struct cls_rule *, uint8_t);
void cls_rule_set_nw_ttl(struct cls_rule *, uint8_t);
-void cls_rule_set_frag(struct cls_rule *, uint8_t frag);
-void cls_rule_set_frag_masked(struct cls_rule *, uint8_t frag, uint8_t mask);
+void cls_rule_set_nw_frag(struct cls_rule *, uint8_t nw_frag);
+void cls_rule_set_nw_frag_masked(struct cls_rule *,
+ uint8_t nw_frag, uint8_t mask);
void cls_rule_set_icmp_type(struct cls_rule *, uint8_t);
void cls_rule_set_icmp_code(struct cls_rule *, uint8_t);
void cls_rule_set_arp_sha(struct cls_rule *, const uint8_t[6]);
flow->ipv6_dst = nh->ip6_dst;
tc_flow = get_unaligned_be32(&nh->ip6_flow);
- flow->tos = ntohl(tc_flow) >> 4;
+ flow->nw_tos = ntohl(tc_flow) >> 4;
flow->ipv6_label = tc_flow & htonl(IPV6_LABEL_MASK);
flow->nw_ttl = nh->ip6_hlim;
flow->nw_proto = IPPROTO_NONE;
}
/* We only process the first fragment. */
- flow->frag = FLOW_FRAG_ANY;
+ flow->nw_frag = FLOW_NW_FRAG_ANY;
if ((frag_hdr->ip6f_offlg & IP6F_OFF_MASK) != htons(0)) {
- flow->frag |= FLOW_FRAG_LATER;
+ flow->nw_frag |= FLOW_NW_FRAG_LATER;
nexthdr = IPPROTO_FRAGMENT;
break;
}
flow->nw_dst = get_unaligned_be32(&nh->ip_dst);
flow->nw_proto = nh->ip_proto;
- flow->tos = nh->ip_tos;
+ flow->nw_tos = nh->ip_tos;
if (IP_IS_FRAGMENT(nh->ip_frag_off)) {
- flow->frag = FLOW_FRAG_ANY;
+ flow->nw_frag = FLOW_NW_FRAG_ANY;
if (nh->ip_frag_off & htons(IP_FRAG_OFF_MASK)) {
- flow->frag |= FLOW_FRAG_LATER;
+ flow->nw_frag |= FLOW_NW_FRAG_LATER;
}
}
flow->nw_ttl = nh->ip_ttl;
if (wc & FWW_IPV6_LABEL) {
flow->ipv6_label = htonl(0);
}
- flow->tos &= wildcards->tos_mask;
+ flow->nw_tos &= wildcards->nw_tos_mask;
if (wc & FWW_NW_TTL) {
flow->nw_ttl = 0;
}
- flow->frag &= wildcards->frag_mask;
+ flow->nw_frag &= wildcards->nw_frag_mask;
if (wc & FWW_ARP_SHA) {
memset(flow->arp_sha, 0, sizeof flow->arp_sha);
}
ds_put_format(ds, " label%#"PRIx32" proto%"PRIu8" tos%#"PRIx8
" ttl%"PRIu8" ipv6",
ntohl(flow->ipv6_label), flow->nw_proto,
- flow->tos, flow->nw_ttl);
+ flow->nw_tos, flow->nw_ttl);
print_ipv6_addr(ds, &flow->ipv6_src);
ds_put_cstr(ds, "->");
print_ipv6_addr(ds, &flow->ipv6_dst);
} else {
ds_put_format(ds, " proto%"PRIu8" tos%#"PRIx8" ttl%"PRIu8
" ip"IP_FMT"->"IP_FMT,
- flow->nw_proto, flow->tos, flow->nw_ttl,
+ flow->nw_proto, flow->nw_tos, flow->nw_ttl,
IP_ARGS(&flow->nw_src), IP_ARGS(&flow->nw_dst));
}
- if (flow->frag) {
+ if (flow->nw_frag) {
ds_put_format(ds, " frag(%s)",
- flow->frag == FLOW_FRAG_ANY ? "first"
- : flow->frag == (FLOW_FRAG_ANY | FLOW_FRAG_LATER)
+ flow->nw_frag == FLOW_NW_FRAG_ANY ? "first"
+ : flow->nw_frag == (FLOW_NW_FRAG_ANY | FLOW_NW_FRAG_LATER)
? "later" : "<error>");
}
if (flow->tp_src || flow->tp_dst) {
wc->ipv6_dst_mask = in6addr_any;
memset(wc->reg_masks, 0, sizeof wc->reg_masks);
wc->vlan_tci_mask = htons(0);
- wc->tos_mask = 0;
- wc->frag_mask = 0;
+ wc->nw_tos_mask = 0;
+ wc->nw_frag_mask = 0;
memset(wc->zeros, 0, sizeof wc->zeros);
}
wc->ipv6_dst_mask = in6addr_exact;
memset(wc->reg_masks, 0xff, sizeof wc->reg_masks);
wc->vlan_tci_mask = htons(UINT16_MAX);
- wc->tos_mask = UINT8_MAX;
- wc->frag_mask = UINT8_MAX;
+ wc->nw_tos_mask = UINT8_MAX;
+ wc->nw_frag_mask = UINT8_MAX;
memset(wc->zeros, 0, sizeof wc->zeros);
}
|| wc->vlan_tci_mask != htons(UINT16_MAX)
|| !ipv6_mask_is_exact(&wc->ipv6_src_mask)
|| !ipv6_mask_is_exact(&wc->ipv6_dst_mask)
- || wc->tos_mask != UINT8_MAX
- || wc->frag_mask != UINT8_MAX) {
+ || wc->nw_tos_mask != UINT8_MAX
+ || wc->nw_frag_mask != UINT8_MAX) {
return false;
}
|| wc->vlan_tci_mask != htons(0)
|| !ipv6_mask_is_any(&wc->ipv6_src_mask)
|| !ipv6_mask_is_any(&wc->ipv6_dst_mask)
- || wc->tos_mask != 0
- || wc->frag_mask != 0) {
+ || wc->nw_tos_mask != 0
+ || wc->nw_frag_mask != 0) {
return false;
}
b->l3 = ip = ofpbuf_put_zeros(b, sizeof *ip);
ip->ip_ihl_ver = IP_IHL_VER(5, 4);
- ip->ip_tos = flow->tos;
+ ip->ip_tos = flow->nw_tos;
ip->ip_proto = flow->nw_proto;
ip->ip_src = flow->nw_src;
ip->ip_dst = flow->nw_dst;
- if (flow->frag & FLOW_FRAG_ANY) {
+ if (flow->nw_frag & FLOW_NW_FRAG_ANY) {
ip->ip_frag_off |= htons(IP_MORE_FRAGMENTS);
- if (flow->frag & FLOW_FRAG_LATER) {
+ if (flow->nw_frag & FLOW_NW_FRAG_LATER) {
ip->ip_frag_off |= htons(100);
}
}
- if (!(flow->frag & FLOW_FRAG_ANY)
- || !(flow->frag & FLOW_FRAG_LATER)) {
+ if (!(flow->nw_frag & FLOW_NW_FRAG_ANY)
+ || !(flow->nw_frag & FLOW_NW_FRAG_LATER)) {
if (flow->nw_proto == IPPROTO_TCP) {
struct tcp_header *tcp;
#define FLOW_DL_TYPE_NONE 0x5ff
/* Fragment bits, used for IPv4 and IPv6, always zero for non-IP flows. */
-#define FLOW_FRAG_ANY (1 << 0) /* Set for any IP fragment. */
-#define FLOW_FRAG_LATER (1 << 1) /* Set for IP fragment with nonzero offset. */
-#define FLOW_FRAG_MASK (FLOW_FRAG_ANY | FLOW_FRAG_LATER)
+#define FLOW_NW_FRAG_ANY (1 << 0) /* Set for any IP frag. */
+#define FLOW_NW_FRAG_LATER (1 << 1) /* Set for IP frag with nonzero offset. */
+#define FLOW_NW_FRAG_MASK (FLOW_NW_FRAG_ANY | FLOW_NW_FRAG_LATER)
-BUILD_ASSERT_DECL(FLOW_FRAG_ANY == NX_IP_FRAG_ANY);
-BUILD_ASSERT_DECL(FLOW_FRAG_LATER == NX_IP_FRAG_LATER);
+BUILD_ASSERT_DECL(FLOW_NW_FRAG_ANY == NX_IP_FRAG_ANY);
+BUILD_ASSERT_DECL(FLOW_NW_FRAG_LATER == NX_IP_FRAG_LATER);
struct flow {
ovs_be64 tun_id; /* Encapsulating tunnel ID. */
uint8_t dl_src[6]; /* Ethernet source address. */
uint8_t dl_dst[6]; /* Ethernet destination address. */
uint8_t nw_proto; /* IP protocol or low 8 bits of ARP opcode. */
- uint8_t tos; /* IP ToS. */
+ uint8_t nw_tos; /* IP ToS (including DSCP and ECN). */
uint8_t arp_sha[6]; /* ARP/ND source hardware address. */
uint8_t arp_tha[6]; /* ARP/ND target hardware address. */
uint8_t nw_ttl; /* IP TTL/Hop Limit. */
- uint8_t frag; /* FLOW_FRAG_* flags. */
+ uint8_t nw_frag; /* FLOW_FRAG_* flags. */
uint8_t reserved[6]; /* Reserved for 64-bit packing. */
};
* flow", followed by FLOW_PAD_SIZE bytes of padding. */
#define FLOW_SIG_SIZE (110 + FLOW_N_REGS * 4)
#define FLOW_PAD_SIZE 6
-BUILD_ASSERT_DECL(offsetof(struct flow, frag) == FLOW_SIG_SIZE - 1);
-BUILD_ASSERT_DECL(sizeof(((struct flow *)0)->frag) == 1);
+BUILD_ASSERT_DECL(offsetof(struct flow, nw_frag) == FLOW_SIG_SIZE - 1);
+BUILD_ASSERT_DECL(sizeof(((struct flow *)0)->nw_frag) == 1);
BUILD_ASSERT_DECL(sizeof(struct flow) == FLOW_SIG_SIZE + FLOW_PAD_SIZE);
/* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */
struct in6_addr ipv6_src_mask; /* 1-bit in each signficant ipv6_src bit. */
struct in6_addr ipv6_dst_mask; /* 1-bit in each signficant ipv6_dst bit. */
ovs_be16 vlan_tci_mask; /* 1-bit in each significant vlan_tci bit. */
- uint8_t tos_mask; /* 1-bit in each significant tos bit. */
- uint8_t frag_mask; /* 1-bit in each significant frag bit. */
+ uint8_t nw_tos_mask; /* 1-bit in each significant nw_tos bit. */
+ uint8_t nw_frag_mask; /* 1-bit in each significant nw_frag bit. */
uint8_t zeros[4]; /* Padding field set to zero. */
};
return ipv6_mask_is_any(&wc->ipv6_dst_mask);
case MFF_IP_DSCP:
- return !(wc->tos_mask & IP_DSCP_MASK);
+ return !(wc->nw_tos_mask & IP_DSCP_MASK);
case MFF_IP_ECN:
- return !(wc->tos_mask & IP_ECN_MASK);
+ return !(wc->nw_tos_mask & IP_ECN_MASK);
case MFF_IP_FRAG:
- return !(wc->frag_mask & FLOW_FRAG_MASK);
+ return !(wc->nw_frag_mask & FLOW_NW_FRAG_MASK);
case MFF_ARP_SPA:
return !wc->nw_src_mask;
break;
case MFF_IP_DSCP:
- mask->u8 = wc->tos_mask & IP_DSCP_MASK;
+ mask->u8 = wc->nw_tos_mask & IP_DSCP_MASK;
break;
case MFF_IP_ECN:
- mask->u8 = wc->tos_mask & IP_ECN_MASK;
+ mask->u8 = wc->nw_tos_mask & IP_ECN_MASK;
break;
case MFF_IP_FRAG:
- mask->u8 = wc->frag_mask & FLOW_FRAG_MASK;
+ mask->u8 = wc->nw_frag_mask & FLOW_NW_FRAG_MASK;
break;
case MFF_ARP_SPA:
case MFF_IP_ECN:
return !(value->u8 & ~IP_ECN_MASK);
case MFF_IP_FRAG:
- return !(value->u8 & ~FLOW_FRAG_MASK);
+ return !(value->u8 & ~FLOW_NW_FRAG_MASK);
case MFF_ARP_OP:
return !(value->be16 & htons(0xff00));
break;
case MFF_IP_DSCP:
- value->u8 = flow->tos & IP_DSCP_MASK;
+ value->u8 = flow->nw_tos & IP_DSCP_MASK;
break;
case MFF_IP_ECN:
- value->u8 = flow->tos & IP_ECN_MASK;
+ value->u8 = flow->nw_tos & IP_ECN_MASK;
break;
case MFF_IP_TTL:
break;
case MFF_IP_FRAG:
- value->u8 = flow->frag;
+ value->u8 = flow->nw_frag;
break;
case MFF_ARP_OP:
break;
case MFF_IP_FRAG:
- cls_rule_set_frag(rule, value->u8);
+ cls_rule_set_nw_frag(rule, value->u8);
break;
case MFF_ARP_OP:
break;
case MFF_IP_DSCP:
- rule->wc.tos_mask |= IP_DSCP_MASK;
- rule->flow.tos &= ~IP_DSCP_MASK;
+ rule->wc.nw_tos_mask |= IP_DSCP_MASK;
+ rule->flow.nw_tos &= ~IP_DSCP_MASK;
break;
case MFF_IP_ECN:
- rule->wc.tos_mask |= IP_ECN_MASK;
- rule->flow.tos &= ~IP_ECN_MASK;
+ rule->wc.nw_tos_mask |= IP_ECN_MASK;
+ rule->flow.nw_tos &= ~IP_ECN_MASK;
break;
case MFF_IP_TTL:
break;
case MFF_IP_FRAG:
- rule->wc.frag_mask |= FLOW_FRAG_MASK;
- rule->flow.frag &= ~FLOW_FRAG_MASK;
+ rule->wc.nw_frag_mask |= FLOW_NW_FRAG_MASK;
+ rule->flow.nw_frag &= ~FLOW_NW_FRAG_MASK;
break;
case MFF_ARP_OP:
break;
case MFF_IP_FRAG:
- cls_rule_set_frag_masked(rule, value->u8, mask->u8);
+ cls_rule_set_nw_frag_masked(rule, value->u8, mask->u8);
break;
case MFF_ARP_SPA:
break;
case MFF_IP_FRAG:
- value->u8 &= FLOW_FRAG_MASK;
+ value->u8 &= FLOW_NW_FRAG_MASK;
break;
case MFF_ARP_OP:
};
static const struct frag_handling all_frags[] = {
-#define A FLOW_FRAG_ANY
-#define L FLOW_FRAG_LATER
+#define A FLOW_NW_FRAG_ANY
+#define L FLOW_NW_FRAG_LATER
/* name mask value */
{ "no", A|L, 0 },
if (!strcasecmp(s, h->name)) {
/* We force the upper bits of the mask on to make mf_parse_value()
* happy (otherwise it will never think it's an exact match.) */
- *maskp = h->mask | ~FLOW_FRAG_MASK;
+ *maskp = h->mask | ~FLOW_NW_FRAG_MASK;
*valuep = h->value;
return NULL;
}
uint8_t mask = *maskp;
value &= mask;
- mask &= FLOW_FRAG_MASK;
+ mask &= FLOW_NW_FRAG_MASK;
for (h = all_frags; h < &all_frags[ARRAY_SIZE(all_frags)]; h++) {
if (value == h->value && mask == h->mask) {
static void
nxm_put_frag(struct ofpbuf *b, const struct cls_rule *cr)
{
- uint8_t frag = cr->flow.frag;
- uint8_t frag_mask = cr->wc.frag_mask;
+ uint8_t nw_frag = cr->flow.nw_frag;
+ uint8_t nw_frag_mask = cr->wc.nw_frag_mask;
- switch (frag_mask) {
+ switch (nw_frag_mask) {
case 0:
break;
- case FLOW_FRAG_MASK:
- nxm_put_8(b, NXM_NX_IP_FRAG, frag);
+ case FLOW_NW_FRAG_MASK:
+ nxm_put_8(b, NXM_NX_IP_FRAG, nw_frag);
break;
default:
- nxm_put_8m(b, NXM_NX_IP_FRAG, frag, frag_mask & FLOW_FRAG_MASK);
+ nxm_put_8m(b, NXM_NX_IP_FRAG, nw_frag,
+ nw_frag_mask & FLOW_NW_FRAG_MASK);
break;
}
}
nxm_put_32m(b, NXM_OF_IP_DST, flow->nw_dst, cr->wc.nw_dst_mask);
nxm_put_frag(b, cr);
- if (cr->wc.tos_mask & IP_DSCP_MASK) {
- nxm_put_8(b, NXM_OF_IP_TOS, flow->tos & IP_DSCP_MASK);
+ if (cr->wc.nw_tos_mask & IP_DSCP_MASK) {
+ nxm_put_8(b, NXM_OF_IP_TOS, flow->nw_tos & IP_DSCP_MASK);
}
- if (cr->wc.tos_mask & IP_ECN_MASK) {
- nxm_put_8(b, NXM_NX_IP_ECN, flow->tos & IP_ECN_MASK);
+ if (cr->wc.nw_tos_mask & IP_ECN_MASK) {
+ nxm_put_8(b, NXM_NX_IP_ECN, flow->nw_tos & IP_ECN_MASK);
}
if (!(wc & FWW_NW_TTL)) {
nxm_put_32(b, NXM_NX_IPV6_LABEL, flow->ipv6_label);
}
- if (cr->wc.tos_mask & IP_DSCP_MASK) {
- nxm_put_8(b, NXM_OF_IP_TOS, flow->tos & IP_DSCP_MASK);
+ if (cr->wc.nw_tos_mask & IP_DSCP_MASK) {
+ nxm_put_8(b, NXM_OF_IP_TOS, flow->nw_tos & IP_DSCP_MASK);
}
- if (cr->wc.tos_mask & IP_ECN_MASK) {
- nxm_put_8(b, NXM_NX_IP_ECN, flow->tos & IP_ECN_MASK);
+ if (cr->wc.nw_tos_mask & IP_ECN_MASK) {
+ nxm_put_8(b, NXM_NX_IP_ECN, flow->nw_tos & IP_ECN_MASK);
}
if (!(wc & FWW_NW_TTL)) {
return ntohs(flow->vlan_tci);
case NFI_NXM_OF_IP_TOS:
- return flow->tos & IP_DSCP_MASK;
+ return flow->nw_tos & IP_DSCP_MASK;
case NFI_NXM_NX_IP_ECN:
- return flow->tos & IP_ECN_MASK;
+ return flow->nw_tos & IP_ECN_MASK;
case NFI_NXM_NX_IP_TTL:
return flow->nw_ttl;
case NFI_NXM_NX_IP_FRAG:
- return flow->frag;
+ return flow->nw_frag;
case NFI_NXM_OF_IP_PROTO:
case NFI_NXM_OF_ARP_OP:
#endif
case NFI_NXM_OF_IP_TOS:
- flow->tos &= ~IP_DSCP_MASK;
- flow->tos |= new_value & IP_DSCP_MASK;
+ flow->nw_tos &= ~IP_DSCP_MASK;
+ flow->nw_tos |= new_value & IP_DSCP_MASK;
break;
case NFI_NXM_NX_IP_ECN:
- flow->tos &= ~IP_ECN_MASK;
- flow->tos |= new_value & IP_ECN_MASK;
+ flow->nw_tos &= ~IP_ECN_MASK;
+ flow->nw_tos |= new_value & IP_ECN_MASK;
break;
case NFI_NXM_NX_IP_TTL:
break;
case NFI_NXM_NX_IP_FRAG:
- flow->frag = new_value;
+ flow->nw_frag = new_value;
break;
case NFI_NXM_OF_IP_SRC:
static uint8_t
ovs_to_odp_frag(uint8_t ovs_frag)
{
- return (ovs_frag & FLOW_FRAG_LATER ? OVS_FRAG_TYPE_LATER
- : ovs_frag & FLOW_FRAG_ANY ? OVS_FRAG_TYPE_FIRST
+ return (ovs_frag & FLOW_NW_FRAG_LATER ? OVS_FRAG_TYPE_LATER
+ : ovs_frag & FLOW_NW_FRAG_ANY ? OVS_FRAG_TYPE_FIRST
: OVS_FRAG_TYPE_NONE);
}
ipv4_key->ipv4_src = flow->nw_src;
ipv4_key->ipv4_dst = flow->nw_dst;
ipv4_key->ipv4_proto = flow->nw_proto;
- ipv4_key->ipv4_tos = flow->tos;
+ ipv4_key->ipv4_tos = flow->nw_tos;
ipv4_key->ipv4_ttl = flow->nw_ttl;
- ipv4_key->ipv4_frag = ovs_to_odp_frag(flow->frag);
+ ipv4_key->ipv4_frag = ovs_to_odp_frag(flow->nw_frag);
} else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
struct ovs_key_ipv6 *ipv6_key;
memcpy(ipv6_key->ipv6_dst, &flow->ipv6_dst, sizeof ipv6_key->ipv6_dst);
ipv6_key->ipv6_label = flow->ipv6_label;
ipv6_key->ipv6_proto = flow->nw_proto;
- ipv6_key->ipv6_tclass = flow->tos;
+ ipv6_key->ipv6_tclass = flow->nw_tos;
ipv6_key->ipv6_hlimit = flow->nw_ttl;
- ipv6_key->ipv6_frag = ovs_to_odp_frag(flow->frag);
+ ipv6_key->ipv6_frag = ovs_to_odp_frag(flow->nw_frag);
} else if (flow->dl_type == htons(ETH_TYPE_ARP)) {
struct ovs_key_arp *arp_key;
if ((flow->dl_type == htons(ETH_TYPE_IP)
|| flow->dl_type == htons(ETH_TYPE_IPV6))
- && !(flow->frag & FLOW_FRAG_LATER)) {
+ && !(flow->nw_frag & FLOW_NW_FRAG_LATER)) {
if (flow->nw_proto == IPPROTO_TCP) {
struct ovs_key_tcp *tcp_key;
}
if (odp_frag != OVS_FRAG_TYPE_NONE) {
- flow->frag |= FLOW_FRAG_ANY;
+ flow->nw_frag |= FLOW_NW_FRAG_ANY;
if (odp_frag == OVS_FRAG_TYPE_LATER) {
- flow->frag |= FLOW_FRAG_LATER;
+ flow->nw_frag |= FLOW_NW_FRAG_LATER;
}
}
return true;
flow->nw_src = ipv4_key->ipv4_src;
flow->nw_dst = ipv4_key->ipv4_dst;
flow->nw_proto = ipv4_key->ipv4_proto;
- flow->tos = ipv4_key->ipv4_tos;
+ flow->nw_tos = ipv4_key->ipv4_tos;
flow->nw_ttl = ipv4_key->ipv4_ttl;
if (!odp_to_ovs_frag(ipv4_key->ipv4_frag, flow)) {
return EINVAL;
memcpy(&flow->ipv6_dst, ipv6_key->ipv6_dst, sizeof flow->ipv6_dst);
flow->ipv6_label = ipv6_key->ipv6_label;
flow->nw_proto = ipv6_key->ipv6_proto;
- flow->tos = ipv6_key->ipv6_tclass;
+ flow->nw_tos = ipv6_key->ipv6_tclass;
flow->nw_ttl = ipv6_key->ipv6_hlimit;
if (!odp_to_ovs_frag(ipv6_key->ipv6_frag, flow)) {
return EINVAL;
return 0;
case OVS_KEY_ATTR_IPV4:
- if (flow->frag & FLOW_FRAG_LATER) {
+ if (flow->nw_frag & FLOW_NW_FRAG_LATER) {
return 0;
}
if (flow->nw_proto == IPPROTO_TCP
return 0;
case OVS_KEY_ATTR_IPV6:
- if (flow->frag & FLOW_FRAG_LATER) {
+ if (flow->nw_frag & FLOW_NW_FRAG_LATER) {
return 0;
}
if (flow->nw_proto == IPPROTO_TCP
case OVS_KEY_ATTR_ICMPV6:
if (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT)
|| flow->tp_src == htons(ND_NEIGHBOR_ADVERT)
- || flow->frag & FLOW_FRAG_LATER) {
+ || flow->nw_frag & FLOW_NW_FRAG_LATER) {
return EINVAL;
}
return 0;
case OVS_KEY_ATTR_UDP:
case OVS_KEY_ATTR_ICMP:
case OVS_KEY_ATTR_ND:
- if (flow->frag & FLOW_FRAG_LATER) {
+ if (flow->nw_frag & FLOW_NW_FRAG_LATER) {
return EINVAL;
}
return 0;
| FWW_ND_TARGET | FWW_IPV6_LABEL);
if (!(ofpfw & OFPFW_NW_TOS)) {
- wc->tos_mask |= IP_DSCP_MASK;
+ wc->nw_tos_mask |= IP_DSCP_MASK;
}
wc->nw_src_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_SRC_SHIFT);
rule->flow.tp_dst = match->tp_dst;
memcpy(rule->flow.dl_src, match->dl_src, ETH_ADDR_LEN);
memcpy(rule->flow.dl_dst, match->dl_dst, ETH_ADDR_LEN);
- rule->flow.tos = match->nw_tos & IP_DSCP_MASK;
+ rule->flow.nw_tos = match->nw_tos & IP_DSCP_MASK;
rule->flow.nw_proto = match->nw_proto;
/* Translate VLANs. */
ofpfw = (OVS_FORCE uint32_t) (wc->wildcards & WC_INVARIANTS);
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_src_mask) << OFPFW_NW_SRC_SHIFT;
ofpfw |= ofputil_netmask_to_wcbits(wc->nw_dst_mask) << OFPFW_NW_DST_SHIFT;
- if (!(wc->tos_mask & IP_DSCP_MASK)) {
+ if (!(wc->nw_tos_mask & IP_DSCP_MASK)) {
ofpfw |= OFPFW_NW_TOS;
}
match->dl_type = ofputil_dl_type_to_openflow(rule->flow.dl_type);
match->nw_src = rule->flow.nw_src;
match->nw_dst = rule->flow.nw_dst;
- match->nw_tos = rule->flow.tos & IP_DSCP_MASK;
+ match->nw_tos = rule->flow.nw_tos & IP_DSCP_MASK;
match->nw_proto = rule->flow.nw_proto;
match->tp_src = rule->flow.tp_src;
match->tp_dst = rule->flow.tp_dst;
}
/* Only NXM supports matching fragments. */
- if (wc->frag_mask) {
+ if (wc->nw_frag_mask) {
return NXFF_NXM;
}
}
/* Only NXM supports matching IP ECN bits. */
- if (wc->tos_mask & IP_ECN_MASK) {
+ if (wc->nw_tos_mask & IP_ECN_MASK) {
return NXFF_NXM;
}
wc.wildcards |= FWW_NW_PROTO;
}
if (!(may_match & MAY_IPVx)) {
- wc.tos_mask = 0;
- wc.frag_mask = 0;
+ wc.nw_tos_mask = 0;
+ wc.nw_frag_mask = 0;
wc.wildcards |= FWW_NW_TTL;
}
if (!(may_match & MAY_ARP_SHA)) {
}
nf_rec->tcp_flags = nf_flow->tcp_flags;
nf_rec->ip_proto = expired->flow.nw_proto;
- nf_rec->ip_tos = expired->flow.tos & IP_DSCP_MASK;
+ nf_rec->ip_tos = expired->flow.nw_tos & IP_DSCP_MASK;
/* NetFlow messages are limited to 30 records. */
if (ntohs(nf_hdr->count) >= 30) {
}
cls = &ofproto->up.tables[table_id];
- if (flow->frag & FLOW_FRAG_ANY
+ if (flow->nw_frag & FLOW_NW_FRAG_ANY
&& ofproto->up.frag_handling == OFPC_FRAG_NORMAL) {
/* For OFPC_NORMAL frag_handling, we must pretend that transport ports
* are unavailable. */
if (base->nw_src == flow->nw_src &&
base->nw_dst == flow->nw_dst &&
- base->tos == flow->tos &&
+ base->nw_tos == flow->nw_tos &&
base->nw_ttl == flow->nw_ttl &&
- base->frag == flow->frag) {
+ base->nw_frag == flow->nw_frag) {
return;
}
ipv4_key.ipv4_src = base->nw_src = flow->nw_src;
ipv4_key.ipv4_dst = base->nw_dst = flow->nw_dst;
ipv4_key.ipv4_proto = base->nw_proto;
- ipv4_key.ipv4_tos = flow->tos;
+ ipv4_key.ipv4_tos = flow->nw_tos;
ipv4_key.ipv4_ttl = flow->nw_ttl;
- ipv4_key.ipv4_frag = (base->frag == 0 ? OVS_FRAG_TYPE_NONE
- : base->frag == FLOW_FRAG_ANY ? OVS_FRAG_TYPE_FIRST
- : OVS_FRAG_TYPE_LATER);
+ ipv4_key.ipv4_frag = (base->nw_frag == 0 ? OVS_FRAG_TYPE_NONE
+ : base->nw_frag == FLOW_NW_FRAG_ANY
+ ? OVS_FRAG_TYPE_FIRST : OVS_FRAG_TYPE_LATER);
commit_action__(odp_actions, OVS_ACTION_ATTR_SET,
OVS_KEY_ATTR_IPV4, &ipv4_key, sizeof(ipv4_key));
break;
case OFPUTIL_OFPAT_SET_NW_TOS:
- ctx->flow.tos &= ~IP_DSCP_MASK;
- ctx->flow.tos |= ia->nw_tos.nw_tos & IP_DSCP_MASK;
+ ctx->flow.nw_tos &= ~IP_DSCP_MASK;
+ ctx->flow.nw_tos |= ia->nw_tos.nw_tos & IP_DSCP_MASK;
break;
case OFPUTIL_OFPAT_SET_TP_SRC:
ctx->table_id = 0;
ctx->exit = false;
- if (ctx->flow.frag & FLOW_FRAG_ANY) {
+ if (ctx->flow.nw_frag & FLOW_NW_FRAG_ANY) {
switch (ctx->ofproto->up.frag_handling) {
case OFPC_FRAG_NORMAL:
/* We must pretend that transport ports are unavailable. */
CLS_FIELD(FWW_DL_SRC, dl_src, DL_SRC) \
CLS_FIELD(FWW_DL_DST | FWW_ETH_MCAST, dl_dst, DL_DST) \
CLS_FIELD(FWW_NW_PROTO, nw_proto, NW_PROTO) \
- CLS_FIELD(0, tos, TOS)
+ CLS_FIELD(0, nw_tos, NW_TOS)
/* Field indexes.
*
& wild->wc.vlan_tci_mask);
} else if (f_idx == CLS_F_IDX_TUN_ID) {
eq = !((fixed->tun_id ^ wild->flow.tun_id) & wild->wc.tun_id_mask);
- } else if (f_idx == CLS_F_IDX_TOS) {
- eq = !((fixed->tos ^ wild->flow.tos)
- & wild->wc.tos_mask);
+ } else if (f_idx == CLS_F_IDX_NW_TOS) {
+ eq = !((fixed->nw_tos ^ wild->flow.nw_tos)
+ & wild->wc.nw_tos_mask);
} else {
NOT_REACHED();
}
static uint8_t dl_dst_values[][6] = { { 0x4a, 0x27, 0x71, 0xae, 0x64, 0xc1 },
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
static uint8_t nw_proto_values[] = { IPPROTO_TCP, IPPROTO_ICMP };
-static uint8_t tos_values[] = { 48, 0 };
+static uint8_t nw_tos_values[] = { 48, 0 };
static void *values[CLS_N_FIELDS][2];
values[CLS_F_IDX_NW_PROTO][0] = &nw_proto_values[0];
values[CLS_F_IDX_NW_PROTO][1] = &nw_proto_values[1];
- values[CLS_F_IDX_TOS][0] = &tos_values[0];
- values[CLS_F_IDX_TOS][1] = &tos_values[1];
+ values[CLS_F_IDX_NW_TOS][0] = &nw_tos_values[0];
+ values[CLS_F_IDX_NW_TOS][1] = &nw_tos_values[1];
values[CLS_F_IDX_TP_SRC][0] = &tp_src_values[0];
values[CLS_F_IDX_TP_SRC][1] = &tp_src_values[1];
#define N_DL_SRC_VALUES ARRAY_SIZE(dl_src_values)
#define N_DL_DST_VALUES ARRAY_SIZE(dl_dst_values)
#define N_NW_PROTO_VALUES ARRAY_SIZE(nw_proto_values)
-#define N_TOS_VALUES ARRAY_SIZE(tos_values)
+#define N_NW_TOS_VALUES ARRAY_SIZE(nw_tos_values)
#define N_FLOW_VALUES (N_NW_SRC_VALUES * \
N_NW_DST_VALUES * \
N_DL_SRC_VALUES * \
N_DL_DST_VALUES * \
N_NW_PROTO_VALUES * \
- N_TOS_VALUES)
+ N_NW_TOS_VALUES)
static unsigned int
get_value(unsigned int *x, unsigned n_values)
memcpy(flow.dl_dst, dl_dst_values[get_value(&x, N_DL_DST_VALUES)],
ETH_ADDR_LEN);
flow.nw_proto = nw_proto_values[get_value(&x, N_NW_PROTO_VALUES)];
- flow.tos = tos_values[get_value(&x, N_TOS_VALUES)];
+ flow.nw_tos = nw_tos_values[get_value(&x, N_NW_TOS_VALUES)];
cr0 = classifier_lookup(cls, &flow);
cr1 = tcls_lookup(tcls, &flow);
rule->cls_rule.wc.vlan_tci_mask = htons(UINT16_MAX);
} else if (f_idx == CLS_F_IDX_TUN_ID) {
rule->cls_rule.wc.tun_id_mask = htonll(UINT64_MAX);
- } else if (f_idx == CLS_F_IDX_TOS) {
- rule->cls_rule.wc.tos_mask = UINT8_MAX;
+ } else if (f_idx == CLS_F_IDX_NW_TOS) {
+ rule->cls_rule.wc.nw_tos_mask = UINT8_MAX;
} else {
NOT_REACHED();
}