Coverage Report

Created: 2025-10-13 07:08

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_REG15.  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 == 16
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
#else
1030
#error "Need to update MFF_REG* to match FLOW_N_REGS"
1031
#endif
1032
1033
#if FLOW_N_XREGS == 8
1034
    /* "xreg<N>".
1035
     *
1036
     * OpenFlow 1.5 ``extended register".
1037
     *
1038
     * Type: be64.
1039
     * Maskable: bitwise.
1040
     * Formatting: hexadecimal.
1041
     * Prerequisites: none.
1042
     * Access: read/write.
1043
     * NXM: none.
1044
     * OXM: OXM_OF_PKT_REG<N>(<N>) since OF1.3 and v2.4.
1045
     */
1046
    MFF_XREG0,
1047
    MFF_XREG1,
1048
    MFF_XREG2,
1049
    MFF_XREG3,
1050
    MFF_XREG4,
1051
    MFF_XREG5,
1052
    MFF_XREG6,
1053
    MFF_XREG7,
1054
#else
1055
#error "Need to update MFF_REG* to match FLOW_N_XREGS"
1056
#endif
1057
1058
#if FLOW_N_XXREGS == 4
1059
    /* "xxreg<N>".
1060
     *
1061
     * ``extended-extended register".
1062
     *
1063
     * Type: be128.
1064
     * Maskable: bitwise.
1065
     * Formatting: hexadecimal.
1066
     * Prerequisites: none.
1067
     * Access: read/write.
1068
     * NXM: NXM_NX_XXREG0(111) since v2.6.              <0>
1069
     * NXM: NXM_NX_XXREG1(112) since v2.6.              <1>
1070
     * NXM: NXM_NX_XXREG2(113) since v2.6.              <2>
1071
     * NXM: NXM_NX_XXREG3(114) since v2.6.              <3>
1072
     * NXM: NXM_NX_XXREG4(115) since vX.Y.              <4>
1073
     * NXM: NXM_NX_XXREG5(116) since vX.Y.              <5>
1074
     * NXM: NXM_NX_XXREG6(117) since vX.Y.              <6>
1075
     * NXM: NXM_NX_XXREG7(118) since vX.Y.              <7>
1076
     * OXM: none.
1077
     */
1078
    MFF_XXREG0,
1079
    MFF_XXREG1,
1080
    MFF_XXREG2,
1081
    MFF_XXREG3,
1082
#else
1083
#error "Need to update MFF_REG* to match FLOW_N_XXREGS"
1084
#endif
1085
1086
/* ## -------- ## */
1087
/* ## Ethernet ## */
1088
/* ## -------- ## */
1089
1090
    /* "eth_src" (aka "dl_src").
1091
     *
1092
     * Source address in Ethernet header.
1093
     *
1094
     * Type: MAC.
1095
     * Maskable: bitwise.
1096
     * Formatting: Ethernet.
1097
     * Prerequisites: Ethernet.
1098
     * Access: read/write.
1099
     * NXM: NXM_OF_ETH_SRC(2) since v1.1.
1100
     * OXM: OXM_OF_ETH_SRC(4) since OF1.2 and v1.7.
1101
     * OF1.0: exact match.
1102
     * OF1.1: bitwise mask.
1103
     */
1104
    MFF_ETH_SRC,
1105
1106
    /* "eth_dst" (aka "dl_dst").
1107
     *
1108
     * Destination address in Ethernet header.
1109
     *
1110
     * Type: MAC.
1111
     * Maskable: bitwise.
1112
     * Formatting: Ethernet.
1113
     * Prerequisites: Ethernet.
1114
     * Access: read/write.
1115
     * NXM: NXM_OF_ETH_DST(1) since v1.1.
1116
     * OXM: OXM_OF_ETH_DST(3) since OF1.2 and v1.7.
1117
     * OF1.0: exact match.
1118
     * OF1.1: bitwise mask.
1119
     */
1120
    MFF_ETH_DST,
1121
1122
    /* "eth_type" (aka "dl_type").
1123
     *
1124
     * Packet's Ethernet type.
1125
     *
1126
     * For a packet with an 802.1Q header, this is the type of the encapsulated
1127
     * frame.
1128
     *
1129
     * Type: be16.
1130
     * Maskable: no.
1131
     * Formatting: hexadecimal.
1132
     * Prerequisites: Ethernet.
1133
     * Access: read-only.
1134
     * NXM: NXM_OF_ETH_TYPE(3) since v1.1.
1135
     * OXM: OXM_OF_ETH_TYPE(5) since OF1.2 and v1.7.
1136
     * OF1.0: exact match.
1137
     * OF1.1: exact match.
1138
     */
1139
    MFF_ETH_TYPE,
1140
1141
/* ## ---- ## */
1142
/* ## VLAN ## */
1143
/* ## ---- ## */
1144
1145
/* It looks odd for vlan_tci, vlan_vid, and vlan_pcp to say that they are
1146
 * supported in OF1.0 and OF1.1, since the detailed semantics of these fields
1147
 * only apply to NXM or OXM.  They are marked as supported for exact matches in
1148
 * OF1.0 and OF1.1 because exact matches on those fields can be successfully
1149
 * translated into the OF1.0 and OF1.1 flow formats. */
1150
1151
    /* "vlan_tci".
1152
     *
1153
     * 802.1Q TCI.
1154
     *
1155
     * For a packet with an 802.1Q header, this is the Tag Control Information
1156
     * (TCI) field, with the CFI bit forced to 1.  For a packet with no 802.1Q
1157
     * header, this has value 0.
1158
     *
1159
     * Type: be16.
1160
     * Maskable: bitwise.
1161
     * Formatting: hexadecimal.
1162
     * Prerequisites: Ethernet.
1163
     * Access: read/write.
1164
     * NXM: NXM_OF_VLAN_TCI(4) since v1.1.
1165
     * OXM: none.
1166
     * OF1.0: exact match.
1167
     * OF1.1: exact match.
1168
     */
1169
    MFF_VLAN_TCI,
1170
1171
    /* "dl_vlan" (OpenFlow 1.0).
1172
     *
1173
     * VLAN ID field.  Zero if no 802.1Q header is present.
1174
     *
1175
     * Type: be16 (low 12 bits).
1176
     * Maskable: no.
1177
     * Formatting: decimal.
1178
     * Prerequisites: Ethernet.
1179
     * Access: read/write.
1180
     * NXM: none.
1181
     * OXM: none.
1182
     * OF1.0: exact match.
1183
     * OF1.1: exact match.
1184
     */
1185
    MFF_DL_VLAN,
1186
1187
    /* "vlan_vid" (OpenFlow 1.2+).
1188
     *
1189
     * If an 802.1Q header is present, this field's value is 0x1000
1190
     * bitwise-or'd with the VLAN ID.  If no 802.1Q is present, this field's
1191
     * value is 0.
1192
     *
1193
     * Type: be16 (low 12 bits).
1194
     * Maskable: bitwise.
1195
     * Formatting: decimal.
1196
     * Prerequisites: Ethernet.
1197
     * Access: read/write.
1198
     * NXM: none.
1199
     * OXM: OXM_OF_VLAN_VID(6) since OF1.2 and v1.7.
1200
     * OF1.0: exact match.
1201
     * OF1.1: exact match.
1202
     */
1203
    MFF_VLAN_VID,
