Coverage Report

Created: 2026-09-14 06:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openvswitch/include/openvswitch/meta-flow.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2011-2017 Nicira, Inc.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at:
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
#ifndef OPENVSWITCH_META_FLOW_H
18
#define OPENVSWITCH_META_FLOW_H 1
19
20
#include <limits.h>
21
#include <stdarg.h>
22
#include <string.h>
23
#include <sys/types.h>
24
#include <netinet/in.h>
25
#include <netinet/ip6.h>
26
#include "openvswitch/flow.h"
27
#include "openvswitch/ofp-errors.h"
28
#include "openvswitch/ofp-protocol.h"
29
#include "openvswitch/packets.h"
30
#include "openvswitch/util.h"
31
32
#ifdef __cplusplus
33
extern "C" {
34
#endif
35
36
struct ds;
37
struct match;
38
struct ofputil_port_map;
39
struct ofputil_tlv_table_mod;
40
41
/* Open vSwitch fields
42
 * ===================
43
 *
44
 * Refer to ovs-fields(7) for a detailed introduction to Open vSwitch fields.
45
 *
46
 *
47
 * Field specifications
48
 * ====================
49
 *
50
 * Each of the enumeration values below represents a field.  The comments
51
 * preceding each enum must be in a stylized form that is parsed at compile
52
 * time by the extract-ofp-fields program.  The comment itself consists of a
53
 * series of paragraphs separate by blank lines.  The paragraphs consist of:
54
 *
55
 *     - The first paragraph gives the user-visible name of the field as a
56
 *       quoted string.  This is the name used for parsing and formatting the
57
 *       field.
58
 *
59
 *       For historical reasons, some fields have an additional name that is
60
 *       accepted as an alternative in parsing.  This name, when there is one,
61
 *       is given as a quoted string in parentheses along with "aka".  For
62
 *       example:
63
 *
64
 *           "tun_id" (aka "tunnel_id").
65
 *
66
 *       New fields should have only one name.
67
 *
68
 *     - Any number of paragraphs of free text that describe the field.  These
69
 *       are kept brief because the main description is in meta-flow.xml.
70
 *
71
 *     - A final paragraph that consists of a series of key-value pairs, one
72
 *       per line, in the form "key: value." where the period at the end of the
73
 *       line is a mandatory part of the syntax.
74
 *
75
 * Every field must specify the following key-value pairs:
76
 *
77
 *   Type:
78
 *
79
 *     The format and size of the field's value.  Some possible values are
80
 *     generic:
81
 *
82
 *         u8: A one-byte field.
83
 *         be16: A two-byte field.
84
 *         be32: A four-byte field.
85
 *         be64: An eight-byte field.
86
 *
87
 *     The remaining values imply more about the value's semantics, though OVS
88
 *     does not currently take advantage of this additional information:
89
 *
90
 *         MAC: A six-byte field whose value is an Ethernet address.
91
 *         IPv6: A 16-byte field whose value is an IPv6 address.
92
 *         tunnelMD: A variable length field, up to 124 bytes, that carries
93
 *                   tunnel metadata.
94
 *
95
 *   Maskable:
96
 *
97
 *     Either "bitwise", if OVS supports matching any subset of bits in the
98
 *     field, or "no", if OVS only supports matching or wildcarding the entire
99
 *     field.
100
 *
101
 *   Formatting:
102
 *
103
 *     Explains how a field's value is formatted and parsed for human
104
 *     consumption.  Some of the options are fairly generally useful:
105
 *
106
 *       decimal: Formats the value as a decimal number.  On parsing, accepts
107
 *         decimal (with no prefix), hexadecimal with 0x prefix, or octal
108
 *         with 0 prefix.
109
 *
110
 *       hexadecimal: Same as decimal except nonzero values are formatted in
111
 *         hex with 0x prefix.  The default for parsing is *not* hexadecimal:
112
 *         only with a 0x prefix is the input in hexadecimal.
113
 *
114
 *       Ethernet: Formats and accepts the common format xx:xx:xx:xx:xx:xx.
115
 *         6-byte fields only.
116
 *
117
 *       IPv4: Formats and accepts the common format w.x.y.z.  4-byte fields
118
 *         only.
119
 *
120
 *       IPv6: Formats and accepts the common IPv6 formats.  16-byte fields
121
 *         only.
122
 *
123
 *       OpenFlow 1.0 port: Accepts an OpenFlow well-known port name
124
 *         (e.g. "IN_PORT") in uppercase or lowercase, or a 16-bit port
125
 *         number in decimal.  Formats ports using their well-known names in
126
 *         uppercase, or in decimal otherwise.  2-byte fields only.
127
 *
128
 *       OpenFlow 1.1+ port: Same syntax as for OpenFlow 1.0 ports but for
129
 *         4-byte OpenFlow 1.1+ port number fields.
130
 *
131
 *     Others are very specific to particular fields:
132
 *
133
 *       frag: One of the strings "no", "first", "later", "yes", "not_later"
134
 *         describing which IPv4/v6 fragments are matched.
135
 *
136
 *       tunnel flags: Any number of the strings "df", "csum", "key", or
137
 *         "oam" separated by "|".
138
 *
139
 *       TCP flags: See the description of tcp_flags in ovs-fields(7).
140
 *
141
 *       packet type: A pair of packet type namespace NS and NS_TYPE within
142
 *       that namespace "(NS,NS_TYPE)". NS and NS_TYPE are formatted in
143
 *       decimal or hexadecimal as and accept decimal and hexadecimal (with
144
 *       0x prefix) at parsing.
145
 *
146
 *   Prerequisites:
147
 *
148
 *     The field's prerequisites.  The values should be straightfoward.
149
 *
150
 *   Access:
151
 *
152
 *     Either "read-only", for a field that cannot be changed via OpenFlow, or
153
 *     "read/write" for a modifiable field.
154
 *
155
 *   NXM:
156
 *
157
 *     If the field has an NXM field assignment, then this specifies the NXM
158
 *     name of the field (e.g. "NXM_OF_ETH_SRC"), followed by its nxm_type in
159
 *     parentheses, followed by "since v<x>.<y>" specifying the version of Open
160
 *     vSwitch that first supported this field in NXM (e.g. "since v1.1" if it
161
 *     was introduced in Open vSwitch 1.1).
162
 *
163
 *     The NXM name must begin with NXM_OF_ or NXM_NX_.  This allows OVS to
164
 *     determine the correct NXM class.
165
 *
166
 *     If the field does not have an NXM field assignment, specify "none".
167
 *
168
 *   OXM:
169
 *
170
 *     If the field has an OXM field assignment, then this specifies the OXM
171
 *     name of the field (e.g. "OXM_OF_ETH_SRC"), followed by its nxm_type in
172
 *     parentheses, followed by "since OF<a>.<b> v<x>.<y>" specifying the
173
 *     versions of OpenFlow and Open vSwitch that first supported this field in
174
 *     OXM (e.g. "since OF1.3 and v1.10" if it was introduced in OpenFlow 1.3
175
 *     and first supported by Open vSwitch in version 1.10).
176
 *
177
 *     Some fields have more than one OXM field assignment.  For example,
178
 *     actset_output has an experimenter OXM assignment in OpenFlow 1.3 and a
179
 *     standard OXM assignment in OpenFlow 1.5.  In such a case, specify both,
180
 *     separated by commas.
181
 *
182
 *     OVS uses the start of the OXM field name to determine the correct OXM
183
 *     class.  To support a new OXM class, edit the mapping table in
184
 *     build-aux/extract-ofp-fields.
185
 *
186
 *     If the field does not have an OXM field assignment, specify "none".
187
 *
188
 * The following key-value pairs are optional.  Open vSwitch already supports
189
 * all the fields to which they apply, so new fields should probably not
190
 * include these pairs:
191
 *
192
 *   OF1.0:
193
 *
194
 *     Specify this as "exact match" if OpenFlow 1.0 can match or wildcard the
195
 *     entire field, or as "CIDR mask" if OpenFlow 1.0 can match any CIDR
196
 *     prefix of the field.  (OpenFlow 1.0 did not support bitwise matching.)
197
 *     Omit, if OpenFlow 1.0 did not support this field.
198
 *
199
 *   OF1.1:
200
 *
201
 *     Specify this as "exact match" if OpenFlow 1.1 can match or wildcard the
202
 *     entire field, or as "bitwise" if OpenFlow 1.1 can match any subset of
203
 *     bits in the field.  Omit, if OpenFlow 1.1 did not support this field.
204
 *
205
 * The following key-value pair is optional:
206
 *
207
 *   Prefix lookup member:
208
 *
209
 *     If this field makes sense for use with classifier_set_prefix_fields(),
210
 *     specify the name of the "struct flow" member that corresponds to the
211
 *     field.
212
 *
213
 * Finally, a few "register" fields have very similar names and purposes,
214
 * e.g. MFF_REG0 through MFF_REG31.  For these, the comments may be merged
215
 * together using <N> as a metasyntactic variable for the numeric suffix.
216
 * Lines in the comment that are specific to one of the particular fields by
217
 * writing, e.g. <1>, to consider that line only for e.g. MFF_REG1.
218
 */
219
220
enum OVS_PACKED_ENUM mf_field_id {
221
/* ## -------- ## */
222
/* ## Metadata ## */
223
/* ## -------- ## */
224
225
    /* "dp_hash".
226
     *
227
     * Flow hash computed in the datapath.  Internal use only, not programmable
228
     * from controller.
229
     *
230
     * The OXM code point for this is an attempt to test OXM experimenter
231
     * support, which is otherwise difficult to test due to the dearth of use
232
     * out in the wild.  Because controllers can't add flows that match on
233
     * dp_hash, this doesn't commit OVS to supporting this OXM experimenter
234
     * code point in the future.
235
     *
236
     * Type: be32.
237
     * Maskable: bitwise.
238
     * Formatting: hexadecimal.
239
     * Prerequisites: none.
240
     * Access: read-only.
241
     * NXM: NXM_NX_DP_HASH(35) since v2.2.
242
     * OXM: NXOXM_ET_DP_HASH(0) since v2.4.
243
     */
244
    MFF_DP_HASH,
245
246
    /* "recirc_id".
247
     *
248
     * ID for recirculation.  The value 0 is reserved for initially received
249
     * packets.  Internal use only, not programmable from controller.
250
     *
251
     * Type: be32.
252
     * Maskable: no.
253
     * Formatting: decimal.
254
     * Prerequisites: none.
255
     * Access: read-only.
256
     * NXM: NXM_NX_RECIRC_ID(36) since v2.2.
257
     * OXM: none.
258
     */
259
    MFF_RECIRC_ID,
260
261
    /* "packet_type".
262
     *
263
     * Define the packet type in OpenFlow 1.5+.
264
     *
265
     * Type: be32.
266
     * Maskable: no.
267
     * Formatting: packet type.
268
     * Prerequisites: none.
269
     * Access: read-only.
270
     * NXM: none.
271
     * OXM: OXM_OF_PACKET_TYPE(44) since OF1.5 and v2.8.
272
     */
273
    MFF_PACKET_TYPE,
274
275
    /* "conj_id".
276
     *
277
     * ID for "conjunction" actions.  Please refer to ovs-fields(7)
278
     * documentation of "conjunction" for details.
279
     *
280
     * Type: be32.
281
     * Maskable: no.
282
     * Formatting: decimal.
283
     * Prerequisites: none.
284
     * Access: read-only.
285
     * NXM: NXM_NX_CONJ_ID(37) since v2.4.
286
     * OXM: none. */
287
    MFF_CONJ_ID,
288
289
    /* "tun_id" (aka "tunnel_id").
290
     *
291
     * The "key" or "tunnel ID" or "VNI" in a packet received via a keyed
292
     * tunnel.  For protocols in which the key is shorter than 64 bits, the key
293
     * is stored in the low bits and the high bits are zeroed.  For non-keyed
294
     * tunnels and packets not received via a tunnel, the value is 0.
295
     *
296
     * Type: be64.
297
     * Maskable: bitwise.
298
     * Formatting: hexadecimal.
299
     * Prerequisites: none.
300
     * Access: read/write.
301
     * NXM: NXM_NX_TUN_ID(16) since v1.1.
302
     * OXM: OXM_OF_TUNNEL_ID(38) since OF1.3 and v1.10.
303
     * Prefix lookup member: tunnel.tun_id.
304
     */
305
    MFF_TUN_ID,
306
307
    /* "tun_src".
308
     *
309
     * The IPv4 source address in the outer IP header of a tunneled packet.
310
     *
311
     * For non-tunneled packets, the value is 0.
312
     *
313
     * Type: be32.
314
     * Maskable: bitwise.
315
     * Formatting: IPv4.
316
     * Prerequisites: none.
317
     * Access: read/write.
318
     * NXM: NXM_NX_TUN_IPV4_SRC(31) since v2.0.
319
     * OXM: none.
320
     * Prefix lookup member: tunnel.ip_src.
321
     */
322
    MFF_TUN_SRC,
323
324
    /* "tun_dst".
325
     *
326
     * The IPv4 destination address in the outer IP header of a tunneled
327
     * packet.
328
     *
329
     * For non-tunneled packets, the value is 0.
330
     *
331
     * Type: be32.
332
     * Maskable: bitwise.
333
     * Formatting: IPv4.
334
     * Prerequisites: none.
335
     * Access: read/write.
336
     * NXM: NXM_NX_TUN_IPV4_DST(32) since v2.0.
337
     * OXM: none.
338
     * Prefix lookup member: tunnel.ip_dst.
339
     */
340
    MFF_TUN_DST,
341
342
    /* "tun_ipv6_src".
343
     *
344
     * The IPv6 source address in the outer IP header of a tunneled packet.
345
     *
346
     * For non-tunneled packets, the value is 0.
347
     *
348
     * Type: be128.
349
     * Maskable: bitwise.
350
     * Formatting: IPv6.
351
     * Prerequisites: none.
352
     * Access: read/write.
353
     * NXM: NXM_NX_TUN_IPV6_SRC(109) since v2.5.
354
     * OXM: none.
355
     * Prefix lookup member: tunnel.ipv6_src.
356
     */
357
    MFF_TUN_IPV6_SRC,
358
359
    /* "tun_ipv6_dst".
360
     *
361
     * The IPv6 destination address in the outer IP header of a tunneled
362
     * packet.
363
     *
364
     * For non-tunneled packets, the value is 0.
365
     *
366
     * Type: be128.
367
     * Maskable: bitwise.
368
     * Formatting: IPv6.
369
     * Prerequisites: none.
370
     * Access: read/write.
371
     * NXM: NXM_NX_TUN_IPV6_DST(110) since v2.5.
372
     * OXM: none.
373
     * Prefix lookup member: tunnel.ipv6_dst.
374
     */
375
    MFF_TUN_IPV6_DST,
376
377
    /* "tun_flags".
378
     *
379
     * Flags representing aspects of tunnel behavior.
380
     *
381
     * For non-tunneled packets, the value is 0.
382
     *
383
     * Type: be16 (low 1 bits).
384
     * Maskable: bitwise.
385
     * Formatting: tunnel flags.
386
     * Prerequisites: none.
387
     * Access: read/write.
388
     * NXM: NXM_NX_TUN_FLAGS(104) since v2.5.
389
     * OXM: none.
390
     */
391
    MFF_TUN_FLAGS,
392
393
    /* "tun_ttl".
394
     *
395
     * The TTL in the outer IP header of a tunneled packet.  Internal use only,
396
     * not programmable from controller.
397
     *
398
     * For non-tunneled packets, the value is 0.
399
     *
400
     * Type: u8.
401
     * Maskable: no.
402
     * Formatting: decimal.
403
     * Prerequisites: none.
404
     * Access: read-only.
405
     * NXM: none.
406
     * OXM: none.
407
     */
408
    MFF_TUN_TTL,
409
410
    /* "tun_tos".
411
     *
412
     * The ToS value in the outer IP header of a tunneled packet.  Internal use
413
     * only, not programmable from controller.
414
     *
415
     * Type: u8.
416
     * Maskable: no.
417
     * Formatting: decimal.
418
     * Prerequisites: none.
419
     * Access: read-only.
420
     * NXM: none.
421
     * OXM: none.
422
     */
423
    MFF_TUN_TOS,
424
425
    /* "tun_gbp_id".
426
     *
427
     * VXLAN Group Policy ID
428
     *
429
     * Type: be16.
430
     * Maskable: bitwise.
431
     * Formatting: decimal.
432
     * Prerequisites: none.
433
     * Access: read/write.
434
     * NXM: NXM_NX_TUN_GBP_ID(38) since v2.4.
435
     * OXM: none.
436
     */
437
    MFF_TUN_GBP_ID,
438
439
    /* "tun_gbp_flags".
440
     *
441
     * VXLAN Group Policy flags
442
     *
443
     * Type: u8.
444
     * Maskable: bitwise.
445
     * Formatting: hexadecimal.
446
     * Prerequisites: none.
447
     * Access: read/write.
448
     * NXM: NXM_NX_TUN_GBP_FLAGS(39) since v2.4.
449
     * OXM: none.
450
     */
451
    MFF_TUN_GBP_FLAGS,
452
453
    /* "tun_erspan_idx".
454
     *
455
     * ERSPAN index (direction/port number)
456
     *
457
     * Type: be32 (low 20 bits).
458
     * Maskable: bitwise.
459
     * Formatting: hexadecimal.
460
     * Prerequisites: none.
461
     * Access: read/write.
462
     * NXM: none.
463
     * OXM: NXOXM_ET_ERSPAN_IDX(11) since v2.10.
464
     */
465
    MFF_TUN_ERSPAN_IDX,
466
467
    /* "tun_erspan_ver".
468
     *
469
     * ERSPAN version (v1 / v2)
470
     *
471
     * Type: u8 (low 4 bits).
472
     * Maskable: bitwise.
473
     * Formatting: decimal.
474
     * Prerequisites: none.
475
     * Access: read/write.
476
     * NXM: none.
477
     * OXM: NXOXM_ET_ERSPAN_VER(12) since v2.10.
478
     */
479
    MFF_TUN_ERSPAN_VER,
480
481
    /* "tun_erspan_dir".
482
     *
483
     * ERSPAN mirrored traffic's direction
484
     *
485
     * Type: u8 (low 1 bits).
486
     * Maskable: bitwise.
487
     * Formatting: decimal.
488
     * Prerequisites: none.
489
     * Access: read/write.
490
     * NXM: none.
491
     * OXM: NXOXM_ET_ERSPAN_DIR(13) since v2.10.
492
     */
493
    MFF_TUN_ERSPAN_DIR,
494
495
    /* "tun_erspan_hwid".
496
     *
497
     * ERSPAN Hardware ID
498
     *
499
     * Type: u8 (low 6 bits).
500
     * Maskable: bitwise.
501
     * Formatting: hexadecimal.
502
     * Prerequisites: none.
503
     * Access: read/write.
504
     * NXM: none.
505
     * OXM: NXOXM_ET_ERSPAN_HWID(14) since v2.10.
506
     */
507
    MFF_TUN_ERSPAN_HWID,
508
509
    /* "tun_gtpu_flags".
510
     *
511
     * GTP-U tunnel flags.
512
     *
513
     * Type: u8.
514
     * Maskable: bitwise.
515
     * Formatting: hexadecimal.
516
     * Prerequisites: none.
517
     * Access: read-only.
518
     * NXM: none.
519
     * OXM: NXOXM_ET_GTPU_FLAGS(15) since v2.13.
520
     */
521
    MFF_TUN_GTPU_FLAGS,
522
523
    /* "tun_gtpu_msgtype".
524
     *
525
     * GTP-U tunnel message type.
526
     *
527
     * Type: u8.
528
     * Maskable: bitwise.
529
     * Formatting: decimal.
530
     * Prerequisites: none.
531
     * Access: read-only.
532
     * NXM: none.
533
     * OXM: NXOXM_ET_GTPU_MSGTYPE(16) since v2.13.
534
     */
535
    MFF_TUN_GTPU_MSGTYPE,
536
537
#if TUN_METADATA_NUM_OPTS == 64
538
    /* "tun_metadata<N>".
539
     *
540
     * Encapsulation metadata for tunnels.
541
     *
542
     * Each NXM can be dynamically mapped onto a particular tunnel field using
543
     * OpenFlow commands. The individual NXMs can each carry up to 124 bytes
544
     * of data and a combined total of 256 across all allocated fields.
545
     *
546
     * Type: tunnelMD.
547
     * Maskable: bitwise.
548
     * Formatting: hexadecimal.
549
     * Prerequisites: none.
550
     * Access: read/write.
551
     * NXM: NXM_NX_TUN_METADATA0(40) since v2.5.        <0>
552
     * NXM: NXM_NX_TUN_METADATA1(41) since v2.5.        <1>
553
     * NXM: NXM_NX_TUN_METADATA2(42) since v2.5.        <2>
554
     * NXM: NXM_NX_TUN_METADATA3(43) since v2.5.        <3>
555
     * NXM: NXM_NX_TUN_METADATA4(44) since v2.5.        <4>
556
     * NXM: NXM_NX_TUN_METADATA5(45) since v2.5.        <5>
557
     * NXM: NXM_NX_TUN_METADATA6(46) since v2.5.        <6>
558
     * NXM: NXM_NX_TUN_METADATA7(47) since v2.5.        <7>
559
     * NXM: NXM_NX_TUN_METADATA8(48) since v2.5.        <8>
560
     * NXM: NXM_NX_TUN_METADATA9(49) since v2.5.        <9>
561
     * NXM: NXM_NX_TUN_METADATA10(50) since v2.5.       <10>
562
     * NXM: NXM_NX_TUN_METADATA11(51) since v2.5.       <11>
563
     * NXM: NXM_NX_TUN_METADATA12(52) since v2.5.       <12>
564
     * NXM: NXM_NX_TUN_METADATA13(53) since v2.5.       <13>
565
     * NXM: NXM_NX_TUN_METADATA14(54) since v2.5.       <14>
566
     * NXM: NXM_NX_TUN_METADATA15(55) since v2.5.       <15>
567
     * NXM: NXM_NX_TUN_METADATA16(56) since v2.5.       <16>
568
     * NXM: NXM_NX_TUN_METADATA17(57) since v2.5.       <17>
569
     * NXM: NXM_NX_TUN_METADATA18(58) since v2.5.       <18>
570
     * NXM: NXM_NX_TUN_METADATA19(59) since v2.5.       <19>
571
     * NXM: NXM_NX_TUN_METADATA20(60) since v2.5.       <20>
572
     * NXM: NXM_NX_TUN_METADATA21(61) since v2.5.       <21>
573
     * NXM: NXM_NX_TUN_METADATA22(62) since v2.5.       <22>
574
     * NXM: NXM_NX_TUN_METADATA23(63) since v2.5.       <23>
575
     * NXM: NXM_NX_TUN_METADATA24(64) since v2.5.       <24>
576
     * NXM: NXM_NX_TUN_METADATA25(65) since v2.5.       <25>
577
     * NXM: NXM_NX_TUN_METADATA26(66) since v2.5.       <26>
578
     * NXM: NXM_NX_TUN_METADATA27(67) since v2.5.       <27>
579
     * NXM: NXM_NX_TUN_METADATA28(68) since v2.5.       <28>
580
     * NXM: NXM_NX_TUN_METADATA29(69) since v2.5.       <29>
581
     * NXM: NXM_NX_TUN_METADATA30(70) since v2.5.       <30>
582
     * NXM: NXM_NX_TUN_METADATA31(71) since v2.5.       <31>
583
     * NXM: NXM_NX_TUN_METADATA32(72) since v2.5.       <32>
584
     * NXM: NXM_NX_TUN_METADATA33(73) since v2.5.       <33>
585
     * NXM: NXM_NX_TUN_METADATA34(74) since v2.5.       <34>
586
     * NXM: NXM_NX_TUN_METADATA35(75) since v2.5.       <35>
587
     * NXM: NXM_NX_TUN_METADATA36(76) since v2.5.       <36>
588
     * NXM: NXM_NX_TUN_METADATA37(77) since v2.5.       <37>
589
     * NXM: NXM_NX_TUN_METADATA38(78) since v2.5.       <38>
590
     * NXM: NXM_NX_TUN_METADATA39(79) since v2.5.       <39>
591
     * NXM: NXM_NX_TUN_METADATA40(80) since v2.5.       <40>
592
     * NXM: NXM_NX_TUN_METADATA41(81) since v2.5.       <41>
593
     * NXM: NXM_NX_TUN_METADATA42(82) since v2.5.       <42>
594
     * NXM: NXM_NX_TUN_METADATA43(83) since v2.5.       <43>
595
     * NXM: NXM_NX_TUN_METADATA44(84) since v2.5.       <44>
596
     * NXM: NXM_NX_TUN_METADATA45(85) since v2.5.       <45>
597
     * NXM: NXM_NX_TUN_METADATA46(86) since v2.5.       <46>
598
     * NXM: NXM_NX_TUN_METADATA47(87) since v2.5.       <47>
599
     * NXM: NXM_NX_TUN_METADATA48(88) since v2.5.       <48>
600
     * NXM: NXM_NX_TUN_METADATA49(89) since v2.5.       <49>
601
     * NXM: NXM_NX_TUN_METADATA50(90) since v2.5.       <50>
602
     * NXM: NXM_NX_TUN_METADATA51(91) since v2.5.       <51>
603
     * NXM: NXM_NX_TUN_METADATA52(92) since v2.5.       <52>
604
     * NXM: NXM_NX_TUN_METADATA53(93) since v2.5.       <53>
605
     * NXM: NXM_NX_TUN_METADATA54(94) since v2.5.       <54>
606
     * NXM: NXM_NX_TUN_METADATA55(95) since v2.5.       <55>
607
     * NXM: NXM_NX_TUN_METADATA56(96) since v2.5.       <56>
608
     * NXM: NXM_NX_TUN_METADATA57(97) since v2.5.       <57>
609
     * NXM: NXM_NX_TUN_METADATA58(98) since v2.5.       <58>
610
     * NXM: NXM_NX_TUN_METADATA59(99) since v2.5.       <59>
611
     * NXM: NXM_NX_TUN_METADATA60(100) since v2.5.      <60>
612
     * NXM: NXM_NX_TUN_METADATA61(101) since v2.5.      <61>
613
     * NXM: NXM_NX_TUN_METADATA62(102) since v2.5.      <62>
614
     * NXM: NXM_NX_TUN_METADATA63(103) since v2.5.      <63>
615
     * OXM: none.
616
     */
617
    MFF_TUN_METADATA0,
618
    MFF_TUN_METADATA1,
619
    MFF_TUN_METADATA2,
620
    MFF_TUN_METADATA3,
621
    MFF_TUN_METADATA4,
622
    MFF_TUN_METADATA5,
623
    MFF_TUN_METADATA6,
624
    MFF_TUN_METADATA7,
625
    MFF_TUN_METADATA8,
626
    MFF_TUN_METADATA9,
627
    MFF_TUN_METADATA10,
628
    MFF_TUN_METADATA11,
629
    MFF_TUN_METADATA12,
630
    MFF_TUN_METADATA13,
631
    MFF_TUN_METADATA14,
632
    MFF_TUN_METADATA15,
633
    MFF_TUN_METADATA16,
634
    MFF_TUN_METADATA17,
635
    MFF_TUN_METADATA18,
636
    MFF_TUN_METADATA19,
637
    MFF_TUN_METADATA20,
638
    MFF_TUN_METADATA21,
639
    MFF_TUN_METADATA22,
640
    MFF_TUN_METADATA23,
641
    MFF_TUN_METADATA24,
642
    MFF_TUN_METADATA25,
643
    MFF_TUN_METADATA26,
644
    MFF_TUN_METADATA27,
645
    MFF_TUN_METADATA28,
646
    MFF_TUN_METADATA29,
647
    MFF_TUN_METADATA30,
648
    MFF_TUN_METADATA31,
649
    MFF_TUN_METADATA32,
650
    MFF_TUN_METADATA33,
651
    MFF_TUN_METADATA34,
652
    MFF_TUN_METADATA35,
653
    MFF_TUN_METADATA36,
654
    MFF_TUN_METADATA37,
655
    MFF_TUN_METADATA38,
656
    MFF_TUN_METADATA39,
657
    MFF_TUN_METADATA40,
658
    MFF_TUN_METADATA41,
659
    MFF_TUN_METADATA42,
660
    MFF_TUN_METADATA43,
661
    MFF_TUN_METADATA44,
662
    MFF_TUN_METADATA45,
663
    MFF_TUN_METADATA46,
664
    MFF_TUN_METADATA47,
665
    MFF_TUN_METADATA48,
666
    MFF_TUN_METADATA49,
667
    MFF_TUN_METADATA50,
668
    MFF_TUN_METADATA51,
669
    MFF_TUN_METADATA52,
670
    MFF_TUN_METADATA53,
671
    MFF_TUN_METADATA54,
672
    MFF_TUN_METADATA55,
673
    MFF_TUN_METADATA56,
674
    MFF_TUN_METADATA57,
675
    MFF_TUN_METADATA58,
676
    MFF_TUN_METADATA59,
677
    MFF_TUN_METADATA60,
678
    MFF_TUN_METADATA61,
679
    MFF_TUN_METADATA62,
680
    MFF_TUN_METADATA63,
681
#else
682
#error "Need to update MFF_TUN_METADATA* to match TUN_METADATA_NUM_OPTS"
683
#endif
684
685
    /* "metadata".
686
     *
687
     * A scratch pad value standardized in OpenFlow 1.1+.  Initially zero, at
688
     * the beginning of the pipeline.
689
     *
690
     * Type: be64.
691
     * Maskable: bitwise.
692
     * Formatting: hexadecimal.
693
     * Prerequisites: none.
694
     * Access: read/write.
695
     * NXM: none.
696
     * OXM: OXM_OF_METADATA(2) since OF1.2 and v1.8.
697
     * OF1.1: bitwise mask.
698
     */
699
    MFF_METADATA,
700
701
    /* "in_port".
702
     *
703
     * 16-bit (OpenFlow 1.0) view of the physical or virtual port on which the
704
     * packet was received.
705
     *
706
     * Type: be16.
707
     * Maskable: no.
708
     * Formatting: OpenFlow 1.0 port.
709
     * Prerequisites: none.
710
     * Access: read/write.
711
     * NXM: NXM_OF_IN_PORT(0) since v1.1.
712
     * OXM: none.
713
     * OF1.0: exact match.
714
     * OF1.1: exact match.
715
     */
716
    MFF_IN_PORT,
717
718
    /* "in_port_oxm".
719
     *
720
     * 32-bit (OpenFlow 1.1+) view of the physical or virtual port on which the
721
     * packet was received.
722
     *
723
     * Type: be32.
724
     * Maskable: no.
725
     * Formatting: OpenFlow 1.1+ port.
726
     * Prerequisites: none.
727
     * Access: read/write.
728
     * NXM: none.
729
     * OXM: OXM_OF_IN_PORT(0) since OF1.2 and v1.7.
730
     * OF1.1: exact match.
731
     */
732
    MFF_IN_PORT_OXM,
733
734
    /* "actset_output".
735
     *
736
     * Type: be32.
737
     * Maskable: no.
738
     * Formatting: OpenFlow 1.1+ port.
739
     * Prerequisites: none.
740
     * Access: read-only.
741
     * NXM: none.
742
     * OXM: ONFOXM_ET_ACTSET_OUTPUT(43) since OF1.3 and v2.4,
743
     *      OXM_OF_ACTSET_OUTPUT(43) since OF1.5 and v2.4.
744
     */
745
    MFF_ACTSET_OUTPUT,
746
747
    /* "skb_priority".
748
     *
749
     * Designates the queue to which output will be directed.  The value in
750
     * this field is not necessarily the OpenFlow queue number; with the Linux
751
     * kernel switch, it instead has a pair of subfields designating the
752
     * "major" and "minor" numbers of a Linux kernel qdisc handle.
753
     *
754
     * This field is "semi-internal" in that it can be set with the "set_queue"
755
     * action but not matched or read or written other ways.
756
     *
757
     * Type: be32.
758
     * Maskable: no.
759
     * Formatting: hexadecimal.
760
     * Prerequisites: none.
761
     * Access: read-only.
762
     * NXM: none.
763
     * OXM: none.
764
     */
765
    MFF_SKB_PRIORITY,
766
767
    /* "pkt_mark".
768
     *
769
     * Packet metadata mark.  The mark may be passed into other system
770
     * components in order to facilitate interaction between subsystems.  On
771
     * Linux this corresponds to struct sk_buff's "skb_mark" member but the
772
     * exact implementation is platform-dependent.
773
     *
774
     * Type: be32.
775
     * Maskable: bitwise.
776
     * Formatting: hexadecimal.
777
     * Prerequisites: none.
778
     * Access: read/write.
779
     * NXM: NXM_NX_PKT_MARK(33) since v2.0.
780
     * OXM: none.
781
     */
782
    MFF_PKT_MARK,
783
784
    /* "ct_state".
785
     *
786
     * Connection tracking state.  The field is populated by the NXAST_CT
787
     * action.
788
     *
789
     * Type: be32.
790
     * Maskable: bitwise.
791
     * Formatting: ct state.
792
     * Prerequisites: none.
793
     * Access: read-only.
794
     * NXM: NXM_NX_CT_STATE(105) since v2.5.
795
     * OXM: none.
796
     */
797
    MFF_CT_STATE,
798
799
    /* "ct_zone".
800
     *
801
     * Connection tracking zone.  The field is populated by the
802
     * NXAST_CT action.
803
     *
804
     * Type: be16.
805
     * Maskable: no.
806
     * Formatting: hexadecimal.
807
     * Prerequisites: none.
808
     * Access: read-only.
809
     * NXM: NXM_NX_CT_ZONE(106) since v2.5.
810
     * OXM: none.
811
     */
812
    MFF_CT_ZONE,
813
814
    /* "ct_mark".
815
     *
816
     * Connection tracking mark.  The mark is carried with the
817
     * connection tracking state.  On Linux this corresponds to the
818
     * nf_conn's "mark" member but the exact implementation is
819
     * platform-dependent.
820
     *
821
     * Writable only from nested actions within the NXAST_CT action.
822
     *
823
     * Type: be32.
824
     * Maskable: bitwise.
825
     * Formatting: hexadecimal.
826
     * Prerequisites: none.
827
     * Access: read/write.
828
     * NXM: NXM_NX_CT_MARK(107) since v2.5.
829
     * OXM: none.
830
     */
831
    MFF_CT_MARK,
832
833
    /* "ct_label".
834
     *
835
     * Connection tracking label.  The label is carried with the
836
     * connection tracking state.  On Linux this is held in the
837
     * conntrack label extension but the exact implementation is
838
     * platform-dependent.
839
     *
840
     * Writable only from nested actions within the NXAST_CT action.
841
     *
842
     * Type: be128.
843
     * Maskable: bitwise.
844
     * Formatting: hexadecimal.
845
     * Prerequisites: none.
846
     * Access: read/write.
847
     * NXM: NXM_NX_CT_LABEL(108) since v2.5.
848
     * OXM: none.
849
     */
850
    MFF_CT_LABEL,
851
852
    /* "ct_nw_proto".
853
     *
854
     * The "protocol" byte in the IPv4 or IPv6 header for the original
855
     * direction conntrack tuple, or of the parent conntrack entry, if the
856
     * current connection is a related connection.
857
     *
858
     * The value is initially zero and populated by the CT action.  The value
859
     * remains zero after the CT action only if the packet can not be
860
     * associated with a valid connection, in which case the prerequisites
861
     * for matching this field ("CT") are not met.
862
     *
863
     * Type: u8.
864
     * Maskable: no.
865
     * Formatting: decimal.
866
     * Prerequisites: CT.
867
     * Access: read-only.
868
     * NXM: NXM_NX_CT_NW_PROTO(119) since v2.8.
869
     * OXM: none.
870
     */
871
    MFF_CT_NW_PROTO,
872
873
    /* "ct_nw_src".
874
     *
875
     * IPv4 source address of the original direction tuple of the conntrack
876
     * entry, or of the parent conntrack entry, if the current connection is a
877
     * related connection.
878
     *
879
     * The value is populated by the CT action.
880
     *
881
     * Type: be32.
882
     * Maskable: bitwise.
883
     * Formatting: IPv4.
884
     * Prerequisites: CT.
885
     * Access: read-only.
886
     * NXM: NXM_NX_CT_NW_SRC(120) since v2.8.
887
     * OXM: none.
888
     * Prefix lookup member: ct_nw_src.
889
     */
890
    MFF_CT_NW_SRC,
891
892
    /* "ct_nw_dst".
893
     *
894
     * IPv4 destination address of the original direction tuple of the
895
     * conntrack entry, or of the parent conntrack entry, if the current
896
     * connection is a related connection.
897
     *
898
     * The value is populated by the CT action.
899
     *
900
     * Type: be32.
901
     * Maskable: bitwise.
902
     * Formatting: IPv4.
903
     * Prerequisites: CT.
904
     * Access: read-only.
905
     * NXM: NXM_NX_CT_NW_DST(121) since v2.8.
906
     * OXM: none.
907
     * Prefix lookup member: ct_nw_dst.
908
     */
909
    MFF_CT_NW_DST,
910
911
    /* "ct_ipv6_src".
912
     *
913
     * IPv6 source address of the original direction tuple of the conntrack
914
     * entry, or of the parent conntrack entry, if the current connection is a
915
     * related connection.
916
     *
917
     * The value is populated by the CT action.
918
     *
919
     * Type: be128.
920
     * Maskable: bitwise.
921
     * Formatting: IPv6.
922
     * Prerequisites: CT.
923
     * Access: read-only.
924
     * NXM: NXM_NX_CT_IPV6_SRC(122) since v2.8.
925
     * OXM: none.
926
     * Prefix lookup member: ct_ipv6_src.
927
     */
928
    MFF_CT_IPV6_SRC,
929
930
    /* "ct_ipv6_dst".
931
     *
932
     * IPv6 destination address of the original direction tuple of the
933
     * conntrack entry, or of the parent conntrack entry, if the current
934
     * connection is a related connection.
935
     *
936
     * The value is populated by the CT action.
937
     *
938
     * Type: be128.
939
     * Maskable: bitwise.
940
     * Formatting: IPv6.
941
     * Prerequisites: CT.
942
     * Access: read-only.
943
     * NXM: NXM_NX_CT_IPV6_DST(123) since v2.8.
944
     * OXM: none.
945
     * Prefix lookup member: ct_ipv6_dst.
946
     */
947
    MFF_CT_IPV6_DST,
948
949
    /* "ct_tp_src".
950
     *
951
     * Transport layer source port of the original direction tuple of the
952
     * conntrack entry, or of the parent conntrack entry, if the current
953
     * connection is a related connection.
954
     *
955
     * The value is populated by the CT action.
956
     *
957
     * Type: be16.
958
     * Maskable: bitwise.
959
     * Formatting: decimal.
960
     * Prerequisites: CT.
961
     * Access: read-only.
962
     * NXM: NXM_NX_CT_TP_SRC(124) since v2.8.
963
     * OXM: none.
964
     */
965
    MFF_CT_TP_SRC,
966
967
    /* "ct_tp_dst".
968
     *
969
     * Transport layer destination port of the original direction tuple of the
970
     * conntrack entry, or of the parent conntrack entry, if the current
971
     * connection is a related connection.
972
     *
973
     * The value is populated by the CT action.
974
     *
975
     * Type: be16.
976
     * Maskable: bitwise.
977
     * Formatting: decimal.
978
     * Prerequisites: CT.
979
     * Access: read-only.
980
     * NXM: NXM_NX_CT_TP_DST(125) since v2.8.
981
     * OXM: none.
982
     */
983
    MFF_CT_TP_DST,
984
985
#if FLOW_N_REGS == 32
986
    /* "reg<N>".
987
     *
988
     * Nicira extension scratch pad register with initial value 0.
989
     *
990
     * Type: be32.
991
     * Maskable: bitwise.
992
     * Formatting: hexadecimal.
993
     * Prerequisites: none.
994
     * Access: read/write.
995
     * NXM: NXM_NX_REG0(0) since v1.1.        <0>
996
     * NXM: NXM_NX_REG1(1) since v1.1.        <1>
997
     * NXM: NXM_NX_REG2(2) since v1.1.        <2>
998
     * NXM: NXM_NX_REG3(3) since v1.1.        <3>
999
     * NXM: NXM_NX_REG4(4) since v1.3.        <4>
1000
     * NXM: NXM_NX_REG5(5) since v1.7.        <5>
1001
     * NXM: NXM_NX_REG6(6) since v1.7.        <6>
1002
     * NXM: NXM_NX_REG7(7) since v1.7.        <7>
1003
     * NXM: NXM_NX_REG8(8) since v2.6.        <8>
1004
     * NXM: NXM_NX_REG9(9) since v2.6.        <9>
1005
     * NXM: NXM_NX_REG10(10) since v2.6.      <10>
1006
     * NXM: NXM_NX_REG11(11) since v2.6.      <11>
1007
     * NXM: NXM_NX_REG12(12) since v2.6.      <12>
1008
     * NXM: NXM_NX_REG13(13) since v2.6.      <13>
1009
     * NXM: NXM_NX_REG14(14) since v2.6.      <14>
1010
     * NXM: NXM_NX_REG15(15) since v2.6.      <15>
1011
     * OXM: none.
1012
     */
1013
    MFF_REG0,
1014
    MFF_REG1,
1015
    MFF_REG2,
1016
    MFF_REG3,
1017
    MFF_REG4,
1018
    MFF_REG5,
1019
    MFF_REG6,
1020
    MFF_REG7,
1021
    MFF_REG8,
1022
    MFF_REG9,
1023
    MFF_REG10,
1024
    MFF_REG11,
1025
    MFF_REG12,
1026
    MFF_REG13,
1027
    MFF_REG14,
1028
    MFF_REG15,
1029
1030
    /* "reg<N>".
1031
     *
1032
     * Nicira extension scratch pad register with initial value 0.
1033
     *
1034
     * Type: be32.
1035
     * Maskable: bitwise.
1036
     * Formatting: hexadecimal.
1037
     * Prerequisites: none.
1038
     * Access: read/write.
1039
     * NXM: none.
1040
     * OXM: NXOXM_ET_REG16(17) since v3.7.      <16>
1041
     * OXM: NXOXM_ET_REG17(18) since v3.7.      <17>
1042
     * OXM: NXOXM_ET_REG18(19) since v3.7.      <18>
1043
     * OXM: NXOXM_ET_REG19(20) since v3.7.      <19>
1044
     * OXM: NXOXM_ET_REG20(21) since v3.7.      <20>
1045
     * OXM: NXOXM_ET_REG21(22) since v3.7.      <21>
1046
     * OXM: NXOXM_ET_REG22(23) since v3.7.      <22>
1047
     * OXM: NXOXM_ET_REG23(24) since v3.7.      <23>
1048
     * OXM: NXOXM_ET_REG24(25) since v3.7.      <24>
1049
     * OXM: NXOXM_ET_REG25(26) since v3.7.      <25>
1050
     * OXM: NXOXM_ET_REG26(27) since v3.7.      <26>
1051
     * OXM: NXOXM_ET_REG27(28) since v3.7.      <27>
1052
     * OXM: NXOXM_ET_REG28(29) since v3.7.      <28>
1053
     * OXM: NXOXM_ET_REG29(30) since v3.7.      <29>
1054
     * OXM: NXOXM_ET_REG30(31) since v3.7.      <30>
1055
     * OXM: NXOXM_ET_REG31(32) since v3.7.      <31>
1056
     */
1057
    MFF_REG16,
1058
    MFF_REG17,
1059
    MFF_REG18,
1060
    MFF_REG19,
1061
    MFF_REG20,
1062
    MFF_REG21,
1063
    MFF_REG22,
1064
    MFF_REG23,
1065
    MFF_REG24,
1066
    MFF_REG25,
1067
    MFF_REG26,
1068
    MFF_REG27,
1069
    MFF_REG28,
1070
    MFF_REG29,
1071
    MFF_REG30,
1072
    MFF_REG31,
1073
#else
1074
#error "Need to update MFF_REG* to match FLOW_N_REGS"
1075
#endif
1076
1077
#if FLOW_N_XREGS == 16
1078
    /* "xreg<N>".
1079
     *
1080
     * OpenFlow 1.5 ``extended register".
1081
     *
1082
     * Type: be64.
1083
     * Maskable: bitwise.
1084
     * Formatting: hexadecimal.
1085
     * Prerequisites: none.
1086
     * Access: read/write.
1087
     * NXM: none.
1088
     * OXM: OXM_OF_PKT_REG0(0) since OF1.3 and v2.4.      <0>
1089
     * OXM: OXM_OF_PKT_REG1(1) since OF1.3 and v2.4.      <1>
1090
     * OXM: OXM_OF_PKT_REG2(2) since OF1.3 and v2.4.      <2>
1091
     * OXM: OXM_OF_PKT_REG3(3) since OF1.3 and v2.4.      <3>
1092
     * OXM: OXM_OF_PKT_REG4(4) since OF1.3 and v2.4.      <4>
1093
     * OXM: OXM_OF_PKT_REG5(5) since OF1.3 and v2.4.      <5>
1094
     * OXM: OXM_OF_PKT_REG6(6) since OF1.3 and v2.4.      <6>
1095
     * OXM: OXM_OF_PKT_REG7(7) since OF1.3 and v2.4.      <7>
1096
     * OXM: OXM_OF_PKT_REG8(8) since OF1.3 and v3.7.      <8>
1097
     * OXM: OXM_OF_PKT_REG9(9) since OF1.3 and v3.7.      <9>
1098
     * OXM: OXM_OF_PKT_REG10(10) since OF1.3 and v3.7.    <10>
1099
     * OXM: OXM_OF_PKT_REG11(11) since OF1.3 and v3.7.    <11>
1100
     * OXM: OXM_OF_PKT_REG12(12) since OF1.3 and v3.7.    <12>
1101
     * OXM: OXM_OF_PKT_REG13(13) since OF1.3 and v3.7.    <13>
1102
     * OXM: OXM_OF_PKT_REG14(14) since OF1.3 and v3.7.    <14>
1103
     * OXM: OXM_OF_PKT_REG15(15) since OF1.3 and v3.7.    <15>
1104
     */
1105
    MFF_XREG0,
1106
    MFF_XREG1,
1107
    MFF_XREG2,
1108
    MFF_XREG3,
1109
    MFF_XREG4,
1110
    MFF_XREG5,
1111
    MFF_XREG6,
1112
    MFF_XREG7,
1113
    MFF_XREG8,
1114
    MFF_XREG9,
1115
    MFF_XREG10,
1116
    MFF_XREG11,
1117
    MFF_XREG12,
1118
    MFF_XREG13,
1119
    MFF_XREG14,
1120
    MFF_XREG15,
1121
#else
1122
#error "Need to update MFF_REG* to match FLOW_N_XREGS"
1123
#endif
1124
1125
#if FLOW_N_XXREGS == 8
1126
    /* "xxreg<N>".
1127
     *
1128
     * ``extended-extended register".
1129
     *
1130
     * Type: be128.
1131
     * Maskable: bitwise.
1132
     * Formatting: hexadecimal.
1133
     * Prerequisites: none.
1134
     * Access: read/write.
1135
     * NXM: NXM_NX_XXREG0(111) since v2.6.             <0>
1136
     * NXM: NXM_NX_XXREG1(112) since v2.6.             <1>
1137
     * NXM: NXM_NX_XXREG2(113) since v2.6.             <2>
1138
     * NXM: NXM_NX_XXREG3(114) since v2.6.             <3>
1139
     * OXM: none.
1140
     */
1141
    MFF_XXREG0,
1142
    MFF_XXREG1,
1143
    MFF_XXREG2,
1144
    MFF_XXREG3,
1145
1146
    /* "xxreg<N>".
1147
     *
1148
     * ``extended-extended register".
1149
     *
1150
     * Type: be128.
1151
     * Maskable: bitwise.
1152
     * Formatting: hexadecimal.
1153
     * Prerequisites: none.
1154
     * Access: read/write.
1155
     * NXM: none.
1156
     * OXM: NXOXM_ET_XXREG4(33) since v3.7.            <4>
1157
     * OXM: NXOXM_ET_XXREG5(34) since v3.7.            <5>
1158
     * OXM: NXOXM_ET_XXREG6(35) since v3.7.            <6>
1159
     * OXM: NXOXM_ET_XXREG7(36) since v3.7.            <7>
1160
     */
1161
    MFF_XXREG4,
1162
    MFF_XXREG5,
1163
    MFF_XXREG6,
1164
    MFF_XXREG7,
1165
#else
1166
#error "Need to update MFF_REG* to match FLOW_N_XXREGS"
1167
#endif
1168
1169
/* ## -------- ## */
1170
/* ## Ethernet ## */
1171
/* ## -------- ## */
1172
1173
    /* "eth_src" (aka "dl_src").
1174
     *
1175
     * Source address in Ethernet header.
1176
     *
1177
     * Type: MAC.
1178
     * Maskable: bitwise.
1179
     * Formatting: Ethernet.
1180
     * Prerequisites: Ethernet.
1181
     * Access: read/write.
1182
     * NXM: NXM_OF_ETH_SRC(2) since v1.1.
1183
     * OXM: OXM_OF_ETH_SRC(4) since OF1.2 and v1.7.
1184
     * OF1.0: exact match.
1185
     * OF1.1: bitwise mask.
1186
     */
1187
    MFF_ETH_SRC,
1188
1189
    /* "eth_dst" (aka "dl_dst").
1190
     *
1191
     * Destination address in Ethernet header.
1192
     *
1193
     * Type: MAC.
1194
     * Maskable: bitwise.
1195
     * Formatting: Ethernet.
1196
     * Prerequisites: Ethernet.
1197
     * Access: read/write.
1198
     * NXM: NXM_OF_ETH_DST(1) since v1.1.
1199
     * OXM: OXM_OF_ETH_DST(3) since OF1.2 and v1.7.
1200
     * OF1.0: exact match.
1201
     * OF1.1: bitwise mask.
1202
     */
1203
    MFF_ETH_DST,
1204
1205
    /* "eth_type" (aka "dl_type").
1206
     *
1207
     * Packet's Ethernet type.
1208
     *
1209
     * For a packet with an 802.1Q header, this is the type of the encapsulated
1210
     * frame.
1211
     *
1212
     * Type: be16.
1213
     * Maskable: no.
1214
     * Formatting: hexadecimal.
1215
     * Prerequisites: Ethernet.
1216
     * Access: read-only.
1217
     * NXM: NXM_OF_ETH_TYPE(3) since v1.1.
1218
     * OXM: OXM_OF_ETH_TYPE(5) since OF1.2 and v1.7.
1219
     * OF1.0: exact match.
1220
     * OF1.1: exact match.
1221
     */
1222
    MFF_ETH_TYPE,
1223
1224
/* ## ---- ## */
1225
/* ## VLAN ## */
1226
/* ## ---- ## */
1227
1228
/* It looks odd for vlan_tci, vlan_vid, and vlan_pcp to say that they are
1229
 * supported in OF1.0 and OF1.1, since the detailed semantics of these fields
1230
 * only apply to NXM or OXM.  They are marked as supported for exact matches in
1231
 * OF1.0 and OF1.1 because exact matches on those fields can be successfully
1232
 * translated into the OF1.0 and OF1.1 flow formats. */
1233
1234
    /* "vlan_tci".
1235
     *
1236
     * 802.1Q TCI.
1237
     *
1238
     * For a packet with an 802.1Q header, this is the Tag Control Information
1239
     * (TCI) field, with the CFI bit forced to 1.  For a packet with no 802.1Q
1240
     * header, this has value 0.
1241
     *
1242
     * Type: be16.
1243
     * Maskable: bitwise.
1244
     * Formatting: hexadecimal.
1245
     * Prerequisites: Ethernet.
1246
     * Access: read/write.
1247
     * NXM: NXM_OF_VLAN_TCI(4) since v1.1.
1248
     * OXM: none.
1249
     * OF1.0: exact match.
1250
     * OF1.1: exact match.
1251
     */
1252
    MFF_VLAN_TCI,
1253
1254
    /* "dl_vlan" (OpenFlow 1.0).
1255
     *
1256
     * VLAN ID field.  Zero if no 802.1Q header is present.
1257
     *
1258
     * Type: be16 (low 12 bits).
1259
     * Maskable: no.
1260
     * Formatting: decimal.
1261
     * Prerequisites: Ethernet.
1262
     * Access: read/write.
1263
     * NXM: none.
1264
     * OXM: none.
1265
     * OF1.0: exact match.
1266
     * OF1.1: exact match.
1267
     */
1268
    MFF_DL_VLAN,
1269
1270
    /* "vlan_vid" (OpenFlow 1.2+).
1271
     *
1272
     * If an 802.1Q header is present, this field's value is 0x1000
1273
     * bitwise-or'd with the VLAN ID.  If no 802.1Q is present, this field's
1274
     * value is 0.
1275
     *
1276
     * Type: be16 (low 12 bits).
1277
     * Maskable: bitwise.
1278
     * Formatting: decimal.
1279
     * Prerequisites: Ethernet.
1280
     * Access: read/write.
1281
     * NXM: none.
1282
     * OXM: OXM_OF_VLAN_VID(6) since OF1.2 and v1.7.
1283
     * OF1.0: exact match.
1284
     * OF1.1: exact match.
1285
     */
1286
    MFF_VLAN_VID,
1287
1288
    /* "dl_vlan_pcp" (OpenFlow 1.0).
1289
     *
1290
     * VLAN priority (PCP) field.  Zero if no 802.1Q header is present.
1291
     *
1292
     * Type: u8 (low 3 bits).
1293
     * Maskable: no.
1294
     * Formatting: decimal.
1295
     * Prerequisites: Ethernet.
1296
     * Access: read/write.
1297
     * NXM: none.
1298
     * OXM: none.
1299
     * OF1.0: exact match.
1300
     * OF1.1: exact match.
1301
     */
1302
    MFF_DL_VLAN_PCP,
1303
1304
    /* "vlan_pcp" (OpenFlow 1.2+).
1305
     *
1306
     * VLAN priority (PCP) field.  Zero if no 802.1Q header is present.
1307
     *
1308
     * Type: u8 (low 3 bits).
1309
     * Maskable: no.
1310
     * Formatting: decimal.
1311
     * Prerequisites: VLAN VID.
1312
     * Access: read/write.
1313
     * NXM: none.
1314
     * OXM: OXM_OF_VLAN_PCP(7) since OF1.2 and v1.7.
1315
     * OF1.0: exact match.
1316
     * OF1.1: exact match.
1317
     */
1318
    MFF_VLAN_PCP,
1319
1320
/* ## ---- ## */
1321
/* ## MPLS ## */
1322
/* ## ---- ## */
1323
1324
    /* "mpls_label".
1325
     *
1326
     * The outermost MPLS label, or 0 if no MPLS labels are present.
1327
     *
1328
     * Type: be32 (low 20 bits).
1329
     * Maskable: no.
1330
     * Formatting: decimal.
1331
     * Prerequisites: MPLS.
1332
     * Access: read/write.
1333
     * NXM: none.
1334
     * OXM: OXM_OF_MPLS_LABEL(34) since OF1.2 and v1.11.
1335
     * OF1.1: exact match.
1336
     */
1337
    MFF_MPLS_LABEL,
1338
1339
    /* "mpls_tc".
1340
     *
1341
     * The outermost MPLS label's traffic control (TC) field, or 0 if no MPLS
1342
     * labels are present.
1343
     *
1344
     * Type: u8 (low 3 bits).
1345
     * Maskable: no.
1346
     * Formatting: decimal.
1347
     * Prerequisites: MPLS.
1348
     * Access: read/write.
1349
     * NXM: none.
1350
     * OXM: OXM_OF_MPLS_TC(35) since OF1.2 and v1.11.
1351
     * OF1.1: exact match.
1352
     */
1353
    MFF_MPLS_TC,
1354
1355
    /* "mpls_bos".
1356
     *
1357
     * The outermost MPLS label's bottom of stack (BoS) field, or 0 if no MPLS
1358
     * labels are present.
1359
     *
1360
     * Type: u8 (low 1 bits).
1361
     * Maskable: no.
1362
     * Formatting: decimal.
1363
     * Prerequisites: MPLS.
1364
     * Access: read-only.
1365
     * NXM: none.
1366
     * OXM: OXM_OF_MPLS_BOS(36) since OF1.3 and v1.11.
1367
     */
1368
    MFF_MPLS_BOS,
1369
1370
    /* "mpls_ttl".
1371
     *
1372
     * The outermost MPLS label's time-to-live (TTL) field, or 0 if no MPLS
1373
     * labels are present.
1374
     *
1375
     * Type: u8.
1376
     * Maskable: no.
1377
     * Formatting: decimal.
1378
     * Prerequisites: MPLS.
1379
     * Access: read/write.
1380
     * NXM: NXM_NX_MPLS_TTL(30) since v2.6.
1381
     * OXM: none.
1382
     */
1383
    MFF_MPLS_TTL,
1384
1385
/* ## ---- ## */
1386
/* ## IPv4 ## */
1387
/* ## ---- ## */
1388
1389
/* Update mf_is_l3_or_higher() if MFF_IPV4_SRC is no longer the first element
1390
 * for a field of layer 3 or higher */
1391
1392
    /* "ip_src" (aka "nw_src").
1393
     *
1394
     * The source address in the IPv4 header.
1395
     *
1396
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1397
     *
1398
     * Type: be32.
1399
     * Maskable: bitwise.
1400
     * Formatting: IPv4.
1401
     * Prerequisites: IPv4.
1402
     * Access: read/write.
1403
     * NXM: NXM_OF_IP_SRC(7) since v1.1.
1404
     * OXM: OXM_OF_IPV4_SRC(11) since OF1.2 and v1.7.
1405
     * OF1.0: CIDR mask.
1406
     * OF1.1: bitwise mask.
1407
     * Prefix lookup member: nw_src.
1408
     */
1409
    MFF_IPV4_SRC,
1410
1411
    /* "ip_dst" (aka "nw_dst").
1412
     *
1413
     * The destination address in the IPv4 header.
1414
     *
1415
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1416
     *
1417
     * Type: be32.
1418
     * Maskable: bitwise.
1419
     * Formatting: IPv4.
1420
     * Prerequisites: IPv4.
1421
     * Access: read/write.
1422
     * NXM: NXM_OF_IP_DST(8) since v1.1.
1423
     * OXM: OXM_OF_IPV4_DST(12) since OF1.2 and v1.7.
1424
     * OF1.0: CIDR mask.
1425
     * OF1.1: bitwise mask.
1426
     * Prefix lookup member: nw_dst.
1427
     */
1428
    MFF_IPV4_DST,
1429
1430
/* ## ---- ## */
1431
/* ## IPv6 ## */
1432
/* ## ---- ## */
1433
1434
    /* "ipv6_src".
1435
     *
1436
     * The source address in the IPv6 header.
1437
     *
1438
     * Type: be128.
1439
     * Maskable: bitwise.
1440
     * Formatting: IPv6.
1441
     * Prerequisites: IPv6.
1442
     * Access: read/write.
1443
     * NXM: NXM_NX_IPV6_SRC(19) since v1.1.
1444
     * OXM: OXM_OF_IPV6_SRC(26) since OF1.2 and v1.1.
1445
     * Prefix lookup member: ipv6_src.
1446
     */
1447
    MFF_IPV6_SRC,
1448
1449
    /* "ipv6_dst".
1450
     *
1451
     * The destination address in the IPv6 header.
1452
     *
1453
     * Type: be128.
1454
     * Maskable: bitwise.
1455
     * Formatting: IPv6.
1456
     * Prerequisites: IPv6.
1457
     * Access: read/write.
1458
     * NXM: NXM_NX_IPV6_DST(20) since v1.1.
1459
     * OXM: OXM_OF_IPV6_DST(27) since OF1.2 and v1.1.
1460
     * Prefix lookup member: ipv6_dst.
1461
     */
1462
    MFF_IPV6_DST,
1463
1464
    /* "ipv6_label".
1465
     *
1466
     * The flow label in the IPv6 header.
1467
     *
1468
     * Type: be32 (low 20 bits).
1469
     * Maskable: bitwise.
1470
     * Formatting: hexadecimal.
1471
     * Prerequisites: IPv6.
1472
     * Access: read/write.
1473
     * NXM: NXM_NX_IPV6_LABEL(27) since v1.4.
1474
     * OXM: OXM_OF_IPV6_FLABEL(28) since OF1.2 and v1.7.
1475
     */
1476
    MFF_IPV6_LABEL,
1477
1478
/* ## ----------------------- ## */
1479
/* ## IPv4/IPv6 common fields ## */
1480
/* ## ----------------------- ## */
1481
1482
    /* "nw_proto" (aka "ip_proto").
1483
     *
1484
     * The "protocol" byte in the IPv4 or IPv6 header.
1485
     *
1486
     * Type: u8.
1487
     * Maskable: no.
1488
     * Formatting: decimal.
1489
     * Prerequisites: IPv4/IPv6.
1490
     * Access: read-only.
1491
     * NXM: NXM_OF_IP_PROTO(6) since v1.1.
1492
     * OXM: OXM_OF_IP_PROTO(10) since OF1.2 and v1.7.
1493
     * OF1.0: exact match.
1494
     * OF1.1: exact match.
1495
     */
1496
    MFF_IP_PROTO,
1497
1498
/* Both views of the DSCP below are marked as supported in all of the versions
1499
 * of OpenFlow because a match on either view can be successfully translated
1500
 * into every OpenFlow flow format. */
1501
1502
    /* "nw_tos" (OpenFlow 1.0/1.1).
1503
     *
1504
     * The DSCP byte in the IPv4 header or the traffic class byte from the IPv6
1505
     * header, with the ECN bits forced to 0.  (That is, bits 2-7 contain the
1506
     * type of service and bits 0-1 are zero.)
1507
     *
1508
     * Type: u8.
1509
     * Maskable: no.
1510
     * Formatting: decimal.
1511
     * Prerequisites: IPv4/IPv6.
1512
     * Access: read/write.
1513
     * NXM: NXM_OF_IP_TOS(5) since v1.1.
1514
     * OXM: none.
1515
     * OF1.0: exact match.
1516
     * OF1.1: exact match.
1517
     */
1518
    MFF_IP_DSCP,
1519
1520
    /* "ip_dscp" (OpenFlow 1.2+).
1521
     *
1522
     * The DSCP byte in the IPv4 header or the traffic class byte from the IPv6
1523
     * header, shifted right 2 bits.  (That is, bits 0-5 contain the type of
1524
     * service and bits 6-7 are zero.)
1525
     *
1526
     * Type: u8 (low 6 bits).
1527
     * Maskable: no.
1528
     * Formatting: decimal.
1529
     * Prerequisites: IPv4/IPv6.
1530
     * Access: read/write.
1531
     * NXM: none.
1532
     * OXM: OXM_OF_IP_DSCP(8) since OF1.2 and v1.7.
1533
     * OF1.0: exact match.
1534
     * OF1.1: exact match.
1535
     */
1536
    MFF_IP_DSCP_SHIFTED,
1537
1538
    /* "nw_ecn" (aka "ip_ecn").
1539
     *
1540
     * The ECN bits in the IPv4 or IPv6 header.
1541
     *
1542
     * Type: u8 (low 2 bits).
1543
     * Maskable: no.
1544
     * Formatting: decimal.
1545
     * Prerequisites: IPv4/IPv6.
1546
     * Access: read/write.
1547
     * NXM: NXM_NX_IP_ECN(28) since v1.4.
1548
     * OXM: OXM_OF_IP_ECN(9) since OF1.2 and v1.7.
1549
     * OF1.1: exact match.
1550
     */
1551
    MFF_IP_ECN,
1552
1553
    /* "nw_ttl".
1554
     *
1555
     * The time-to-live (TTL) in the IPv4 header or hop limit in the IPv6
1556
     * header.
1557
     *
1558
     * Type: u8.
1559
     * Maskable: no.
1560
     * Formatting: decimal.
1561
     * Prerequisites: IPv4/IPv6.
1562
     * Access: read/write.
1563
     * NXM: NXM_NX_IP_TTL(29) since v1.4.
1564
     * OXM: none.
1565
     */
1566
    MFF_IP_TTL,
1567
1568
    /* "ip_frag" (aka "nw_frag").
1569
     *
1570
     * IP fragment information.
1571
     *
1572
     * Type: u8 (low 2 bits).
1573
     * Maskable: bitwise.
1574
     * Formatting: frag.
1575
     * Prerequisites: IPv4/IPv6.
1576
     * Access: read-only.
1577
     * NXM: NXM_NX_IP_FRAG(26) since v1.3.
1578
     * OXM: none.
1579
     */
1580
    MFF_IP_FRAG,
1581
1582
/* ## --- ## */
1583
/* ## ARP ## */
1584
/* ## --- ## */
1585
1586
    /* "arp_op".
1587
     *
1588
     * ARP opcode.
1589
     *
1590
     * For an Ethernet+IP ARP packet, the opcode in the ARP header.  Always 0
1591
     * otherwise.  Only ARP opcodes between 1 and 255 should be specified for
1592
     * matching.
1593
     *
1594
     * Type: be16.
1595
     * Maskable: no.
1596
     * Formatting: decimal.
1597
     * Prerequisites: ARP.
1598
     * Access: read/write.
1599
     * NXM: NXM_OF_ARP_OP(15) since v1.1.
1600
     * OXM: OXM_OF_ARP_OP(21) since OF1.2 and v1.7.
1601
     * OF1.0: exact match.
1602
     * OF1.1: exact match.
1603
     */
1604
    MFF_ARP_OP,
1605
1606
    /* "arp_spa".
1607
     *
1608
     * For an Ethernet+IP ARP packet, the source protocol (IPv4) address in the
1609
     * ARP header.  Always 0 otherwise.
1610
     *
1611
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1612
     *
1613
     * Type: be32.
1614
     * Maskable: bitwise.
1615
     * Formatting: IPv4.
1616
     * Prerequisites: ARP.
1617
     * Access: read/write.
1618
     * NXM: NXM_OF_ARP_SPA(16) since v1.1.
1619
     * OXM: OXM_OF_ARP_SPA(22) since OF1.2 and v1.7.
1620
     * OF1.0: CIDR mask.
1621
     * OF1.1: bitwise mask.
1622
     */
1623
    MFF_ARP_SPA,
1624
1625
    /* "arp_tpa".
1626
     *
1627
     * For an Ethernet+IP ARP packet, the target protocol (IPv4) address in the
1628
     * ARP header.  Always 0 otherwise.
1629
     *
1630
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1631
     *
1632
     * Type: be32.
1633
     * Maskable: bitwise.
1634
     * Formatting: IPv4.
1635
     * Prerequisites: ARP.
1636
     * Access: read/write.
1637
     * NXM: NXM_OF_ARP_TPA(17) since v1.1.
1638
     * OXM: OXM_OF_ARP_TPA(23) since OF1.2 and v1.7.
1639
     * OF1.0: CIDR mask.
1640
     * OF1.1: bitwise mask.
1641
     */
1642
    MFF_ARP_TPA,
1643
1644
    /* "arp_sha".
1645
     *
1646
     * For an Ethernet+IP ARP packet, the source hardware (Ethernet) address in
1647
     * the ARP header.  Always 0 otherwise.
1648
     *
1649
     * Type: MAC.
1650
     * Maskable: bitwise.
1651
     * Formatting: Ethernet.
1652
     * Prerequisites: ARP.
1653
     * Access: read/write.
1654
     * NXM: NXM_NX_ARP_SHA(17) since v1.1.
1655
     * OXM: OXM_OF_ARP_SHA(24) since OF1.2 and v1.7.
1656
     */
1657
    MFF_ARP_SHA,
1658
1659
    /* "arp_tha".
1660
     *
1661
     * For an Ethernet+IP ARP packet, the target hardware (Ethernet) address in
1662
     * the ARP header.  Always 0 otherwise.
1663
     *
1664
     * Type: MAC.
1665
     * Maskable: bitwise.
1666
     * Formatting: Ethernet.
1667
     * Prerequisites: ARP.
1668
     * Access: read/write.
1669
     * NXM: NXM_NX_ARP_THA(18) since v1.1.
1670
     * OXM: OXM_OF_ARP_THA(25) since OF1.2 and v1.7.
1671
     */
1672
    MFF_ARP_THA,
1673
1674
/* ## --- ## */
1675
/* ## TCP ## */
1676
/* ## --- ## */
1677
1678
    /* "tcp_src" (aka "tp_src").
1679
     *
1680
     * TCP source port.
1681
     *
1682
     * Type: be16.
1683
     * Maskable: bitwise.
1684
     * Formatting: decimal.
1685
     * Prerequisites: TCP.
1686
     * Access: read/write.
1687
     * NXM: NXM_OF_TCP_SRC(9) since v1.1.
1688
     * OXM: OXM_OF_TCP_SRC(13) since OF1.2 and v1.7.
1689
     * OF1.0: exact match.
1690
     * OF1.1: exact match.
1691
     */
1692
    MFF_TCP_SRC,
1693
1694
    /* "tcp_dst" (aka "tp_dst").
1695
     *
1696
     * TCP destination port.
1697
     *
1698
     * Type: be16.
1699
     * Maskable: bitwise.
1700
     * Formatting: decimal.
1701
     * Prerequisites: TCP.
1702
     * Access: read/write.
1703
     * NXM: NXM_OF_TCP_DST(10) since v1.1.
1704
     * OXM: OXM_OF_TCP_DST(14) since OF1.2 and v1.7.
1705
     * OF1.0: exact match.
1706
     * OF1.1: exact match.
1707
     */
1708
    MFF_TCP_DST,
1709
1710
    /* "tcp_flags".
1711
     *
1712
     * Flags in the TCP header.
1713
     *
1714
     * TCP currently defines 9 flag bits, and additional 3 bits are reserved
1715
     * (must be transmitted as zero).  See RFCs 793, 3168, and 3540.
1716
     *
1717
     * Type: be16 (low 12 bits).
1718
     * Maskable: bitwise.
1719
     * Formatting: TCP flags.
1720
     * Prerequisites: TCP.
1721
     * Access: read-only.
1722
     * NXM: NXM_NX_TCP_FLAGS(34) since v2.1.
1723
     * OXM: ONFOXM_ET_TCP_FLAGS(42) since OF1.3 and v2.4,
1724
     *      OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3.
1725
     */
1726
    MFF_TCP_FLAGS,
1727
1728
/* ## --- ## */
1729
/* ## UDP ## */
1730
/* ## --- ## */
1731
1732
    /* "udp_src".
1733
     *
1734
     * UDP source port.
1735
     *
1736
     * Type: be16.
1737
     * Maskable: bitwise.
1738
     * Formatting: decimal.
1739
     * Prerequisites: UDP.
1740
     * Access: read/write.
1741
     * NXM: NXM_OF_UDP_SRC(11) since v1.1.
1742
     * OXM: OXM_OF_UDP_SRC(15) since OF1.2 and v1.7.
1743
     * OF1.0: exact match.
1744
     * OF1.1: exact match.
1745
     */
1746
    MFF_UDP_SRC,
1747
1748
    /* "udp_dst".
1749
     *
1750
     * UDP destination port
1751
     *
1752
     * Type: be16.
1753
     * Maskable: bitwise.
1754
     * Formatting: decimal.
1755
     * Prerequisites: UDP.
1756
     * Access: read/write.
1757
     * NXM: NXM_OF_UDP_DST(12) since v1.1.
1758
     * OXM: OXM_OF_UDP_DST(16) since OF1.2 and v1.7.
1759
     * OF1.0: exact match.
1760
     * OF1.1: exact match.
1761
     */
1762
    MFF_UDP_DST,
1763
1764
/* ## ---- ## */
1765
/* ## SCTP ## */
1766
/* ## ---- ## */
1767
1768
    /* "sctp_src".
1769
     *
1770
     * SCTP source port.
1771
     *
1772
     * Type: be16.
1773
     * Maskable: bitwise.
1774
     * Formatting: decimal.
1775
     * Prerequisites: SCTP.
1776
     * Access: read/write.
1777
     * NXM: none.
1778
     * OXM: OXM_OF_SCTP_SRC(17) since OF1.2 and v2.0.
1779
     * OF1.1: exact match.
1780
     */
1781
    MFF_SCTP_SRC,
1782
1783
    /* "sctp_dst".
1784
     *
1785
     * SCTP destination port.
1786
     *
1787
     * Type: be16.
1788
     * Maskable: bitwise.
1789
     * Formatting: decimal.
1790
     * Prerequisites: SCTP.
1791
     * Access: read/write.
1792
     * NXM: none.
1793
     * OXM: OXM_OF_SCTP_DST(18) since OF1.2 and v2.0.
1794
     * OF1.1: exact match.
1795
     */
1796
    MFF_SCTP_DST,
1797
1798
/* ## ---- ## */
1799
/* ## ICMP ## */
1800
/* ## ---- ## */
1801
1802
    /* "icmp_type".
1803
     *
1804
     * ICMPv4 type.
1805
     *
1806
     * Type: u8.
1807
     * Maskable: no.
1808
     * Formatting: decimal.
1809
     * Prerequisites: ICMPv4.
1810
     * Access: read/write.
1811
     * NXM: NXM_OF_ICMP_TYPE(13) since v1.1.
1812
     * OXM: OXM_OF_ICMPV4_TYPE(19) since OF1.2 and v1.7.
1813
     * OF1.0: exact match.
1814
     * OF1.1: exact match.
1815
     */
1816
    MFF_ICMPV4_TYPE,
1817
1818
    /* "icmp_code".
1819
     *
1820
     * ICMPv4 code.
1821
     *
1822
     * Type: u8.
1823
     * Maskable: no.
1824
     * Formatting: decimal.
1825
     * Prerequisites: ICMPv4.
1826
     * Access: read/write.
1827
     * NXM: NXM_OF_ICMP_CODE(14) since v1.1.
1828
     * OXM: OXM_OF_ICMPV4_CODE(20) since OF1.2 and v1.7.
1829
     * OF1.0: exact match.
1830
     * OF1.1: exact match.
1831
     */
1832
    MFF_ICMPV4_CODE,
1833
1834
    /* "icmpv6_type".
1835
     *
1836
     * ICMPv6 type.
1837
     *
1838
     * Type: u8.
1839
     * Maskable: no.
1840
     * Formatting: decimal.
1841
     * Prerequisites: ICMPv6.
1842
     * Access: read/write.
1843
     * NXM: NXM_NX_ICMPV6_TYPE(21) since v1.1.
1844
     * OXM: OXM_OF_ICMPV6_TYPE(29) since OF1.2 and v1.7.
1845
     */
1846
    MFF_ICMPV6_TYPE,
1847
1848
    /* "icmpv6_code".
1849
     *
1850
     * ICMPv6 code.
1851
     *
1852
     * Type: u8.
1853
     * Maskable: no.
1854
     * Formatting: decimal.
1855
     * Prerequisites: ICMPv6.
1856
     * Access: read/write.
1857
     * NXM: NXM_NX_ICMPV6_CODE(22) since v1.1.
1858
     * OXM: OXM_OF_ICMPV6_CODE(30) since OF1.2 and v1.7.
1859
     */
1860
    MFF_ICMPV6_CODE,
1861
1862
/* ## ------------------------- ## */
1863
/* ## ICMPv6 Neighbor Discovery ## */
1864
/* ## ------------------------- ## */
1865
1866
    /* "nd_target".
1867
     *
1868
     * The target address in an IPv6 Neighbor Discovery message.
1869
     *
1870
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1871
     *
1872
     * Type: be128.
1873
     * Maskable: bitwise.
1874
     * Formatting: IPv6.
1875
     * Prerequisites: ND.
1876
     * Access: read/write.
1877
     * NXM: NXM_NX_ND_TARGET(23) since v1.1.
1878
     * OXM: OXM_OF_IPV6_ND_TARGET(31) since OF1.2 and v1.7.
1879
     */
1880
    MFF_ND_TARGET,
1881
1882
    /* "nd_sll".
1883
     *
1884
     * The source link layer address in an IPv6 Neighbor Discovery message.
1885
     *
1886
     * Type: MAC.
1887
     * Maskable: bitwise.
1888
     * Formatting: Ethernet.
1889
     * Prerequisites: ND solicit.
1890
     * Access: read/write.
1891
     * NXM: NXM_NX_ND_SLL(24) since v1.1.
1892
     * OXM: OXM_OF_IPV6_ND_SLL(32) since OF1.2 and v1.7.
1893
     */
1894
    MFF_ND_SLL,
1895
1896
    /* "nd_tll".
1897
     *
1898
     * The target link layer address in an IPv6 Neighbor Discovery message.
1899
     *
1900
     * Type: MAC.
1901
     * Maskable: bitwise.
1902
     * Formatting: Ethernet.
1903
     * Prerequisites: ND advert.
1904
     * Access: read/write.
1905
     * NXM: NXM_NX_ND_TLL(25) since v1.1.
1906
     * OXM: OXM_OF_IPV6_ND_TLL(33) since OF1.2 and v1.7.
1907
     */
1908
    MFF_ND_TLL,
1909
1910
    /* "nd_reserved".
1911
     *
1912
     * The reserved field in IPv6 Neighbor Discovery message.
1913
     *
1914
     * Type: be32.
1915
     * Maskable: no.
1916
     * Formatting: decimal.
1917
     * Prerequisites: ND.
1918
     * Access: read/write.
1919
     * NXM: none.
1920
     * OXM: ERICOXM_OF_ICMPV6_ND_RESERVED(1) since v2.11.
1921
     */
1922
    MFF_ND_RESERVED,
1923
1924
    /* "nd_options_type".
1925
     *
1926
     * The type of the option in IPv6 Neighbor Discovery message.
1927
     *
1928
     * Type: u8.
1929
     * Maskable: no.
1930
     * Formatting: decimal.
1931
     * Prerequisites: ND.
1932
     * Access: read/write.
1933
     * NXM: none.
1934
     * OXM: ERICOXM_OF_ICMPV6_ND_OPTIONS_TYPE(2) since v2.11.
1935
     */
1936
    MFF_ND_OPTIONS_TYPE,
1937
1938
/* ## ---- ## */
1939
/* ## NSH  ## */
1940
/* ## ---- ## */
1941
1942
    /* "nsh_flags".
1943
     *
1944
     * flags field in NSH base header.
1945
     *
1946
     * Type: u8.
1947
     * Maskable: bitwise.
1948
     * Formatting: decimal.
1949
     * Prerequisites: NSH.
1950
     * Access: read/write.
1951
     * NXM: none.
1952
     * OXM: NXOXM_NSH_FLAGS(1) since v2.8.
1953
     */
1954
    MFF_NSH_FLAGS,
1955
1956
    /* "nsh_mdtype".
1957
     *
1958
     * mdtype field in NSH base header.
1959
     *
1960
     * Type: u8.
1961
     * Maskable: no.
1962
     * Formatting: decimal.
1963
     * Prerequisites: NSH.
1964
     * Access: read-only.
1965
     * NXM: none.
1966
     * OXM: NXOXM_NSH_MDTYPE(2) since v2.8.
1967
     */
1968
    MFF_NSH_MDTYPE,
1969
1970
    /* "nsh_np".
1971
     *
1972
     * np (next protocol) field in NSH base header.
1973
     *
1974
     * Type: u8.
1975
     * Maskable: no.
1976
     * Formatting: decimal.
1977
     * Prerequisites: NSH.
1978
     * Access: read-only.
1979
     * NXM: none.
1980
     * OXM: NXOXM_NSH_NP(3) since v2.8.
1981
     */
1982
    MFF_NSH_NP,
1983
1984
    /* "nsh_spi" (aka "nsp").
1985
     *
1986
     * spi (service path identifier) field in NSH base header.
1987
     *
1988
     * Type: be32 (low 24 bits).
1989
     * Maskable: no.
1990
     * Formatting: hexadecimal.
1991
     * Prerequisites: NSH.
1992
     * Access: read/write.
1993
     * NXM: none.
1994
     * OXM: NXOXM_NSH_SPI(4) since v2.8.
1995
     */
1996
    MFF_NSH_SPI,
1997
1998
    /* "nsh_si" (aka "nsi").
1999
     *
2000
     * si (service index) field in NSH base header.
2001
     *
2002
     * Type: u8.
2003
     * Maskable: no.
2004
     * Formatting: decimal.
2005
     * Prerequisites: NSH.
2006
     * Access: read/write.
2007
     * NXM: none.
2008
     * OXM: NXOXM_NSH_SI(5) since v2.8.
2009
     */
2010
    MFF_NSH_SI,
2011
2012
    /* "nsh_c<N>" (aka "nshc<N>").
2013
     *
2014
     * context fields in NSH context header.
2015
     *
2016
     * Type: be32.
2017
     * Maskable: bitwise.
2018
     * Formatting: hexadecimal.
2019
     * Prerequisites: NSH.
2020
     * Access: read/write.
2021
     * NXM: none.
2022
     * OXM: NXOXM_NSH_C1(6) since v2.8.        <1>
2023
     * OXM: NXOXM_NSH_C2(7) since v2.8.        <2>
2024
     * OXM: NXOXM_NSH_C3(8) since v2.8.        <3>
2025
     * OXM: NXOXM_NSH_C4(9) since v2.8.        <4>
2026
     */
2027
    MFF_NSH_C1,
2028
    MFF_NSH_C2,
2029
    MFF_NSH_C3,
2030
    MFF_NSH_C4,
2031
2032
    /* "nsh_ttl".
2033
     *
2034
     * TTL field in NSH base header.
2035
     *
2036
     * Type: u8.
2037
     * Maskable: no.
2038
     * Formatting: decimal.
2039
     * Prerequisites: NSH.
2040
     * Access: read/write.
2041
     * NXM: none.
2042
     * OXM: NXOXM_NSH_TTL(10) since v2.9.
2043
     */
2044
    MFF_NSH_TTL,
2045
2046
    MFF_N_IDS
2047
};
2048
2049
/* A set of mf_field_ids. */
2050
struct mf_bitmap {
2051
    unsigned long bm[BITMAP_N_LONGS(MFF_N_IDS)];
2052
};
2053
0
#define MF_BITMAP_INITIALIZER { { [0] = 0 } }
2054
2055
bool mf_bitmap_is_superset(const struct mf_bitmap *super,
2056
                           const struct mf_bitmap *sub);
2057
struct mf_bitmap mf_bitmap_and(struct mf_bitmap, struct mf_bitmap);
2058
struct mf_bitmap mf_bitmap_or(struct mf_bitmap, struct mf_bitmap);
2059
struct mf_bitmap mf_bitmap_not(struct mf_bitmap);
2060
2061
/* Use this macro as CASE_MFF_REGS: in a switch statement to choose all of the
2062
 * MFF_REGn cases. */
2063
#if FLOW_N_REGS == 32
2064
#define CASE_MFF_REGS                                               \
2065
0
    case MFF_REG0: case MFF_REG1: case MFF_REG2: case MFF_REG3:     \
2066
0
    case MFF_REG4: case MFF_REG5: case MFF_REG6: case MFF_REG7:     \
2067
0
    case MFF_REG8: case MFF_REG9: case MFF_REG10: case MFF_REG11:   \
2068
0
    case MFF_REG12: case MFF_REG13: case MFF_REG14: case MFF_REG15: \
2069
0
    case MFF_REG16: case MFF_REG17: case MFF_REG18: case MFF_REG19: \
2070
0
    case MFF_REG20: case MFF_REG21: case MFF_REG22: case MFF_REG23: \
2071
0
    case MFF_REG24: case MFF_REG25: case MFF_REG26: case MFF_REG27: \
2072
0
    case MFF_REG28: case MFF_REG29: case MFF_REG30: case MFF_REG31
2073
#else
2074
#error "Need to update CASE_MFF_REGS to match FLOW_N_REGS"
2075
#endif
2076
2077
/* Use this macro as CASE_MFF_XREGS: in a switch statement to choose all of the
2078
 * MFF_REGn cases. */
2079
#if FLOW_N_XREGS == 16
2080
#define CASE_MFF_XREGS                                                 \
2081
0
    case MFF_XREG0: case MFF_XREG1: case MFF_XREG2: case MFF_XREG3:    \
2082
0
    case MFF_XREG4: case MFF_XREG5: case MFF_XREG6: case MFF_XREG7:    \
2083
0
    case MFF_XREG8: case MFF_XREG9: case MFF_XREG10: case MFF_XREG11:  \
2084
0
    case MFF_XREG12: case MFF_XREG13: case MFF_XREG14: case MFF_XREG15
2085
#else
2086
#error "Need to update CASE_MFF_XREGS to match FLOW_N_XREGS"
2087
#endif
2088
2089
/* Use this macro as CASE_MFF_XXREGS: in a switch statement to choose
2090
 * all of the MFF_REGn cases. */
2091
#if FLOW_N_XXREGS == 8
2092
#define CASE_MFF_XXREGS                                                 \
2093
0
    case MFF_XXREG0: case MFF_XXREG1: case MFF_XXREG2: case MFF_XXREG3: \
2094
0
    case MFF_XXREG4: case MFF_XXREG5: case MFF_XXREG6: case MFF_XXREG7
2095
#else
2096
#error "Need to update CASE_MFF_XXREGS to match FLOW_N_XXREGS"
2097
#endif
2098
2099
static inline bool
2100
mf_is_register(enum mf_field_id id)
2101
0
{
2102
0
    return ((id >= MFF_REG0   && id < MFF_REG0   + FLOW_N_REGS) ||
2103
0
            (id >= MFF_XREG0  && id < MFF_XREG0  + FLOW_N_XREGS) ||
2104
0
            (id >= MFF_XXREG0 && id < MFF_XXREG0 + FLOW_N_XXREGS));
2105
0
}
Unexecuted instantiation: flow_extract_target.c:mf_is_register
Unexecuted instantiation: flow.c:mf_is_register
Unexecuted instantiation: match.c:mf_is_register
Unexecuted instantiation: ofp-match.c:mf_is_register
Unexecuted instantiation: ofp-print.c:mf_is_register
Unexecuted instantiation: ofp-switch.c:mf_is_register
Unexecuted instantiation: ofp-table.c:mf_is_register
Unexecuted instantiation: ofp-util.c:mf_is_register
Unexecuted instantiation: ovs-router.c:mf_is_register
Unexecuted instantiation: packets.c:mf_is_register
Unexecuted instantiation: tnl-ports.c:mf_is_register
Unexecuted instantiation: tun-metadata.c:mf_is_register
Unexecuted instantiation: tc.c:mf_is_register
Unexecuted instantiation: classifier.c:mf_is_register
Unexecuted instantiation: dpif-offload-dummy.c:mf_is_register
Unexecuted instantiation: dpif.c:mf_is_register
Unexecuted instantiation: meta-flow.c:mf_is_register
Unexecuted instantiation: netdev-dummy.c:mf_is_register
Unexecuted instantiation: nx-match.c:mf_is_register
Unexecuted instantiation: odp-execute.c:mf_is_register
Unexecuted instantiation: odp-util.c:mf_is_register
Unexecuted instantiation: ofp-actions.c:mf_is_register
Unexecuted instantiation: ofp-bundle.c:mf_is_register
Unexecuted instantiation: ofp-connection.c:mf_is_register
Unexecuted instantiation: ofp-errors.c:mf_is_register
Unexecuted instantiation: ofp-flow.c:mf_is_register
Unexecuted instantiation: ofp-group.c:mf_is_register
Unexecuted instantiation: ofp-meter.c:mf_is_register
Unexecuted instantiation: ofp-monitor.c:mf_is_register
Unexecuted instantiation: ofp-packet.c:mf_is_register
Unexecuted instantiation: ofp-parse.c:mf_is_register
Unexecuted instantiation: dpif-netlink.c:mf_is_register
Unexecuted instantiation: dpif-offload-tc.c:mf_is_register
Unexecuted instantiation: dpif-offload-tc-netdev.c:mf_is_register
Unexecuted instantiation: bundle.c:mf_is_register
Unexecuted instantiation: conntrack.c:mf_is_register
Unexecuted instantiation: dpctl.c:mf_is_register
Unexecuted instantiation: dpif-netdev.c:mf_is_register
Unexecuted instantiation: learn.c:mf_is_register
Unexecuted instantiation: multipath.c:mf_is_register
2106
2107
/* Use this macro as CASE_MFF_TUN_METADATA: in a switch statement to choose
2108
 * all of the MFF_TUN_METADATAn cases. */
2109
#define CASE_MFF_TUN_METADATA                         \
2110
0
    case MFF_TUN_METADATA0: case MFF_TUN_METADATA1:   \
2111
0
    case MFF_TUN_METADATA2: case MFF_TUN_METADATA3:   \
2112
0
    case MFF_TUN_METADATA4: case MFF_TUN_METADATA5:   \
2113
0
    case MFF_TUN_METADATA6: case MFF_TUN_METADATA7:   \
2114
0
    case MFF_TUN_METADATA8: case MFF_TUN_METADATA9:   \
2115
0
    case MFF_TUN_METADATA10: case MFF_TUN_METADATA11: \
2116
0
    case MFF_TUN_METADATA12: case MFF_TUN_METADATA13: \
2117
0
    case MFF_TUN_METADATA14: case MFF_TUN_METADATA15: \
2118
0
    case MFF_TUN_METADATA16: case MFF_TUN_METADATA17: \
2119
0
    case MFF_TUN_METADATA18: case MFF_TUN_METADATA19: \
2120
0
    case MFF_TUN_METADATA20: case MFF_TUN_METADATA21: \
2121
0
    case MFF_TUN_METADATA22: case MFF_TUN_METADATA23: \
2122
0
    case MFF_TUN_METADATA24: case MFF_TUN_METADATA25: \
2123
0
    case MFF_TUN_METADATA26: case MFF_TUN_METADATA27: \
2124
0
    case MFF_TUN_METADATA28: case MFF_TUN_METADATA29: \
2125
0
    case MFF_TUN_METADATA30: case MFF_TUN_METADATA31: \
2126
0
    case MFF_TUN_METADATA32: case MFF_TUN_METADATA33: \
2127
0
    case MFF_TUN_METADATA34: case MFF_TUN_METADATA35: \
2128
0
    case MFF_TUN_METADATA36: case MFF_TUN_METADATA37: \
2129
0
    case MFF_TUN_METADATA38: case MFF_TUN_METADATA39: \
2130
0
    case MFF_TUN_METADATA40: case MFF_TUN_METADATA41: \
2131
0
    case MFF_TUN_METADATA42: case MFF_TUN_METADATA43: \
2132
0
    case MFF_TUN_METADATA44: case MFF_TUN_METADATA45: \
2133
0
    case MFF_TUN_METADATA46: case MFF_TUN_METADATA47: \
2134
0
    case MFF_TUN_METADATA48: case MFF_TUN_METADATA49: \
2135
0
    case MFF_TUN_METADATA50: case MFF_TUN_METADATA51: \
2136
0
    case MFF_TUN_METADATA52: case MFF_TUN_METADATA53: \
2137
0
    case MFF_TUN_METADATA54: case MFF_TUN_METADATA55: \
2138
0
    case MFF_TUN_METADATA56: case MFF_TUN_METADATA57: \
2139
0
    case MFF_TUN_METADATA58: case MFF_TUN_METADATA59: \
2140
0
    case MFF_TUN_METADATA60: case MFF_TUN_METADATA61: \
2141
0
    case MFF_TUN_METADATA62: case MFF_TUN_METADATA63
2142
2143
/* Prerequisites for matching a field.
2144
 *
2145
 * A field may only be matched if the correct lower-level protocols are also
2146
 * matched.  For example, the TCP port may be matched only if the Ethernet type
2147
 * matches ETH_TYPE_IP and the IP protocol matches IPPROTO_TCP. */
2148
enum OVS_PACKED_ENUM mf_prereqs {
2149
    MFP_NONE,
2150
2151
    /* L2 requirements. */
2152
    MFP_ETHERNET,
2153
    MFP_ARP,
2154
    MFP_VLAN_VID,
2155
    MFP_IPV4,
2156
    MFP_IPV6,
2157
    MFP_IP_ANY,
2158
    MFP_NSH,
2159
2160
    /* L2.5 requirements. */
2161
    MFP_MPLS,
2162
2163
    /* L2+L3 requirements. */
2164
    MFP_TCP,                    /* On IPv4 or IPv6. */
2165
    MFP_UDP,                    /* On IPv4 or IPv6. */
2166
    MFP_SCTP,                   /* On IPv4 or IPv6. */
2167
    MFP_ICMPV4,
2168
    MFP_ICMPV6,
2169
    MFP_CT_VALID,               /* Implies IPv4 or IPv6. */
2170
2171
    /* L2+L3+L4 requirements. */
2172
    MFP_ND,
2173
    MFP_ND_SOLICIT,
2174
    MFP_ND_ADVERT
2175
};
2176
2177
/* Forms of partial-field masking allowed for a field.
2178
 *
2179
 * Every field may be masked as a whole. */
2180
enum OVS_PACKED_ENUM mf_maskable {
2181
    MFM_NONE,                   /* No sub-field masking. */
2182
    MFM_FULLY,                  /* Every bit is individually maskable. */
2183
};
2184
2185
/* How to format or parse a field's value. */
2186
enum OVS_PACKED_ENUM mf_string {
2187
    /* Integer formats.
2188
     *
2189
     * The particular MFS_* constant sets the output format.  On input, either
2190
     * decimal or hexadecimal (prefixed with 0x) is accepted. */
2191
    MFS_DECIMAL,
2192
    MFS_HEXADECIMAL,
2193
2194
    /* Other formats. */
2195
    MFS_CT_STATE,               /* Connection tracking state */
2196
    MFS_ETHERNET,
2197
    MFS_IPV4,
2198
    MFS_IPV6,
2199
    MFS_OFP_PORT,               /* 16-bit OpenFlow 1.0 port number or name. */
2200
    MFS_OFP_PORT_OXM,           /* 32-bit OpenFlow 1.1+ port number or name. */
2201
    MFS_FRAG,                   /* no, yes, first, later, not_later */
2202
    MFS_TNL_FLAGS,              /* FLOW_TNL_F_* flags */
2203
    MFS_TCP_FLAGS,              /* TCP_* flags */
2204
    MFS_PACKET_TYPE,            /* "(NS,NS_TYPE)" */
2205
};
2206
2207
struct mf_field {
2208
    /* Identification. */
2209
    enum mf_field_id id;        /* MFF_*. */
2210
    const char *name;           /* Name of this field, e.g. "eth_type". */
2211
    const char *extra_name;     /* Alternate name, e.g. "dl_type", or NULL. */
2212
2213
    /* Size.
2214
     *
2215
     * Most fields have n_bytes * 8 == n_bits.  There are a few exceptions:
2216
     *
2217
     *     - "dl_vlan" is 2 bytes but only 12 bits.
2218
     *     - "dl_vlan_pcp" is 1 byte but only 3 bits.
2219
     *     - "is_frag" is 1 byte but only 2 bits.
2220
     *     - "ipv6_label" is 4 bytes but only 20 bits.
2221
     *     - "mpls_label" is 4 bytes but only 20 bits.
2222
     *     - "mpls_tc"    is 1 byte but only 3 bits.
2223
     *     - "mpls_bos"   is 1 byte but only 1 bit.
2224
     */
2225
    unsigned int n_bytes;       /* Width of the field in bytes. */
2226
    unsigned int n_bits;        /* Number of significant bits in field. */
2227
    bool variable_len;          /* Length is variable, if so width is max. */
2228
2229
    /* Properties. */
2230
    enum mf_maskable maskable;
2231
    enum mf_string string;
2232
    enum mf_prereqs prereqs;
2233
    bool writable;              /* May be written by actions? */
2234
    bool mapped;                /* Variable length mf_field is mapped. */
2235
2236
    /* Usable protocols.
2237
     *
2238
     * NXM and OXM are extensible, allowing later extensions to be sent in
2239
     * earlier protocol versions, so this does not necessarily correspond to
2240
     * the OpenFlow protocol version the field was introduced in.
2241
     * Also, some field types are tranparently mapped to each other via the
2242
     * struct flow (like vlan and dscp/tos fields), so each variant supports
2243
     * all protocols. */
2244
    enum ofputil_protocol usable_protocols_exact; /* Match/set whole field. */
2245
    enum ofputil_protocol usable_protocols_cidr;    /* Match CIDR mask. */
2246
    enum ofputil_protocol usable_protocols_bitwise; /* Match arbitrary bits. */
2247
2248
    int flow_be32ofs;  /* Field's be32 offset in "struct flow", if prefix tree
2249
                        * lookup is supported for the field, or -1. */
2250
};
2251
2252
/* The representation of a field's value. */
2253
union mf_value {
2254
    uint8_t b[128];
2255
    uint8_t tun_metadata[128];
2256
    struct in6_addr ipv6;
2257
    struct eth_addr mac;
2258
    ovs_be128 be128;
2259
    ovs_be64 be64;
2260
    ovs_be32 be32;
2261
    ovs_be16 be16;
2262
    uint8_t u8;
2263
};
2264
BUILD_ASSERT_DECL(sizeof(union mf_value) == 128);
2265
BUILD_ASSERT_DECL(sizeof(union mf_value) >= TLV_MAX_OPT_SIZE);
2266
2267
/* A const mf_value with all bits initialized to ones. */
2268
extern const union mf_value exact_match_mask;
2269
2270
/* Part of a field. */
2271
struct mf_subfield {
2272
    const struct mf_field *field;
2273
    unsigned int ofs;           /* Bit offset. */
2274
    unsigned int n_bits;        /* Number of bits. */
2275
};
2276
2277
/* Data for some part of an mf_field.
2278
 *
2279
 * The data is stored "right-justified".  For example, if "union mf_subvalue
2280
 * value" contains NXM_OF_VLAN_TCI[0..11], then one could access the
2281
 * corresponding data in value.be16[7] as the bits in the mask htons(0xfff). */
2282
union mf_subvalue {
2283
    /* Access to full data. */
2284
    uint8_t u8[128];
2285
    ovs_be16 be16[64];
2286
    ovs_be32 be32[32];
2287
    ovs_be64 be64[16];
2288
    ovs_be128 be128[8];
2289
2290
    /* Convenient access to just least-significant bits in various forms. */
2291
    struct {
2292
        uint8_t dummy_u8[127];
2293
        uint8_t u8_val;
2294
    };
2295
    struct {
2296
        ovs_be16 dummy_be16[63];
2297
        ovs_be16 be16_int;
2298
    };
2299
    struct {
2300
        ovs_be32 dummy_be32[31];
2301
        ovs_be32 be32_int;
2302
    };
2303
    struct {
2304
        ovs_be64 dummy_integer[15];
2305
        ovs_be64 integer;
2306
    };
2307
    struct {
2308
        ovs_be128 dummy_be128[7];
2309
        ovs_be128 be128_int;
2310
    };
2311
    struct {
2312
        uint8_t dummy_mac[122];
2313
        struct eth_addr mac;
2314
    };
2315
    struct {
2316
        ovs_be32 dummy_ipv4[31];
2317
        ovs_be32 ipv4;
2318
    };
2319
    struct {
2320
        struct in6_addr dummy_ipv6[7];
2321
        struct in6_addr ipv6;
2322
    };
2323
};
2324
BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue));
2325
2326
/* A const mf_subvalue with all bits initialized to ones. */
2327
extern const union mf_subvalue exact_sub_match_mask;
2328
2329
bool mf_subvalue_intersect(const union mf_subvalue *a_value,
2330
                           const union mf_subvalue *a_mask,
2331
                           const union mf_subvalue *b_value,
2332
                           const union mf_subvalue *b_mask,
2333
                           union mf_subvalue *dst_value,
2334
                           union mf_subvalue *dst_mask);
