~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to include/openflow/nicira-ext.h

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

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