18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2007-2013 Nicira, Inc.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef FLOW_NETLINK_H
88c2ecf20Sopenharmony_ci#define FLOW_NETLINK_H 1
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/kernel.h>
118c2ecf20Sopenharmony_ci#include <linux/netlink.h>
128c2ecf20Sopenharmony_ci#include <linux/openvswitch.h>
138c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
148c2ecf20Sopenharmony_ci#include <linux/types.h>
158c2ecf20Sopenharmony_ci#include <linux/rcupdate.h>
168c2ecf20Sopenharmony_ci#include <linux/if_ether.h>
178c2ecf20Sopenharmony_ci#include <linux/in6.h>
188c2ecf20Sopenharmony_ci#include <linux/jiffies.h>
198c2ecf20Sopenharmony_ci#include <linux/time.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <net/inet_ecn.h>
228c2ecf20Sopenharmony_ci#include <net/ip_tunnels.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include "flow.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cisize_t ovs_tun_key_attr_size(void);
278c2ecf20Sopenharmony_cisize_t ovs_key_attr_size(void);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_civoid ovs_match_init(struct sw_flow_match *match,
308c2ecf20Sopenharmony_ci		    struct sw_flow_key *key, bool reset_key,
318c2ecf20Sopenharmony_ci		    struct sw_flow_mask *mask);
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciint ovs_nla_put_key(const struct sw_flow_key *, const struct sw_flow_key *,
348c2ecf20Sopenharmony_ci		    int attr, bool is_mask, struct sk_buff *);
358c2ecf20Sopenharmony_ciint parse_flow_nlattrs(const struct nlattr *attr, const struct nlattr *a[],
368c2ecf20Sopenharmony_ci		       u64 *attrsp, bool log);
378c2ecf20Sopenharmony_ciint ovs_nla_get_flow_metadata(struct net *net,
388c2ecf20Sopenharmony_ci			      const struct nlattr *a[OVS_KEY_ATTR_MAX + 1],
398c2ecf20Sopenharmony_ci			      u64 attrs, struct sw_flow_key *key, bool log);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciint ovs_nla_put_identifier(const struct sw_flow *flow, struct sk_buff *skb);
428c2ecf20Sopenharmony_ciint ovs_nla_put_masked_key(const struct sw_flow *flow, struct sk_buff *skb);
438c2ecf20Sopenharmony_ciint ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciint ovs_nla_get_match(struct net *, struct sw_flow_match *,
468c2ecf20Sopenharmony_ci		      const struct nlattr *key, const struct nlattr *mask,
478c2ecf20Sopenharmony_ci		      bool log);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciint ovs_nla_put_tunnel_info(struct sk_buff *skb,
508c2ecf20Sopenharmony_ci			    struct ip_tunnel_info *tun_info);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cibool ovs_nla_get_ufid(struct sw_flow_id *, const struct nlattr *, bool log);
538c2ecf20Sopenharmony_ciint ovs_nla_get_identifier(struct sw_flow_id *sfid, const struct nlattr *ufid,
548c2ecf20Sopenharmony_ci			   const struct sw_flow_key *key, bool log);
558c2ecf20Sopenharmony_ciu32 ovs_nla_get_ufid_flags(const struct nlattr *attr);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciint ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
588c2ecf20Sopenharmony_ci			 const struct sw_flow_key *key,
598c2ecf20Sopenharmony_ci			 struct sw_flow_actions **sfa, bool log);
608c2ecf20Sopenharmony_ciint ovs_nla_add_action(struct sw_flow_actions **sfa, int attrtype,
618c2ecf20Sopenharmony_ci		       void *data, int len, bool log);
628c2ecf20Sopenharmony_ciint ovs_nla_put_actions(const struct nlattr *attr,
638c2ecf20Sopenharmony_ci			int len, struct sk_buff *skb);
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_civoid ovs_nla_free_flow_actions(struct sw_flow_actions *);
668c2ecf20Sopenharmony_civoid ovs_nla_free_flow_actions_rcu(struct sw_flow_actions *);
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciint nsh_key_from_nlattr(const struct nlattr *attr, struct ovs_key_nsh *nsh,
698c2ecf20Sopenharmony_ci			struct ovs_key_nsh *nsh_mask);
708c2ecf20Sopenharmony_ciint nsh_hdr_from_nlattr(const struct nlattr *attr, struct nshhdr *nh,
718c2ecf20Sopenharmony_ci			size_t size);
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#endif /* flow_netlink.h */
74