1204
1205
    /* "dl_vlan_pcp" (OpenFlow 1.0).
1206
     *
1207
     * VLAN priority (PCP) field.  Zero if no 802.1Q header is present.
1208
     *
1209
     * Type: u8 (low 3 bits).
1210
     * Maskable: no.
1211
     * Formatting: decimal.
1212
     * Prerequisites: Ethernet.
1213
     * Access: read/write.
1214
     * NXM: none.
1215
     * OXM: none.
1216
     * OF1.0: exact match.
1217
     * OF1.1: exact match.
1218
     */
1219
    MFF_DL_VLAN_PCP,
1220
1221
    /* "vlan_pcp" (OpenFlow 1.2+).
1222
     *
1223
     * VLAN priority (PCP) field.  Zero if no 802.1Q header is present.
1224
     *
1225
     * Type: u8 (low 3 bits).
1226
     * Maskable: no.
1227
     * Formatting: decimal.
1228
     * Prerequisites: VLAN VID.
1229
     * Access: read/write.
1230
     * NXM: none.
1231
     * OXM: OXM_OF_VLAN_PCP(7) since OF1.2 and v1.7.
1232
     * OF1.0: exact match.
1233
     * OF1.1: exact match.
1234
     */
1235
    MFF_VLAN_PCP,
1236
1237
/* ## ---- ## */
1238
/* ## MPLS ## */
1239
/* ## ---- ## */
1240
1241
    /* "mpls_label".
1242
     *
1243
     * The outermost MPLS label, or 0 if no MPLS labels are present.
1244
     *
1245
     * Type: be32 (low 20 bits).
1246
     * Maskable: no.
1247
     * Formatting: decimal.
1248
     * Prerequisites: MPLS.
1249
     * Access: read/write.
1250
     * NXM: none.
1251
     * OXM: OXM_OF_MPLS_LABEL(34) since OF1.2 and v1.11.
1252
     * OF1.1: exact match.
1253
     */
1254
    MFF_MPLS_LABEL,
1255
1256
    /* "mpls_tc".
1257
     *
1258
     * The outermost MPLS label's traffic control (TC) field, or 0 if no MPLS
1259
     * labels are present.
1260
     *
1261
     * Type: u8 (low 3 bits).
1262
     * Maskable: no.
1263
     * Formatting: decimal.
1264
     * Prerequisites: MPLS.
1265
     * Access: read/write.
1266
     * NXM: none.
1267
     * OXM: OXM_OF_MPLS_TC(35) since OF1.2 and v1.11.
1268
     * OF1.1: exact match.
1269
     */
1270
    MFF_MPLS_TC,
1271
1272
    /* "mpls_bos".
1273
     *
1274
     * The outermost MPLS label's bottom of stack (BoS) field, or 0 if no MPLS
1275
     * labels are present.
1276
     *
1277
     * Type: u8 (low 1 bits).
1278
     * Maskable: no.
1279
     * Formatting: decimal.
1280
     * Prerequisites: MPLS.
1281
     * Access: read-only.
1282
     * NXM: none.
1283
     * OXM: OXM_OF_MPLS_BOS(36) since OF1.3 and v1.11.
1284
     */
1285
    MFF_MPLS_BOS,
1286
1287
    /* "mpls_ttl".
1288
     *
1289
     * The outermost MPLS label's time-to-live (TTL) field, or 0 if no MPLS
1290
     * labels are present.
1291
     *
1292
     * Type: u8.
1293
     * Maskable: no.
1294
     * Formatting: decimal.
1295
     * Prerequisites: MPLS.
1296
     * Access: read/write.
1297
     * NXM: NXM_NX_MPLS_TTL(30) since v2.6.
1298
     * OXM: none.
1299
     */
1300
    MFF_MPLS_TTL,
1301
1302
/* ## ---- ## */
1303
/* ## IPv4 ## */
1304
/* ## ---- ## */
1305
1306
/* Update mf_is_l3_or_higher() if MFF_IPV4_SRC is no longer the first element
1307
 * for a field of layer 3 or higher */
1308
1309
    /* "ip_src" (aka "nw_src").
1310
     *
1311
     * The source address in the IPv4 header.
1312
     *
1313
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1314
     *
1315
     * Type: be32.
1316
     * Maskable: bitwise.
1317
     * Formatting: IPv4.
1318
     * Prerequisites: IPv4.
1319
     * Access: read/write.
1320
     * NXM: NXM_OF_IP_SRC(7) since v1.1.
1321
     * OXM: OXM_OF_IPV4_SRC(11) since OF1.2 and v1.7.
1322
     * OF1.0: CIDR mask.
1323
     * OF1.1: bitwise mask.
1324
     * Prefix lookup member: nw_src.
1325
     */
1326
    MFF_IPV4_SRC,
1327
1328
    /* "ip_dst" (aka "nw_dst").
1329
     *
1330
     * The destination address in the IPv4 header.
1331
     *
1332
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1333
     *
1334
     * Type: be32.
1335
     * Maskable: bitwise.
1336
     * Formatting: IPv4.
1337
     * Prerequisites: IPv4.
1338
     * Access: read/write.
1339
     * NXM: NXM_OF_IP_DST(8) since v1.1.
1340
     * OXM: OXM_OF_IPV4_DST(12) since OF1.2 and v1.7.
1341
     * OF1.0: CIDR mask.
1342
     * OF1.1: bitwise mask.
1343
     * Prefix lookup member: nw_dst.
1344
     */
1345
    MFF_IPV4_DST,
1346
1347
/* ## ---- ## */
1348
/* ## IPv6 ## */
1349
/* ## ---- ## */
1350
1351
    /* "ipv6_src".
1352
     *
1353
     * The source address in the IPv6 header.
1354
     *
1355
     * Type: be128.
1356
     * Maskable: bitwise.
1357
     * Formatting: IPv6.
1358
     * Prerequisites: IPv6.
1359
     * Access: read/write.
1360
     * NXM: NXM_NX_IPV6_SRC(19) since v1.1.
1361
     * OXM: OXM_OF_IPV6_SRC(26) since OF1.2 and v1.1.
1362
     * Prefix lookup member: ipv6_src.
1363
     */
1364
    MFF_IPV6_SRC,
1365
1366
    /* "ipv6_dst".
1367
     *
1368
     * The destination address in the IPv6 header.
1369
     *
1370
     * Type: be128.
1371
     * Maskable: bitwise.
1372
     * Formatting: IPv6.
1373
     * Prerequisites: IPv6.
1374
     * Access: read/write.
1375
     * NXM: NXM_NX_IPV6_DST(20) since v1.1.
1376
     * OXM: OXM_OF_IPV6_DST(27) since OF1.2 and v1.1.
1377
     * Prefix lookup member: ipv6_dst.
1378
     */
1379
    MFF_IPV6_DST,
1380
1381
    /* "ipv6_label".
1382
     *
1383
     * The flow label in the IPv6 header.
1384
     *
1385
     * Type: be32 (low 20 bits).
1386
     * Maskable: bitwise.
1387
     * Formatting: hexadecimal.
1388
     * Prerequisites: IPv6.
1389
     * Access: read/write.
1390
     * NXM: NXM_NX_IPV6_LABEL(27) since v1.4.
1391
     * OXM: OXM_OF_IPV6_FLABEL(28) since OF1.2 and v1.7.
1392
     */
1393
    MFF_IPV6_LABEL,
