Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 1 | // Copyright 2013, Big Switch Networks, Inc. |
| 2 | // |
Dan Talayco | f76f711 | 2013-05-19 23:32:12 -0700 | [diff] [blame] | 3 | // LoxiGen is licensed under the Eclipse Public License, |
Dan Talayco | ba50672 | 2013-05-21 14:33:33 -0700 | [diff] [blame] | 4 | // version 1.0 (EPL), with the following special exception: |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 5 | // |
| 6 | // LOXI Exception |
| 7 | // |
Dan Talayco | f76f711 | 2013-05-19 23:32:12 -0700 | [diff] [blame] | 8 | // As a special exception to the terms of the EPL, you may |
| 9 | // distribute libraries generated by LoxiGen (LoxiGen Libraries) |
| 10 | // under the terms of your choice, provided that copyright and |
| 11 | // licensing notices generated by LoxiGen are not altered or removed |
| 12 | // from the LoxiGen Libraries and the notice provided below is (i) |
| 13 | // included in the LoxiGen Libraries, if distributed in source code |
| 14 | // form and (ii) included in any documentation for the LoxiGen |
| 15 | // Libraries, if distributed in binary form. |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 16 | // |
Dan Talayco | f76f711 | 2013-05-19 23:32:12 -0700 | [diff] [blame] | 17 | // Notice: "Copyright 2013, Big Switch Networks, Inc. |
| 18 | // This library was generated by the LoxiGen Compiler." |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 19 | // |
Dan Talayco | f76f711 | 2013-05-19 23:32:12 -0700 | [diff] [blame] | 20 | // You may not use this file except in compliance with the EPL or |
| 21 | // LOXI Exception. You may obtain a copy of the EPL at: |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 22 | // |
| 23 | // http://www.eclipse.org/legal/epl-v10.html |
| 24 | // |
Dan Talayco | f76f711 | 2013-05-19 23:32:12 -0700 | [diff] [blame] | 25 | // Unless required by applicable law or agreed to in writing, |
| 26 | // software distributed under the License is distributed on an "AS |
| 27 | // IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 28 | // express or implied. See the EPL for the specific language |
| 29 | // governing permissions and limitations under the EPL. |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 30 | |
| 31 | #version any |
| 32 | |
Kiran Poola | 8ecd3f1 | 2013-07-09 17:58:12 -0700 | [diff] [blame] | 33 | enum ofp_bsn_vport_status { |
Kiran Poola | 747339a | 2013-07-09 17:45:22 -0700 | [diff] [blame] | 34 | OF_BSN_VPORT_STATUS_OK = 0, |
| 35 | OF_BSN_VPORT_STATUS_FAILED = 1, |
| 36 | }; |
| 37 | |
Dan Talayco | 78654ff | 2013-05-24 11:41:55 -0700 | [diff] [blame] | 38 | // When the ingress or egress VID has this value, no outer tag should be used. |
| 39 | // In this case, the corresponding TPID is ignored. |
| 40 | |
Andreas Wundsam | 4ee5146 | 2013-07-30 11:00:37 -0700 | [diff] [blame] | 41 | enum ofp_bsn_vport_q_in_q_untagged(wire_type=uint16_t, complete=False) { |
Dan Talayco | 78654ff | 2013-05-24 11:41:55 -0700 | [diff] [blame] | 42 | OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 0xffff, |
| 43 | }; |
| 44 | |
Wilson Ng | 8c9d957 | 2014-04-15 16:27:53 -0700 | [diff] [blame] | 45 | enum ofp_bsn_vport_l2gre_flags(wire_type=uint32_t, bitmask=True) { |
| 46 | OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID = 0x1, |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 47 | |
Wilson Ng | 8c9d957 | 2014-04-15 16:27:53 -0700 | [diff] [blame] | 48 | /* DSCP flags are mutually exclusive */ |
| 49 | OF_BSN_VPORT_L2GRE_DSCP_ASSIGN = 0x2, |
| 50 | OF_BSN_VPORT_L2GRE_DSCP_COPY = 0x4, |
Wilson Ng | 8afae4c | 2014-06-16 14:37:35 -0700 | [diff] [blame] | 51 | |
| 52 | OF_BSN_VPORT_L2GRE_LOOPBACK_IS_VALID = 0x8, |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame^] | 53 | |
| 54 | OF_BSN_VPORT_L2GRE_RATE_LIMIT_IS_VALID = 0x10, |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 57 | // BSN Virtual port object header |
| 58 | // FIXME For now, inheritance is not exercised. See below. |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 59 | struct of_bsn_vport { |
Andreas Wundsam | 70411bf | 2013-08-02 22:26:38 -0700 | [diff] [blame] | 60 | uint16_t type == ?; /* Discriminate virtual port type */ |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 61 | uint16_t length; /* Length in bytes of this structure with this header */ |
| 62 | /* Remainder of data is specific to the port type */ |
| 63 | }; |
| 64 | |
| 65 | |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 66 | // Q-in-Q virtual port specification |
| 67 | |
Rich Lane | e9c37db | 2013-06-21 18:30:24 -0700 | [diff] [blame] | 68 | struct of_bsn_vport_q_in_q : of_bsn_vport { |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 69 | uint16_t type == 0; |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 70 | uint16_t length; |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 71 | uint32_t port_no; /* OF port number of parent; usually phys port */ |
| 72 | uint16_t ingress_tpid; |
| 73 | uint16_t ingress_vlan_id; |
| 74 | uint16_t egress_tpid; |
| 75 | uint16_t egress_vlan_id; |
Kiran Poola | 4d83d65 | 2013-09-20 13:28:31 -0700 | [diff] [blame] | 76 | of_port_name_t if_name; /* Name to use in create operation */ |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 79 | |
| 80 | // L2GRE tunnel virtual port specification |
| 81 | |
| 82 | struct of_bsn_vport_l2gre : of_bsn_vport { |
| 83 | uint16_t type == 1; |
| 84 | uint16_t length; |
Wilson Ng | 8c9d957 | 2014-04-15 16:27:53 -0700 | [diff] [blame] | 85 | enum ofp_bsn_vport_l2gre_flags flags; |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 86 | of_port_no_t port_no; /* OF port number of parent */ |
| 87 | of_port_no_t loopback_port_no; /* OF port number of loopback */ |
| 88 | of_mac_addr_t local_mac; /* Local MAC */ |
| 89 | of_mac_addr_t nh_mac; /* Next Hop MAC */ |
| 90 | of_ipv4_t src_ip; /* Source IP */ |
| 91 | of_ipv4_t dst_ip; /* Destination IP */ |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 92 | uint8_t dscp; |
| 93 | uint8_t ttl; |
Wilson Ng | 8c9d957 | 2014-04-15 16:27:53 -0700 | [diff] [blame] | 94 | pad(2); |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 95 | uint32_t vpn; /* VPN ID (for GRE Key) */ |
Wilson Ng | 5902bbf | 2014-07-31 13:30:49 -0700 | [diff] [blame^] | 96 | uint32_t rate_limit; /* Rate limit in Kbps */ |
Wilson Ng | 28fc85b | 2014-06-10 18:18:39 -0700 | [diff] [blame] | 97 | of_port_name_t if_name; /* Virtual Interface Name */ |
Wilson Ng | d618188 | 2014-04-14 16:28:35 -0700 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 101 | // Request from controller to switch to create vport |
Rich Lane | e9c37db | 2013-06-21 18:30:24 -0700 | [diff] [blame] | 102 | struct of_bsn_virtual_port_create_request : of_bsn_header { |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 103 | uint8_t version; |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 104 | uint8_t type == 4; |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 105 | uint16_t length; |
| 106 | uint32_t xid; |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 107 | uint32_t experimenter == 0x5c16c7; |
| 108 | uint32_t subtype == 15; |
Wilson Ng | a5706e6 | 2014-04-09 04:11:20 -0700 | [diff] [blame] | 109 | of_bsn_vport_t vport; // Description of vport to create |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 110 | // Additional data follows depending on header type |
| 111 | }; |
| 112 | |
| 113 | // Reply from switch to controller indicating port number created |
| 114 | // vport_no must be 16 bits to be compatible with 1.0 |
Rich Lane | e9c37db | 2013-06-21 18:30:24 -0700 | [diff] [blame] | 115 | struct of_bsn_virtual_port_create_reply : of_bsn_header { |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 116 | uint8_t version; |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 117 | uint8_t type == 4; |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 118 | uint16_t length; |
| 119 | uint32_t xid; // Must match create_request |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 120 | uint32_t experimenter == 0x5c16c7; |
| 121 | uint32_t subtype == 16; |
Dan Talayco | b392f6b | 2013-06-12 10:48:17 -0700 | [diff] [blame] | 122 | uint32_t status; // 0 means success |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 123 | uint32_t vport_no; // The OF port number created. 16-bits for OF 1.0 |
| 124 | }; |
| 125 | |
| 126 | // Request from controller to switch to remove a vport |
Rich Lane | e9c37db | 2013-06-21 18:30:24 -0700 | [diff] [blame] | 127 | struct of_bsn_virtual_port_remove_request : of_bsn_header { |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 128 | uint8_t version; |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 129 | uint8_t type == 4; |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 130 | uint16_t length; |
| 131 | uint32_t xid; |
Rich Lane | d071467 | 2013-05-29 14:22:35 -0700 | [diff] [blame] | 132 | uint32_t experimenter == 0x5c16c7; |
| 133 | uint32_t subtype == 17; |
Dan Talayco | c0e802e | 2013-05-18 23:52:39 -0700 | [diff] [blame] | 134 | uint32_t vport_no; // The OF port number to be removed |
| 135 | }; |
Dan Talayco | b392f6b | 2013-06-12 10:48:17 -0700 | [diff] [blame] | 136 | |
| 137 | // Request from controller to switch to remove a vport |
Rich Lane | e9c37db | 2013-06-21 18:30:24 -0700 | [diff] [blame] | 138 | struct of_bsn_virtual_port_remove_reply : of_bsn_header { |
Dan Talayco | b392f6b | 2013-06-12 10:48:17 -0700 | [diff] [blame] | 139 | uint8_t version; |
| 140 | uint8_t type == 4; |
| 141 | uint16_t length; |
| 142 | uint32_t xid; // Must match request xid |
| 143 | uint32_t experimenter == 0x5c16c7; |
| 144 | uint32_t subtype == 26; |
| 145 | uint32_t status; // 0 means success |
| 146 | }; |