2335
int mf_subvalue_width(const union mf_subvalue *);
2336
void mf_subvalue_shift(union mf_subvalue *, int n);
2337
void mf_subvalue_format(const union mf_subvalue *, struct ds *);
2338
2339
static inline void mf_subvalue_from_value(const struct mf_subfield *sf,
2340
                                          union mf_subvalue *sv,
2341
                                          const void *value)
2342
0
{
2343
0
    unsigned int n_bytes = DIV_ROUND_UP(sf->n_bits, 8);
2344
0
    memset(sv, 0, sizeof *sv - n_bytes);
2345
0
    memcpy(&sv->u8[sizeof sv->u8 - n_bytes], value, n_bytes);
2346
0
}
Unexecuted instantiation: flow_extract_target.c:mf_subvalue_from_value
Unexecuted instantiation: flow.c:mf_subvalue_from_value
Unexecuted instantiation: match.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-match.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-print.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-switch.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-table.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-util.c:mf_subvalue_from_value
Unexecuted instantiation: ovs-router.c:mf_subvalue_from_value
Unexecuted instantiation: packets.c:mf_subvalue_from_value
Unexecuted instantiation: tnl-ports.c:mf_subvalue_from_value
Unexecuted instantiation: tun-metadata.c:mf_subvalue_from_value
Unexecuted instantiation: tc.c:mf_subvalue_from_value
Unexecuted instantiation: classifier.c:mf_subvalue_from_value
Unexecuted instantiation: dpif-offload-dummy.c:mf_subvalue_from_value
Unexecuted instantiation: dpif.c:mf_subvalue_from_value
Unexecuted instantiation: meta-flow.c:mf_subvalue_from_value
Unexecuted instantiation: netdev-dummy.c:mf_subvalue_from_value
Unexecuted instantiation: nx-match.c:mf_subvalue_from_value
Unexecuted instantiation: odp-execute.c:mf_subvalue_from_value
Unexecuted instantiation: odp-util.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-actions.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-bundle.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-connection.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-errors.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-flow.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-group.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-meter.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-monitor.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-packet.c:mf_subvalue_from_value
Unexecuted instantiation: ofp-parse.c:mf_subvalue_from_value
Unexecuted instantiation: dpif-netlink.c:mf_subvalue_from_value
Unexecuted instantiation: dpif-offload-tc.c:mf_subvalue_from_value
Unexecuted instantiation: dpif-offload-tc-netdev.c:mf_subvalue_from_value
Unexecuted instantiation: bundle.c:mf_subvalue_from_value
Unexecuted instantiation: conntrack.c:mf_subvalue_from_value
Unexecuted instantiation: dpctl.c:mf_subvalue_from_value
Unexecuted instantiation: dpif-netdev.c:mf_subvalue_from_value
Unexecuted instantiation: learn.c:mf_subvalue_from_value
Unexecuted instantiation: multipath.c:mf_subvalue_from_value
2347
2348
2349
/* Set of field values. 'values' only includes the actual data bytes for each
2350
 * field for which is used, as marked by 1-bits in 'used'. */