1394
1395
/* ## ----------------------- ## */
1396
/* ## IPv4/IPv6 common fields ## */
1397
/* ## ----------------------- ## */
1398
1399
    /* "nw_proto" (aka "ip_proto").
1400
     *
1401
     * The "protocol" byte in the IPv4 or IPv6 header.
1402
     *
1403
     * Type: u8.
1404
     * Maskable: no.
1405
     * Formatting: decimal.
1406
     * Prerequisites: IPv4/IPv6.
1407
     * Access: read-only.
1408
     * NXM: NXM_OF_IP_PROTO(6) since v1.1.
1409
     * OXM: OXM_OF_IP_PROTO(10) since OF1.2 and v1.7.
1410
     * OF1.0: exact match.
1411
     * OF1.1: exact match.
1412
     */
1413
    MFF_IP_PROTO,
1414
1415
/* Both views of the DSCP below are marked as supported in all of the versions
1416
 * of OpenFlow because a match on either view can be successfully translated
1417
 * into every OpenFlow flow format. */
1418
1419
    /* "nw_tos" (OpenFlow 1.0/1.1).
1420
     *
1421
     * The DSCP byte in the IPv4 header or the traffic class byte from the IPv6
1422
     * header, with the ECN bits forced to 0.  (That is, bits 2-7 contain the
1423
     * type of service and bits 0-1 are zero.)
1424
     *
1425
     * Type: u8.
1426
     * Maskable: no.
1427
     * Formatting: decimal.
1428
     * Prerequisites: IPv4/IPv6.
1429
     * Access: read/write.
1430
     * NXM: NXM_OF_IP_TOS(5) since v1.1.
1431
     * OXM: none.
1432
     * OF1.0: exact match.
1433
     * OF1.1: exact match.
1434
     */
1435
    MFF_IP_DSCP,
1436
1437
    /* "ip_dscp" (OpenFlow 1.2+).
1438
     *
1439
     * The DSCP byte in the IPv4 header or the traffic class byte from the IPv6
1440
     * header, shifted right 2 bits.  (That is, bits 0-5 contain the type of
1441
     * service and bits 6-7 are zero.)
1442
     *
1443
     * Type: u8 (low 6 bits).
1444
     * Maskable: no.
1445
     * Formatting: decimal.
1446
     * Prerequisites: IPv4/IPv6.
1447
     * Access: read/write.
1448
     * NXM: none.
1449
     * OXM: OXM_OF_IP_DSCP(8) since OF1.2 and v1.7.
1450
     * OF1.0: exact match.
1451
     * OF1.1: exact match.
1452
     */
1453
    MFF_IP_DSCP_SHIFTED,
1454
1455
    /* "nw_ecn" (aka "ip_ecn").
1456
     *
1457
     * The ECN bits in the IPv4 or IPv6 header.
1458
     *
1459
     * Type: u8 (low 2 bits).
1460
     * Maskable: no.
1461
     * Formatting: decimal.
1462
     * Prerequisites: IPv4/IPv6.
1463
     * Access: read/write.
1464
     * NXM: NXM_NX_IP_ECN(28) since v1.4.
1465
     * OXM: OXM_OF_IP_ECN(9) since OF1.2 and v1.7.
1466
     * OF1.1: exact match.
1467
     */
1468
    MFF_IP_ECN,
1469
1470
    /* "nw_ttl".
1471
     *
1472
     * The time-to-live (TTL) in the IPv4 header or hop limit in the IPv6
1473
     * header.
1474
     *
1475
     * Type: u8.
1476
     * Maskable: no.
1477
     * Formatting: decimal.
1478
     * Prerequisites: IPv4/IPv6.
1479
     * Access: read/write.
1480
     * NXM: NXM_NX_IP_TTL(29) since v1.4.
1481
     * OXM: none.
1482
     */
1483
    MFF_IP_TTL,
1484
1485
    /* "ip_frag" (aka "nw_frag").
1486
     *
1487
     * IP fragment information.
1488
     *
1489
     * Type: u8 (low 2 bits).
1490
     * Maskable: bitwise.
1491
     * Formatting: frag.
1492
     * Prerequisites: IPv4/IPv6.
1493
     * Access: read-only.
1494
     * NXM: NXM_NX_IP_FRAG(26) since v1.3.
1495
     * OXM: none.
1496
     */
1497
    MFF_IP_FRAG,
1498
1499
/* ## --- ## */
1500
/* ## ARP ## */
1501
/* ## --- ## */
1502
1503
    /* "arp_op".
1504
     *
1505
     * ARP opcode.
1506
     *
1507
     * For an Ethernet+IP ARP packet, the opcode in the ARP header.  Always 0
1508
     * otherwise.  Only ARP opcodes between 1 and 255 should be specified for
1509
     * matching.
1510
     *
1511
     * Type: be16.
1512
     * Maskable: no.
1513
     * Formatting: decimal.
1514
     * Prerequisites: ARP.
1515
     * Access: read/write.
1516
     * NXM: NXM_OF_ARP_OP(15) since v1.1.
1517
     * OXM: OXM_OF_ARP_OP(21) since OF1.2 and v1.7.
1518
     * OF1.0: exact match.
1519
     * OF1.1: exact match.
1520
     */
1521
    MFF_ARP_OP,
1522
1523
    /* "arp_spa".
1524
     *
1525
     * For an Ethernet+IP ARP packet, the source protocol (IPv4) address in the
1526
     * ARP header.  Always 0 otherwise.
1527
     *
1528
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1529
     *
1530
     * Type: be32.
1531
     * Maskable: bitwise.
1532
     * Formatting: IPv4.
1533
     * Prerequisites: ARP.
1534
     * Access: read/write.
1535
     * NXM: NXM_OF_ARP_SPA(16) since v1.1.
1536
     * OXM: OXM_OF_ARP_SPA(22) since OF1.2 and v1.7.
1537
     * OF1.0: CIDR mask.
1538
     * OF1.1: bitwise mask.
1539
     */
1540
    MFF_ARP_SPA,
1541
1542
    /* "arp_tpa".
1543
     *
1544
     * For an Ethernet+IP ARP packet, the target protocol (IPv4) address in the
1545
     * ARP header.  Always 0 otherwise.
1546
     *
1547
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1548
     *
1549
     * Type: be32.
1550
     * Maskable: bitwise.
1551
     * Formatting: IPv4.
1552
     * Prerequisites: ARP.
1553
     * Access: read/write.
1554
     * NXM: NXM_OF_ARP_TPA(17) since v1.1.
1555
     * OXM: OXM_OF_ARP_TPA(23) since OF1.2 and v1.7.
1556
     * OF1.0: CIDR mask.
1557
     * OF1.1: bitwise mask.
1558
     */
1559
    MFF_ARP_TPA,
1560
1561
    /* "arp_sha".
1562
     *
1563
     * For an Ethernet+IP ARP packet, the source hardware (Ethernet) address in
1564
     * the ARP header.  Always 0 otherwise.
1565
     *
1566
     * Type: MAC.
1567
     * Maskable: bitwise.
1568
     * Formatting: Ethernet.
1569
     * Prerequisites: ARP.
1570
     * Access: read/write.
1571
     * NXM: NXM_NX_ARP_SHA(17) since v1.1.
1572
     * OXM: OXM_OF_ARP_SHA(24) since OF1.2 and v1.7.
1573
     */
1574
    MFF_ARP_SHA,
1575
1576
    /* "arp_tha".
1577
     *
1578
     * For an Ethernet+IP ARP packet, the target hardware (Ethernet) address in
1579
     * the ARP header.  Always 0 otherwise.
1580
     *
1581
     * Type: MAC.
1582
     * Maskable: bitwise.
1583
     * Formatting: Ethernet.
1584
     * Prerequisites: ARP.
1585
     * Access: read/write.
1586
     * NXM: NXM_NX_ARP_THA(18) since v1.1.
1587
     * OXM: OXM_OF_ARP_THA(25) since OF1.2 and v1.7.
1588
     */
