]> git.proxmox.com Git - mirror_ovs.git/blob - lib/netdev-offload.h
ovsdb-idl: Fix iteration over tracked rows with no actual data.
[mirror_ovs.git] / lib / netdev-offload.h
1 /*
2 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
3 * Copyright (c) 2019 Samsung Electronics Co.,Ltd.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #ifndef NETDEV_OFFLOAD_H
19 #define NETDEV_OFFLOAD_H 1
20
21 #include "openvswitch/netdev.h"
22 #include "openvswitch/types.h"
23 #include "packets.h"
24 #include "flow.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 struct dp_packet_batch;
31 struct dp_packet;
32 struct netdev_class;
33 struct netdev_rxq;
34 struct netdev_saved_flags;
35 struct ofpbuf;
36 struct in_addr;
37 struct in6_addr;
38 struct smap;
39 struct sset;
40 struct ovs_action_push_tnl;
41
42
43 /* Offload-capable (HW) netdev information */
44 struct netdev_hw_info {
45 bool oor; /* Out of Offload Resources ? */
46 int offload_count; /* Pending (non-offloaded) flow count */
47 int pending_count; /* Offloaded flow count */
48 };
49
50 enum hw_info_type {
51 HW_INFO_TYPE_OOR = 1, /* OOR state */
52 HW_INFO_TYPE_PEND_COUNT = 2, /* Pending(non-offloaded) flow count */
53 HW_INFO_TYPE_OFFL_COUNT = 3 /* Offloaded flow count */
54 };
55
56 struct netdev_flow_dump {
57 struct netdev *netdev;
58 odp_port_t port;
59 bool terse;
60 struct nl_dump *nl_dump;
61 };
62
63 /* Flow offloading. */
64 struct offload_info {
65 ovs_be16 tp_dst_port; /* Destination port for tunnel in SET action */
66 uint8_t tunnel_csum_on; /* Tunnel header with checksum */
67
68 bool recirc_id_shared_with_tc; /* Indicates whever tc chains will be in
69 * sync with datapath recirc ids. */
70
71 /*
72 * The flow mark id assigened to the flow. If any pkts hit the flow,
73 * it will be in the pkt meta data.
74 */
75 uint32_t flow_mark;
76
77 bool tc_modify_flow_deleted; /* Indicate the tc modify flow put success
78 * to delete the original flow. */
79 };
80
81 int netdev_flow_flush(struct netdev *);
82 int netdev_flow_dump_create(struct netdev *, struct netdev_flow_dump **dump,
83 bool terse);
84 int netdev_flow_dump_destroy(struct netdev_flow_dump *);
85 bool netdev_flow_dump_next(struct netdev_flow_dump *, struct match *,
86 struct nlattr **actions, struct dpif_flow_stats *,
87 struct dpif_flow_attrs *, ovs_u128 *ufid,
88 struct ofpbuf *rbuffer, struct ofpbuf *wbuffer);
89 int netdev_flow_put(struct netdev *, struct match *, struct nlattr *actions,
90 size_t actions_len, const ovs_u128 *,
91 struct offload_info *, struct dpif_flow_stats *);
92 int netdev_flow_get(struct netdev *, struct match *, struct nlattr **actions,
93 const ovs_u128 *, struct dpif_flow_stats *,
94 struct dpif_flow_attrs *, struct ofpbuf *wbuffer);
95 int netdev_flow_del(struct netdev *, const ovs_u128 *,
96 struct dpif_flow_stats *);
97 int netdev_init_flow_api(struct netdev *);
98 void netdev_uninit_flow_api(struct netdev *);
99 uint32_t netdev_get_block_id(struct netdev *);
100 int netdev_get_hw_info(struct netdev *, int);
101 void netdev_set_hw_info(struct netdev *, int, int);
102 bool netdev_any_oor(void);
103 bool netdev_is_flow_api_enabled(void);
104 void netdev_set_flow_api_enabled(const struct smap *ovs_other_config);
105 bool netdev_is_offload_rebalance_policy_enabled(void);
106
107 struct dpif_port;
108 int netdev_ports_insert(struct netdev *, const char *dpif_type,
109 struct dpif_port *);
110 struct netdev *netdev_ports_get(odp_port_t port, const char *dpif_type);
111 int netdev_ports_remove(odp_port_t port, const char *dpif_type);
112 odp_port_t netdev_ifindex_to_odp_port(int ifindex);
113
114 struct netdev_flow_dump **netdev_ports_flow_dump_create(
115 const char *dpif_type,
116 int *ports,
117 bool terse);
118 void netdev_ports_flow_flush(const char *dpif_type);
119 int netdev_ports_flow_del(const char *dpif_type, const ovs_u128 *ufid,
120 struct dpif_flow_stats *stats);
121 int netdev_ports_flow_get(const char *dpif_type, struct match *match,
122 struct nlattr **actions,
123 const ovs_u128 *ufid,
124 struct dpif_flow_stats *stats,
125 struct dpif_flow_attrs *attrs,
126 struct ofpbuf *buf);
127
128 #ifdef __cplusplus
129 }
130 #endif
131
132 #endif /* netdev-offload.h */