netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Vlad Buslov <vladbu@nvidia.com>, Roi Dayan <roid@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next V2 15/17] net/mlx5: Bridge, extract FDB delete notification to function
Date: Mon, 16 Aug 2021 16:22:17 -0700	[thread overview]
Message-ID: <20210816232219.557083-16-saeed@kernel.org> (raw)
In-Reply-To: <20210816232219.557083-1-saeed@kernel.org>

From: Vlad Buslov <vladbu@nvidia.com>

SWITCHDEV_FDB_DEL_TO_BRIDGE notification is generated in multiple places in
bridge code. Following patch in series changes the condition for the
notification. Extract the notification into dedicated helper function
mlx5_esw_bridge_fdb_del_notify() to only modify it in single place in the
future changes.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/esw/bridge.c  | 27 +++++++++----------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
index 65173db2a2f4..5f5571190ffe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
@@ -76,6 +76,15 @@ mlx5_esw_bridge_fdb_offload_notify(struct net_device *dev, const unsigned char *
 	call_switchdev_notifiers(val, dev, &send_info.info, NULL);
 }
 
+static void
+mlx5_esw_bridge_fdb_del_notify(struct mlx5_esw_bridge_fdb_entry *entry)
+{
+	if (!(entry->flags & MLX5_ESW_BRIDGE_FLAG_ADDED_BY_USER))
+		mlx5_esw_bridge_fdb_offload_notify(entry->dev, entry->key.addr,
+						   entry->key.vid,
+						   SWITCHDEV_FDB_DEL_TO_BRIDGE);
+}
+
 static struct mlx5_flow_table *
 mlx5_esw_bridge_table_create(int max_fte, u32 level, struct mlx5_eswitch *esw)
 {
@@ -699,10 +708,7 @@ static void mlx5_esw_bridge_fdb_flush(struct mlx5_esw_bridge *bridge)
 	struct mlx5_esw_bridge_fdb_entry *entry, *tmp;
 
 	list_for_each_entry_safe(entry, tmp, &bridge->fdb_list, list) {
-		if (!(entry->flags & MLX5_ESW_BRIDGE_FLAG_ADDED_BY_USER))
-			mlx5_esw_bridge_fdb_offload_notify(entry->dev, entry->key.addr,
-							   entry->key.vid,
-							   SWITCHDEV_FDB_DEL_TO_BRIDGE);
+		mlx5_esw_bridge_fdb_del_notify(entry);
 		mlx5_esw_bridge_fdb_entry_cleanup(entry, bridge);
 	}
 }
@@ -850,10 +856,7 @@ static void mlx5_esw_bridge_vlan_flush(struct mlx5_esw_bridge_vlan *vlan,
 	struct mlx5_esw_bridge_fdb_entry *entry, *tmp;
 
 	list_for_each_entry_safe(entry, tmp, &vlan->fdb_list, vlan_list) {
-		if (!(entry->flags & MLX5_ESW_BRIDGE_FLAG_ADDED_BY_USER))
-			mlx5_esw_bridge_fdb_offload_notify(entry->dev, entry->key.addr,
-							   entry->key.vid,
-							   SWITCHDEV_FDB_DEL_TO_BRIDGE);
+		mlx5_esw_bridge_fdb_del_notify(entry);
 		mlx5_esw_bridge_fdb_entry_cleanup(entry, bridge);
 	}
 
@@ -1241,9 +1244,7 @@ void mlx5_esw_bridge_fdb_remove(struct net_device *dev, u16 vport_num, u16 esw_o
 		return;
 	}
 
-	if (!(entry->flags & MLX5_ESW_BRIDGE_FLAG_ADDED_BY_USER))
-		mlx5_esw_bridge_fdb_offload_notify(dev, entry->key.addr, entry->key.vid,
-						   SWITCHDEV_FDB_DEL_TO_BRIDGE);
+	mlx5_esw_bridge_fdb_del_notify(entry);
 	mlx5_esw_bridge_fdb_entry_cleanup(entry, bridge);
 }
 
@@ -1263,9 +1264,7 @@ void mlx5_esw_bridge_update(struct mlx5_esw_bridge_offloads *br_offloads)
 			if (time_after(lastuse, entry->lastuse)) {
 				mlx5_esw_bridge_fdb_entry_refresh(lastuse, entry);
 			} else if (time_is_before_jiffies(entry->lastuse + bridge->ageing_time)) {
-				mlx5_esw_bridge_fdb_offload_notify(entry->dev, entry->key.addr,
-								   entry->key.vid,
-								   SWITCHDEV_FDB_DEL_TO_BRIDGE);
+				mlx5_esw_bridge_fdb_del_notify(entry);
 				mlx5_esw_bridge_fdb_entry_cleanup(entry, bridge);
 			}
 		}
-- 
2.31.1


  parent reply	other threads:[~2021-08-16 23:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 23:22 [pull request][net-next V2 00/17] mlx5 updates 2021-08-16 Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 01/17] net/mlx5e: Do not try enable RSS when resetting indir table Saeed Mahameed
2021-08-17  9:40   ` patchwork-bot+netdevbpf
2021-08-16 23:22 ` [net-next V2 02/17] net/mlx5e: Introduce TIR create/destroy API in rx_res Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 03/17] net/mlx5e: Introduce abstraction of RSS context Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 04/17] net/mlx5e: Convert RSS to a dedicated object Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 05/17] net/mlx5e: Dynamically allocate TIRs in RSS contexts Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 06/17] net/mlx5e: Support multiple " Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 07/17] net/mlx5e: Support flow classification into " Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 08/17] net/mlx5e: Abstract MQPRIO params Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 09/17] net/mlx5e: Maintain MQPRIO mode parameter Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 10/17] net/mlx5e: Handle errors of netdev_set_num_tc() Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 11/17] net/mlx5e: Support MQPRIO channel mode Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 12/17] net/mlx5: Bridge, release bridge in same function where it is taken Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 13/17] net/mlx5: Bridge, obtain core device from eswitch instead of priv Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 14/17] net/mlx5: Bridge, identify port by vport_num+esw_owner_vhca_id pair Saeed Mahameed
2021-08-16 23:22 ` Saeed Mahameed [this message]
2021-08-16 23:22 ` [net-next V2 16/17] net/mlx5: Bridge, allow merged eswitch connectivity Saeed Mahameed
2021-08-16 23:22 ` [net-next V2 17/17] net/mlx5: Bridge, support LAG Saeed Mahameed

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=20210816232219.557083-16-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vladbu@nvidia.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).