1589
    MFF_ARP_THA,
1590
1591
/* ## --- ## */
1592
/* ## TCP ## */
1593
/* ## --- ## */
1594
1595
    /* "tcp_src" (aka "tp_src").
1596
     *
1597
     * TCP source port.
1598
     *
1599
     * Type: be16.
1600
     * Maskable: bitwise.
1601
     * Formatting: decimal.
1602
     * Prerequisites: TCP.
1603
     * Access: read/write.
1604
     * NXM: NXM_OF_TCP_SRC(9) since v1.1.
1605
     * OXM: OXM_OF_TCP_SRC(13) since OF1.2 and v1.7.
1606
     * OF1.0: exact match.
1607
     * OF1.1: exact match.
1608
     */
1609
    MFF_TCP_SRC,
1610
1611
    /* "tcp_dst" (aka "tp_dst").
1612
     *
1613
     * TCP destination port.
1614
     *
1615
     * Type: be16.
1616
     * Maskable: bitwise.
1617
     * Formatting: decimal.
1618
     * Prerequisites: TCP.
1619
     * Access: read/write.
1620
     * NXM: NXM_OF_TCP_DST(10) since v1.1.
1621
     * OXM: OXM_OF_TCP_DST(14) since OF1.2 and v1.7.
1622
     * OF1.0: exact match.
1623
     * OF1.1: exact match.
1624
     */
1625
    MFF_TCP_DST,
1626
1627
    /* "tcp_flags".
1628
     *
1629
     * Flags in the TCP header.
1630
     *
1631
     * TCP currently defines 9 flag bits, and additional 3 bits are reserved
1632
     * (must be transmitted as zero).  See RFCs 793, 3168, and 3540.
1633
     *
1634
     * Type: be16 (low 12 bits).
1635
     * Maskable: bitwise.
1636
     * Formatting: TCP flags.
1637
     * Prerequisites: TCP.
1638
     * Access: read-only.
1639
     * NXM: NXM_NX_TCP_FLAGS(34) since v2.1.
1640
     * OXM: ONFOXM_ET_TCP_FLAGS(42) since OF1.3 and v2.4,
1641
     *      OXM_OF_TCP_FLAGS(42) since OF1.5 and v2.3.
1642
     */
1643
    MFF_TCP_FLAGS,
1644
1645
/* ## --- ## */
1646
/* ## UDP ## */
1647
/* ## --- ## */
1648
1649
    /* "udp_src".
1650
     *
1651
     * UDP source port.
1652
     *
1653
     * Type: be16.
1654
     * Maskable: bitwise.
1655
     * Formatting: decimal.
1656
     * Prerequisites: UDP.
1657
     * Access: read/write.
1658
     * NXM: NXM_OF_UDP_SRC(11) since v1.1.
1659
     * OXM: OXM_OF_UDP_SRC(15) since OF1.2 and v1.7.
1660
     * OF1.0: exact match.
1661
     * OF1.1: exact match.
1662
     */
1663
    MFF_UDP_SRC,
1664
1665
    /* "udp_dst".
1666
     *
1667
     * UDP destination port
1668
     *
1669
     * Type: be16.
1670
     * Maskable: bitwise.
1671
     * Formatting: decimal.
1672
     * Prerequisites: UDP.
1673
     * Access: read/write.
1674
     * NXM: NXM_OF_UDP_DST(12) since v1.1.
1675
     * OXM: OXM_OF_UDP_DST(16) since OF1.2 and v1.7.
1676
     * OF1.0: exact match.
1677
     * OF1.1: exact match.
1678
     */
1679
    MFF_UDP_DST,
1680
1681
/* ## ---- ## */
1682
/* ## SCTP ## */
1683
/* ## ---- ## */
1684
1685
    /* "sctp_src".
1686
     *
1687
     * SCTP source port.
1688
     *
1689
     * Type: be16.
1690
     * Maskable: bitwise.
1691
     * Formatting: decimal.
1692
     * Prerequisites: SCTP.
1693
     * Access: read/write.
1694
     * NXM: none.
1695
     * OXM: OXM_OF_SCTP_SRC(17) since OF1.2 and v2.0.
1696
     * OF1.1: exact match.
1697
     */
1698
    MFF_SCTP_SRC,
1699
1700
    /* "sctp_dst".
1701
     *
1702
     * SCTP destination port.
1703
     *
1704
     * Type: be16.
1705
     * Maskable: bitwise.
1706
     * Formatting: decimal.
1707
     * Prerequisites: SCTP.
1708
     * Access: read/write.
1709
     * NXM: none.
1710
     * OXM: OXM_OF_SCTP_DST(18) since OF1.2 and v2.0.
1711
     * OF1.1: exact match.
1712
     */
1713
    MFF_SCTP_DST,
1714
1715
/* ## ---- ## */
1716
/* ## ICMP ## */
1717
/* ## ---- ## */
1718
1719
    /* "icmp_type".
1720
     *
1721
     * ICMPv4 type.
1722
     *
1723
     * Type: u8.
1724
     * Maskable: no.
1725
     * Formatting: decimal.
1726
     * Prerequisites: ICMPv4.
1727
     * Access: read/write.
1728
     * NXM: NXM_OF_ICMP_TYPE(13) since v1.1.
1729
     * OXM: OXM_OF_ICMPV4_TYPE(19) since OF1.2 and v1.7.
1730
     * OF1.0: exact match.
1731
     * OF1.1: exact match.
1732
     */
1733
    MFF_ICMPV4_TYPE,
1734
1735
    /* "icmp_code".
1736
     *
1737
     * ICMPv4 code.
1738
     *
1739
     * Type: u8.
1740
     * Maskable: no.
1741
     * Formatting: decimal.
1742
     * Prerequisites: ICMPv4.
1743
     * Access: read/write.
1744
     * NXM: NXM_OF_ICMP_CODE(14) since v1.1.
1745
     * OXM: OXM_OF_ICMPV4_CODE(20) since OF1.2 and v1.7.
1746
     * OF1.0: exact match.
1747
     * OF1.1: exact match.
1748
     */
1749
    MFF_ICMPV4_CODE,
1750
1751
    /* "icmpv6_type".
1752
     *
1753
     * ICMPv6 type.
1754
     *
1755
     * Type: u8.
1756
     * Maskable: no.
1757
     * Formatting: decimal.
1758
     * Prerequisites: ICMPv6.
1759
     * Access: read/write.
1760
     * NXM: NXM_NX_ICMPV6_TYPE(21) since v1.1.
1761
     * OXM: OXM_OF_ICMPV6_TYPE(29) since OF1.2 and v1.7.
1762
     */
1763
    MFF_ICMPV6_TYPE,
1764
1765
    /* "icmpv6_code".
1766
     *
1767
     * ICMPv6 code.
1768
     *
1769
     * Type: u8.
1770
     * Maskable: no.
1771
     * Formatting: decimal.
1772
     * Prerequisites: ICMPv6.
1773
     * Access: read/write.
1774
     * NXM: NXM_NX_ICMPV6_CODE(22) since v1.1.
1775
     * OXM: OXM_OF_ICMPV6_CODE(30) since OF1.2 and v1.7.
1776
     */
1777
    MFF_ICMPV6_CODE,
