Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2007-2013 Nicira, Inc. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of version 2 of the GNU General Public |
| 6 | * License as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 16 | * 02110-1301, USA |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | #ifndef FLOW_NETLINK_H |
| 21 | #define FLOW_NETLINK_H 1 |
| 22 | |
| 23 | #include <linux/kernel.h> |
| 24 | #include <linux/netlink.h> |
| 25 | #include <linux/openvswitch.h> |
| 26 | #include <linux/spinlock.h> |
| 27 | #include <linux/types.h> |
| 28 | #include <linux/rcupdate.h> |
| 29 | #include <linux/if_ether.h> |
| 30 | #include <linux/in6.h> |
| 31 | #include <linux/jiffies.h> |
| 32 | #include <linux/time.h> |
| 33 | #include <linux/flex_array.h> |
| 34 | |
| 35 | #include <net/inet_ecn.h> |
| 36 | #include <net/ip_tunnels.h> |
| 37 | |
| 38 | #include "flow.h" |
| 39 | |
Wenyu Zhang | 8f0aad6 | 2014-11-06 06:51:24 -0800 | [diff] [blame] | 40 | size_t ovs_tun_key_attr_size(void); |
Joe Stringer | 41af73e | 2014-10-18 16:14:14 -0700 | [diff] [blame] | 41 | size_t ovs_key_attr_size(void); |
| 42 | |
Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 43 | void ovs_match_init(struct sw_flow_match *match, |
pravin shelar | 2279994 | 2016-09-19 13:51:00 -0700 | [diff] [blame] | 44 | struct sw_flow_key *key, bool reset_key, |
| 45 | struct sw_flow_mask *mask); |
Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 46 | |
Joe Stringer | 5b4237b | 2015-01-21 16:42:48 -0800 | [diff] [blame] | 47 | int ovs_nla_put_key(const struct sw_flow_key *, const struct sw_flow_key *, |
| 48 | int attr, bool is_mask, struct sk_buff *); |
Jarno Rajahalme | 9dd7f89 | 2017-02-09 11:21:59 -0800 | [diff] [blame] | 49 | int parse_flow_nlattrs(const struct nlattr *attr, const struct nlattr *a[], |
| 50 | u64 *attrsp, bool log); |
| 51 | int ovs_nla_get_flow_metadata(struct net *net, |
| 52 | const struct nlattr *a[OVS_KEY_ATTR_MAX + 1], |
| 53 | u64 attrs, struct sw_flow_key *key, bool log); |
Pravin B Shelar | 83c8df2 | 2014-09-15 19:20:31 -0700 | [diff] [blame] | 54 | |
Joe Stringer | 74ed7ab | 2015-01-21 16:42:52 -0800 | [diff] [blame] | 55 | int ovs_nla_put_identifier(const struct sw_flow *flow, struct sk_buff *skb); |
| 56 | int ovs_nla_put_masked_key(const struct sw_flow *flow, struct sk_buff *skb); |
Joe Stringer | 5b4237b | 2015-01-21 16:42:48 -0800 | [diff] [blame] | 57 | int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb); |
| 58 | |
Joe Stringer | c2ac667 | 2015-08-26 11:31:52 -0700 | [diff] [blame] | 59 | int ovs_nla_get_match(struct net *, struct sw_flow_match *, |
| 60 | const struct nlattr *key, const struct nlattr *mask, |
| 61 | bool log); |
Pravin B Shelar | fc4099f | 2015-10-22 18:17:16 -0700 | [diff] [blame] | 62 | |
| 63 | int ovs_nla_put_tunnel_info(struct sk_buff *skb, |
| 64 | struct ip_tunnel_info *tun_info); |
Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 65 | |
Joe Stringer | 74ed7ab | 2015-01-21 16:42:52 -0800 | [diff] [blame] | 66 | bool ovs_nla_get_ufid(struct sw_flow_id *, const struct nlattr *, bool log); |
| 67 | int ovs_nla_get_identifier(struct sw_flow_id *sfid, const struct nlattr *ufid, |
| 68 | const struct sw_flow_key *key, bool log); |
| 69 | u32 ovs_nla_get_ufid_flags(const struct nlattr *attr); |
| 70 | |
Joe Stringer | 7f8a436 | 2015-08-26 11:31:48 -0700 | [diff] [blame] | 71 | int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, |
Simon Horman | 25cd9ba | 2014-10-06 05:05:13 -0700 | [diff] [blame] | 72 | const struct sw_flow_key *key, |
Jarno Rajahalme | 05da589 | 2014-11-06 07:03:05 -0800 | [diff] [blame] | 73 | struct sw_flow_actions **sfa, bool log); |
Joe Stringer | 7f8a436 | 2015-08-26 11:31:48 -0700 | [diff] [blame] | 74 | int ovs_nla_add_action(struct sw_flow_actions **sfa, int attrtype, |
| 75 | void *data, int len, bool log); |
Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 76 | int ovs_nla_put_actions(const struct nlattr *attr, |
| 77 | int len, struct sk_buff *skb); |
| 78 | |
Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 79 | void ovs_nla_free_flow_actions(struct sw_flow_actions *); |
Thomas Graf | 34ae932 | 2015-07-21 10:44:03 +0200 | [diff] [blame] | 80 | void ovs_nla_free_flow_actions_rcu(struct sw_flow_actions *); |
Pravin B Shelar | e644571 | 2013-10-03 18:16:47 -0700 | [diff] [blame] | 81 | |
| 82 | #endif /* flow_netlink.h */ |