]>
Commit | Line | Data |
---|---|---|
b2bd6da6 BW |
1 | /* |
2 | * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 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_PACKETS_H | |
18 | #define OPENVSWITCH_PACKETS_H 1 | |
19 | ||
20 | #include <netinet/in.h> | |
21 | #include "openvswitch/tun-metadata.h" | |
22 | ||
ec30ca5f BP |
23 | #ifdef __cplusplus |
24 | extern "C" { | |
25 | #endif | |
26 | ||
b2bd6da6 BW |
27 | /* Tunnel information used in flow key and metadata. */ |
28 | struct flow_tnl { | |
29 | ovs_be32 ip_dst; | |
30 | struct in6_addr ipv6_dst; | |
31 | ovs_be32 ip_src; | |
32 | struct in6_addr ipv6_src; | |
33 | ovs_be64 tun_id; | |
34 | uint16_t flags; | |
35 | uint8_t ip_tos; | |
36 | uint8_t ip_ttl; | |
37 | ovs_be16 tp_src; | |
38 | ovs_be16 tp_dst; | |
39 | ovs_be16 gbp_id; | |
40 | uint8_t gbp_flags; | |
41 | uint8_t pad1[5]; /* Pad to 64 bits. */ | |
42 | struct tun_metadata metadata; | |
43 | }; | |
44 | ||
45 | /* Some flags are exposed through OpenFlow while others are used only | |
46 | * internally. */ | |
47 | ||
48 | /* Public flags */ | |
49 | #define FLOW_TNL_F_OAM (1 << 0) | |
50 | ||
51 | #define FLOW_TNL_PUB_F_MASK ((1 << 1) - 1) | |
52 | ||
53 | /* Private flags */ | |
54 | #define FLOW_TNL_F_DONT_FRAGMENT (1 << 1) | |
55 | #define FLOW_TNL_F_CSUM (1 << 2) | |
56 | #define FLOW_TNL_F_KEY (1 << 3) | |
57 | ||
58 | #define FLOW_TNL_F_MASK ((1 << 4) - 1) | |
59 | ||
60 | /* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port | |
61 | * numbers and other times datapath (dpif) port numbers. This union allows | |
62 | * access to both. */ | |
63 | union flow_in_port { | |
64 | odp_port_t odp_port; | |
65 | ofp_port_t ofp_port; | |
66 | }; | |
67 | ||
f0fb825a EG |
68 | union flow_vlan_hdr { |
69 | ovs_be32 qtag; | |
70 | struct { | |
71 | ovs_be16 tpid; /* ETH_TYPE_VLAN_DOT1Q or ETH_TYPE_DOT1AD */ | |
72 | ovs_be16 tci; | |
73 | }; | |
74 | }; | |
75 | ||
3d2fbd70 JS |
76 | /* Network Service Header keys */ |
77 | struct flow_nsh { | |
78 | uint8_t flags; | |
79 | uint8_t mdtype; | |
80 | uint8_t np; | |
81 | uint8_t si; | |
82 | ovs_be32 spi; | |
83 | ovs_be32 c[4]; | |
84 | }; | |
85 | ||
86 | /* NSH flags */ | |
87 | #define FLOW_NSH_F_OAM (1 << 0) | |
88 | #define FLOW_NSH_F_CTX (1 << 1) | |
89 | ||
90 | #define FLOW_NSH_F_MASK ((1 << 2) - 1) | |
91 | ||
1acb986d | 92 | #ifdef __cplusplus |
93 | } | |
94 | #endif | |
95 | ||
b2bd6da6 | 96 | #endif /* packets.h */ |