return "OpenFlow10+table_id";
case OFPUTIL_P_OF12_OXM:
- return NULL;
+ return "OXM";
}
/* Check abbreviations. */
BUILD_ASSERT_DECL(FLOW_WC_SEQ == 17);
- /* NXM and OF1.1+ supports bitwise matching on ethernet addresses. */
+ /* NXM, OXM, and OF1.1 support bitwise matching on ethernet addresses. */
if (!eth_mask_is_exact(wc->masks.dl_src)
&& !eth_addr_is_zero(wc->masks.dl_src)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
if (!eth_mask_is_exact(wc->masks.dl_dst)
&& !eth_addr_is_zero(wc->masks.dl_dst)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* NXM and OF1.1+ support matching metadata. */
+ /* NXM, OXM, and OF1.1+ support matching metadata. */
if (wc->masks.metadata != htonll(0)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching ARP hardware addresses. */
+ /* NXM and OXM support matching ARP hardware addresses. */
if (!eth_addr_is_zero(wc->masks.arp_sha) ||
!eth_addr_is_zero(wc->masks.arp_tha)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching IPv6 traffic. */
+ /* NXM and OXM support matching IPv6 traffic. */
if (match->flow.dl_type == htons(ETH_TYPE_IPV6)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching registers. */
+ /* NXM and OXM support matching registers. */
if (!regs_fully_wildcarded(wc)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching tun_id. */
+ /* NXM and OXM support matching tun_id. */
if (wc->masks.tunnel.tun_id != htonll(0)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching fragments. */
+ /* NXM and OXM support matching fragments. */
if (wc->masks.nw_frag) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching IPv6 flow label. */
+ /* NXM and OXM support matching IPv6 flow label. */
if (wc->masks.ipv6_label) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching IP ECN bits. */
+ /* NXM and OXM support matching IP ECN bits. */
if (wc->masks.nw_tos & IP_ECN_MASK) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports matching IP TTL/hop limit. */
+ /* NXM and OXM support matching IP TTL/hop limit. */
if (wc->masks.nw_ttl) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports non-CIDR IPv4 address masks. */
+ /* NXM and OXM support non-CIDR IPv4 address masks. */
if (!ip_is_cidr(wc->masks.nw_src) || !ip_is_cidr(wc->masks.nw_dst)) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
- /* Only NXM supports bitwise matching on transport port. */
+ /* 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))) {
- return OFPUTIL_P_OF10_NXM_ANY;
+ return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
/* Other formats can express this rule. */
usable_protocols &= OFPUTIL_P_TID;
}
- /* Matching of the cookie is only supported through NXM. */
+ /* Matching of the cookie is only supported through NXM or OF1.1+. */
if (fm->cookie_mask != htonll(0)) {
- usable_protocols &= OFPUTIL_P_OF10_NXM_ANY;
+ usable_protocols &= OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
}
assert(usable_protocols);
usable_protocols = ofputil_usable_protocols(&fsr->match);
if (fsr->cookie_mask != htonll(0)) {
- usable_protocols &= OFPUTIL_P_OF10_NXM_ANY;
+ usable_protocols &= OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM;
}
return usable_protocols;
}
AT_CHECK([ovs-ofctl parse-flows flows.txt
], [0], [stdout])
AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
-[[usable protocols: NXM+table_id
+[[usable protocols: NXM+table_id,OXM
chosen protocol: NXM+table_id
NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
])
AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
-usable protocols: NXM
+usable protocols: NXM,OXM
chosen protocol: NXM-table_id
NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
]])
AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout], [stderr])
AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
-[[usable protocols: NXM
+[[usable protocols: NXM,OXM
chosen protocol: NXM-table_id
NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
dnl such as tunnels and metadata.
AT_SETUP([ovs-ofctl -F option and NXM features])
AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
- [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
+ [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
])
AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop],
- [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
+ [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
])
AT_CLEANUP
AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
- [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
+ [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
])
OVS_VSWITCHD_STOP
AT_CLEANUP