]> git.proxmox.com Git - mirror_ovs.git/blame - lib/netdev-offload.h
netdev-offload: Implement terse dump support
[mirror_ovs.git] / lib / netdev-offload.h
CommitLineData
b6cabb8f
IM
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
27extern "C" {
28#endif
29
30struct dp_packet_batch;
31struct dp_packet;
32struct netdev_class;
33struct netdev_rxq;
34struct netdev_saved_flags;
35struct ofpbuf;
36struct in_addr;
37struct in6_addr;
38struct smap;
39struct sset;
40struct ovs_action_push_tnl;
41
42
43/* Offload-capable (HW) netdev information */
44struct 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
50enum 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
56struct 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. */
64struct offload_info {
65 const struct dpif_class *dpif_class;
66 ovs_be16 tp_dst_port; /* Destination port for tunnel in SET action */
67 uint8_t tunnel_csum_on; /* Tunnel header with checksum */
68
b2ae4069
PB
69 bool recirc_id_shared_with_tc; /* Indicates whever tc chains will be in
70 * sync with datapath recirc ids. */
71
b6cabb8f
IM
72 /*
73 * The flow mark id assigened to the flow. If any pkts hit the flow,
74 * it will be in the pkt meta data.
75 */
76 uint32_t flow_mark;
65b84d4a 77
78 bool tc_modify_flow_deleted; /* Indicate the tc modify flow put success
79 * to delete the original flow. */
b6cabb8f
IM
80};
81
82int netdev_flow_flush(struct netdev *);
19153657
VB
83int netdev_flow_dump_create(struct netdev *, struct netdev_flow_dump **dump,
84 bool terse);
b6cabb8f
IM
85int netdev_flow_dump_destroy(struct netdev_flow_dump *);
86bool netdev_flow_dump_next(struct netdev_flow_dump *, struct match *,
87 struct nlattr **actions, struct dpif_flow_stats *,
88 struct dpif_flow_attrs *, ovs_u128 *ufid,
89 struct ofpbuf *rbuffer, struct ofpbuf *wbuffer);
90int netdev_flow_put(struct netdev *, struct match *, struct nlattr *actions,
91 size_t actions_len, const ovs_u128 *,
92 struct offload_info *, struct dpif_flow_stats *);
93int netdev_flow_get(struct netdev *, struct match *, struct nlattr **actions,
94 const ovs_u128 *, struct dpif_flow_stats *,
95 struct dpif_flow_attrs *, struct ofpbuf *wbuffer);
96int netdev_flow_del(struct netdev *, const ovs_u128 *,
97 struct dpif_flow_stats *);
98int netdev_init_flow_api(struct netdev *);
99void netdev_uninit_flow_api(struct netdev *);
100uint32_t netdev_get_block_id(struct netdev *);
101int netdev_get_hw_info(struct netdev *, int);
102void netdev_set_hw_info(struct netdev *, int, int);
103bool netdev_any_oor(void);
104bool netdev_is_flow_api_enabled(void);
105void netdev_set_flow_api_enabled(const struct smap *ovs_other_config);
106bool netdev_is_offload_rebalance_policy_enabled(void);
107
108struct dpif_class;
109struct dpif_port;
110int netdev_ports_insert(struct netdev *, const struct dpif_class *,
111 struct dpif_port *);
112struct netdev *netdev_ports_get(odp_port_t port, const struct dpif_class *);
113int netdev_ports_remove(odp_port_t port, const struct dpif_class *);
114odp_port_t netdev_ifindex_to_odp_port(int ifindex);
115
116struct netdev_flow_dump **netdev_ports_flow_dump_create(
117 const struct dpif_class *,
19153657
VB
118 int *ports,
119 bool terse);
b6cabb8f
IM
120void netdev_ports_flow_flush(const struct dpif_class *);
121int netdev_ports_flow_del(const struct dpif_class *, const ovs_u128 *ufid,
122 struct dpif_flow_stats *stats);
123int netdev_ports_flow_get(const struct dpif_class *, struct match *match,
124 struct nlattr **actions,
125 const ovs_u128 *ufid,
126 struct dpif_flow_stats *stats,
127 struct dpif_flow_attrs *attrs,
128 struct ofpbuf *buf);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* netdev-offload.h */