1778
1779
/* ## ------------------------- ## */
1780
/* ## ICMPv6 Neighbor Discovery ## */
1781
/* ## ------------------------- ## */
1782
1783
    /* "nd_target".
1784
     *
1785
     * The target address in an IPv6 Neighbor Discovery message.
1786
     *
1787
     * Before Open vSwitch 1.8, only CIDR masks were supported.
1788
     *
1789
     * Type: be128.
1790
     * Maskable: bitwise.
1791
     * Formatting: IPv6.
1792
     * Prerequisites: ND.
1793
     * Access: read/write.
1794
     * NXM: NXM_NX_ND_TARGET(23) since v1.1.
1795
     * OXM: OXM_OF_IPV6_ND_TARGET(31) since OF1.2 and v1.7.
1796
     */
1797
    MFF_ND_TARGET,
1798
1799
    /* "nd_sll".
1800
     *
1801
     * The source link layer address in an IPv6 Neighbor Discovery message.
1802
     *
1803
     * Type: MAC.
1804
     * Maskable: bitwise.
1805
     * Formatting: Ethernet.
1806
     * Prerequisites: ND solicit.
1807
     * Access: read/write.
1808
     * NXM: NXM_NX_ND_SLL(24) since v1.1.
1809
     * OXM: OXM_OF_IPV6_ND_SLL(32) since OF1.2 and v1.7.
1810
     */
1811
    MFF_ND_SLL,
1812
1813
    /* "nd_tll".
1814
     *
1815
     * The target link layer address in an IPv6 Neighbor Discovery message.
1816
     *
1817
     * Type: MAC.
1818
     * Maskable: bitwise.
1819
     * Formatting: Ethernet.
1820
     * Prerequisites: ND advert.
1821
     * Access: read/write.
1822
     * NXM: NXM_NX_ND_TLL(25) since v1.1.
1823
     * OXM: OXM_OF_IPV6_ND_TLL(33) since OF1.2 and v1.7.
1824
     */
1825
    MFF_ND_TLL,
1826
1827
    /* "nd_reserved".
1828
     *
1829
     * The reserved field in IPv6 Neighbor Discovery message.
1830
     *
1831
     * Type: be32.
1832
     * Maskable: no.
1833
     * Formatting: decimal.
1834
     * Prerequisites: ND.
1835
     * Access: read/write.
1836
     * NXM: none.
1837
     * OXM: ERICOXM_OF_ICMPV6_ND_RESERVED(1) since v2.11.
1838
     */
1839
    MFF_ND_RESERVED,
1840
1841
    /* "nd_options_type".
1842
     *
1843
     * The type of the option in IPv6 Neighbor Discovery message.
1844
     *
1845
     * Type: u8.
1846
     * Maskable: no.
1847
     * Formatting: decimal.
1848
     * Prerequisites: ND.
1849
     * Access: read/write.
1850
     * NXM: none.
1851
     * OXM: ERICOXM_OF_ICMPV6_ND_OPTIONS_TYPE(2) since v2.11.
1852
     */
1853
    MFF_ND_OPTIONS_TYPE,
1854
1855
/* ## ---- ## */
1856
/* ## NSH  ## */
1857
/* ## ---- ## */
1858
1859
    /* "nsh_flags".
1860
     *
1861
     * flags field in NSH base header.
1862
     *
1863
     * Type: u8.
1864
     * Maskable: bitwise.
1865
     * Formatting: decimal.
1866
     * Prerequisites: NSH.
1867
     * Access: read/write.
1868
     * NXM: none.
1869
     * OXM: NXOXM_NSH_FLAGS(1) since v2.8.
1870
     */
1871
    MFF_NSH_FLAGS,
1872
1873
    /* "nsh_mdtype".
1874
     *
1875
     * mdtype field in NSH base header.
1876
     *
1877
     * Type: u8.
1878
     * Maskable: no.
1879
     * Formatting: decimal.
1880
     * Prerequisites: NSH.
1881
     * Access: read-only.
1882
     * NXM: none.
1883
     * OXM: NXOXM_NSH_MDTYPE(2) since v2.8.
1884
     */
1885
    MFF_NSH_MDTYPE,
1886
1887
    /* "nsh_np".
1888
     *
1889
     * np (next protocol) field in NSH base header.
1890
     *
1891
     * Type: u8.
1892
     * Maskable: no.
1893
     * Formatting: decimal.
1894
     * Prerequisites: NSH.
1895
     * Access: read-only.
1896
     * NXM: none.
1897
     * OXM: NXOXM_NSH_NP(3) since v2.8.
1898
     */
1899
    MFF_NSH_NP,
1900
1901
    /* "nsh_spi" (aka "nsp").
1902
     *
1903
     * spi (service path identifier) field in NSH base header.
1904
     *
1905
     * Type: be32 (low 24 bits).
1906
     * Maskable: no.
1907
     * Formatting: hexadecimal.
1908
     * Prerequisites: NSH.
1909
     * Access: read/write.
1910
     * NXM: none.
1911
     * OXM: NXOXM_NSH_SPI(4) since v2.8.
1912
     */
1913
    MFF_NSH_SPI,
1914
1915
    /* "nsh_si" (aka "nsi").
1916
     *
1917
     * si (service index) field in NSH base header.
1918
     *
1919
     * Type: u8.
1920
     * Maskable: no.
1921
     * Formatting: decimal.
1922
     * Prerequisites: NSH.
1923
     * Access: read/write.
1924
     * NXM: none.
1925
     * OXM: NXOXM_NSH_SI(5) since v2.8.
1926
     */
1927
    MFF_NSH_SI,
1928
1929
    /* "nsh_c<N>" (aka "nshc<N>").
1930
     *
1931
     * context fields in NSH context header.
1932
     *
1933
     * Type: be32.
1934
     * Maskable: bitwise.
1935
     * Formatting: hexadecimal.
1936
     * Prerequisites: NSH.
1937
     * Access: read/write.
1938
     * NXM: none.
1939
     * OXM: NXOXM_NSH_C1(6) since v2.8.        <1>
1940
     * OXM: NXOXM_NSH_C2(7) since v2.8.        <2>
1941
     * OXM: NXOXM_NSH_C3(8) since v2.8.        <3>
1942
     * OXM: NXOXM_NSH_C4(9) since v2.8.        <4>
1943
     */
1944
    MFF_NSH_C1,
1945
    MFF_NSH_C2,
1946
    MFF_NSH_C3,
1947
    MFF_NSH_C4,
1948
1949
    /* "nsh_ttl".
1950
     *
1951
     * TTL field in NSH base header.
1952
     *
1953
     * Type: u8.
1954
     * Maskable: no.
1955
     * Formatting: decimal.
1956
     * Prerequisites: NSH.
1957
     * Access: read/write.
1958
     * NXM: none.
1959
     * OXM: NXOXM_NSH_TTL(10) since v2.9.
1960
     */
1961
    MFF_NSH_TTL,
1962
1963
    MFF_N_IDS
1964
};
1965
1966
/* A set of mf_field_ids. */
1967
struct mf_bitmap {
1968
    unsigned long bm[BITMAP_N_LONGS(MFF_N_IDS)];
1969
};
1970
0
#define MF_BITMAP_INITIALIZER { { [0] = 0 } }
1971
1972
bool mf_bitmap_is_superset(const struct mf_bitmap *super,
1973
                           const struct mf_bitmap *sub);
1974
struct mf_bitmap mf_bitmap_and(struct mf_bitmap, struct mf_bitmap);
1975
struct mf_bitmap mf_bitmap_or(struct mf_bitmap, struct mf_bitmap);
1976
struct mf_bitmap mf_bitmap_not(struct mf_bitmap);
1977
1978
/* Use this macro as CASE_MFF_REGS: in a switch statement to choose all of the
1979
 * MFF_REGn cases. */
