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