Coverage Report

Created: 2026-06-22 06:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openvswitch/lib/netdev-native-tnl.h
Line
Count
Source
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
                       const struct netdev *ingress_netdev,
39
                       struct dp_packet *packet,
40
                       const struct ovs_action_push_tnl *data);
41
struct dp_packet *
42
netdev_gre_pop_header(struct dp_packet *packet);
43
44
int
45
netdev_erspan_build_header(const struct netdev *netdev,
46
                           struct ovs_action_push_tnl *data,
47
                           const struct netdev_tnl_build_header_params *p);
48
49
void
50
netdev_erspan_push_header(const struct netdev *netdev,
51
                          const struct netdev *ingress_netdev,
52
                          struct dp_packet *packet,
53
                          const struct ovs_action_push_tnl *data);
54
struct dp_packet *
55
netdev_erspan_pop_header(struct dp_packet *packet);
56
57
struct dp_packet *
58
netdev_gtpu_pop_header(struct dp_packet *packet);
59
60
void
61
netdev_gtpu_push_header(const struct netdev *netdev,
62
                        const struct netdev *ingress_netdev,
63
                        struct dp_packet *packet,
64
                        const struct ovs_action_push_tnl *data);
65
66
int
67
netdev_gtpu_build_header(const struct netdev *netdev,
68
                         struct ovs_action_push_tnl *data,
69
                         const struct netdev_tnl_build_header_params *p);
70
71
struct dp_packet *netdev_srv6_pop_header(struct dp_packet *);
72
73
void netdev_srv6_push_header(const struct netdev *,
74
                             const struct netdev *ingress_netdev,
75
                             struct dp_packet *,
76
                             const struct ovs_action_push_tnl *);
77
78
int netdev_srv6_build_header(const struct netdev *,
79
                             struct ovs_action_push_tnl *,
80
                             const struct netdev_tnl_build_header_params *);
81
82
void
83
netdev_tnl_push_udp_header(const struct netdev *netdev,
84
                           const struct netdev *ingress_netdev,
85
                           struct dp_packet *packet,
86
                           const struct ovs_action_push_tnl *data);
87
int
88
netdev_geneve_build_header(const struct netdev *netdev,
89
                           struct ovs_action_push_tnl *data,
90
                           const struct netdev_tnl_build_header_params *params);
91
92
struct dp_packet *
93
netdev_geneve_pop_header(struct dp_packet *packet);
94
95
int
96
netdev_vxlan_build_header(const struct netdev *netdev,
97
                          struct ovs_action_push_tnl *data,
98
                          const struct netdev_tnl_build_header_params *params);
99
100
struct dp_packet *
101
netdev_vxlan_pop_header(struct dp_packet *packet);
102
103
static inline bool
104
netdev_tnl_is_header_ipv6(const void *header)
105
0
{
106
0
    const struct eth_header *eth;
107
0
    eth = header;
108
0
    return eth->eth_type == htons(ETH_TYPE_IPV6);
109
0
}
Unexecuted instantiation: dpif-offload-dummy.c:netdev_tnl_is_header_ipv6
Unexecuted instantiation: netdev-vport.c:netdev_tnl_is_header_ipv6
Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_is_header_ipv6
110
111
static inline struct ip_header *
112
netdev_tnl_ip_hdr(void *eth)
113
0
{
114
0
    return (void *)((char *)eth + sizeof (struct eth_header));
115
0
}
Unexecuted instantiation: dpif-offload-dummy.c:netdev_tnl_ip_hdr
Unexecuted instantiation: netdev-vport.c:netdev_tnl_ip_hdr
Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_ip_hdr
116
117
static inline struct ovs_16aligned_ip6_hdr *
118
netdev_tnl_ipv6_hdr(void *eth)
119
0
{
120
0
    return (void *)((char *)eth + sizeof (struct eth_header));
121
0
}
Unexecuted instantiation: dpif-offload-dummy.c:netdev_tnl_ipv6_hdr
Unexecuted instantiation: netdev-vport.c:netdev_tnl_ipv6_hdr
Unexecuted instantiation: netdev-native-tnl.c:netdev_tnl_ipv6_hdr
122
123
void *
124
netdev_tnl_ip_build_header(struct ovs_action_push_tnl *data,
125
                           const struct netdev_tnl_build_header_params *params,
126
                           uint8_t next_proto, ovs_be32 ipv6_label);
127
128
extern uint16_t tnl_udp_port_min;
129
extern uint16_t tnl_udp_port_max;
130
131
ovs_be16 netdev_tnl_get_src_port(struct dp_packet *);
132
133
void *
134
netdev_tnl_push_ip_header(struct dp_packet *packet, const void *header,
135
                          int size, int *ip_tot_size, ovs_be32 ipv6_label);
136
void
137
netdev_tnl_egress_port_range(struct unixctl_conn *conn, int argc,
138
                             const char *argv[], void *aux OVS_UNUSED);
139
#endif