netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, dsahern@gmail.com,
	jiri@mellanox.com, jakub.kicinski@netronome.com,
	saeedm@mellanox.com, mlxsw@mellanox.com,
	Ido Schimmel <idosch@mellanox.com>
Subject: Re: [RFC PATCH net-next 13/15] mlxsw: spectrum_router: Mark routes as "in hardware"
Date: Thu, 3 Oct 2019 18:16:04 +0300	[thread overview]
Message-ID: <20191003151604.GB26217@splinter> (raw)
In-Reply-To: <20191002182730.GG2279@nanopsycho>

On Wed, Oct 02, 2019 at 08:27:30PM +0200, Jiri Pirko wrote:
> Wed, Oct 02, 2019 at 10:41:01AM CEST, idosch@idosch.org wrote:
> >From: Ido Schimmel <idosch@mellanox.com>
> >
> >Make use of the recently introduced APIs and mark notified routes as "in
> >hardware" after they were programmed to the device's LPM tree.
> >
> >Similarly, when a route is replaced by an higher priority one, clear the
> >"in hardware" indication from it.
> >
> >Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> >---
> > .../ethernet/mellanox/mlxsw/spectrum_router.c | 19 +++++++++++++++++++
> > 1 file changed, 19 insertions(+)
> >
> >diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> >index 5a4e61f1feec..26ab8ae482ec 100644
> >--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> >+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> >@@ -4769,7 +4769,10 @@ static void mlxsw_sp_fib4_entry_replace(struct mlxsw_sp *mlxsw_sp,
> > 					struct mlxsw_sp_fib4_entry *fib4_entry)
> > {
> > 	struct mlxsw_sp_fib_node *fib_node = fib4_entry->common.fib_node;
> >+	struct net *net = mlxsw_sp_net(mlxsw_sp);
> >+	u32 *addr = (u32 *) fib_node->key.addr;
> > 	struct mlxsw_sp_fib4_entry *replaced;
> >+	struct fib_info *fi;
> > 
> > 	if (list_is_singular(&fib_node->entry_list))
> > 		return;
> >@@ -4777,6 +4780,10 @@ static void mlxsw_sp_fib4_entry_replace(struct mlxsw_sp *mlxsw_sp,
> > 	/* We inserted the new entry before replaced one */
> > 	replaced = list_next_entry(fib4_entry, common.list);
> > 
> >+	fi = mlxsw_sp_nexthop4_group_fi(replaced->common.nh_group);
> >+	fib_alias_in_hw_clear(net, *addr, fib_node->key.prefix_len, fi,
> >+			      replaced->tos, replaced->type, replaced->tb_id);
> >+
> > 	mlxsw_sp_fib4_node_entry_unlink(mlxsw_sp, replaced);
> > 	mlxsw_sp_fib4_entry_destroy(mlxsw_sp, replaced);
> > 	mlxsw_sp_fib_node_put(mlxsw_sp, fib_node);
> >@@ -4786,6 +4793,7 @@ static int
> > mlxsw_sp_router_fib4_replace(struct mlxsw_sp *mlxsw_sp,
> > 			     const struct fib_entry_notifier_info *fen_info)
> > {
> >+	struct net *net = mlxsw_sp_net(mlxsw_sp);
> > 	struct mlxsw_sp_fib4_entry *fib4_entry;
> > 	struct mlxsw_sp_fib_node *fib_node;
> > 	int err;
> >@@ -4815,6 +4823,10 @@ mlxsw_sp_router_fib4_replace(struct mlxsw_sp *mlxsw_sp,
> > 		goto err_fib4_node_entry_link;
> > 	}
> > 
> >+	fib_alias_in_hw_set(net, fen_info->dst, fen_info->dst_len,
> >+			    fen_info->fi, fen_info->tos, fen_info->type,
> >+			    fen_info->tb_id);
> 
> Can't you pass "fa" through fen_info and down to fib_alias_in_hw_set and
> avoid lookup?

No, because we don't have a reference count on 'fa' and we can't
guarantee that it will not disappear by the time we want to mark it.

> 
> 
> >+
> > 	mlxsw_sp_fib4_entry_replace(mlxsw_sp, fib4_entry);
> > 
> > 	return 0;
> >@@ -5731,11 +5743,18 @@ static void mlxsw_sp_fib4_node_flush(struct mlxsw_sp *mlxsw_sp,
> > 				     struct mlxsw_sp_fib_node *fib_node)
> > {
> > 	struct mlxsw_sp_fib4_entry *fib4_entry, *tmp;
> >+	struct net *net = mlxsw_sp_net(mlxsw_sp);
> >+	u32 *addr = (u32 *) fib_node->key.addr;
> > 
> > 	list_for_each_entry_safe(fib4_entry, tmp, &fib_node->entry_list,
> > 				 common.list) {
> > 		bool do_break = &tmp->common.list == &fib_node->entry_list;
> >+		struct fib_info *fi;
> > 
> >+		fi = mlxsw_sp_nexthop4_group_fi(fib4_entry->common.nh_group);
> >+		fib_alias_in_hw_clear(net, *addr, fib_node->key.prefix_len, fi,
> >+				      fib4_entry->tos, fib4_entry->type,
> >+				      fib4_entry->tb_id);
> > 		mlxsw_sp_fib4_node_entry_unlink(mlxsw_sp, fib4_entry);
> > 		mlxsw_sp_fib4_entry_destroy(mlxsw_sp, fib4_entry);
> > 		mlxsw_sp_fib_node_put(mlxsw_sp, fib_node);
> >-- 
> >2.21.0
> >

  reply	other threads:[~2019-10-03 15:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02  8:40 [RFC PATCH net-next 00/15] Simplify IPv4 route offload API Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 01/15] ipv4: Add temporary events to the FIB notification chain Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 02/15] ipv4: Notify route after insertion to the routing table Ido Schimmel
2019-10-03  1:34   ` David Ahern
2019-10-03  5:16     ` Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 03/15] ipv4: Notify route if replacing currently offloaded one Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 04/15] ipv4: Notify newly added route if should be offloaded Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 05/15] ipv4: Handle route deletion notification Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 06/15] ipv4: Handle route deletion notification during flush Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 07/15] ipv4: Only Replay routes of interest to new listeners Ido Schimmel
2019-10-02 17:44   ` Jiri Pirko
2019-10-03 13:04     ` Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 08/15] mlxsw: spectrum_router: Start using new IPv4 route notifications Ido Schimmel
2019-10-02 17:52   ` Jiri Pirko
2019-10-02 18:01     ` Jiri Pirko
2019-10-03 15:10       ` Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 09/15] ipv4: Remove old route notifications and convert listeners Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 10/15] ipv4: Replace route in list before notifying Ido Schimmel
2019-10-02  8:40 ` [RFC PATCH net-next 11/15] ipv4: Encapsulate function arguments in a struct Ido Schimmel
2019-10-02  8:41 ` [RFC PATCH net-next 12/15] ipv4: Add "in hardware" indication to routes Ido Schimmel
2019-10-02 15:58   ` Roopa Prabhu
2019-10-02 18:21     ` Jiri Pirko
2019-10-03  2:34       ` David Ahern
2019-10-03  5:37         ` Ido Schimmel
2019-10-04  1:55           ` David Ahern
2019-10-04 14:43             ` Ido Schimmel
2019-10-04 16:38               ` David Ahern
2019-10-04 17:43                 ` Roopa Prabhu
2019-10-04 23:20                   ` David Ahern
2019-10-03  5:40         ` Jiri Pirko
2019-10-03 12:59     ` Ido Schimmel
2019-10-04  4:25       ` Roopa Prabhu
2019-10-02  8:41 ` [RFC PATCH net-next 13/15] mlxsw: spectrum_router: Mark routes as "in hardware" Ido Schimmel
2019-10-02 18:27   ` Jiri Pirko
2019-10-03 15:16     ` Ido Schimmel [this message]
2019-10-02  8:41 ` [RFC PATCH net-next 14/15] netdevsim: fib: " Ido Schimmel
2019-10-02  8:41 ` [RFC PATCH net-next 15/15] selftests: netdevsim: Add test for route offload API Ido Schimmel
2019-10-02 18:17 ` [RFC PATCH net-next 00/15] Simplify IPv4 " Jiri Pirko
2019-10-03  5:18   ` Ido Schimmel

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=20191003151604.GB26217@splinter \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    /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).