]>
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; | |
42 | uint8_t pad1[5]; /* Pad to 64 bits. */ | |
43 | struct tun_metadata metadata; | |
44 | }; | |
45 | ||
46 | /* Some flags are exposed through OpenFlow while others are used only | |
47 | * internally. */ | |
48 | ||
49 | /* Public flags */ | |
50 | #define FLOW_TNL_F_OAM (1 << 0) | |
51 | ||
52 | #define FLOW_TNL_PUB_F_MASK ((1 << 1) - 1) | |
53 | ||
54 | /* Private flags */ | |
55 | #define FLOW_TNL_F_DONT_FRAGMENT (1 << 1) | |
56 | #define FLOW_TNL_F_CSUM (1 << 2) | |
57 | #define FLOW_TNL_F_KEY (1 << 3) | |
58 | ||
59 | #define FLOW_TNL_F_MASK ((1 << 4) - 1) | |
60 | ||
61 | /* Unfortunately, a "struct flow" sometimes has to handle OpenFlow port | |
62 | * numbers and other times datapath (dpif) port numbers. This union allows | |
63 | * access to both. */ | |
64 | union flow_in_port { | |
65 | odp_port_t odp_port; | |
66 | ofp_port_t ofp_port; | |
67 | }; | |
68 | ||
f0fb825a EG |
69 | union flow_vlan_hdr { |
70 | ovs_be32 qtag; | |
71 | struct { | |
72 | ovs_be16 tpid; /* ETH_TYPE_VLAN_DOT1Q or ETH_TYPE_DOT1AD */ | |
73 | ovs_be16 tci; | |
74 | }; | |
75 | }; | |
76 | ||
3d2fbd70 JS |
77 | /* Network Service Header keys */ |
78 | struct flow_nsh { | |
79 | uint8_t flags; | |
80 | uint8_t mdtype; | |
81 | uint8_t np; | |
82 | uint8_t si; | |
83 | ovs_be32 spi; | |
84 | ovs_be32 c[4]; | |
85 | }; | |
86 | ||
87 | /* NSH flags */ | |
88 | #define FLOW_NSH_F_OAM (1 << 0) | |
89 | #define FLOW_NSH_F_CTX (1 << 1) | |
90 | ||
91 | #define FLOW_NSH_F_MASK ((1 << 2) - 1) | |
92 | ||
1acb986d | 93 | #ifdef __cplusplus |
94 | } | |
95 | #endif | |
96 | ||
b2bd6da6 | 97 | #endif /* packets.h */ |