2351
struct field_array {
2352
    struct mf_bitmap used;
2353
    size_t values_size;      /* Number of bytes currently in 'values'. */
2354
    uint8_t *values;     /* Dynamically allocated to the correct size. */
2355
};
2356
2357
/* Finding mf_fields. */
2358
const struct mf_field *mf_from_name(const char *name);
2359
const struct mf_field *mf_from_name_len(const char *name, size_t len);
2360
2361
static inline const struct mf_field *
2362
mf_from_id(enum mf_field_id id)
2363
0
{
2364
0
    extern const struct mf_field mf_fields[MFF_N_IDS];
2365
0
    ovs_assert((unsigned int) id < MFF_N_IDS);
2366
0
    return &mf_fields[id];
2367
0
}
Unexecuted instantiation: flow_extract_target.c:mf_from_id
Unexecuted instantiation: flow.c:mf_from_id
Unexecuted instantiation: match.c:mf_from_id
Unexecuted instantiation: ofp-match.c:mf_from_id
Unexecuted instantiation: ofp-print.c:mf_from_id
Unexecuted instantiation: ofp-switch.c:mf_from_id
Unexecuted instantiation: ofp-table.c:mf_from_id
Unexecuted instantiation: ofp-util.c:mf_from_id
Unexecuted instantiation: ovs-router.c:mf_from_id
Unexecuted instantiation: packets.c:mf_from_id
Unexecuted instantiation: tnl-ports.c:mf_from_id
Unexecuted instantiation: tun-metadata.c:mf_from_id
Unexecuted instantiation: tc.c:mf_from_id
Unexecuted instantiation: classifier.c:mf_from_id
Unexecuted instantiation: dpif-offload-dummy.c:mf_from_id
Unexecuted instantiation: dpif.c:mf_from_id
Unexecuted instantiation: meta-flow.c:mf_from_id
Unexecuted instantiation: netdev-dummy.c:mf_from_id
Unexecuted instantiation: nx-match.c:mf_from_id
Unexecuted instantiation: odp-execute.c:mf_from_id
Unexecuted instantiation: odp-util.c:mf_from_id
Unexecuted instantiation: ofp-actions.c:mf_from_id
Unexecuted instantiation: ofp-bundle.c:mf_from_id
Unexecuted instantiation: ofp-connection.c:mf_from_id
Unexecuted instantiation: ofp-errors.c:mf_from_id
Unexecuted instantiation: ofp-flow.c:mf_from_id
Unexecuted instantiation: ofp-group.c:mf_from_id
Unexecuted instantiation: ofp-meter.c:mf_from_id
Unexecuted instantiation: ofp-monitor.c:mf_from_id
Unexecuted instantiation: ofp-packet.c:mf_from_id
Unexecuted instantiation: ofp-parse.c:mf_from_id
Unexecuted instantiation: dpif-netlink.c:mf_from_id
Unexecuted instantiation: dpif-offload-tc.c:mf_from_id
Unexecuted instantiation: dpif-offload-tc-netdev.c:mf_from_id
Unexecuted instantiation: bundle.c:mf_from_id
Unexecuted instantiation: conntrack.c:mf_from_id
Unexecuted instantiation: dpctl.c:mf_from_id
Unexecuted instantiation: dpif-netdev.c:mf_from_id
Unexecuted instantiation: learn.c:mf_from_id
Unexecuted instantiation: multipath.c:mf_from_id
2368
2369
/* Inspecting wildcarded bits. */
2370
bool mf_is_all_wild(const struct mf_field *, const struct flow_wildcards *);
2371
2372
bool mf_is_mask_valid(const struct mf_field *, const union mf_value *mask);
2373
void mf_get_mask(const struct mf_field *, const struct flow_wildcards *,
2374
                 union mf_value *mask);