1980
#if FLOW_N_REGS ==16
1981
#define CASE_MFF_REGS                                             \
1982
0
    case MFF_REG0: case MFF_REG1: case MFF_REG2: case MFF_REG3:   \
1983
0
    case MFF_REG4: case MFF_REG5: case MFF_REG6: case MFF_REG7:   \
1984
0
    case MFF_REG8: case MFF_REG9: case MFF_REG10: case MFF_REG11: \
1985
0
    case MFF_REG12: case MFF_REG13: case MFF_REG14: case MFF_REG15
1986
#else
1987
#error "Need to update CASE_MFF_REGS to match FLOW_N_REGS"
1988
#endif
1989
1990
/* Use this macro as CASE_MFF_XREGS: in a switch statement to choose all of the
1991
 * MFF_REGn cases. */
1992
#if FLOW_N_XREGS == 8
1993
#define CASE_MFF_XREGS                                              \
1994
0
    case MFF_XREG0: case MFF_XREG1: case MFF_XREG2: case MFF_XREG3: \
1995
0
    case MFF_XREG4: case MFF_XREG5: case MFF_XREG6: case MFF_XREG7
1996
#else
1997
#error "Need to update CASE_MFF_XREGS to match FLOW_N_XREGS"
1998
#endif
1999
2000
/* Use this macro as CASE_MFF_XXREGS: in a switch statement to choose
2001
 * all of the MFF_REGn cases. */
2002
#if FLOW_N_XXREGS == 4
2003
#define CASE_MFF_XXREGS                                              \
2004
0
    case MFF_XXREG0: case MFF_XXREG1: case MFF_XXREG2: case MFF_XXREG3
2005
#else
2006
#error "Need to update CASE_MFF_XXREGS to match FLOW_N_XXREGS"
2007
#endif
2008
2009
static inline bool
2010
mf_is_register(enum mf_field_id id)
2011
0
{
2012
0
    return ((id >= MFF_REG0   && id < MFF_REG0   + FLOW_N_REGS) ||
2013
0
            (id >= MFF_XREG0  && id < MFF_XREG0  + FLOW_N_XREGS) ||
2014
0
            (id >= MFF_XXREG0 && id < MFF_XXREG0 + FLOW_N_XXREGS));
2015
0
}
Unexecuted instantiation: miniflow_target.c:mf_is_register
Unexecuted instantiation: flow.c:mf_is_register
Unexecuted instantiation: 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: netdev-offload-tc.c:mf_is_register
Unexecuted instantiation: tc.c:mf_is_register
Unexecuted instantiation: classifier.c:mf_is_register
Unexecuted instantiation: dpif.c:mf_is_register
Unexecuted instantiation: meta-flow.c:mf_is_register
Unexecuted instantiation: nx-match.c:mf_is_register
Unexecuted instantiation: odp-execute.c:mf_is_register
Unexecuted instantiation: odp-execute-private.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-match.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: 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
2016
2017
/* Use this macro as CASE_MFF_TUN_METADATA: in a switch statement to choose
2018
 * all of the MFF_TUN_METADATAn cases. */
2019
#define CASE_MFF_TUN_METADATA                         \
2020
0
    case MFF_TUN_METADATA0: case MFF_TUN_METADATA1:   \
2021
0
    case MFF_TUN_METADATA2: case MFF_TUN_METADATA3:   \
2022
0
    case MFF_TUN_METADATA4: case MFF_TUN_METADATA5:   \
2023
0
    case MFF_TUN_METADATA6: case MFF_TUN_METADATA7:   \
2024
0
    case MFF_TUN_METADATA8: case MFF_TUN_METADATA9:   \
2025
0
    case MFF_TUN_METADATA10: case MFF_TUN_METADATA11: \
2026
0
    case MFF_TUN_METADATA12: case MFF_TUN_METADATA13: \
2027
0
    case MFF_TUN_METADATA14: case MFF_TUN_METADATA15: \
2028
0
    case MFF_TUN_METADATA16: case MFF_TUN_METADATA17: \
2029
0
    case MFF_TUN_METADATA18: case MFF_TUN_METADATA19: \
2030
0
    case MFF_TUN_METADATA20: case MFF_TUN_METADATA21: \
2031
0
    case MFF_TUN_METADATA22: case MFF_TUN_METADATA23: \
2032
0
    case MFF_TUN_METADATA24: case MFF_TUN_METADATA25: \
2033
0
    case MFF_TUN_METADATA26: case MFF_TUN_METADATA27: \
2034
0
    case MFF_TUN_METADATA28: case MFF_TUN_METADATA29: \
2035
0
    case MFF_TUN_METADATA30: case MFF_TUN_METADATA31: \
2036
0
    case MFF_TUN_METADATA32: case MFF_TUN_METADATA33: \
2037
0
    case MFF_TUN_METADATA34: case MFF_TUN_METADATA35: \
2038
0
    case MFF_TUN_METADATA36: case MFF_TUN_METADATA37: \
2039
0
    case MFF_TUN_METADATA38: case MFF_TUN_METADATA39: \
2040
0
    case MFF_TUN_METADATA40: case MFF_TUN_METADATA41: \
2041
0
    case MFF_TUN_METADATA42: case MFF_TUN_METADATA43: \
2042
0
    case MFF_TUN_METADATA44: case MFF_TUN_METADATA45: \
2043
0
    case MFF_TUN_METADATA46: case MFF_TUN_METADATA47: \
2044
0
    case MFF_TUN_METADATA48: case MFF_TUN_METADATA49: \
2045
0
    case MFF_TUN_METADATA50: case MFF_TUN_METADATA51: \
2046
0
    case MFF_TUN_METADATA52: case MFF_TUN_METADATA53: \
2047
0
    case MFF_TUN_METADATA54: case MFF_TUN_METADATA55: \
2048
0
    case MFF_TUN_METADATA56: case MFF_TUN_METADATA57: \
2049
0
    case MFF_TUN_METADATA58: case MFF_TUN_METADATA59: \
2050
0
    case MFF_TUN_METADATA60: case MFF_TUN_METADATA61: \
2051
0
    case MFF_TUN_METADATA62: case MFF_TUN_METADATA63
2052
2053
/* Prerequisites for matching a field.
2054
 *
2055
 * A field may only be matched if the correct lower-level protocols are also
2056
 * matched.  For example, the TCP port may be matched only if the Ethernet type
2057
 * matches ETH_TYPE_IP and the IP protocol matches IPPROTO_TCP. */
2058
enum OVS_PACKED_ENUM mf_prereqs {
2059
    MFP_NONE,
2060
2061
    /* L2 requirements. */
2062
    MFP_ETHERNET,
2063
    MFP_ARP,
2064
    MFP_VLAN_VID,
2065
    MFP_IPV4,
2066
    MFP_IPV6,
2067
    MFP_IP_ANY,
2068
    MFP_NSH,
2069
2070
    /* L2.5 requirements. */
2071
    MFP_MPLS,
2072
2073
    /* L2+L3 requirements. */
2074
    MFP_TCP,                    /* On IPv4 or IPv6. */
2075
    MFP_UDP,                    /* On IPv4 or IPv6. */
2076
    MFP_SCTP,                   /* On IPv4 or IPv6. */
2077
    MFP_ICMPV4,
2078
    MFP_ICMPV6,
2079
    MFP_CT_VALID,               /* Implies IPv4 or IPv6. */
2080
2081
    /* L2+L3+L4 requirements. */
2082
    MFP_ND,
2083
    MFP_ND_SOLICIT,
2084
    MFP_ND_ADVERT
2085
};
2086
2087
/* Forms of partial-field masking allowed for a field.
2088
 *
2089
 * Every field may be masked as a whole. */
