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, ivecera@redhat.com,
	stephen@networkplumber.org, mlxsw@mellanox.com
Subject: [patch net-next 05/10] mlxsw: spectrum: Make port flood update more generic
Date: Thu,  9 Feb 2017 14:54:44 +0100	[thread overview]
Message-ID: <1486648489-16455-6-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1486648489-16455-1-git-send-email-jiri@resnulli.us>

From: Nogah Frankel <nogahf@mellanox.com>

Currently, there is a per port flood update function only for the UC
table. Make the function  more generic by changing the table type to be
an input.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 .../ethernet/mellanox/mlxsw/spectrum_switchdev.c   | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 2bd5ffe..b1e2ec12 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -219,8 +219,9 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
 	return err;
 }
 
-static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
-				      bool set)
+static int mlxsw_sp_port_flood_table_set(struct mlxsw_sp_port *mlxsw_sp_port,
+					 enum mlxsw_sp_flood_table table,
+					 bool set)
 {
 	struct net_device *dev = mlxsw_sp_port->dev;
 	u16 vid, last_visited_vid;
@@ -231,15 +232,12 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
 		u16 vfid = mlxsw_sp_fid_to_vfid(fid);
 
 		return __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vfid,
-						       vfid,
-						       MLXSW_SP_FLOOD_TABLE_UC,
-						       set);
+						       vfid, table, set);
 	}
 
 	for_each_set_bit(vid, mlxsw_sp_port->active_vlans, VLAN_N_VID) {
 		err = __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid,
-						      MLXSW_SP_FLOOD_TABLE_UC,
-						      set);
+						      table, set);
 		if (err) {
 			last_visited_vid = vid;
 			goto err_port_flood_set;
@@ -250,8 +248,8 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
 
 err_port_flood_set:
 	for_each_set_bit(vid, mlxsw_sp_port->active_vlans, last_visited_vid)
-		__mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid,
-						MLXSW_SP_FLOOD_TABLE_UC, !set);
+		__mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid, table,
+						!set);
 	netdev_err(dev, "Failed to configure unicast flooding\n");
 	return err;
 }
@@ -311,8 +309,9 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
 		return 0;
 
 	if ((uc_flood ^ brport_flags) & BR_FLOOD) {
-		err = mlxsw_sp_port_uc_flood_set(mlxsw_sp_port,
-						 !mlxsw_sp_port->uc_flood);
+		err = mlxsw_sp_port_flood_table_set(mlxsw_sp_port,
+						    MLXSW_SP_FLOOD_TABLE_UC,
+						    !mlxsw_sp_port->uc_flood);
 		if (err)
 			return err;
 	}
@@ -332,8 +331,9 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
 
 err_port_learning_set:
 	if ((uc_flood ^ brport_flags) & BR_FLOOD)
-		mlxsw_sp_port_uc_flood_set(mlxsw_sp_port,
-					   mlxsw_sp_port->uc_flood);
+		mlxsw_sp_port_flood_table_set(mlxsw_sp_port,
+					      MLXSW_SP_FLOOD_TABLE_UC,
+					      mlxsw_sp_port->uc_flood);
 	return err;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2017-02-09 13:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 13:54 [patch net-next 00/10] mlxsw: Offload MC flood for unregister MC Jiri Pirko
2017-02-09 13:54 ` [patch net-next 01/10] switchdev: bridge: Offload multicast disabled Jiri Pirko
2017-02-09 15:10   ` Ivan Vecera
2017-02-09 13:54 ` [patch net-next 02/10] bridge: mcast: Merge the mc router ports deletions to one function Jiri Pirko
2017-02-09 15:11   ` Ivan Vecera
2017-02-09 13:54 ` [patch net-next 03/10] switchdev: bridge: Offload mc router ports Jiri Pirko
2017-02-09 15:11   ` Ivan Vecera
2017-02-09 13:54 ` [patch net-next 04/10] mlxsw: spectrum: Break flood set func to be per table Jiri Pirko
2017-02-09 13:54 ` Jiri Pirko [this message]
2017-02-09 13:54 ` [patch net-next 06/10] mlxsw: spectrum: Change max vfid Jiri Pirko
2017-02-09 13:54 ` [patch net-next 07/10] mlxsw: spectrum: Separate bc and mc floods Jiri Pirko
2017-02-09 13:54 ` [patch net-next 08/10] mlxsw: spectrum: Add an option to flood mc by mc_router_port Jiri Pirko
2017-02-09 13:54 ` [patch net-next 09/10] mlxsw: spectrum: Extend port_orig_get for bridge devices Jiri Pirko
2017-02-09 13:54 ` [patch net-next 10/10] mlxsw: spectrum: Update mc_disabled flag by switchdev attr Jiri Pirko
2017-02-10 18:12 ` [patch net-next 00/10] mlxsw: Offload MC flood for unregister MC David Miller

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=1486648489-16455-6-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=ivecera@redhat.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).