2375
2376
/* Prerequisites. */
2377
bool mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow,
2378
                       struct flow_wildcards *wc);
2379
bool mf_are_match_prereqs_ok(const struct mf_field *, const struct match *);
2380
2381
static inline bool
2382
mf_is_l3_or_higher(const struct mf_field *mf)
2383
0
{
2384
0
    return mf->id >= MFF_IPV4_SRC;
2385
0
}
Unexecuted instantiation: flow_extract_target.c:mf_is_l3_or_higher
Unexecuted instantiation: flow.c:mf_is_l3_or_higher
Unexecuted instantiation: match.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-match.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-print.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-switch.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-table.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-util.c:mf_is_l3_or_higher
Unexecuted instantiation: ovs-router.c:mf_is_l3_or_higher
Unexecuted instantiation: packets.c:mf_is_l3_or_higher
Unexecuted instantiation: tnl-ports.c:mf_is_l3_or_higher
Unexecuted instantiation: tun-metadata.c:mf_is_l3_or_higher
Unexecuted instantiation: tc.c:mf_is_l3_or_higher
Unexecuted instantiation: classifier.c:mf_is_l3_or_higher
Unexecuted instantiation: dpif-offload-dummy.c:mf_is_l3_or_higher
Unexecuted instantiation: dpif.c:mf_is_l3_or_higher
Unexecuted instantiation: meta-flow.c:mf_is_l3_or_higher
Unexecuted instantiation: netdev-dummy.c:mf_is_l3_or_higher
Unexecuted instantiation: nx-match.c:mf_is_l3_or_higher
Unexecuted instantiation: odp-execute.c:mf_is_l3_or_higher
Unexecuted instantiation: odp-util.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-actions.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-bundle.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-connection.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-errors.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-flow.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-group.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-meter.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-monitor.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-packet.c:mf_is_l3_or_higher
Unexecuted instantiation: ofp-parse.c:mf_is_l3_or_higher
Unexecuted instantiation: dpif-netlink.c:mf_is_l3_or_higher
Unexecuted instantiation: dpif-offload-tc.c:mf_is_l3_or_higher
Unexecuted instantiation: dpif-offload-tc-netdev.c:mf_is_l3_or_higher
Unexecuted instantiation: bundle.c:mf_is_l3_or_higher
Unexecuted instantiation: conntrack.c:mf_is_l3_or_higher
Unexecuted instantiation: dpctl.c:mf_is_l3_or_higher
Unexecuted instantiation: dpif-netdev.c:mf_is_l3_or_higher
Unexecuted instantiation: learn.c:mf_is_l3_or_higher
Unexecuted instantiation: multipath.c:mf_is_l3_or_higher
2386
2387
/* Field values. */
2388
bool mf_is_value_valid(const struct mf_field *, const union mf_value *value);
2389
2390
void mf_get_value(const struct mf_field *, const struct flow *,
2391
                  union mf_value *value);
