Coverage Report

Created: 2023-03-26 07:41

/src/openvswitch/lib/netdev-dpdk.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2014, 2015, 2016 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_DPDK_H
18
#define NETDEV_DPDK_H
19
20
#include <config.h>
21
22
#include "openvswitch/compiler.h"
23
#include "smap.h"
24
25
struct dp_packet;
26
struct netdev;
27
28
#ifdef DPDK_NETDEV
29
30
#include <rte_flow.h>
31
32
void netdev_dpdk_register(const struct smap *);
33
void free_dpdk_buf(struct dp_packet *);
34
35
bool netdev_dpdk_flow_api_supported(struct netdev *);
36
37
int
38
netdev_dpdk_rte_flow_destroy(struct netdev *netdev,
39
                             struct rte_flow *rte_flow,
40
                             struct rte_flow_error *error);
41
struct rte_flow *
42
netdev_dpdk_rte_flow_create(struct netdev *netdev,
43
                            const struct rte_flow_attr *attr,
44
                            const struct rte_flow_item *items,
45
                            const struct rte_flow_action *actions,
46
                            struct rte_flow_error *error);
47
int
48
netdev_dpdk_rte_flow_query_count(struct netdev *netdev,
49
                                 struct rte_flow *rte_flow,
50
                                 struct rte_flow_query_count *query,
51
                                 struct rte_flow_error *error);
52
int
53
netdev_dpdk_get_port_id(struct netdev *netdev);
54
55
#ifdef ALLOW_EXPERIMENTAL_API
56
57
int netdev_dpdk_rte_flow_tunnel_decap_set(struct netdev *,
58
                                          struct rte_flow_tunnel *,
59
                                          struct rte_flow_action **,
60
                                          uint32_t *num_of_actions,
61
                                          struct rte_flow_error *);
62
int netdev_dpdk_rte_flow_tunnel_match(struct netdev *,
63
                                      struct rte_flow_tunnel *,
64
                                      struct rte_flow_item **,
65
                                      uint32_t *num_of_items,
66
                                      struct rte_flow_error *);
67
int netdev_dpdk_rte_flow_get_restore_info(struct netdev *,
68
                                          struct dp_packet *,
69
                                          struct rte_flow_restore_info *,
70
                                          struct rte_flow_error *);
71
int netdev_dpdk_rte_flow_tunnel_action_decap_release(struct netdev *,
72
                                                     struct rte_flow_action *,
73
                                                     uint32_t num_of_actions,
74
                                                     struct rte_flow_error *);
75
int netdev_dpdk_rte_flow_tunnel_item_release(struct netdev *,
76
                                             struct rte_flow_item *,
77
                                             uint32_t num_of_items,
78
                                             struct rte_flow_error *);
79
80
#else
81
82
static inline void
83
set_error(struct rte_flow_error *error, enum rte_flow_error_type type)
84
{
85
    if (!error) {
86
        return;
87
    }
88
    error->type = type;
89
    error->cause = NULL;
90
    error->message = NULL;
91
}
92
93
static inline int
94
netdev_dpdk_rte_flow_tunnel_decap_set(
95
    struct netdev *netdev OVS_UNUSED,
96
    struct rte_flow_tunnel *tunnel OVS_UNUSED,
97
    struct rte_flow_action **actions OVS_UNUSED,
98
    uint32_t *num_of_actions OVS_UNUSED,
99
    struct rte_flow_error *error)
100
{
101
    set_error(error, RTE_FLOW_ERROR_TYPE_ACTION);
102
    return -1;
103
}
104
105
static inline int
106
netdev_dpdk_rte_flow_tunnel_match(struct netdev *netdev OVS_UNUSED,
107
                                  struct rte_flow_tunnel *tunnel OVS_UNUSED,
108
                                  struct rte_flow_item **items OVS_UNUSED,
109
                                  uint32_t *num_of_items OVS_UNUSED,
110
                                  struct rte_flow_error *error)
111
{
112
    set_error(error, RTE_FLOW_ERROR_TYPE_ITEM);
113
    return -1;
114
}
115
116
static inline int
117
netdev_dpdk_rte_flow_get_restore_info(
118
    struct netdev *netdev OVS_UNUSED,
119
    struct dp_packet *p OVS_UNUSED,
120
    struct rte_flow_restore_info *info OVS_UNUSED,
121
    struct rte_flow_error *error)
122
{
123
    set_error(error, RTE_FLOW_ERROR_TYPE_ATTR);
124
    return -1;
125
}
126
127
static inline int
128
netdev_dpdk_rte_flow_tunnel_action_decap_release(
129
    struct netdev *netdev OVS_UNUSED,
130
    struct rte_flow_action *actions OVS_UNUSED,
131
    uint32_t num_of_actions OVS_UNUSED,
132
    struct rte_flow_error *error)
133
{
134
    set_error(error, RTE_FLOW_ERROR_TYPE_NONE);
135
    return 0;
136
}
137
138
static inline int
139
netdev_dpdk_rte_flow_tunnel_item_release(
140
    struct netdev *netdev OVS_UNUSED,
141
    struct rte_flow_item *items OVS_UNUSED,
142
    uint32_t num_of_items OVS_UNUSED,
143
    struct rte_flow_error *error)
144
{
145
    set_error(error, RTE_FLOW_ERROR_TYPE_NONE);
146
    return 0;
147
}
148
149
#endif /* ALLOW_EXPERIMENTAL_API */
150
151
#else
152
153
static inline void
154
free_dpdk_buf(struct dp_packet *buf OVS_UNUSED)
155
0
{
156
    /* Nothing */
157
0
}
Unexecuted instantiation: packets.c:free_dpdk_buf
Unexecuted instantiation: dp-packet.c:free_dpdk_buf
158
159
#endif
160
161
#endif /* netdev-dpdk.h */