Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 1 | #ifndef _NET_FLOW_OFFLOAD_H |
| 2 | #define _NET_FLOW_OFFLOAD_H |
| 3 | |
Edward Cree | fa85999 | 2019-05-31 22:47:21 +0100 | [diff] [blame] | 4 | #include <linux/kernel.h> |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 5 | #include <linux/list.h> |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 6 | #include <net/flow_dissector.h> |
wenxu | 4e48190 | 2019-08-07 09:13:52 +0800 | [diff] [blame^] | 7 | #include <linux/rhashtable.h> |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 8 | |
| 9 | struct flow_match { |
| 10 | struct flow_dissector *dissector; |
| 11 | void *mask; |
| 12 | void *key; |
| 13 | }; |
| 14 | |
Jiri Pirko | 9558a83 | 2019-06-19 09:41:04 +0300 | [diff] [blame] | 15 | struct flow_match_meta { |
| 16 | struct flow_dissector_key_meta *key, *mask; |
| 17 | }; |
| 18 | |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 19 | struct flow_match_basic { |
| 20 | struct flow_dissector_key_basic *key, *mask; |
| 21 | }; |
| 22 | |
| 23 | struct flow_match_control { |
| 24 | struct flow_dissector_key_control *key, *mask; |
| 25 | }; |
| 26 | |
| 27 | struct flow_match_eth_addrs { |
| 28 | struct flow_dissector_key_eth_addrs *key, *mask; |
| 29 | }; |
| 30 | |
| 31 | struct flow_match_vlan { |
| 32 | struct flow_dissector_key_vlan *key, *mask; |
| 33 | }; |
| 34 | |
| 35 | struct flow_match_ipv4_addrs { |
| 36 | struct flow_dissector_key_ipv4_addrs *key, *mask; |
| 37 | }; |
| 38 | |
| 39 | struct flow_match_ipv6_addrs { |
| 40 | struct flow_dissector_key_ipv6_addrs *key, *mask; |
| 41 | }; |
| 42 | |
| 43 | struct flow_match_ip { |
| 44 | struct flow_dissector_key_ip *key, *mask; |
| 45 | }; |
| 46 | |
| 47 | struct flow_match_ports { |
| 48 | struct flow_dissector_key_ports *key, *mask; |
| 49 | }; |
| 50 | |
| 51 | struct flow_match_icmp { |
| 52 | struct flow_dissector_key_icmp *key, *mask; |
| 53 | }; |
| 54 | |
| 55 | struct flow_match_tcp { |
| 56 | struct flow_dissector_key_tcp *key, *mask; |
| 57 | }; |
| 58 | |
| 59 | struct flow_match_mpls { |
| 60 | struct flow_dissector_key_mpls *key, *mask; |
| 61 | }; |
| 62 | |
| 63 | struct flow_match_enc_keyid { |
| 64 | struct flow_dissector_key_keyid *key, *mask; |
| 65 | }; |
| 66 | |
| 67 | struct flow_match_enc_opts { |
| 68 | struct flow_dissector_key_enc_opts *key, *mask; |
| 69 | }; |
| 70 | |
| 71 | struct flow_rule; |
| 72 | |
Jiri Pirko | 9558a83 | 2019-06-19 09:41:04 +0300 | [diff] [blame] | 73 | void flow_rule_match_meta(const struct flow_rule *rule, |
| 74 | struct flow_match_meta *out); |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 75 | void flow_rule_match_basic(const struct flow_rule *rule, |
| 76 | struct flow_match_basic *out); |
| 77 | void flow_rule_match_control(const struct flow_rule *rule, |
| 78 | struct flow_match_control *out); |
| 79 | void flow_rule_match_eth_addrs(const struct flow_rule *rule, |
| 80 | struct flow_match_eth_addrs *out); |
| 81 | void flow_rule_match_vlan(const struct flow_rule *rule, |
| 82 | struct flow_match_vlan *out); |
Edward Cree | bae9ed6 | 2019-05-14 21:18:12 +0100 | [diff] [blame] | 83 | void flow_rule_match_cvlan(const struct flow_rule *rule, |
| 84 | struct flow_match_vlan *out); |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 85 | void flow_rule_match_ipv4_addrs(const struct flow_rule *rule, |
| 86 | struct flow_match_ipv4_addrs *out); |
| 87 | void flow_rule_match_ipv6_addrs(const struct flow_rule *rule, |
| 88 | struct flow_match_ipv6_addrs *out); |
| 89 | void flow_rule_match_ip(const struct flow_rule *rule, |
| 90 | struct flow_match_ip *out); |
| 91 | void flow_rule_match_ports(const struct flow_rule *rule, |
| 92 | struct flow_match_ports *out); |
| 93 | void flow_rule_match_tcp(const struct flow_rule *rule, |
| 94 | struct flow_match_tcp *out); |
| 95 | void flow_rule_match_icmp(const struct flow_rule *rule, |
| 96 | struct flow_match_icmp *out); |
| 97 | void flow_rule_match_mpls(const struct flow_rule *rule, |
| 98 | struct flow_match_mpls *out); |
| 99 | void flow_rule_match_enc_control(const struct flow_rule *rule, |
| 100 | struct flow_match_control *out); |
| 101 | void flow_rule_match_enc_ipv4_addrs(const struct flow_rule *rule, |
| 102 | struct flow_match_ipv4_addrs *out); |
| 103 | void flow_rule_match_enc_ipv6_addrs(const struct flow_rule *rule, |
| 104 | struct flow_match_ipv6_addrs *out); |
| 105 | void flow_rule_match_enc_ip(const struct flow_rule *rule, |
| 106 | struct flow_match_ip *out); |
| 107 | void flow_rule_match_enc_ports(const struct flow_rule *rule, |
| 108 | struct flow_match_ports *out); |
| 109 | void flow_rule_match_enc_keyid(const struct flow_rule *rule, |
| 110 | struct flow_match_enc_keyid *out); |
| 111 | void flow_rule_match_enc_opts(const struct flow_rule *rule, |
| 112 | struct flow_match_enc_opts *out); |
| 113 | |
Pablo Neira Ayuso | e3ab786 | 2019-02-02 12:50:45 +0100 | [diff] [blame] | 114 | enum flow_action_id { |
| 115 | FLOW_ACTION_ACCEPT = 0, |
| 116 | FLOW_ACTION_DROP, |
| 117 | FLOW_ACTION_TRAP, |
| 118 | FLOW_ACTION_GOTO, |
| 119 | FLOW_ACTION_REDIRECT, |
| 120 | FLOW_ACTION_MIRRED, |
John Hurley | 48e584a | 2019-08-04 16:09:06 +0100 | [diff] [blame] | 121 | FLOW_ACTION_REDIRECT_INGRESS, |
| 122 | FLOW_ACTION_MIRRED_INGRESS, |
Pablo Neira Ayuso | e3ab786 | 2019-02-02 12:50:45 +0100 | [diff] [blame] | 123 | FLOW_ACTION_VLAN_PUSH, |
| 124 | FLOW_ACTION_VLAN_POP, |
| 125 | FLOW_ACTION_VLAN_MANGLE, |
| 126 | FLOW_ACTION_TUNNEL_ENCAP, |
| 127 | FLOW_ACTION_TUNNEL_DECAP, |
| 128 | FLOW_ACTION_MANGLE, |
| 129 | FLOW_ACTION_ADD, |
| 130 | FLOW_ACTION_CSUM, |
| 131 | FLOW_ACTION_MARK, |
John Hurley | fb1b775 | 2019-08-04 16:09:04 +0100 | [diff] [blame] | 132 | FLOW_ACTION_PTYPE, |
Pablo Neira Ayuso | 8bec283 | 2019-02-02 12:50:50 +0100 | [diff] [blame] | 133 | FLOW_ACTION_WAKE, |
| 134 | FLOW_ACTION_QUEUE, |
Pieter Jansen van Vuuren | a7a7be6 | 2019-05-04 04:46:16 -0700 | [diff] [blame] | 135 | FLOW_ACTION_SAMPLE, |
Pieter Jansen van Vuuren | 8c8cfc6 | 2019-05-04 04:46:22 -0700 | [diff] [blame] | 136 | FLOW_ACTION_POLICE, |
Paul Blakey | b57dc7c | 2019-07-09 10:30:48 +0300 | [diff] [blame] | 137 | FLOW_ACTION_CT, |
John Hurley | 6749d590 | 2019-07-23 15:33:59 +0100 | [diff] [blame] | 138 | FLOW_ACTION_MPLS_PUSH, |
| 139 | FLOW_ACTION_MPLS_POP, |
| 140 | FLOW_ACTION_MPLS_MANGLE, |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 141 | }; |
| 142 | |
Pablo Neira Ayuso | e3ab786 | 2019-02-02 12:50:45 +0100 | [diff] [blame] | 143 | /* This is mirroring enum pedit_header_type definition for easy mapping between |
| 144 | * tc pedit action. Legacy TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK is mapped to |
| 145 | * FLOW_ACT_MANGLE_UNSPEC, which is supported by no driver. |
| 146 | */ |
| 147 | enum flow_action_mangle_base { |
| 148 | FLOW_ACT_MANGLE_UNSPEC = 0, |
| 149 | FLOW_ACT_MANGLE_HDR_TYPE_ETH, |
| 150 | FLOW_ACT_MANGLE_HDR_TYPE_IP4, |
| 151 | FLOW_ACT_MANGLE_HDR_TYPE_IP6, |
| 152 | FLOW_ACT_MANGLE_HDR_TYPE_TCP, |
| 153 | FLOW_ACT_MANGLE_HDR_TYPE_UDP, |
| 154 | }; |
| 155 | |
| 156 | struct flow_action_entry { |
| 157 | enum flow_action_id id; |
| 158 | union { |
| 159 | u32 chain_index; /* FLOW_ACTION_GOTO */ |
| 160 | struct net_device *dev; /* FLOW_ACTION_REDIRECT */ |
| 161 | struct { /* FLOW_ACTION_VLAN */ |
| 162 | u16 vid; |
| 163 | __be16 proto; |
| 164 | u8 prio; |
| 165 | } vlan; |
| 166 | struct { /* FLOW_ACTION_PACKET_EDIT */ |
| 167 | enum flow_action_mangle_base htype; |
| 168 | u32 offset; |
| 169 | u32 mask; |
| 170 | u32 val; |
| 171 | } mangle; |
| 172 | const struct ip_tunnel_info *tunnel; /* FLOW_ACTION_TUNNEL_ENCAP */ |
| 173 | u32 csum_flags; /* FLOW_ACTION_CSUM */ |
| 174 | u32 mark; /* FLOW_ACTION_MARK */ |
John Hurley | fb1b775 | 2019-08-04 16:09:04 +0100 | [diff] [blame] | 175 | u16 ptype; /* FLOW_ACTION_PTYPE */ |
Pablo Neira Ayuso | 8bec283 | 2019-02-02 12:50:50 +0100 | [diff] [blame] | 176 | struct { /* FLOW_ACTION_QUEUE */ |
| 177 | u32 ctx; |
| 178 | u32 index; |
| 179 | u8 vf; |
| 180 | } queue; |
Pieter Jansen van Vuuren | a7a7be6 | 2019-05-04 04:46:16 -0700 | [diff] [blame] | 181 | struct { /* FLOW_ACTION_SAMPLE */ |
| 182 | struct psample_group *psample_group; |
| 183 | u32 rate; |
| 184 | u32 trunc_size; |
| 185 | bool truncate; |
| 186 | } sample; |
Pieter Jansen van Vuuren | 8c8cfc6 | 2019-05-04 04:46:22 -0700 | [diff] [blame] | 187 | struct { /* FLOW_ACTION_POLICE */ |
| 188 | s64 burst; |
| 189 | u64 rate_bytes_ps; |
| 190 | } police; |
Paul Blakey | b57dc7c | 2019-07-09 10:30:48 +0300 | [diff] [blame] | 191 | struct { /* FLOW_ACTION_CT */ |
| 192 | int action; |
| 193 | u16 zone; |
| 194 | } ct; |
John Hurley | 6749d590 | 2019-07-23 15:33:59 +0100 | [diff] [blame] | 195 | struct { /* FLOW_ACTION_MPLS_PUSH */ |
| 196 | u32 label; |
| 197 | __be16 proto; |
| 198 | u8 tc; |
| 199 | u8 bos; |
| 200 | u8 ttl; |
| 201 | } mpls_push; |
| 202 | struct { /* FLOW_ACTION_MPLS_POP */ |
| 203 | __be16 proto; |
| 204 | } mpls_pop; |
| 205 | struct { /* FLOW_ACTION_MPLS_MANGLE */ |
| 206 | u32 label; |
| 207 | u8 tc; |
| 208 | u8 bos; |
| 209 | u8 ttl; |
| 210 | } mpls_mangle; |
Pablo Neira Ayuso | e3ab786 | 2019-02-02 12:50:45 +0100 | [diff] [blame] | 211 | }; |
| 212 | }; |
| 213 | |
| 214 | struct flow_action { |
| 215 | unsigned int num_entries; |
| 216 | struct flow_action_entry entries[0]; |
| 217 | }; |
| 218 | |
| 219 | static inline bool flow_action_has_entries(const struct flow_action *action) |
| 220 | { |
| 221 | return action->num_entries; |
| 222 | } |
| 223 | |
Pieter Jansen van Vuuren | ab79af3 | 2019-05-04 04:46:18 -0700 | [diff] [blame] | 224 | /** |
| 225 | * flow_action_has_one_action() - check if exactly one action is present |
| 226 | * @action: tc filter flow offload action |
| 227 | * |
| 228 | * Returns true if exactly one action is present. |
| 229 | */ |
| 230 | static inline bool flow_offload_has_one_action(const struct flow_action *action) |
| 231 | { |
| 232 | return action->num_entries == 1; |
| 233 | } |
| 234 | |
Pablo Neira Ayuso | e3ab786 | 2019-02-02 12:50:45 +0100 | [diff] [blame] | 235 | #define flow_action_for_each(__i, __act, __actions) \ |
Eli Britstein | 6663cf8 | 2019-02-11 09:52:59 +0200 | [diff] [blame] | 236 | for (__i = 0, __act = &(__actions)->entries[0]; __i < (__actions)->num_entries; __act = &(__actions)->entries[++__i]) |
Pablo Neira Ayuso | e3ab786 | 2019-02-02 12:50:45 +0100 | [diff] [blame] | 237 | |
| 238 | struct flow_rule { |
| 239 | struct flow_match match; |
| 240 | struct flow_action action; |
| 241 | }; |
| 242 | |
| 243 | struct flow_rule *flow_rule_alloc(unsigned int num_actions); |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 244 | |
| 245 | static inline bool flow_rule_match_key(const struct flow_rule *rule, |
| 246 | enum flow_dissector_key_id key) |
| 247 | { |
| 248 | return dissector_uses_key(rule->match.dissector, key); |
| 249 | } |
| 250 | |
Pablo Neira Ayuso | 3b1903e | 2019-02-02 12:50:47 +0100 | [diff] [blame] | 251 | struct flow_stats { |
| 252 | u64 pkts; |
| 253 | u64 bytes; |
| 254 | u64 lastused; |
| 255 | }; |
| 256 | |
| 257 | static inline void flow_stats_update(struct flow_stats *flow_stats, |
| 258 | u64 bytes, u64 pkts, u64 lastused) |
| 259 | { |
John Hurley | 9f9dc49 | 2019-02-13 00:23:52 +0000 | [diff] [blame] | 260 | flow_stats->pkts += pkts; |
| 261 | flow_stats->bytes += bytes; |
| 262 | flow_stats->lastused = max_t(u64, flow_stats->lastused, lastused); |
Pablo Neira Ayuso | 3b1903e | 2019-02-02 12:50:47 +0100 | [diff] [blame] | 263 | } |
| 264 | |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 265 | enum flow_block_command { |
Pablo Neira Ayuso | 9c0e189 | 2019-07-09 22:55:40 +0200 | [diff] [blame] | 266 | FLOW_BLOCK_BIND, |
| 267 | FLOW_BLOCK_UNBIND, |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 268 | }; |
| 269 | |
| 270 | enum flow_block_binder_type { |
Pablo Neira Ayuso | 32f8c40 | 2019-07-09 22:55:41 +0200 | [diff] [blame] | 271 | FLOW_BLOCK_BINDER_TYPE_UNSPEC, |
| 272 | FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS, |
| 273 | FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS, |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 274 | }; |
| 275 | |
Pablo Neira Ayuso | 14bfb13 | 2019-07-19 18:20:16 +0200 | [diff] [blame] | 276 | struct flow_block { |
| 277 | struct list_head cb_list; |
| 278 | }; |
| 279 | |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 280 | struct netlink_ext_ack; |
| 281 | |
| 282 | struct flow_block_offload { |
| 283 | enum flow_block_command command; |
| 284 | enum flow_block_binder_type binder_type; |
Pablo Neira Ayuso | 955bcb6 | 2019-07-09 22:55:46 +0200 | [diff] [blame] | 285 | bool block_shared; |
Pablo Neira Ayuso | da3eeb9 | 2019-07-09 22:55:43 +0200 | [diff] [blame] | 286 | struct net *net; |
Pablo Neira Ayuso | 14bfb13 | 2019-07-19 18:20:16 +0200 | [diff] [blame] | 287 | struct flow_block *block; |
Pablo Neira Ayuso | da3eeb9 | 2019-07-09 22:55:43 +0200 | [diff] [blame] | 288 | struct list_head cb_list; |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 289 | struct list_head *driver_block_list; |
| 290 | struct netlink_ext_ack *extack; |
| 291 | }; |
| 292 | |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 293 | enum tc_setup_type; |
| 294 | typedef int flow_setup_cb_t(enum tc_setup_type type, void *type_data, |
| 295 | void *cb_priv); |
| 296 | |
Pablo Neira Ayuso | d63db30 | 2019-07-09 22:55:42 +0200 | [diff] [blame] | 297 | struct flow_block_cb { |
Pablo Neira Ayuso | da3eeb9 | 2019-07-09 22:55:43 +0200 | [diff] [blame] | 298 | struct list_head driver_list; |
Pablo Neira Ayuso | d63db30 | 2019-07-09 22:55:42 +0200 | [diff] [blame] | 299 | struct list_head list; |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 300 | flow_setup_cb_t *cb; |
Pablo Neira Ayuso | d63db30 | 2019-07-09 22:55:42 +0200 | [diff] [blame] | 301 | void *cb_ident; |
| 302 | void *cb_priv; |
| 303 | void (*release)(void *cb_priv); |
| 304 | unsigned int refcnt; |
| 305 | }; |
| 306 | |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 307 | struct flow_block_cb *flow_block_cb_alloc(flow_setup_cb_t *cb, |
Pablo Neira Ayuso | d63db30 | 2019-07-09 22:55:42 +0200 | [diff] [blame] | 308 | void *cb_ident, void *cb_priv, |
| 309 | void (*release)(void *cb_priv)); |
| 310 | void flow_block_cb_free(struct flow_block_cb *block_cb); |
| 311 | |
Pablo Neira Ayuso | 14bfb13 | 2019-07-19 18:20:16 +0200 | [diff] [blame] | 312 | struct flow_block_cb *flow_block_cb_lookup(struct flow_block *block, |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 313 | flow_setup_cb_t *cb, void *cb_ident); |
Pablo Neira Ayuso | da3eeb9 | 2019-07-09 22:55:43 +0200 | [diff] [blame] | 314 | |
Pablo Neira Ayuso | 67bd0d5 | 2019-07-09 22:55:44 +0200 | [diff] [blame] | 315 | void *flow_block_cb_priv(struct flow_block_cb *block_cb); |
| 316 | void flow_block_cb_incref(struct flow_block_cb *block_cb); |
| 317 | unsigned int flow_block_cb_decref(struct flow_block_cb *block_cb); |
| 318 | |
Pablo Neira Ayuso | da3eeb9 | 2019-07-09 22:55:43 +0200 | [diff] [blame] | 319 | static inline void flow_block_cb_add(struct flow_block_cb *block_cb, |
| 320 | struct flow_block_offload *offload) |
| 321 | { |
| 322 | list_add_tail(&block_cb->list, &offload->cb_list); |
| 323 | } |
| 324 | |
| 325 | static inline void flow_block_cb_remove(struct flow_block_cb *block_cb, |
| 326 | struct flow_block_offload *offload) |
| 327 | { |
| 328 | list_move(&block_cb->list, &offload->cb_list); |
| 329 | } |
| 330 | |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 331 | bool flow_block_cb_is_busy(flow_setup_cb_t *cb, void *cb_ident, |
Pablo Neira Ayuso | 0d4fd02 | 2019-07-09 22:55:48 +0200 | [diff] [blame] | 332 | struct list_head *driver_block_list); |
| 333 | |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 334 | int flow_block_cb_setup_simple(struct flow_block_offload *f, |
Pablo Neira Ayuso | a732331 | 2019-07-19 18:20:15 +0200 | [diff] [blame] | 335 | struct list_head *driver_list, |
| 336 | flow_setup_cb_t *cb, |
Pablo Neira Ayuso | 4e95bc2 | 2019-07-09 22:55:39 +0200 | [diff] [blame] | 337 | void *cb_ident, void *cb_priv, bool ingress_only); |
| 338 | |
Pablo Neira Ayuso | f9e3008 | 2019-07-09 22:55:49 +0200 | [diff] [blame] | 339 | enum flow_cls_command { |
| 340 | FLOW_CLS_REPLACE, |
| 341 | FLOW_CLS_DESTROY, |
| 342 | FLOW_CLS_STATS, |
| 343 | FLOW_CLS_TMPLT_CREATE, |
| 344 | FLOW_CLS_TMPLT_DESTROY, |
| 345 | }; |
| 346 | |
| 347 | struct flow_cls_common_offload { |
| 348 | u32 chain_index; |
| 349 | __be16 protocol; |
| 350 | u32 prio; |
| 351 | struct netlink_ext_ack *extack; |
| 352 | }; |
| 353 | |
| 354 | struct flow_cls_offload { |
| 355 | struct flow_cls_common_offload common; |
| 356 | enum flow_cls_command command; |
| 357 | unsigned long cookie; |
| 358 | struct flow_rule *rule; |
| 359 | struct flow_stats stats; |
| 360 | u32 classid; |
| 361 | }; |
| 362 | |
| 363 | static inline struct flow_rule * |
| 364 | flow_cls_offload_flow_rule(struct flow_cls_offload *flow_cmd) |
| 365 | { |
| 366 | return flow_cmd->rule; |
| 367 | } |
| 368 | |
Pablo Neira Ayuso | 14bfb13 | 2019-07-19 18:20:16 +0200 | [diff] [blame] | 369 | static inline void flow_block_init(struct flow_block *flow_block) |
| 370 | { |
| 371 | INIT_LIST_HEAD(&flow_block->cb_list); |
| 372 | } |
| 373 | |
wenxu | 4e48190 | 2019-08-07 09:13:52 +0800 | [diff] [blame^] | 374 | typedef int flow_indr_block_bind_cb_t(struct net_device *dev, void *cb_priv, |
| 375 | enum tc_setup_type type, void *type_data); |
| 376 | |
| 377 | typedef void flow_indr_block_ing_cmd_t(struct net_device *dev, |
| 378 | flow_indr_block_bind_cb_t *cb, |
| 379 | void *cb_priv, |
| 380 | enum flow_block_command command); |
| 381 | |
| 382 | int __flow_indr_block_cb_register(struct net_device *dev, void *cb_priv, |
| 383 | flow_indr_block_bind_cb_t *cb, |
| 384 | void *cb_ident); |
| 385 | |
| 386 | void __flow_indr_block_cb_unregister(struct net_device *dev, |
| 387 | flow_indr_block_bind_cb_t *cb, |
| 388 | void *cb_ident); |
| 389 | |
| 390 | int flow_indr_block_cb_register(struct net_device *dev, void *cb_priv, |
| 391 | flow_indr_block_bind_cb_t *cb, void *cb_ident); |
| 392 | |
| 393 | void flow_indr_block_cb_unregister(struct net_device *dev, |
| 394 | flow_indr_block_bind_cb_t *cb, |
| 395 | void *cb_ident); |
| 396 | |
| 397 | void flow_indr_block_call(struct net_device *dev, |
| 398 | flow_indr_block_ing_cmd_t *cb, |
| 399 | struct flow_block_offload *bo, |
| 400 | enum flow_block_command command); |
| 401 | |
Pablo Neira Ayuso | 8f25662 | 2019-02-02 12:50:43 +0100 | [diff] [blame] | 402 | #endif /* _NET_FLOW_OFFLOAD_H */ |