aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2020-11-04 15:30:23 +0200
committerJakub Kicinski <kuba@kernel.org>2020-11-06 11:28:48 -0800
commit1c9cac65cecd4f98d8713ec0c737c38a26e5b5c2 (patch)
treeb1655b411451c04cfbfe797fe3ccce4173dfeb06 /include
parentMerge tag 'mlx5-updates-2020-11-03' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux (diff)
downloadlinux-dev-1c9cac65cecd4f98d8713ec0c737c38a26e5b5c2.tar.xz
linux-dev-1c9cac65cecd4f98d8713ec0c737c38a26e5b5c2.zip
nexthop: Add nexthop notification data structures
Add data structures that will be used for nexthop replace and delete notifications in the previously introduced nexthop notification chain. New data structures are added instead of passing the existing nexthop code structures directly for several reasons. First, the existing structures encode a lot of bookkeeping information which is irrelevant for listeners of the notification chain. Second, the existing structures can be changed without worrying about introducing regressions in listeners since they are not accessed directly by them. Third, listeners of the notification chain do not need to each parse the relatively complex nexthop code structures. They are passing the required information in a simplified way. Note that a single 'has_encap' bit is added instead of the actual encapsulation information since current listeners do not support such nexthops. Changes since RFC: * s/is_encap/has_encap/ Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/nexthop.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index 2fd76a9b6dc8..4a17b040b502 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -108,6 +108,41 @@ enum nexthop_event_type {
NEXTHOP_EVENT_DEL
};
+struct nh_notifier_single_info {
+ struct net_device *dev;
+ u8 gw_family;
+ union {
+ __be32 ipv4;
+ struct in6_addr ipv6;
+ };
+ u8 is_reject:1,
+ is_fdb:1,
+ has_encap:1;
+};
+
+struct nh_notifier_grp_entry_info {
+ u8 weight;
+ u32 id;
+ struct nh_notifier_single_info nh;
+};
+
+struct nh_notifier_grp_info {
+ u16 num_nh;
+ bool is_fdb;
+ struct nh_notifier_grp_entry_info nh_entries[];
+};
+
+struct nh_notifier_info {
+ struct net *net;
+ struct netlink_ext_ack *extack;
+ u32 id;
+ bool is_grp;
+ union {
+ struct nh_notifier_single_info *nh;
+ struct nh_notifier_grp_info *nh_grp;
+ };
+};
+
int register_nexthop_notifier(struct net *net, struct notifier_block *nb);
int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb);