/src/openvswitch/lib/netdev-native-tnl.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2010, 2011, 2013, 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 NETDEV_VPORT_NATIVE_TNL_H |
18 | | #define NETDEV_VPORT_NATIVE_TNL_H 1 |
19 | | |
20 | | #include <stdbool.h> |
21 | | #include <stddef.h> |
22 | | #include "compiler.h" |
23 | | #include "dp-packet.h" |
24 | | #include "packets.h" |
25 | | #include "unixctl.h" |
26 | | |
27 | | struct netdev; |
28 | | struct ovs_action_push_tnl; |
29 | | struct netdev_tnl_build_header_params; |
30 | | |
31 | | int |
32 | | netdev_gre_build_header(const struct netdev *netdev, |
33 | | struct ovs_action_push_tnl *data, |
34 | | const struct netdev_tnl_build_header_params *params); |
35 | | |
36 | | void |
37 | | netdev_gre_push_header(const struct netdev *netdev, |
38 | | struct dp_packet *packet, |
39 | | const struct ovs_action_push_tnl *data); |
40 | | struct dp_packet * |
41 | | netdev_gre_pop_header(struct dp_packet *packet); |
42 | | |
43 | | int |
44 | | netdev_erspan_build_header(const struct netdev *netdev, |
45 | | struct ovs_action_push_tnl *data, |
46 | | const struct netdev_tnl_build_header_params *p); |
47 | | |
48 | | void |
49 | | netdev_erspan_push_header(const struct netdev *netdev, |
50 | | struct dp_packet *packet, |
51 | | const struct ovs_action_push_tnl *data); |
52 | | struct dp_packet * |
53 | | netdev_erspan_pop_header(struct dp_packet *packet); |
54 | | |
55 | | struct dp_packet * |
56 | | netdev_gtpu_pop_header(struct dp_packet *packet); |
57 | | |
58 | | void |
59 | | netdev_gtpu_push_header(const struct netdev *netdev, |
60 | | struct dp_packet *packet, |
61 | | const struct ovs_action_push_tnl *data); |
62 | | |
63 | | int |
64 | | netdev_gtpu_build_header(const struct netdev *netdev, |
65 | | struct ovs_action_push_tnl *data, |
66 | | const struct netdev_tnl_build_header_params *p); |
67 | | |
68 | | void |
69 | | netdev_tnl_push_udp_header(const struct netdev *netdev, |
70 | | struct dp_packet *packet, |
71 | | const struct ovs_action_push_tnl *data); |
72 | | int |
73 | | netdev_geneve_build_header(const struct netdev *netdev, |
74 | | struct ovs_action_push_tnl *data, |
75 | | const struct netdev_tnl_build_header_params *params); |
76 | | |
77 | | struct dp_packet * |
78 | | netdev_geneve_pop_header(struct dp_packet *packet); |
79 | | |
80 | | int |
81 | | netdev_vxlan_build_header(const struct netdev *netdev, |
82 | | struct ovs_action_push_tnl *data, |
83 | | const struct netdev_tnl_build_header_params *params); |
84 | | |
85 | | struct dp_packet * |
86 | | netdev_vxlan_pop_header(struct dp_packet *packet); |
87 | | |
88 | | static inline bool |
89 | | netdev_tnl_is_header_ipv6(const void *header) |
90 | 0 | { |
91 | 0 | const struct eth_header *eth; |
92 | 0 | eth = header; |
93 | 0 | return eth->eth_type == htons(ETH_TYPE_IPV6); |
94 | 0 | } Unexecuted instantiation: netdev-vport.c:netdev_tnl_is_header_ipv6 Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_is_header_ipv6 |
95 | | |
96 | | static inline struct ip_header * |
97 | | netdev_tnl_ip_hdr(void *eth) |
98 | 0 | { |
99 | 0 | return (void *)((char *)eth + sizeof (struct eth_header)); |
100 | 0 | } Unexecuted instantiation: netdev-vport.c:netdev_tnl_ip_hdr Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_ip_hdr |
101 | | |
102 | | static inline struct ovs_16aligned_ip6_hdr * |
103 | | netdev_tnl_ipv6_hdr(void *eth) |
104 | 0 | { |
105 | 0 | return (void *)((char *)eth + sizeof (struct eth_header)); |
106 | 0 | } Unexecuted instantiation: netdev-vport.c:netdev_tnl_ipv6_hdr Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_ipv6_hdr |
107 | | |
108 | | void * |
109 | | netdev_tnl_ip_build_header(struct ovs_action_push_tnl *data, |
110 | | const struct netdev_tnl_build_header_params *params, |
111 | | uint8_t next_proto); |
112 | | |
113 | | extern uint16_t tnl_udp_port_min; |
114 | | extern uint16_t tnl_udp_port_max; |
115 | | |
116 | | static inline ovs_be16 |
117 | | netdev_tnl_get_src_port(struct dp_packet *packet) |
118 | 0 | { |
119 | 0 | uint32_t hash; |
120 | |
|
121 | 0 | hash = dp_packet_get_rss_hash(packet); |
122 | |
|
123 | 0 | return htons((((uint64_t) hash * (tnl_udp_port_max - tnl_udp_port_min)) >> 32) + |
124 | 0 | tnl_udp_port_min); |
125 | 0 | } Unexecuted instantiation: netdev-vport.c:netdev_tnl_get_src_port Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_get_src_port |
126 | | |
127 | | void * |
128 | | netdev_tnl_ip_extract_tnl_md(struct dp_packet *packet, struct flow_tnl *tnl, |
129 | | unsigned int *hlen); |
130 | | void * |
131 | | netdev_tnl_push_ip_header(struct dp_packet *packet, |
132 | | const void *header, int size, int *ip_tot_size); |
133 | | void |
134 | | netdev_tnl_egress_port_range(struct unixctl_conn *conn, int argc, |
135 | | const char *argv[], void *aux OVS_UNUSED); |
136 | | #endif |