netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
	mlxsw@mellanox.com
Subject: [patch net-next 6/8] mlxsw: spectrum_router: Remove redundant check
Date: Mon,  6 Feb 2017 16:20:15 +0100	[thread overview]
Message-ID: <1486394417-8011-7-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1486394417-8011-1-git-send-email-jiri@resnulli.us>

From: Ido Schimmel <idosch@mellanox.com>

We only add neighbour entries that are also used for nexthops to
'nexthop_neighs_list', so when iterating over this list there's no need
to check that the entry is indeed used for nexthops.

Remove the redundant check.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index c338b08..98a6d03 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -847,13 +847,11 @@ static void mlxsw_sp_router_neighs_update_nh(struct mlxsw_sp *mlxsw_sp)
 	/* Take RTNL mutex here to prevent lists from changes */
 	rtnl_lock();
 	list_for_each_entry(neigh_entry, &mlxsw_sp->router.nexthop_neighs_list,
-			    nexthop_neighs_list_node) {
+			    nexthop_neighs_list_node)
 		/* If this neigh have nexthops, make the kernel think this neigh
 		 * is active regardless of the traffic.
 		 */
-		if (!list_empty(&neigh_entry->nexthop_list))
-			neigh_event_send(neigh_entry->key.n, NULL);
-	}
+		neigh_event_send(neigh_entry->key.n, NULL);
 	rtnl_unlock();
 }
 
@@ -897,11 +895,9 @@ static void mlxsw_sp_router_probe_unresolved_nexthops(struct work_struct *work)
 	 */
 	rtnl_lock();
 	list_for_each_entry(neigh_entry, &mlxsw_sp->router.nexthop_neighs_list,
-			    nexthop_neighs_list_node) {
-		if (!(neigh_entry->key.n->nud_state & NUD_VALID) &&
-		    !list_empty(&neigh_entry->nexthop_list))
+			    nexthop_neighs_list_node)
+		if (!(neigh_entry->key.n->nud_state & NUD_VALID))
 			neigh_event_send(neigh_entry->key.n, NULL);
-	}
 	rtnl_unlock();
 
 	mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw,
-- 
2.7.4

  parent reply	other threads:[~2017-02-06 15:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 15:20 [patch net-next 0/8] mlxsw: cleanup neigh handling Jiri Pirko
2017-02-06 15:20 ` [patch net-next 1/8] mlxsw: core: Queue work immediately instead of delaying it Jiri Pirko
2017-02-06 15:20 ` [patch net-next 2/8] mlxsw: spectrum_router: Use ordered workqueue for neigh updates Jiri Pirko
2017-02-06 15:20 ` [patch net-next 3/8] mlxsw: spectrum_router: Remove unused variable Jiri Pirko
2017-02-06 15:20 ` [patch net-next 4/8] mlxsw: spectrum_router: Simplify neighbour reflection Jiri Pirko
2017-02-06 15:20 ` [patch net-next 5/8] net: remove ndo_neigh_{construct,destroy} from stacked devices Jiri Pirko
2017-02-06 15:20 ` Jiri Pirko [this message]
2017-02-06 15:20 ` [patch net-next 7/8] mlxsw: spectrum_router: Don't read 'nud_state' without lock Jiri Pirko
2017-02-06 15:20 ` [patch net-next 8/8] mlxsw: spectrum_router: Fix typo in comment Jiri Pirko
2017-02-06 16:28 ` [patch net-next 0/8] mlxsw: cleanup neigh handling David Miller
2017-02-07  9:45   ` Jiri Pirko

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=1486394417-8011-7-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=eladr@mellanox.com \
    --cc=idosch@mellanox.com \
    --cc=mlxsw@mellanox.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).