2090
enum OVS_PACKED_ENUM mf_maskable {
2091
    MFM_NONE,                   /* No sub-field masking. */
2092
    MFM_FULLY,                  /* Every bit is individually maskable. */
2093
};
2094
2095
/* How to format or parse a field's value. */
2096
enum OVS_PACKED_ENUM mf_string {
2097
    /* Integer formats.
2098
     *
2099
     * The particular MFS_* constant sets the output format.  On input, either
2100
     * decimal or hexadecimal (prefixed with 0x) is accepted. */
2101
    MFS_DECIMAL,
2102
    MFS_HEXADECIMAL,
2103
2104
    /* Other formats. */
2105
    MFS_CT_STATE,               /* Connection tracking state */
2106
    MFS_ETHERNET,
2107
    MFS_IPV4,
2108
    MFS_IPV6,
2109
    MFS_OFP_PORT,               /* 16-bit OpenFlow 1.0 port number or name. */
2110
    MFS_OFP_PORT_OXM,           /* 32-bit OpenFlow 1.1+ port number or name. */
2111
    MFS_FRAG,                   /* no, yes, first, later, not_later */
2112
    MFS_TNL_FLAGS,              /* FLOW_TNL_F_* flags */
2113
    MFS_TCP_FLAGS,              /* TCP_* flags */
2114
    MFS_PACKET_TYPE,            /* "(NS,NS_TYPE)" */
2115
};
2116
2117
struct mf_field {
2118
    /* Identification. */
2119
    enum mf_field_id id;        /* MFF_*. */
2120
    const char *name;           /* Name of this field, e.g. "eth_type". */
2121
    const char *extra_name;     /* Alternate name, e.g. "dl_type", or NULL. */
2122
2123
    /* Size.
2124
     *
2125
     * Most fields have n_bytes * 8 == n_bits.  There are a few exceptions:
2126
     *
2127
     *     - "dl_vlan" is 2 bytes but only 12 bits.
2128
     *     - "dl_vlan_pcp" is 1 byte but only 3 bits.
2129
     *     - "is_frag" is 1 byte but only 2 bits.
2130
     *     - "ipv6_label" is 4 bytes but only 20 bits.
2131
     *     - "mpls_label" is 4 bytes but only 20 bits.
2132
     *     - "mpls_tc"    is 1 byte but only 3 bits.
2133
     *     - "mpls_bos"   is 1 byte but only 1 bit.
2134
     */
2135
    unsigned int n_bytes;       /* Width of the field in bytes. */
2136
    unsigned int n_bits;        /* Number of significant bits in field. */
2137
    bool variable_len;          /* Length is variable, if so width is max. */
2138
2139
    /* Properties. */
2140
    enum mf_maskable maskable;
2141
    enum mf_string string;
2142
    enum mf_prereqs prereqs;
2143
    bool writable;              /* May be written by actions? */
2144
    bool mapped;                /* Variable length mf_field is mapped. */
2145
2146
    /* Usable protocols.
2147
     *
2148
     * NXM and OXM are extensible, allowing later extensions to be sent in
2149
     * earlier protocol versions, so this does not necessarily correspond to
2150
     * the OpenFlow protocol version the field was introduced in.
2151
     * Also, some field types are tranparently mapped to each other via the
2152
     * struct flow (like vlan and dscp/tos fields), so each variant supports
2153
     * all protocols. */
2154
    enum ofputil_protocol usable_protocols_exact; /* Match/set whole field. */
2155
    enum ofputil_protocol usable_protocols_cidr;    /* Match CIDR mask. */
2156
    enum ofputil_protocol usable_protocols_bitwise; /* Match arbitrary bits. */
2157
2158
    int flow_be32ofs;  /* Field's be32 offset in "struct flow", if prefix tree
2159
                        * lookup is supported for the field, or -1. */
2160
};
2161
2162
/* The representation of a field's value. */
2163
union mf_value {
2164
    uint8_t b[128];
2165
    uint8_t tun_metadata[128];
2166
    struct in6_addr ipv6;
2167
    struct eth_addr mac;
2168
    ovs_be128 be128;
2169
    ovs_be64 be64;
2170
    ovs_be32 be32;
2171
    ovs_be16 be16;
2172
    uint8_t u8;
2173
};
2174
BUILD_ASSERT_DECL(sizeof(union mf_value) == 128);
2175
BUILD_ASSERT_DECL(sizeof(union mf_value) >= TLV_MAX_OPT_SIZE);
2176
2177
/* A const mf_value with all bits initialized to ones. */
2178
extern const union mf_value exact_match_mask;
2179
2180
/* Part of a field. */
2181
struct mf_subfield {
2182
    const struct mf_field *field;
2183
    unsigned int ofs;           /* Bit offset. */
2184
    unsigned int n_bits;        /* Number of bits. */
2185
};
2186
2187
/* Data for some part of an mf_field.
2188
 *
2189
 * The data is stored "right-justified".  For example, if "union mf_subvalue
2190
 * value" contains NXM_OF_VLAN_TCI[0..11], then one could access the
2191
 * corresponding data in value.be16[7] as the bits in the mask htons(0xfff). */
2192
union mf_subvalue {
2193
    /* Access to full data. */
2194
    uint8_t u8[128];
2195
    ovs_be16 be16[64];
2196
    ovs_be32 be32[32];
2197
    ovs_be64 be64[16];
2198
    ovs_be128 be128[8];
2199
2200
    /* Convenient access to just least-significant bits in various forms. */
2201
    struct {
2202
        uint8_t dummy_u8[127];
2203
        uint8_t u8_val;
2204
    };
2205
    struct {
2206
        ovs_be16 dummy_be16[63];
2207
        ovs_be16 be16_int;
2208
    };
2209
    struct {
2210
        ovs_be32 dummy_be32[31];
2211
        ovs_be32 be32_int;
2212
    };
2213
    struct {
2214
        ovs_be64 dummy_integer[15];
2215
        ovs_be64 integer;
2216
    };
2217
    struct {
2218
        ovs_be128 dummy_be128[7];
2219
        ovs_be128 be128_int;
2220
    };
2221
    struct {
2222
        uint8_t dummy_mac[122];
2223
        struct eth_addr mac;
2224
    };
2225
    struct {
2226
        ovs_be32 dummy_ipv4[31];
2227
        ovs_be32 ipv4;
2228
    };
2229
    struct {
2230
        struct in6_addr dummy_ipv6[7];
2231
        struct in6_addr ipv6;
2232
    };
2233
};
2234
BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue));
2235
2236
/* A const mf_subvalue with all bits initialized to ones. */
2237
extern const union mf_subvalue exact_sub_match_mask;
2238
2239
bool mf_subvalue_intersect(const union mf_subvalue *a_value,
2240
                           const union mf_subvalue *a_mask,
2241
                           const union mf_subvalue *b_value,
2242
                           const union mf_subvalue *b_mask,
2243
                           union mf_subvalue *dst_value,
2244
                           union mf_subvalue *dst_mask);
2245
int mf_subvalue_width(const union mf_subvalue *);
2246
void mf_subvalue_shift(union mf_subvalue *, int n);
2247
void mf_subvalue_format(const union mf_subvalue *, struct ds *);
2248
2249
static inline void mf_subvalue_from_value(const struct mf_subfield *sf,
2250
                                          union mf_subvalue *sv,
2251
                                          const void *value)
