2
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
2
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
116
115
/* This command enables or disables an Open vSwitch extension that allows a
117
116
* controller to specify the OpenFlow table to which a flow should be added,
118
117
* instead of having the switch decide which table is most appropriate as
119
* required by OpenFlow 1.0. By default, the extension is disabled.
118
* required by OpenFlow 1.0. Because NXM was designed as an extension to
119
* OpenFlow 1.0, the extension applies equally to ofp10_flow_mod and
120
* nx_flow_mod. By default, the extension is disabled.
121
122
* When this feature is enabled, Open vSwitch treats struct ofp10_flow_mod's
122
* 16-bit 'command' member as two separate fields. The upper 8 bits are used
123
* as the table ID, the lower 8 bits specify the command as usual. A table ID
124
* of 0xff is treated like a wildcarded table ID.
123
* and struct nx_flow_mod's 16-bit 'command' member as two separate fields.
124
* The upper 8 bits are used as the table ID, the lower 8 bits specify the
125
* command as usual. A table ID of 0xff is treated like a wildcarded table ID.
126
127
* The specific treatment of the table ID depends on the type of flow mod:
292
293
NXAST_NOTE, /* struct nx_action_note */
293
294
NXAST_SET_TUNNEL64, /* struct nx_action_set_tunnel64 */
294
295
NXAST_MULTIPATH, /* struct nx_action_multipath */
295
NXAST_AUTOPATH__DEPRECATED, /* struct nx_action_autopath */
296
NXAST_AUTOPATH__OBSOLETE, /* No longer used. */
296
297
NXAST_BUNDLE, /* struct nx_action_bundle */
297
298
NXAST_BUNDLE_LOAD, /* struct nx_action_bundle */
298
299
NXAST_RESUBMIT_TABLE, /* struct nx_action_resubmit */
304
305
NXAST_CONTROLLER, /* struct nx_action_controller */
305
306
NXAST_DEC_TTL_CNT_IDS, /* struct nx_action_cnt_ids */
306
307
NXAST_WRITE_METADATA, /* struct nx_action_write_metadata */
308
NXAST_PUSH_MPLS, /* struct nx_action_push_mpls */
309
NXAST_POP_MPLS, /* struct nx_action_pop_mpls */
310
NXAST_SET_MPLS_TTL, /* struct nx_action_ttl */
311
NXAST_DEC_MPLS_TTL, /* struct nx_action_header */
312
NXAST_STACK_PUSH, /* struct nx_action_stack */
313
NXAST_STACK_POP, /* struct nx_action_stack */
314
NXAST_SAMPLE, /* struct nx_action_sample */
309
317
/* Header for Nicira-defined actions. */
492
504
* adds or modifies the 802.1Q header appropriately, setting the TCI field
493
505
* to the field's new value (with the CFI bit masked out).
495
* - NXM_NX_TUN_ID. Modifying this value modifies the tunnel ID used for the
496
* packet's next tunnel encapsulation.
507
* - NXM_NX_TUN_ID, NXM_NX_TUN_IPV4_SRC, NXM_NX_TUN_IPV4_DST. Modifying
508
* any of these values modifies the corresponding tunnel header field used
509
* for the packet's next tunnel encapsulation, if allowed by the
510
* configuration of the output tunnel port.
498
512
* A given nxm_header value may be used as 'src' or 'dst' only on a flow whose
499
513
* nx_match satisfies its prerequisites. For example, NXM_OF_IP_TOS may be
559
573
OFP_ASSERT(sizeof(struct nx_action_reg_load) == 24);
575
/* Action structure for NXAST_STACK_PUSH and NXAST_STACK_POP.
577
* Pushes (or pops) field[offset: offset + n_bits] to (or from)
580
struct nx_action_stack {
581
ovs_be16 type; /* OFPAT_VENDOR. */
582
ovs_be16 len; /* Length is 16. */
583
ovs_be32 vendor; /* NX_VENDOR_ID. */
584
ovs_be16 subtype; /* NXAST_STACK_PUSH or NXAST_STACK_POP. */
585
ovs_be16 offset; /* Bit offset into the field. */
586
ovs_be32 field; /* The field used for push or pop. */
587
ovs_be16 n_bits; /* (n_bits + 1) bits of the field. */
588
uint8_t zero[6]; /* Reserved, must be zero. */
590
OFP_ASSERT(sizeof(struct nx_action_stack) == 24);
561
592
/* Action structure for NXAST_NOTE.
563
594
* This action has no effect. It is variable length. The switch does not
943
974
OFP_ASSERT(sizeof(struct nx_action_fin_timeout) == 16);
945
/* Action structure for NXAST_AUTOPATH.
947
* This action performs the following steps in sequence:
949
* 1. Hashes the flow using an implementation-defined hash function.
951
* The hashed fields' values are drawn from the current state of the
952
* flow, including all modifications that have been made by actions up to
955
* 2. Selects an OpenFlow 'port'.
957
* 'port' is selected in an implementation-defined manner, taking into
958
* account 'id' and the hash value calculated in step 1.
960
* Generally a switch will have been configured with a set of ports that
961
* may be chosen given 'id'. The switch may take into account any number
962
* of factors when choosing 'port' from its configured set. Factors may
963
* include carrier, load, and the results of configuration protocols such
966
* 3. Stores 'port' in dst[ofs:ofs+n_bits].
968
* The format and semantics of 'dst' and 'ofs_nbits' are similar to those
969
* for the NXAST_REG_LOAD action.
971
* The switch will reject actions in which ofs+n_bits is greater than the width
972
* of 'dst', with error type OFPET_BAD_ACTION, code OFPBAC_BAD_ARGUMENT.
974
struct nx_action_autopath {
975
ovs_be16 type; /* OFPAT_VENDOR. */
976
ovs_be16 len; /* Length is 24. */
977
ovs_be32 vendor; /* NX_VENDOR_ID. */
978
ovs_be16 subtype; /* NXAST_AUTOPATH. */
980
/* Where to store the result. */
981
ovs_be16 ofs_nbits; /* (ofs << 6) | (n_bits - 1). */
982
ovs_be32 dst; /* Destination. */
984
ovs_be32 id; /* Autopath ID. */
987
OFP_ASSERT(sizeof(struct nx_action_autopath) == 24);
989
976
/* Action structure for NXAST_BUNDLE and NXAST_BUNDLE_LOAD.
991
978
* The bundle actions choose a slave from a supplied list of options.
1582
* For a packet received via a GRE or VXLAN tunnel including a (32-bit) key, the
1583
* key is stored in the low 32-bits and the high bits are zeroed. For other
1584
* packets, the value is 0.
1569
* For a packet received via a GRE, VXLAN or LISP tunnel including a (32-bit)
1570
* key, the key is stored in the low 32-bits and the high bits are zeroed. For
1571
* other packets, the value is 0.
1586
1573
* All zero bits, for packets not received via a keyed tunnel.
1764
1751
#define NXM_NX_COOKIE NXM_HEADER (0x0001, 30, 8)
1765
1752
#define NXM_NX_COOKIE_W NXM_HEADER_W(0x0001, 30, 8)
1754
/* The source or destination address in the outer IP header of a tunneled
1757
* For non-tunneled packets, the value is 0.
1761
* Format: 32-bit integer in network byte order.
1763
* Masking: Fully maskable. */
1764
#define NXM_NX_TUN_IPV4_SRC NXM_HEADER (0x0001, 31, 4)
1765
#define NXM_NX_TUN_IPV4_SRC_W NXM_HEADER_W(0x0001, 31, 4)
1766
#define NXM_NX_TUN_IPV4_DST NXM_HEADER (0x0001, 32, 4)
1767
#define NXM_NX_TUN_IPV4_DST_W NXM_HEADER_W(0x0001, 32, 4)
1767
1769
/* ## --------------------- ## */
1768
1770
/* ## Requests and replies. ## */
1769
1771
/* ## --------------------- ## */
1788
1790
struct nx_flow_mod {
1789
1791
ovs_be64 cookie; /* Opaque controller-issued identifier. */
1790
ovs_be16 command; /* One of OFPFC_*. */
1792
ovs_be16 command; /* OFPFC_* + possibly a table ID (see comment
1793
* on struct nx_flow_mod_table_id). */
1791
1794
ovs_be16 idle_timeout; /* Idle time before discarding (seconds). */
1792
1795
ovs_be16 hard_timeout; /* Max time before discarding (seconds). */
1793
1796
ovs_be16 priority; /* Priority level of flow entry. */
2219
2222
OFP_ASSERT(sizeof(struct nx_action_write_metadata) == 32);
2224
/* Action structure for NXAST_PUSH_MPLS. */
2225
struct nx_action_push_mpls {
2226
ovs_be16 type; /* OFPAT_VENDOR. */
2227
ovs_be16 len; /* Length is 8. */
2228
ovs_be32 vendor; /* NX_VENDOR_ID. */
2229
ovs_be16 subtype; /* NXAST_PUSH_MPLS. */
2230
ovs_be16 ethertype; /* Ethertype */
2233
OFP_ASSERT(sizeof(struct nx_action_push_mpls) == 16);
2235
/* Action structure for NXAST_POP_MPLS. */
2236
struct nx_action_pop_mpls {
2237
ovs_be16 type; /* OFPAT_VENDOR. */
2238
ovs_be16 len; /* Length is 8. */
2239
ovs_be32 vendor; /* NX_VENDOR_ID. */
2240
ovs_be16 subtype; /* NXAST_POP_MPLS. */
2241
ovs_be16 ethertype; /* Ethertype */
2244
OFP_ASSERT(sizeof(struct nx_action_pop_mpls) == 16);
2246
/* Action structure for NXAST_SET_MPLS_TTL. */
2247
struct nx_action_mpls_ttl {
2248
ovs_be16 type; /* OFPAT_VENDOR. */
2249
ovs_be16 len; /* Length is 8. */
2250
ovs_be32 vendor; /* NX_VENDOR_ID. */
2251
ovs_be16 subtype; /* NXAST_SET_MPLS_TTL. */
2252
uint8_t ttl; /* TTL */
2255
OFP_ASSERT(sizeof(struct nx_action_mpls_ttl) == 16);
2257
/* Action structure for NXAST_SAMPLE.
2259
* Samples matching packets with the given probability and sends them
2260
* each to the set of collectors identified with the given ID. The
2261
* probability is expressed as a number of packets to be sampled out
2262
* of USHRT_MAX packets, and must be >0.
2264
* When sending packet samples to IPFIX collectors, the IPFIX flow
2265
* record sent for each sampled packet is associated with the given
2266
* observation domain ID and observation point ID. Each IPFIX flow
2267
* record contain the sampled packet's headers when executing this
2268
* rule. If a sampled packet's headers are modified by previous
2269
* actions in the flow, those modified headers are sent. */
2270
struct nx_action_sample {
2271
ovs_be16 type; /* OFPAT_VENDOR. */
2272
ovs_be16 len; /* Length is 24. */
2273
ovs_be32 vendor; /* NX_VENDOR_ID. */
2274
ovs_be16 subtype; /* NXAST_SAMPLE. */
2275
ovs_be16 probability; /* Fraction of packets to sample. */
2276
ovs_be32 collector_set_id; /* ID of collector set in OVSDB. */
2277
ovs_be32 obs_domain_id; /* ID of sampling observation domain. */
2278
ovs_be32 obs_point_id; /* ID of sampling observation point. */
2280
OFP_ASSERT(sizeof(struct nx_action_sample) == 24);
2221
2282
#endif /* openflow/nicira-ext.h */