2392
void mf_set_value(const struct mf_field *, const union mf_value *value,
2393
                  struct match *, char **err_str);
2394
void mf_set_flow_value(const struct mf_field *, const union mf_value *value,
2395
                       struct flow *);
2396
void mf_set_flow_value_masked(const struct mf_field *,
2397
                              const union mf_value *value,
2398
                              const union mf_value *mask,
2399
                              struct flow *);
2400
bool mf_is_tunnel_field(const struct mf_field *);
2401
bool mf_is_tun_metadata(const struct mf_field *);
2402
bool mf_is_any_metadata(const struct mf_field *);
2403
bool mf_is_frozen_metadata(const struct mf_field *);
2404
bool mf_is_pipeline_field(const struct mf_field *);
2405
bool mf_is_set(const struct mf_field *, const struct flow *);
2406
void mf_mask_field(const struct mf_field *, struct flow_wildcards *);
2407
void mf_mask_field_masked(const struct mf_field *, const union mf_value *mask,
2408
                          struct flow_wildcards *);
2409
int mf_field_len(const struct mf_field *, const union mf_value *value,
2410
                 const union mf_value *mask, bool *is_masked);
2411
2412
void mf_get(const struct mf_field *, const struct match *,
2413
            union mf_value *value, union mf_value *mask);
