netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, dsahern@gmail.com,
	jiri@nvidia.com, mlxsw@nvidia.com,
	Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next 11/18] nexthop: Emit a notification when a nexthop group is reduced
Date: Wed,  4 Nov 2020 15:30:33 +0200	[thread overview]
Message-ID: <20201104133040.1125369-12-idosch@idosch.org> (raw)
In-Reply-To: <20201104133040.1125369-1-idosch@idosch.org>

From: Ido Schimmel <idosch@nvidia.com>

When a single nexthop is deleted, the configuration of all the groups
using the nexthop is effectively modified. In this case, emit a
notification in the nexthop notification chain for each modified group
so that listeners would not need to keep track of which nexthops are
member in which groups.

In the rare cases where the notification fails, emit an error to the
kernel log. This is done by allocating extack on the stack and printing
the error logged by the listener that rejected the notification.

Changes since RFC:
* Allocate extack on the stack

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 net/ipv4/nexthop.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 0e8e753956f1..d5a2c28bea49 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -892,9 +892,10 @@ static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
 {
 	struct nh_grp_entry *nhges, *new_nhges;
 	struct nexthop *nhp = nhge->nh_parent;
+	struct netlink_ext_ack extack;
 	struct nexthop *nh = nhge->nh;
 	struct nh_group *nhg, *newg;
-	int i, j;
+	int i, j, err;
 
 	WARN_ON(!nh);
 
@@ -942,6 +943,10 @@ static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
 	list_del(&nhge->nh_list);
 	nexthop_put(nhge->nh);
 
+	err = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, nhp, &extack);
+	if (err)
+		pr_err("%s\n", extack._msg);
+
 	if (nlinfo)
 		nexthop_notify(RTM_NEWNEXTHOP, nhp, nlinfo);
 }
-- 
2.26.2


  parent reply	other threads:[~2020-11-04 13:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 13:30 [PATCH net-next 00/18] nexthop: Add support for nexthop objects offload Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 01/18] nexthop: Add nexthop notification data structures Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 02/18] nexthop: Pass extack to nexthop notifier Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 03/18] nexthop: Prepare new notification info Ido Schimmel
2020-11-06 19:08   ` Jakub Kicinski
2020-11-04 13:30 ` [PATCH net-next 04/18] nexthop: vxlan: Convert to " Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 05/18] rtnetlink: Add RTNH_F_TRAP flag Ido Schimmel
2020-11-06 19:12   ` Jakub Kicinski
2020-11-09 15:35     ` Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 06/18] nexthop: Allow setting "offload" and "trap" indications on nexthops Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 07/18] nexthop: Emit a notification when a nexthop is added Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 08/18] nexthop: Emit a notification when a nexthop group is replaced Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 09/18] nexthop: Emit a notification when a single nexthop " Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 10/18] nexthop: Emit a notification when a nexthop group is modified Ido Schimmel
2020-11-04 13:30 ` Ido Schimmel [this message]
2020-11-04 13:30 ` [PATCH net-next 12/18] nexthop: Pass extack to register_nexthop_notifier() Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 13/18] nexthop: Replay nexthops when registering a notifier Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 14/18] nexthop: Remove in-kernel route notifications when nexthop changes Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 15/18] netdevsim: Add devlink resource for nexthops Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 16/18] netdevsim: Add dummy implementation for nexthop offload Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 17/18] netdevsim: Allow programming routes with nexthop objects Ido Schimmel
2020-11-04 13:30 ` [PATCH net-next 18/18] selftests: netdevsim: Add test for nexthop offload API Ido Schimmel
2020-11-06 19:31 ` [PATCH net-next 00/18] nexthop: Add support for nexthop objects offload Jakub Kicinski
2020-11-09 15:41   ` Ido Schimmel
2020-11-10  3:48     ` 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=20201104133040.1125369-12-idosch@idosch.org \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=idosch@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.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).