blob: fe7f77fc5f189077032b1be889ee320fb4be7325 [file] [log] [blame]
Thomas Gleixnerc9422992019-05-29 07:12:43 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Pravin B Shelare6445712013-10-03 18:16:47 -07002/*
3 * Copyright (c) 2007-2013 Nicira, Inc.
Pravin B Shelare6445712013-10-03 18:16:47 -07004 */
5
6
7#ifndef FLOW_NETLINK_H
8#define FLOW_NETLINK_H 1
9
10#include <linux/kernel.h>
11#include <linux/netlink.h>
12#include <linux/openvswitch.h>
13#include <linux/spinlock.h>
14#include <linux/types.h>
15#include <linux/rcupdate.h>
16#include <linux/if_ether.h>
17#include <linux/in6.h>
18#include <linux/jiffies.h>
19#include <linux/time.h>
Pravin B Shelare6445712013-10-03 18:16:47 -070020
21#include <net/inet_ecn.h>
22#include <net/ip_tunnels.h>
23
24#include "flow.h"
25
Wenyu Zhang8f0aad62014-11-06 06:51:24 -080026size_t ovs_tun_key_attr_size(void);
Joe Stringer41af73e2014-10-18 16:14:14 -070027size_t ovs_key_attr_size(void);
28
Pravin B Shelare6445712013-10-03 18:16:47 -070029void ovs_match_init(struct sw_flow_match *match,
pravin shelar22799942016-09-19 13:51:00 -070030 struct sw_flow_key *key, bool reset_key,
31 struct sw_flow_mask *mask);
Pravin B Shelare6445712013-10-03 18:16:47 -070032
Joe Stringer5b4237b2015-01-21 16:42:48 -080033int ovs_nla_put_key(const struct sw_flow_key *, const struct sw_flow_key *,
34 int attr, bool is_mask, struct sk_buff *);
Jarno Rajahalme9dd7f892017-02-09 11:21:59 -080035int parse_flow_nlattrs(const struct nlattr *attr, const struct nlattr *a[],
36 u64 *attrsp, bool log);
37int ovs_nla_get_flow_metadata(struct net *net,
38 const struct nlattr *a[OVS_KEY_ATTR_MAX + 1],
39 u64 attrs, struct sw_flow_key *key, bool log);
Pravin B Shelar83c8df22014-09-15 19:20:31 -070040
Joe Stringer74ed7ab2015-01-21 16:42:52 -080041int ovs_nla_put_identifier(const struct sw_flow *flow, struct sk_buff *skb);
42int ovs_nla_put_masked_key(const struct sw_flow *flow, struct sk_buff *skb);
Joe Stringer5b4237b2015-01-21 16:42:48 -080043int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb);
44
Joe Stringerc2ac6672015-08-26 11:31:52 -070045int ovs_nla_get_match(struct net *, struct sw_flow_match *,
46 const struct nlattr *key, const struct nlattr *mask,
47 bool log);
Pravin B Shelarfc4099f2015-10-22 18:17:16 -070048
49int ovs_nla_put_tunnel_info(struct sk_buff *skb,
50 struct ip_tunnel_info *tun_info);
Pravin B Shelare6445712013-10-03 18:16:47 -070051
Joe Stringer74ed7ab2015-01-21 16:42:52 -080052bool ovs_nla_get_ufid(struct sw_flow_id *, const struct nlattr *, bool log);
53int ovs_nla_get_identifier(struct sw_flow_id *sfid, const struct nlattr *ufid,
54 const struct sw_flow_key *key, bool log);
55u32 ovs_nla_get_ufid_flags(const struct nlattr *attr);
56
Joe Stringer7f8a4362015-08-26 11:31:48 -070057int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
Simon Horman25cd9ba2014-10-06 05:05:13 -070058 const struct sw_flow_key *key,
Jarno Rajahalme05da5892014-11-06 07:03:05 -080059 struct sw_flow_actions **sfa, bool log);
Joe Stringer7f8a4362015-08-26 11:31:48 -070060int ovs_nla_add_action(struct sw_flow_actions **sfa, int attrtype,
61 void *data, int len, bool log);
Pravin B Shelare6445712013-10-03 18:16:47 -070062int ovs_nla_put_actions(const struct nlattr *attr,
63 int len, struct sk_buff *skb);
64
Pravin B Shelare6445712013-10-03 18:16:47 -070065void ovs_nla_free_flow_actions(struct sw_flow_actions *);
Thomas Graf34ae9322015-07-21 10:44:03 +020066void ovs_nla_free_flow_actions_rcu(struct sw_flow_actions *);
Pravin B Shelare6445712013-10-03 18:16:47 -070067
Yi Yangb2d0f5d2017-11-07 21:07:02 +080068int nsh_key_from_nlattr(const struct nlattr *attr, struct ovs_key_nsh *nsh,
69 struct ovs_key_nsh *nsh_mask);
70int nsh_hdr_from_nlattr(const struct nlattr *attr, struct nshhdr *nh,
71 size_t size);
72
Pravin B Shelare6445712013-10-03 18:16:47 -070073#endif /* flow_netlink.h */