^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2007-2013 Nicira, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef FLOW_NETLINK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define FLOW_NETLINK_H 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/netlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/openvswitch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/rcupdate.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/if_ether.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/in6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/jiffies.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <net/inet_ecn.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <net/ip_tunnels.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include "flow.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) size_t ovs_tun_key_attr_size(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) size_t ovs_key_attr_size(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void ovs_match_init(struct sw_flow_match *match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct sw_flow_key *key, bool reset_key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct sw_flow_mask *mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int ovs_nla_put_key(const struct sw_flow_key *, const struct sw_flow_key *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int attr, bool is_mask, struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int parse_flow_nlattrs(const struct nlattr *attr, const struct nlattr *a[],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u64 *attrsp, bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int ovs_nla_get_flow_metadata(struct net *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) const struct nlattr *a[OVS_KEY_ATTR_MAX + 1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u64 attrs, struct sw_flow_key *key, bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int ovs_nla_put_identifier(const struct sw_flow *flow, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int ovs_nla_put_masked_key(const struct sw_flow *flow, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) int ovs_nla_get_match(struct net *, struct sw_flow_match *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) const struct nlattr *key, const struct nlattr *mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) int ovs_nla_put_tunnel_info(struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct ip_tunnel_info *tun_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) bool ovs_nla_get_ufid(struct sw_flow_id *, const struct nlattr *, bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) int ovs_nla_get_identifier(struct sw_flow_id *sfid, const struct nlattr *ufid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) const struct sw_flow_key *key, bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) u32 ovs_nla_get_ufid_flags(const struct nlattr *attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) const struct sw_flow_key *key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct sw_flow_actions **sfa, bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) int ovs_nla_add_action(struct sw_flow_actions **sfa, int attrtype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void *data, int len, bool log);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int ovs_nla_put_actions(const struct nlattr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) int len, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) void ovs_nla_free_flow_actions(struct sw_flow_actions *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void ovs_nla_free_flow_actions_rcu(struct sw_flow_actions *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int nsh_key_from_nlattr(const struct nlattr *attr, struct ovs_key_nsh *nsh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct ovs_key_nsh *nsh_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int nsh_hdr_from_nlattr(const struct nlattr *attr, struct nshhdr *nh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #endif /* flow_netlink.h */