]>
Commit | Line | Data |
---|---|---|
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 | |
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 | 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 | ||
82 | int netdev_flow_flush(struct netdev *); | |
19153657 VB |
83 | int netdev_flow_dump_create(struct netdev *, struct netdev_flow_dump **dump, |
84 | bool terse); | |
b6cabb8f IM |
85 | int netdev_flow_dump_destroy(struct netdev_flow_dump *); |
86 | bool 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); | |
90 | int 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 *); | |
93 | int 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); | |
96 | int netdev_flow_del(struct netdev *, const ovs_u128 *, | |
97 | struct dpif_flow_stats *); | |
98 | int netdev_init_flow_api(struct netdev *); | |
99 | void netdev_uninit_flow_api(struct netdev *); | |
100 | uint32_t netdev_get_block_id(struct netdev *); | |
101 | int netdev_get_hw_info(struct netdev *, int); | |
102 | void netdev_set_hw_info(struct netdev *, int, int); | |
103 | bool netdev_any_oor(void); | |
104 | bool netdev_is_flow_api_enabled(void); | |
105 | void netdev_set_flow_api_enabled(const struct smap *ovs_other_config); | |
106 | bool netdev_is_offload_rebalance_policy_enabled(void); | |
107 | ||
108 | struct dpif_class; | |
109 | struct dpif_port; | |
110 | int netdev_ports_insert(struct netdev *, const struct dpif_class *, | |
111 | struct dpif_port *); | |
112 | struct netdev *netdev_ports_get(odp_port_t port, const struct dpif_class *); | |
113 | int netdev_ports_remove(odp_port_t port, const struct dpif_class *); | |
114 | odp_port_t netdev_ifindex_to_odp_port(int ifindex); | |
115 | ||
116 | struct netdev_flow_dump **netdev_ports_flow_dump_create( | |
117 | const struct dpif_class *, | |
19153657 VB |
118 | int *ports, |
119 | bool terse); | |
b6cabb8f IM |
120 | void netdev_ports_flow_flush(const struct dpif_class *); |
121 | int netdev_ports_flow_del(const struct dpif_class *, const ovs_u128 *ufid, | |
122 | struct dpif_flow_stats *stats); | |
123 | int 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 */ |