2252
0
{
2253
0
    unsigned int n_bytes = DIV_ROUND_UP(sf->n_bits, 8);
2254
0
    memset(sv, 0, sizeof *sv - n_bytes);
2255
0
    memcpy(&sv->u8[sizeof sv->u8 - n_bytes], value, n_bytes);
2256
0
}
Unexecuted instantiation: miniflow_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-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: netdev-offload-tc.c:mf_subvalue_from_value
Unexecuted instantiation: tc.c:mf_subvalue_from_value
Unexecuted instantiation: classifier.c:mf_subvalue_from_value
Unexecuted instantiation: dpif.c:mf_subvalue_from_value
Unexecuted instantiation: meta-flow.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-execute-private.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-match.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: 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
2257
2258
2259
/* Set of field values. 'values' only includes the actual data bytes for each
2260
 * field for which is used, as marked by 1-bits in 'used'. */
2261
struct field_array {
2262
    struct mf_bitmap used;
2263
    size_t values_size;      /* Number of bytes currently in 'values'. */
2264
    uint8_t *values;     /* Dynamically allocated to the correct size. */
2265
};
2266
2267
/* Finding mf_fields. */
2268
const struct mf_field *mf_from_name(const char *name);
2269
const struct mf_field *mf_from_name_len(const char *name, size_t len);
2270
2271
static inline const struct mf_field *
2272
mf_from_id(enum mf_field_id id)
2273
0
{
2274
0
    extern const struct mf_field mf_fields[MFF_N_IDS];
2275
0
    ovs_assert((unsigned int) id < MFF_N_IDS);
2276
0
    return &mf_fields[id];
2277
0
}
Unexecuted instantiation: miniflow_target.c:mf_from_id
Unexecuted instantiation: flow.c:mf_from_id
Unexecuted instantiation: 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: netdev-offload-tc.c:mf_from_id
Unexecuted instantiation: tc.c:mf_from_id
Unexecuted instantiation: classifier.c:mf_from_id
Unexecuted instantiation: dpif.c:mf_from_id
Unexecuted instantiation: meta-flow.c:mf_from_id
Unexecuted instantiation: nx-match.c:mf_from_id
Unexecuted instantiation: odp-execute.c:mf_from_id
Unexecuted instantiation: odp-execute-private.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-match.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: 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
2278
2279
/* Inspecting wildcarded bits. */
2280
bool mf_is_all_wild(const struct mf_field *, const struct flow_wildcards *);
2281
2282
bool mf_is_mask_valid(const struct mf_field *, const union mf_value *mask);
2283
void mf_get_mask(const struct mf_field *, const struct flow_wildcards *,
2284
                 union mf_value *mask);
2285
2286
/* Prerequisites. */
2287
bool mf_are_prereqs_ok(const struct mf_field *mf, const struct flow *flow,
2288
                       struct flow_wildcards *wc);
2289
bool mf_are_match_prereqs_ok(const struct mf_field *, const struct match *);
2290
2291
static inline bool
2292
mf_is_l3_or_higher(const struct mf_field *mf)
2293
0
{
2294
0
    return mf->id >= MFF_IPV4_SRC;
2295
0
}
Unexecuted instantiation: miniflow_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-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: netdev-offload-tc.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.c:mf_is_l3_or_higher
Unexecuted instantiation: meta-flow.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-execute-private.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-match.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: 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
2296
2297
/* Field values. */
2298
bool mf_is_value_valid(const struct mf_field *, const union mf_value *value);
2299
2300
void mf_get_value(const struct mf_field *, const struct flow *,
2301
                  union mf_value *value);
2302
void mf_set_value(const struct mf_field *, const union mf_value *value,
2303
                  struct match *, char **err_str);
2304
void mf_set_flow_value(const struct mf_field *, const union mf_value *value,
2305
                       struct flow *);
2306
void mf_set_flow_value_masked(const struct mf_field *,
2307
                              const union mf_value *value,
2308
                              const union mf_value *mask,
2309
                              struct flow *);
2310
bool mf_is_tun_metadata(const struct mf_field *);
2311
bool mf_is_any_metadata(const struct mf_field *);
2312
bool mf_is_frozen_metadata(const struct mf_field *);
2313
bool mf_is_pipeline_field(const struct mf_field *);
2314
bool mf_is_set(const struct mf_field *, const struct flow *);
2315
void mf_mask_field(const struct mf_field *, struct flow_wildcards *);
2316
void mf_mask_field_masked(const struct mf_field *, const union mf_value *mask,
2317
                          struct flow_wildcards *);
2318
int mf_field_len(const struct mf_field *, const union mf_value *value,
2319
                 const union mf_value *mask, bool *is_masked);
2320
2321
void mf_get(const struct mf_field *, const struct match *,
2322
            union mf_value *value, union mf_value *mask);
2323
2324
/* Returns the set of usable protocols. */
2325
uint32_t mf_set(const struct mf_field *, const union mf_value *value,
2326
                const union mf_value *mask, struct match *, char **err_str);
2327
2328
void mf_set_wild(const struct mf_field *, struct match *, char **err_str);
2329
2330
/* Subfields. */
2331
void mf_write_subfield_flow(const struct mf_subfield *,
2332
                            const union mf_subvalue *, struct flow *);
2333
void mf_write_subfield(const struct mf_subfield *, const union mf_subvalue *,
2334
                       struct match *);
2335
void mf_write_subfield_value(const struct mf_subfield *, const void *src,
2336
                             struct match *);
2337
2338
void mf_mask_subfield(const struct mf_field *,
2339
                      const union mf_subvalue *value,
2340
                      const union mf_subvalue *mask,
2341
                      struct match *);
2342
2343
void mf_read_subfield(const struct mf_subfield *, const struct flow *,
2344
                      union mf_subvalue *);
2345
uint64_t mf_get_subfield(const struct mf_subfield *, const struct flow *);
2346
2347
void mf_subfield_copy(const struct mf_subfield *src,
2348
                      const struct mf_subfield *dst,
2349
                      struct flow *, struct flow_wildcards *);
2350
void mf_subfield_swap(const struct mf_subfield *,
2351
                      const struct mf_subfield *,
2352
                      struct flow *flow, struct flow_wildcards *);
2353
2354
enum ofperr mf_check_src(const struct mf_subfield *, const struct match *);
2355
enum ofperr mf_check_dst(const struct mf_subfield *, const struct match *);
2356
2357
/* Parsing and formatting. */
2358
char *mf_parse(const struct mf_field *, const char *,
2359
               const struct ofputil_port_map *,
2360
               union mf_value *value, union mf_value *mask);
2361
char *mf_parse_value(const struct mf_field *, const char *,
2362
                     const struct ofputil_port_map *, union mf_value *);
2363
void mf_format(const struct mf_field *,
2364
               const union mf_value *value, const union mf_value *mask,
2365
               const struct ofputil_port_map *,
2366
               struct ds *);
2367
void mf_format_subvalue(const union mf_subvalue *subvalue, struct ds *s);
2368
2369
/* Field Arrays. */
2370
void field_array_set(enum mf_field_id id, const union mf_value *,
2371
                     struct field_array *);
2372
2373
/* Mask the required l3 prerequisites if a 'set' action occurs. */
2374
void mf_set_mask_l3_prereqs(const struct mf_field *, const struct flow *,
2375
                            struct flow_wildcards *);
2376
2377
#ifdef __cplusplus
2378
}
2379
#endif
2380
2381
#endif /* meta-flow.h */