2414
2415
/* Returns the set of usable protocols. */
2416
uint32_t mf_set(const struct mf_field *, const union mf_value *value,
2417
                const union mf_value *mask, struct match *, char **err_str);
2418
2419
void mf_set_wild(const struct mf_field *, struct match *, char **err_str);
2420
2421
/* Subfields. */
2422
void mf_write_subfield_flow(const struct mf_subfield *,
2423
                            const union mf_subvalue *, struct flow *);
2424
void mf_write_subfield(const struct mf_subfield *, const union mf_subvalue *,
2425
                       struct match *);
2426
void mf_write_subfield_value(const struct mf_subfield *, const void *src,
2427
                             struct match *);
2428
2429
void mf_mask_subfield(const struct mf_field *,
2430
                      const union mf_subvalue *value,
2431
                      const union mf_subvalue *mask,
2432
                      struct match *);
2433
2434
void mf_read_subfield(const struct mf_subfield *, const struct flow *,
2435
                      union mf_subvalue *);
2436
uint64_t mf_get_subfield(const struct mf_subfield *, const struct flow *);
2437
2438
void mf_subfield_copy(const struct mf_subfield *src,
2439
                      const struct mf_subfield *dst,
2440
                      struct flow *, struct flow_wildcards *);
2441
void mf_subfield_swap(const struct mf_subfield *,
2442
                      const struct mf_subfield *,
2443
                      struct flow *flow, struct flow_wildcards *);
