/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 | | static inline void |
56 | | set_error(struct rte_flow_error *error, enum rte_flow_error_type type) |
57 | | { |
58 | | if (!error) { |
59 | | return; |
60 | | } |
61 | | error->type = type; |
62 | | error->cause = NULL; |
63 | | error->message = NULL; |
64 | | } |
65 | | |
66 | | #ifdef ALLOW_EXPERIMENTAL_API |
67 | | |
68 | | int netdev_dpdk_rte_flow_tunnel_decap_set(struct netdev *, |
69 | | struct rte_flow_tunnel *, |
70 | | struct rte_flow_action **, |
71 | | uint32_t *num_of_actions, |
72 | | struct rte_flow_error *); |
73 | | int netdev_dpdk_rte_flow_tunnel_match(struct netdev *, |
74 | | struct rte_flow_tunnel *, |
75 | | struct rte_flow_item **, |
76 | | uint32_t *num_of_items, |
77 | | struct rte_flow_error *); |
78 | | int netdev_dpdk_rte_flow_get_restore_info(struct netdev *, |
79 | | struct dp_packet *, |
80 | | struct rte_flow_restore_info *, |
81 | | struct rte_flow_error *); |
82 | | int netdev_dpdk_rte_flow_tunnel_action_decap_release(struct netdev *, |
83 | | struct rte_flow_action *, |
84 | | uint32_t num_of_actions, |
85 | | struct rte_flow_error *); |
86 | | int netdev_dpdk_rte_flow_tunnel_item_release(struct netdev *, |
87 | | struct rte_flow_item *, |
88 | | uint32_t num_of_items, |
89 | | struct rte_flow_error *); |
90 | | |
91 | | #else |
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: ofp_print_target.c:free_dpdk_buf Unexecuted instantiation: ofp-print.c:free_dpdk_buf Unexecuted instantiation: dp-packet.c:free_dpdk_buf Unexecuted instantiation: flow.c:free_dpdk_buf Unexecuted instantiation: netdev.c:free_dpdk_buf Unexecuted instantiation: ofp-packet.c:free_dpdk_buf Unexecuted instantiation: ovs-router.c:free_dpdk_buf Unexecuted instantiation: packets.c:free_dpdk_buf Unexecuted instantiation: netdev-linux.c:free_dpdk_buf Unexecuted instantiation: netdev-offload-tc.c:free_dpdk_buf Unexecuted instantiation: dp-packet-gso.c:free_dpdk_buf Unexecuted instantiation: dpif.c:free_dpdk_buf Unexecuted instantiation: netdev-offload.c:free_dpdk_buf Unexecuted instantiation: netdev-vport.c:free_dpdk_buf Unexecuted instantiation: odp-execute.c:free_dpdk_buf Unexecuted instantiation: odp-execute-private.c:free_dpdk_buf Unexecuted instantiation: odp-util.c:free_dpdk_buf Unexecuted instantiation: tnl-neigh-cache.c:free_dpdk_buf Unexecuted instantiation: netdev-native-tnl.c:free_dpdk_buf Unexecuted instantiation: dpif-netlink.c:free_dpdk_buf Unexecuted instantiation: conntrack.c:free_dpdk_buf Unexecuted instantiation: ct-dpif.c:free_dpdk_buf Unexecuted instantiation: dpctl.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-private-dfc.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-private-dpif.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-private-extract.c:free_dpdk_buf Unexecuted instantiation: ipf.c:free_dpdk_buf Unexecuted instantiation: conntrack-icmp.c:free_dpdk_buf Unexecuted instantiation: conntrack-tcp.c:free_dpdk_buf Unexecuted instantiation: conntrack-tp.c:free_dpdk_buf Unexecuted instantiation: conntrack-other.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-extract-study.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-lookup.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-lookup-autovalidator.c:free_dpdk_buf Unexecuted instantiation: dpif-netdev-lookup-generic.c:free_dpdk_buf |
158 | | |
159 | | #endif |
160 | | |
161 | | #endif /* netdev-dpdk.h */ |