/*
- * Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* MAC: A six-byte field whose value is an Ethernet address.
* IPv6: A 16-byte field whose value is an IPv6 address.
+ * tunnelMD: A variable length field, up to 124 bytes, that carries
+ * tunnel metadata.
*
* Maskable:
*
* OXM (e.g. "since OF1.3 and v1.10" if it was introduced in OpenFlow 1.3
* and first supported by Open vSwitch in version 1.10).
*
+ * Some fields have more than one OXM field assignment. For example,
+ * actset_output has an experimenter OXM assignment in OpenFlow 1.3 and a
+ * standard OXM assignment in OpenFlow 1.5. In such a case, specify both,
+ * separated by commas.
+ *
* OVS uses the start of the OXM field name to determine the correct OXM
* class. To support a new OXM class, edit the mapping table in
* build-aux/extract-ofp-fields.
* Flow hash computed in the datapath. Internal use only, not programmable
* from controller.
*
+ * The OXM code point for this is an attempt to test OXM experimenter
+ * support, which is otherwise difficult to test due to the dearth of use
+ * out in the wild. Because controllers can't add flows that match on
+ * dp_hash, this doesn't commit OVS to supporting this OXM experimenter
+ * code point in the future.
+ *
* Type: be32.
* Maskable: bitwise.
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read-only.
* NXM: NXM_NX_DP_HASH(35) since v2.2.
- * OXM: none.
+ * OXM: NXOXM_ET_DP_HASH(0) since OF1.5 and v2.4.
*/
MFF_DP_HASH,
*/
MFF_RECIRC_ID,
+ /* "conj_id".
+ *
+ * ID for "conjunction" actions. Please refer to ovs-ofctl(8)
+ * documentation of "conjunction" for details.
+ *
+ * Type: be32.
+ * Maskable: no.
+ * Formatting: decimal.
+ * Prerequisites: none.
+ * Access: read-only.
+ * NXM: NXM_NX_CONJ_ID(37) since v2.4.
+ * OXM: none. */
+ MFF_CONJ_ID,
+
/* "tun_id" (aka "tunnel_id").
*
* The "key" or "tunnel ID" or "VNI" in a packet received via a keyed
*/
MFF_TUN_DST,
+ /* "tun_ipv6_src".
+ *
+ * The IPv6 source address in the outer IP header of a tunneled packet.
+ *
+ * For non-tunneled packets, the value is 0.
+ *
+ * Type: be128.
+ * Maskable: bitwise.
+ * Formatting: IPv6.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_IPV6_SRC(109) since v2.5.
+ * OXM: none.
+ * Prefix lookup member: tunnel.ipv6_src.
+ */
+ MFF_TUN_IPV6_SRC,
+
+ /* "tun_ipv6_dst".
+ *
+ * The IPv6 destination address in the outer IP header of a tunneled
+ * packet.
+ *
+ * For non-tunneled packets, the value is 0.
+ *
+ * Type: be128.
+ * Maskable: bitwise.
+ * Formatting: IPv6.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_IPV6_DST(110) since v2.5.
+ * OXM: none.
+ * Prefix lookup member: tunnel.ipv6_dst.
+ */
+ MFF_TUN_IPV6_DST,
+
/* "tun_flags".
*
- * Combination of FLOW_TNL_F_* bitmapped flags that indicate properties of
- * a tunneled packet. Internal use only, not programmable from controller.
+ * Flags representing aspects of tunnel behavior.
+ *
+ * This field currently only has a single flag defined:
+ *
+ * - NX_TUN_FLAG_OAM: The tunnel protocol indicated that this is an
+ * OAM control packet.
+ *
+ * The switch may reject matches against values that it is not aware of.
+ *
+ * Note that it is possible for newer version of Open vSwitch to
+ * introduce additional flags with varying meaning. It is therefore not
+ * recommended to use an exact match on this field since the behavior of
+ * these new flags is unknown and should be ignored.
*
* For non-tunneled packets, the value is 0.
*
- * Type: be16.
- * Maskable: no.
+ * Type: be16 (low 1 bits).
+ * Maskable: bitwise.
* Formatting: tunnel flags.
* Prerequisites: none.
- * Access: read-only.
- * NXM: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_FLAGS(104) since v2.5.
* OXM: none.
*/
MFF_TUN_FLAGS,
*/
MFF_TUN_TOS,
+ /* "tun_gbp_id".
+ *
+ * VXLAN Group Policy ID
+ *
+ * Type: be16.
+ * Maskable: bitwise.
+ * Formatting: decimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_GBP_ID(38) since v2.4.
+ * OXM: none.
+ */
+ MFF_TUN_GBP_ID,
+
+ /* "tun_gbp_flags".
+ *
+ * VXLAN Group Policy flags
+ *
+ * Type: u8.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_GBP_FLAGS(39) since v2.4.
+ * OXM: none.
+ */
+ MFF_TUN_GBP_FLAGS,
+
+#if TUN_METADATA_NUM_OPTS == 64
+ /* "tun_metadata<N>".
+ *
+ * Encapsulation metadata for tunnels.
+ *
+ * Each NXM can be dynamically mapped onto a particular tunnel field using
+ * OpenFlow commands. The individual NXMs can each carry up to 124 bytes
+ * of data and a combined total of 256 across all allocated fields.
+ *
+ * Type: tunnelMD.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_TUN_METADATA0(40) since v2.5. <0>
+ * NXM: NXM_NX_TUN_METADATA1(41) since v2.5. <1>
+ * NXM: NXM_NX_TUN_METADATA2(42) since v2.5. <2>
+ * NXM: NXM_NX_TUN_METADATA3(43) since v2.5. <3>
+ * NXM: NXM_NX_TUN_METADATA4(44) since v2.5. <4>
+ * NXM: NXM_NX_TUN_METADATA5(45) since v2.5. <5>
+ * NXM: NXM_NX_TUN_METADATA6(46) since v2.5. <6>
+ * NXM: NXM_NX_TUN_METADATA7(47) since v2.5. <7>
+ * NXM: NXM_NX_TUN_METADATA8(48) since v2.5. <8>
+ * NXM: NXM_NX_TUN_METADATA9(49) since v2.5. <9>
+ * NXM: NXM_NX_TUN_METADATA10(50) since v2.5. <10>
+ * NXM: NXM_NX_TUN_METADATA11(51) since v2.5. <11>
+ * NXM: NXM_NX_TUN_METADATA12(52) since v2.5. <12>
+ * NXM: NXM_NX_TUN_METADATA13(53) since v2.5. <13>
+ * NXM: NXM_NX_TUN_METADATA14(54) since v2.5. <14>
+ * NXM: NXM_NX_TUN_METADATA15(55) since v2.5. <15>
+ * NXM: NXM_NX_TUN_METADATA16(56) since v2.5. <16>
+ * NXM: NXM_NX_TUN_METADATA17(57) since v2.5. <17>
+ * NXM: NXM_NX_TUN_METADATA18(58) since v2.5. <18>
+ * NXM: NXM_NX_TUN_METADATA19(59) since v2.5. <19>
+ * NXM: NXM_NX_TUN_METADATA20(60) since v2.5. <20>
+ * NXM: NXM_NX_TUN_METADATA21(61) since v2.5. <21>
+ * NXM: NXM_NX_TUN_METADATA22(62) since v2.5. <22>
+ * NXM: NXM_NX_TUN_METADATA23(63) since v2.5. <23>
+ * NXM: NXM_NX_TUN_METADATA24(64) since v2.5. <24>
+ * NXM: NXM_NX_TUN_METADATA25(65) since v2.5. <25>
+ * NXM: NXM_NX_TUN_METADATA26(66) since v2.5. <26>
+ * NXM: NXM_NX_TUN_METADATA27(67) since v2.5. <27>
+ * NXM: NXM_NX_TUN_METADATA28(68) since v2.5. <28>
+ * NXM: NXM_NX_TUN_METADATA29(69) since v2.5. <29>
+ * NXM: NXM_NX_TUN_METADATA30(70) since v2.5. <30>
+ * NXM: NXM_NX_TUN_METADATA31(71) since v2.5. <31>
+ * NXM: NXM_NX_TUN_METADATA32(72) since v2.5. <32>
+ * NXM: NXM_NX_TUN_METADATA33(73) since v2.5. <33>
+ * NXM: NXM_NX_TUN_METADATA34(74) since v2.5. <34>
+ * NXM: NXM_NX_TUN_METADATA35(75) since v2.5. <35>
+ * NXM: NXM_NX_TUN_METADATA36(76) since v2.5. <36>
+ * NXM: NXM_NX_TUN_METADATA37(77) since v2.5. <37>
+ * NXM: NXM_NX_TUN_METADATA38(78) since v2.5. <38>
+ * NXM: NXM_NX_TUN_METADATA39(79) since v2.5. <39>
+ * NXM: NXM_NX_TUN_METADATA40(80) since v2.5. <40>
+ * NXM: NXM_NX_TUN_METADATA41(81) since v2.5. <41>
+ * NXM: NXM_NX_TUN_METADATA42(82) since v2.5. <42>
+ * NXM: NXM_NX_TUN_METADATA43(83) since v2.5. <43>
+ * NXM: NXM_NX_TUN_METADATA44(84) since v2.5. <44>
+ * NXM: NXM_NX_TUN_METADATA45(85) since v2.5. <45>
+ * NXM: NXM_NX_TUN_METADATA46(86) since v2.5. <46>
+ * NXM: NXM_NX_TUN_METADATA47(87) since v2.5. <47>
+ * NXM: NXM_NX_TUN_METADATA48(88) since v2.5. <48>
+ * NXM: NXM_NX_TUN_METADATA49(89) since v2.5. <49>
+ * NXM: NXM_NX_TUN_METADATA50(90) since v2.5. <50>
+ * NXM: NXM_NX_TUN_METADATA51(91) since v2.5. <51>
+ * NXM: NXM_NX_TUN_METADATA52(92) since v2.5. <52>
+ * NXM: NXM_NX_TUN_METADATA53(93) since v2.5. <53>
+ * NXM: NXM_NX_TUN_METADATA54(94) since v2.5. <54>
+ * NXM: NXM_NX_TUN_METADATA55(95) since v2.5. <55>
+ * NXM: NXM_NX_TUN_METADATA56(96) since v2.5. <56>
+ * NXM: NXM_NX_TUN_METADATA57(97) since v2.5. <57>
+ * NXM: NXM_NX_TUN_METADATA58(98) since v2.5. <58>
+ * NXM: NXM_NX_TUN_METADATA59(99) since v2.5. <59>
+ * NXM: NXM_NX_TUN_METADATA60(100) since v2.5. <60>
+ * NXM: NXM_NX_TUN_METADATA61(101) since v2.5. <61>
+ * NXM: NXM_NX_TUN_METADATA62(102) since v2.5. <62>
+ * NXM: NXM_NX_TUN_METADATA63(103) since v2.5. <63>
+ * OXM: none.
+ */
+ MFF_TUN_METADATA0,
+ MFF_TUN_METADATA1,
+ MFF_TUN_METADATA2,
+ MFF_TUN_METADATA3,
+ MFF_TUN_METADATA4,
+ MFF_TUN_METADATA5,
+ MFF_TUN_METADATA6,
+ MFF_TUN_METADATA7,
+ MFF_TUN_METADATA8,
+ MFF_TUN_METADATA9,
+ MFF_TUN_METADATA10,
+ MFF_TUN_METADATA11,
+ MFF_TUN_METADATA12,
+ MFF_TUN_METADATA13,
+ MFF_TUN_METADATA14,
+ MFF_TUN_METADATA15,
+ MFF_TUN_METADATA16,
+ MFF_TUN_METADATA17,
+ MFF_TUN_METADATA18,
+ MFF_TUN_METADATA19,
+ MFF_TUN_METADATA20,
+ MFF_TUN_METADATA21,
+ MFF_TUN_METADATA22,
+ MFF_TUN_METADATA23,
+ MFF_TUN_METADATA24,
+ MFF_TUN_METADATA25,
+ MFF_TUN_METADATA26,
+ MFF_TUN_METADATA27,
+ MFF_TUN_METADATA28,
+ MFF_TUN_METADATA29,
+ MFF_TUN_METADATA30,
+ MFF_TUN_METADATA31,
+ MFF_TUN_METADATA32,
+ MFF_TUN_METADATA33,
+ MFF_TUN_METADATA34,
+ MFF_TUN_METADATA35,
+ MFF_TUN_METADATA36,
+ MFF_TUN_METADATA37,
+ MFF_TUN_METADATA38,
+ MFF_TUN_METADATA39,
+ MFF_TUN_METADATA40,
+ MFF_TUN_METADATA41,
+ MFF_TUN_METADATA42,
+ MFF_TUN_METADATA43,
+ MFF_TUN_METADATA44,
+ MFF_TUN_METADATA45,
+ MFF_TUN_METADATA46,
+ MFF_TUN_METADATA47,
+ MFF_TUN_METADATA48,
+ MFF_TUN_METADATA49,
+ MFF_TUN_METADATA50,
+ MFF_TUN_METADATA51,
+ MFF_TUN_METADATA52,
+ MFF_TUN_METADATA53,
+ MFF_TUN_METADATA54,
+ MFF_TUN_METADATA55,
+ MFF_TUN_METADATA56,
+ MFF_TUN_METADATA57,
+ MFF_TUN_METADATA58,
+ MFF_TUN_METADATA59,
+ MFF_TUN_METADATA60,
+ MFF_TUN_METADATA61,
+ MFF_TUN_METADATA62,
+ MFF_TUN_METADATA63,
+#else
+#error "Need to update MFF_TUN_METADATA* to match TUN_METADATA_NUM_OPTS"
+#endif
+
/* "metadata".
*
* A scratch pad value standardized in OpenFlow 1.1+. Initially zero, at
*/
MFF_IN_PORT_OXM,
+ /* "actset_output".
+ *
+ * Type: be32.
+ * Maskable: no.
+ * Formatting: OpenFlow 1.1+ port.
+ * Prerequisites: none.
+ * Access: read-only.
+ * NXM: none.
+ * OXM: ONFOXM_ET_ACTSET_OUTPUT(43) since OF1.3 and v2.4,
+ * OXM_OF_ACTSET_OUTPUT(43) since OF1.5 and v2.4.
+ */
+ MFF_ACTSET_OUTPUT,
+
/* "skb_priority".
*
* Designates the queue to which output will be directed. The value in
*/
MFF_PKT_MARK,
+ /* "ct_state".
+ *
+ * Connection tracking state. The field is populated by the NXAST_CT
+ * action. The following bit values describe the state of the connection:
+ *
+ * - New (0x01): This is the beginning of a new connection.
+ * - Established (0x02): This is part of an already existing connection.
+ * - Related (0x04): This is a separate connection that is related to an
+ * existing connection.
+ * - Reply (0x08): This flow is in the reply direction, ie it did not
+ * initiate the connection.
+ * - Invalid (0x10): This flow could not be associated with a connection.
+ * This could be set for a variety of reasons,
+ * including (but not limited to):
+ * - L3/L4 protocol handler is not loaded/unavailable.
+ * - L3/L4 protocol handler determines that the packet
+ * is malformed or invalid for the current FSM stage.
+ * - Packets are unexpected length for protocol.
+ * - Tracked (0x20): Connection tracking has occurred.
+ *
+ * The "Tracked" bit corresponds to the packet_state as described in the
+ * description of NXAST_CT action. The remaining bits correspond to
+ * connection state. The "New" bit implies that the connection state
+ * is uncommitted, while "Established" implies that it has previously been
+ * committed.
+ *
+ * There are additional constraints on the ct_state bits, listed in order
+ * of precedence below:
+ *
+ * - If "Tracked" is unset, no other bits may be set.
+ * - If "Tracked" is set, one or more other bits may be set.
+ * - If "Invalid" is set, only the "Tracked" bit is also set.
+ * - The "New" and "Established" bits are mutually exclusive.
+ * - The "New" and "Reply" bits are mutually exclusive.
+ * - The "Related" bit may be set in conjunction with any other bits.
+ * Connections that are identified as "Related" are separate
+ * connections from the originating connection, so must be committed
+ * separately. All packets for a related connection will have the
+ * "Related" bit set (not just the initial packet).
+ *
+ * Type: be32.
+ * Maskable: bitwise.
+ * Formatting: ct state.
+ * Prerequisites: none.
+ * Access: read-only.
+ * NXM: NXM_NX_CT_STATE(105) since v2.5.
+ * OXM: none.
+ */
+ MFF_CT_STATE,
+
+ /* "ct_zone".
+ *
+ * Connection tracking zone. The field is populated by the
+ * NXAST_CT action.
+ *
+ * Type: be16.
+ * Maskable: no.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read-only.
+ * NXM: NXM_NX_CT_ZONE(106) since v2.5.
+ * OXM: none.
+ */
+ MFF_CT_ZONE,
+
+ /* "ct_mark".
+ *
+ * Connection tracking mark. The mark is carried with the
+ * connection tracking state. On Linux this corresponds to the
+ * nf_conn's "mark" member but the exact implementation is
+ * platform-dependent.
+ *
+ * Writable only from nested actions within the NXAST_CT action.
+ *
+ * Type: be32.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_CT_MARK(107) since v2.5.
+ * OXM: none.
+ */
+ MFF_CT_MARK,
+
+ /* "ct_label".
+ *
+ * Connection tracking label. The label is carried with the
+ * connection tracking state. On Linux this is held in the
+ * conntrack label extension but the exact implementation is
+ * platform-dependent.
+ *
+ * Writable only from nested actions within the NXAST_CT action.
+ *
+ * Type: be128.
+ * Maskable: bitwise.
+ * Formatting: hexadecimal.
+ * Prerequisites: none.
+ * Access: read/write.
+ * NXM: NXM_NX_CT_LABEL(108) since v2.5.
+ * OXM: none.
+ */
+ MFF_CT_LABEL,
+
#if FLOW_N_REGS == 8
/* "reg<N>".
*
#if FLOW_N_XREGS == 4
/* "xreg<N>".
*
- * OpenFlow 1.5 (draft) ``extended register". Each extended register
+ * OpenFlow 1.5 ``extended register". Each extended register
* overlays two of the Nicira extension 32-bit registers: xreg0 overlays
* reg0 and reg1, with reg0 supplying the most-significant bits of xreg0
* and reg1 the least-significant. xreg1 similarly overlays reg2 and reg3,
* and so on.
*
+ * These registers were introduced in OpenFlow 1.5, but EXT-244 in the ONF
+ * JIRA also publishes them as a (draft) OpenFlow extension to OpenFlow
+ * 1.3.
+ *
* Type: be64.
* Maskable: bitwise.
* Formatting: hexadecimal.
* Prerequisites: none.
* Access: read/write.
* NXM: none.
- * OXM: OXM_OF_PKT_REG<N>(<N>) since OF1.5 and v2.4.
+ * OXM: OXM_OF_PKT_REG<N>(<N>) since OF1.3 and v2.4.
*/
MFF_XREG0,
MFF_XREG1,
*
* The source address in the IPv6 header.
*
- * Type: IPv6.
+ * Type: be128.
* Maskable: bitwise.
* Formatting: IPv6.
* Prerequisites: IPv6.
*
* The destination address in the IPv6 header.
*
- * Type: IPv6.
+ * Type: be128.
* Maskable: bitwise.
* Formatting: IPv6.
* Prerequisites: IPv6.
* Maskable: bitwise.
* Formatting: hexadecimal.
* Prerequisites: IPv6.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_NX_IPV6_LABEL(27) since v1.4.
* OXM: OXM_OF_IPV6_FLABEL(28) since OF1.2 and v1.7.
*/
* Prerequisites: TCP.
* Access: read-only.
* NXM: NXM_NX_TCP_FLAGS(34) since v2.1.
- * OXM: OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3.
+ * OXM: ONFOXM_ET_TCP_FLAGS(42) since OF1.3 and v2.4,
+ * OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3.
*/
MFF_TCP_FLAGS,
* Maskable: no.
* Formatting: decimal.
* Prerequisites: ICMPv4.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_OF_ICMP_TYPE(13) since v1.1.
* OXM: OXM_OF_ICMPV4_TYPE(19) since OF1.2 and v1.7.
* OF1.0: exact match.
* Maskable: no.
* Formatting: decimal.
* Prerequisites: ICMPv4.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_OF_ICMP_CODE(14) since v1.1.
* OXM: OXM_OF_ICMPV4_CODE(20) since OF1.2 and v1.7.
* OF1.0: exact match.
* Maskable: no.
* Formatting: decimal.
* Prerequisites: ICMPv6.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_NX_ICMPV6_TYPE(21) since v1.1.
* OXM: OXM_OF_ICMPV6_TYPE(29) since OF1.2 and v1.7.
*/
* Maskable: no.
* Formatting: decimal.
* Prerequisites: ICMPv6.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_NX_ICMPV6_CODE(22) since v1.1.
* OXM: OXM_OF_ICMPV6_CODE(30) since OF1.2 and v1.7.
*/
*
* Before Open vSwitch 1.8, only CIDR masks were supported.
*
- * Type: IPv6.
+ * Type: be128.
* Maskable: bitwise.
* Formatting: IPv6.
* Prerequisites: ND.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_NX_ND_TARGET(23) since v1.1.
* OXM: OXM_OF_IPV6_ND_TARGET(31) since OF1.2 and v1.7.
*/
* Maskable: bitwise.
* Formatting: Ethernet.
* Prerequisites: ND solicit.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_NX_ND_SLL(24) since v1.1.
* OXM: OXM_OF_IPV6_ND_SLL(32) since OF1.2 and v1.7.
*/
* Maskable: bitwise.
* Formatting: Ethernet.
* Prerequisites: ND advert.
- * Access: read-only.
+ * Access: read/write.
* NXM: NXM_NX_ND_TLL(25) since v1.1.
* OXM: OXM_OF_IPV6_ND_TLL(33) since OF1.2 and v1.7.
*/
#error "Need to update CASE_MFF_XREGS to match FLOW_N_XREGS"
#endif
+/* Use this macro as CASE_MFF_TUN_METADATA: in a switch statement to choose
+ * all of the MFF_TUN_METADATAn cases. */
+#define CASE_MFF_TUN_METADATA \
+ case MFF_TUN_METADATA0: case MFF_TUN_METADATA1: \
+ case MFF_TUN_METADATA2: case MFF_TUN_METADATA3: \
+ case MFF_TUN_METADATA4: case MFF_TUN_METADATA5: \
+ case MFF_TUN_METADATA6: case MFF_TUN_METADATA7: \
+ case MFF_TUN_METADATA8: case MFF_TUN_METADATA9: \
+ case MFF_TUN_METADATA10: case MFF_TUN_METADATA11: \
+ case MFF_TUN_METADATA12: case MFF_TUN_METADATA13: \
+ case MFF_TUN_METADATA14: case MFF_TUN_METADATA15: \
+ case MFF_TUN_METADATA16: case MFF_TUN_METADATA17: \
+ case MFF_TUN_METADATA18: case MFF_TUN_METADATA19: \
+ case MFF_TUN_METADATA20: case MFF_TUN_METADATA21: \
+ case MFF_TUN_METADATA22: case MFF_TUN_METADATA23: \
+ case MFF_TUN_METADATA24: case MFF_TUN_METADATA25: \
+ case MFF_TUN_METADATA26: case MFF_TUN_METADATA27: \
+ case MFF_TUN_METADATA28: case MFF_TUN_METADATA29: \
+ case MFF_TUN_METADATA30: case MFF_TUN_METADATA31: \
+ case MFF_TUN_METADATA32: case MFF_TUN_METADATA33: \
+ case MFF_TUN_METADATA34: case MFF_TUN_METADATA35: \
+ case MFF_TUN_METADATA36: case MFF_TUN_METADATA37: \
+ case MFF_TUN_METADATA38: case MFF_TUN_METADATA39: \
+ case MFF_TUN_METADATA40: case MFF_TUN_METADATA41: \
+ case MFF_TUN_METADATA42: case MFF_TUN_METADATA43: \
+ case MFF_TUN_METADATA44: case MFF_TUN_METADATA45: \
+ case MFF_TUN_METADATA46: case MFF_TUN_METADATA47: \
+ case MFF_TUN_METADATA48: case MFF_TUN_METADATA49: \
+ case MFF_TUN_METADATA50: case MFF_TUN_METADATA51: \
+ case MFF_TUN_METADATA52: case MFF_TUN_METADATA53: \
+ case MFF_TUN_METADATA54: case MFF_TUN_METADATA55: \
+ case MFF_TUN_METADATA56: case MFF_TUN_METADATA57: \
+ case MFF_TUN_METADATA58: case MFF_TUN_METADATA59: \
+ case MFF_TUN_METADATA60: case MFF_TUN_METADATA61: \
+ case MFF_TUN_METADATA62: case MFF_TUN_METADATA63
+
/* Prerequisites for matching a field.
*
* A field may only be matched if the correct lower-level protocols are also
MFS_HEXADECIMAL,
/* Other formats. */
+ MFS_CT_STATE, /* Connection tracking state */
MFS_ETHERNET,
MFS_IPV4,
MFS_IPV6,
*/
unsigned int n_bytes; /* Width of the field in bytes. */
unsigned int n_bits; /* Number of significant bits in field. */
+ bool variable_len; /* Length is variable, if so width is max. */
/* Properties. */
enum mf_maskable maskable;
enum mf_prereqs prereqs;
bool writable; /* May be written by actions? */
- /* NXM and OXM properties.
- *
- * There are the following possibilities for these members for a given
- * mf_field:
- *
- * - Neither NXM nor OXM defines such a field: these members will all be
- * zero or NULL.
- *
- * - NXM and OXM both define such a field: nxm_header and oxm_header will
- * both be nonzero and different, similarly for nxm_name and oxm_name.
- * In this case, 'oxm_version' is significant: if it is greater than
- * OFP12_VERSION, then only that version of OpenFlow introduced this
- * OXM header, so ovs-vswitchd should send 'nxm_header' instead with
- * earlier protocol versions to avoid confusing controllers that were
- * using a previous Open vSwitch extension.
- *
- * - Only NXM or only OXM defines such a field: nxm_header and oxm_header
- * will both have the same value (either an OXM_* or NXM_* value) and
- * similarly for nxm_name and oxm_name.
- *
- * Thus, 'nxm_header' is the appropriate header to use when outputting an
- * NXM formatted match, since it will be an NXM_* constant when possible
- * for compatibility with OpenFlow implementations that expect that, with
- * OXM_* constants used for fields that OXM adds. Conversely, 'oxm_header'
- * is the header to use when outputting an OXM formatted match to an
- * OpenFlow connection of version 'oxm_version' or above (and otherwise
- * 'nxm_header'). */
- uint32_t nxm_header; /* An NXM_* (or OXM_*) constant. */
- const char *nxm_name; /* The nxm_header constant's name. */
- uint32_t oxm_header; /* An OXM_* (or NXM_*) constant. */
- const char *oxm_name; /* The oxm_header constant's name */
- enum ofp_version oxm_version; /* OpenFlow version that added oxm_header. */
-
/* Usable protocols.
*
* NXM and OXM are extensible, allowing later extensions to be sent in
/* The representation of a field's value. */
union mf_value {
+ uint8_t tun_metadata[128];
struct in6_addr ipv6;
- uint8_t mac[ETH_ADDR_LEN];
+ struct eth_addr mac;
+ ovs_be128 be128;
ovs_be64 be64;
ovs_be32 be32;
ovs_be16 be16;
uint8_t u8;
};
-BUILD_ASSERT_DECL(sizeof(union mf_value) == 16);
+BUILD_ASSERT_DECL(sizeof(union mf_value) == 128);
+BUILD_ASSERT_DECL(sizeof(union mf_value) >= TLV_MAX_OPT_SIZE);
-#define MF_EXACT_MASK_INITIALIZER { IN6ADDR_EXACT_INIT }
+/* A const mf_value with all bits initialized to ones. */
+extern const union mf_value exact_match_mask;
/* Part of a field. */
struct mf_subfield {
* value" contains NXM_OF_VLAN_TCI[0..11], then one could access the
* corresponding data in value.be16[7] as the bits in the mask htons(0xfff). */
union mf_subvalue {
- uint8_t u8[16];
- ovs_be16 be16[8];
- ovs_be32 be32[4];
- ovs_be64 be64[2];
+ /* Access to full data. */
+ uint8_t u8[128];
+ ovs_be16 be16[64];
+ ovs_be32 be32[32];
+ ovs_be64 be64[16];
+
+ /* Convenient access to just least-significant bits in various forms. */
+ struct {
+ ovs_be64 dummy_integer[15];
+ ovs_be64 integer;
+ };
+ struct {
+ uint8_t dummy_mac[122];
+ struct eth_addr mac;
+ };
+ struct {
+ ovs_be32 dummy_ipv4[31];
+ ovs_be32 ipv4;
+ };
+ struct {
+ struct in6_addr dummy_ipv6[7];
+ struct in6_addr ipv6;
+ };
};
BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue));
+bool mf_subvalue_intersect(const union mf_subvalue *a_value,
+ const union mf_subvalue *a_mask,
+ const union mf_subvalue *b_value,
+ const union mf_subvalue *b_mask,
+ union mf_subvalue *dst_value,
+ union mf_subvalue *dst_mask);
+int mf_subvalue_width(const union mf_subvalue *);
+void mf_subvalue_shift(union mf_subvalue *, int n);
+void mf_subvalue_format(const union mf_subvalue *, struct ds *);
+
+/* An array of fields with values */
+struct field_array {
+ struct mf_bitmap used;
+ union mf_value value[MFF_N_IDS];
+};
+
/* Finding mf_fields. */
const struct mf_field *mf_from_name(const char *name);
-const struct mf_field *mf_from_nxm_header(uint32_t nxm_header);
-const struct mf_field *mf_from_nxm_name(const char *nxm_name);
static inline const struct mf_field *
mf_from_id(enum mf_field_id id)
return &mf_fields[id];
}
-/* NXM and OXM protocol headers. */
-uint32_t mf_oxm_header(enum mf_field_id, enum ofp_version oxm_version);
-
/* Inspecting wildcarded bits. */
bool mf_is_all_wild(const struct mf_field *, const struct flow_wildcards *);
/* Prerequisites. */
bool mf_are_prereqs_ok(const struct mf_field *, const struct flow *);
-void mf_mask_field_and_prereqs(const struct mf_field *, struct flow *mask);
+void mf_mask_field_and_prereqs(const struct mf_field *,
+ struct flow_wildcards *);
+void mf_bitmap_set_field_and_prereqs(const struct mf_field *mf, struct
+ mf_bitmap *bm);
static inline bool
mf_is_l3_or_higher(const struct mf_field *mf)
void mf_get_value(const struct mf_field *, const struct flow *,
union mf_value *value);
void mf_set_value(const struct mf_field *, const union mf_value *value,
- struct match *);
+ struct match *, char **err_str);
void mf_set_flow_value(const struct mf_field *, const union mf_value *value,
struct flow *);
-bool mf_is_zero(const struct mf_field *, const struct flow *);
+void mf_set_flow_value_masked(const struct mf_field *,
+ const union mf_value *value,
+ const union mf_value *mask,
+ struct flow *);
+bool mf_is_tun_metadata(const struct mf_field *);
+bool mf_is_set(const struct mf_field *, const struct flow *);
void mf_mask_field(const struct mf_field *, struct flow *);
+int mf_field_len(const struct mf_field *, const union mf_value *value,
+ const union mf_value *mask, bool *is_masked);
void mf_get(const struct mf_field *, const struct match *,
union mf_value *value, union mf_value *mask);
/* Returns the set of usable protocols. */
-enum ofputil_protocol mf_set(const struct mf_field *,
- const union mf_value *value,
- const union mf_value *mask,
- struct match *);
+uint32_t mf_set(const struct mf_field *, const union mf_value *value,
+ const union mf_value *mask, struct match *, char **err_str);
-void mf_set_wild(const struct mf_field *, struct match *);
+void mf_set_wild(const struct mf_field *, struct match *, char **err_str);
/* Subfields. */
void mf_write_subfield_flow(const struct mf_subfield *,
const union mf_subvalue *, struct flow *);
void mf_write_subfield(const struct mf_subfield *, const union mf_subvalue *,
struct match *);
+void mf_mask_subfield(const struct mf_field *,
+ const union mf_subvalue *value,
+ const union mf_subvalue *mask,
+ struct match *);
void mf_read_subfield(const struct mf_subfield *, const struct flow *,
union mf_subvalue *);
uint64_t mf_get_subfield(const struct mf_subfield *, const struct flow *);
-void mf_format_subfield(const struct mf_subfield *, struct ds *);
-char *mf_parse_subfield__(struct mf_subfield *sf, const char **s)
- WARN_UNUSED_RESULT;
-char *mf_parse_subfield(struct mf_subfield *, const char *s)
- WARN_UNUSED_RESULT;
-
enum ofperr mf_check_src(const struct mf_subfield *, const struct flow *);
enum ofperr mf_check_dst(const struct mf_subfield *, const struct flow *);
struct ds *);
void mf_format_subvalue(const union mf_subvalue *subvalue, struct ds *s);
+/* Field Arrays. */
+void field_array_set(enum mf_field_id id, const union mf_value *,
+ struct field_array *);
+
#endif /* meta-flow.h */