]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/netdev-offload.h
2 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
3 * Copyright (c) 2019 Samsung Electronics Co.,Ltd.
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef NETDEV_OFFLOAD_H
19 #define NETDEV_OFFLOAD_H 1
21 #include "openvswitch/netdev.h"
22 #include "openvswitch/types.h"
30 struct dp_packet_batch
;
34 struct netdev_saved_flags
;
40 struct ovs_action_push_tnl
;
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 */
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 */
56 struct netdev_flow_dump
{
57 struct netdev
*netdev
;
60 struct nl_dump
*nl_dump
;
63 /* Flow offloading. */
65 ovs_be16 tp_dst_port
; /* Destination port for tunnel in SET action */
66 uint8_t tunnel_csum_on
; /* Tunnel header with checksum */
68 bool recirc_id_shared_with_tc
; /* Indicates whever tc chains will be in
69 * sync with datapath recirc ids. */
72 * The flow mark id assigened to the flow. If any pkts hit the flow,
73 * it will be in the pkt meta data.
77 bool tc_modify_flow_deleted
; /* Indicate the tc modify flow put success
78 * to delete the original flow. */
81 int netdev_flow_flush(struct netdev
*);
82 int netdev_flow_dump_create(struct netdev
*, struct netdev_flow_dump
**dump
,
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);
108 int netdev_ports_insert(struct netdev
*, const char *dpif_type
,
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
);
114 struct netdev_flow_dump
**netdev_ports_flow_dump_create(
115 const char *dpif_type
,
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
,
132 #endif /* netdev-offload.h */