From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, mlxsw@mellanox.com,
dsa@cumulusnetworks.com, shm@cumulusnetworks.com,
kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org,
kaber@trash.net, lorenzo@google.com, mateusz.bajorski@nokia.com
Subject: [patch net-next 02/10] ipv4: fib_rules: Add notifier info to FIB rules notifications
Date: Mon, 13 Mar 2017 08:38:25 +0100 [thread overview]
Message-ID: <1489390713-2634-2-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1489390713-2634-1-git-send-email-jiri@resnulli.us>
From: Ido Schimmel <idosch@mellanox.com>
Whenever a FIB rule is added or removed, a notification is sent in the
FIB notification chain. However, listeners don't have a way to tell
which rule was added or removed.
This is problematic as we would like to give listeners the ability to
decide which action to execute based on the notified rule. Specifically,
offloading drivers should be able to determine if they support the
reflection of the notified FIB rule and flush their LPM tables in case
they don't.
Do that by adding a notifier info to these notifications and embed the
common FIB rule struct in it.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
include/net/ip_fib.h | 7 +++++++
net/ipv4/fib_rules.c | 13 ++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index d9cee96..79fc314 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -213,6 +213,13 @@ struct fib_entry_notifier_info {
u32 tb_id;
};
+#ifdef CONFIG_IP_MULTIPLE_TABLES
+struct fib_rule_notifier_info {
+ struct fib_notifier_info info; /* must be first */
+ struct fib_rule *rule;
+};
+#endif
+
struct fib_nh_notifier_info {
struct fib_notifier_info info; /* must be first */
struct fib_nh *fib_nh;
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 2892109..d14fc0a 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -165,11 +165,14 @@ static struct fib_table *fib_empty_table(struct net *net)
}
static int call_fib_rule_notifiers(struct net *net,
- enum fib_event_type event_type)
+ enum fib_event_type event_type,
+ struct fib_rule *rule)
{
- struct fib_notifier_info info;
+ struct fib_rule_notifier_info info = {
+ .rule = rule,
+ };
- return call_fib_notifiers(net, event_type, &info);
+ return call_fib_notifiers(net, event_type, &info.info);
}
void fib_rules_notify(struct net *net, struct notifier_block *nb)
@@ -236,7 +239,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
rule4->tos = frh->tos;
net->ipv4.fib_has_custom_rules = true;
- call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD);
+ call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD, rule);
err = 0;
errout:
@@ -258,7 +261,7 @@ static int fib4_rule_delete(struct fib_rule *rule)
net->ipv4.fib_num_tclassid_users--;
#endif
net->ipv4.fib_has_custom_rules = true;
- call_fib_rule_notifiers(net, FIB_EVENT_RULE_DEL);
+ call_fib_rule_notifiers(net, FIB_EVENT_RULE_DEL, rule);
errout:
return err;
}
--
2.7.4
next prev parent reply other threads:[~2017-03-13 7:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 7:35 [patch net-next 00/10] mlxsw: Enable VRF offload Jiri Pirko
2017-03-13 7:38 ` [patch net-next 01/10] net: fib_rules: Add default rule indication Jiri Pirko
2017-03-13 7:38 ` Jiri Pirko [this message]
2017-03-13 7:38 ` [patch net-next 03/10] ipv4: fib_rules: Dump FIB rules when registering FIB notifier Jiri Pirko
2017-03-13 14:52 ` David Ahern
2017-03-13 17:33 ` Ido Schimmel
2017-03-13 7:38 ` [patch net-next 04/10] net: Add netif_is_vrf_master helper Jiri Pirko
2017-03-13 14:39 ` David Ahern
2017-03-13 15:01 ` Ido Schimmel
2017-03-13 15:15 ` David Ahern
2017-03-13 15:58 ` Ido Schimmel
2017-03-13 7:38 ` [patch net-next 05/10] net: vrf: Set slave's private flag before linking Jiri Pirko
2017-03-13 15:19 ` David Ahern
2017-03-13 7:38 ` [patch net-next 06/10] mlxsw: spectrum_router: Associate RIFs with correct VR Jiri Pirko
2017-03-13 7:38 ` [patch net-next 07/10] mlxsw: spectrum_router: Don't destroy RIF if L3 slave Jiri Pirko
2017-03-13 7:38 ` [patch net-next 08/10] mlxsw: spectrum_router: Add support for VRFs Jiri Pirko
2017-03-13 7:38 ` [patch net-next 09/10] mlxsw: spectrum_router: Add support for VRFs on top of bridges Jiri Pirko
2017-03-13 7:38 ` [patch net-next 10/10] mlxsw: spectrum_router: Don't abort on l3mdev rules Jiri Pirko
2017-03-13 14:59 ` David Ahern
2017-03-13 15:22 ` Ido Schimmel
2017-03-13 15:37 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489390713-2634-2-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=idosch@mellanox.com \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=lorenzo@google.com \
--cc=mateusz.bajorski@nokia.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=shm@cumulusnetworks.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).