2444
2445
enum ofperr mf_check_src(const struct mf_subfield *, const struct match *);
2446
enum ofperr mf_check_dst(const struct mf_subfield *, const struct match *);
2447
2448
/* Parsing and formatting. */
2449
char *mf_parse(const struct mf_field *, const char *,
2450
               const struct ofputil_port_map *,
2451
               union mf_value *value, union mf_value *mask);
2452
char *mf_parse_value(const struct mf_field *, const char *,
2453
                     const struct ofputil_port_map *, union mf_value *);
2454
void mf_format(const struct mf_field *,
2455
               const union mf_value *value, const union mf_value *mask,
2456
               const struct ofputil_port_map *,
2457
               struct ds *);
2458
void mf_format_subvalue(const union mf_subvalue *subvalue, struct ds *s);
2459
2460
/* Field Arrays. */
2461
void field_array_set(enum mf_field_id id, const union mf_value *,
2462
                     struct field_array *);
2463
2464
/* Mask the required l3 prerequisites if a 'set' action occurs. */
2465
void mf_set_mask_l3_prereqs(const struct mf_field *, const struct flow *,
2466
                            struct flow_wildcards *);
2467
2468
#ifdef __cplusplus
2469
}
2470
#endif
2471
2472
#endif /* meta-flow.h */