* [patch net-next 1/2] mlxsw: spectrum: pass local_port to mlxsw_sp_port_fdb_uc_op @ 2016-01-07 9:25 Jiri Pirko 2016-01-07 9:25 ` [patch net-next 2/2] mlxsw: spectrum: remove FDB entry in case we get unknown object notification Jiri Pirko 0 siblings, 1 reply; 4+ messages in thread From: Jiri Pirko @ 2016-01-07 9:25 UTC (permalink / raw) To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz From: Jiri Pirko <jiri@mellanox.com> Do not pass struct mlxsw_sp_port to mlxsw_sp_port_fdb_uc_op and rather just pass local_port. This is needed in case this is called from SFN process function and mlxsw_sp_port is not existent for particular local_port. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> --- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 6215954..d22076b 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -568,11 +568,10 @@ static enum mlxsw_reg_sfd_op mlxsw_sp_sfd_op(bool adding) MLXSW_REG_SFD_OP_WRITE_REMOVE; } -static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp_port *mlxsw_sp_port, +static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, const char *mac, u16 fid, bool adding, bool dynamic) { - struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; char *sfd_pl; int err; @@ -583,7 +582,7 @@ static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp_port *mlxsw_sp_port, mlxsw_reg_sfd_pack(sfd_pl, mlxsw_sp_sfd_op(adding), 0); mlxsw_reg_sfd_uc_pack(sfd_pl, 0, mlxsw_sp_sfd_rec_policy(dynamic), mac, fid, MLXSW_REG_SFD_REC_ACTION_NOP, - mlxsw_sp_port->local_port); + local_port); err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); kfree(sfd_pl); @@ -633,7 +632,8 @@ mlxsw_sp_port_fdb_static_add(struct mlxsw_sp_port *mlxsw_sp_port, fid = mlxsw_sp_port->pvid; if (!mlxsw_sp_port->lagged) - return mlxsw_sp_port_fdb_uc_op(mlxsw_sp_port, + return mlxsw_sp_port_fdb_uc_op(mlxsw_sp_port->mlxsw_sp, + mlxsw_sp_port->local_port, fdb->addr, fid, true, false); else return mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp_port->mlxsw_sp, @@ -772,7 +772,8 @@ mlxsw_sp_port_fdb_static_del(struct mlxsw_sp_port *mlxsw_sp_port, } if (!mlxsw_sp_port->lagged) - return mlxsw_sp_port_fdb_uc_op(mlxsw_sp_port, + return mlxsw_sp_port_fdb_uc_op(mlxsw_sp_port->mlxsw_sp, + mlxsw_sp_port->local_port, fdb->addr, fid, false, false); else @@ -1028,7 +1029,7 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, vid = fid; } - err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp_port, mac, fid, + err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding && mlxsw_sp_port->learning, true); if (err) { if (net_ratelimit()) -- 1.9.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch net-next 2/2] mlxsw: spectrum: remove FDB entry in case we get unknown object notification 2016-01-07 9:25 [patch net-next 1/2] mlxsw: spectrum: pass local_port to mlxsw_sp_port_fdb_uc_op Jiri Pirko @ 2016-01-07 9:25 ` Jiri Pirko 2016-01-07 10:27 ` kbuild test robot 0 siblings, 1 reply; 4+ messages in thread From: Jiri Pirko @ 2016-01-07 9:25 UTC (permalink / raw) To: netdev; +Cc: davem, idosch, eladr, yotamg, ogerlitz From: Jiri Pirko <jiri@mellanox.com> It may happen that we get notification for FDB entry for object (port, lag, vport), which does not exist. Currently we ignore that, which only causes this being re-sent in next notification. The entry will never disappear. So get rid of it by simply removing it using SFD register. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> --- .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index d22076b..b2873ef 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1002,13 +1002,14 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, char mac[ETH_ALEN]; u8 local_port; u16 vid, fid; + bool do_notification = true; int err; mlxsw_reg_sfn_mac_unpack(sfn_pl, rec_index, mac, &fid, &local_port); mlxsw_sp_port = mlxsw_sp->ports[local_port]; if (!mlxsw_sp_port) { dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect local port in FDB notification\n"); - return; + goto just_remove; } if (mlxsw_sp_fid_is_vfid(fid)) { @@ -1019,9 +1020,8 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, vfid); if (!mlxsw_sp_vport) { netdev_err(mlxsw_sp_port->dev, "Failed to find a matching vPort following FDB notification\n"); - return; + goto just_remove; } - vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); /* Override the physical port with the vPort. */ mlxsw_sp_port = mlxsw_sp_vport; @@ -1029,6 +1029,7 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, vid = fid; } +do_fdb_op: err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding && mlxsw_sp_port->learning, true); if (err) { @@ -1037,9 +1038,17 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, return; } + if (!do_notification) + return; mlxsw_sp_fdb_call_notifiers(mlxsw_sp_port->learning, mlxsw_sp_port->learning_sync, adding, mac, vid, mlxsw_sp_port->dev); + return; + +just_remove: + adding = false; + do_notification = false; + goto do_fdb_op; } static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp, @@ -1051,13 +1060,14 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp, u16 lag_vid = 0; u16 lag_id; u16 vid, fid; + bool do_notification = true; int err; mlxsw_reg_sfn_mac_lag_unpack(sfn_pl, rec_index, mac, &fid, &lag_id); mlxsw_sp_port = mlxsw_sp_lag_rep_port(mlxsw_sp, lag_id); if (!mlxsw_sp_port) { dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Cannot find port representor for LAG\n"); - return; + goto just_remove; } if (mlxsw_sp_fid_is_vfid(fid)) { @@ -1068,7 +1078,7 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp, vfid); if (!mlxsw_sp_vport) { netdev_err(mlxsw_sp_port->dev, "Failed to find a matching vPort following FDB notification\n"); - return; + goto just_remove; } vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); @@ -1079,6 +1089,7 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp, vid = fid; } +do_fdb_op: err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid, adding && mlxsw_sp_port->learning, true); @@ -1088,10 +1099,18 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp, return; } + if (!do_notification) + return; mlxsw_sp_fdb_call_notifiers(mlxsw_sp_port->learning, mlxsw_sp_port->learning_sync, adding, mac, vid, mlxsw_sp_lag_get(mlxsw_sp, lag_id)->dev); + return; + +just_remove: + adding = false; + do_notification = false; + goto do_fdb_op; } static void mlxsw_sp_fdb_notify_rec_process(struct mlxsw_sp *mlxsw_sp, -- 1.9.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch net-next 2/2] mlxsw: spectrum: remove FDB entry in case we get unknown object notification 2016-01-07 9:25 ` [patch net-next 2/2] mlxsw: spectrum: remove FDB entry in case we get unknown object notification Jiri Pirko @ 2016-01-07 10:27 ` kbuild test robot 2016-01-07 10:47 ` Jiri Pirko 0 siblings, 1 reply; 4+ messages in thread From: kbuild test robot @ 2016-01-07 10:27 UTC (permalink / raw) To: Jiri Pirko; +Cc: kbuild-all, netdev, davem, idosch, eladr, yotamg, ogerlitz Hi Jiri, [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Jiri-Pirko/mlxsw-spectrum-pass-local_port-to-mlxsw_sp_port_fdb_uc_op/20160107-172927 coccinelle warnings: (new ones prefixed by >>) >> drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:1122:32-40: ERROR: mlxsw_sp_port is NULL but dereferenced. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:1062:35-43: ERROR: mlxsw_sp_port is NULL but dereferenced. vim +1122 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c aac78a44 Ido Schimmel 2015-12-15 1106 vfid); aac78a44 Ido Schimmel 2015-12-15 1107 if (!mlxsw_sp_vport) { aac78a44 Ido Schimmel 2015-12-15 1108 netdev_err(mlxsw_sp_port->dev, "Failed to find a matching vPort following FDB notification\n"); 5c00f06c Jiri Pirko 2016-01-07 1109 goto just_remove; aac78a44 Ido Schimmel 2015-12-15 1110 } aac78a44 Ido Schimmel 2015-12-15 1111 aac78a44 Ido Schimmel 2015-12-15 1112 vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport); 64771e31 Ido Schimmel 2015-12-15 1113 lag_vid = vid; aac78a44 Ido Schimmel 2015-12-15 1114 /* Override the physical port with the vPort. */ aac78a44 Ido Schimmel 2015-12-15 1115 mlxsw_sp_port = mlxsw_sp_vport; aac78a44 Ido Schimmel 2015-12-15 1116 } else { aac78a44 Ido Schimmel 2015-12-15 1117 vid = fid; aac78a44 Ido Schimmel 2015-12-15 1118 } aac78a44 Ido Schimmel 2015-12-15 1119 5c00f06c Jiri Pirko 2016-01-07 1120 do_fdb_op: 64771e31 Ido Schimmel 2015-12-15 1121 err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid, 8a1ab5d7 Jiri Pirko 2015-12-03 @1122 adding && mlxsw_sp_port->learning, 8a1ab5d7 Jiri Pirko 2015-12-03 1123 true); 8a1ab5d7 Jiri Pirko 2015-12-03 1124 if (err) { 8a1ab5d7 Jiri Pirko 2015-12-03 1125 if (net_ratelimit()) 8a1ab5d7 Jiri Pirko 2015-12-03 1126 netdev_err(mlxsw_sp_port->dev, "Failed to set FDB entry\n"); 8a1ab5d7 Jiri Pirko 2015-12-03 1127 return; 8a1ab5d7 Jiri Pirko 2015-12-03 1128 } 8a1ab5d7 Jiri Pirko 2015-12-03 1129 5c00f06c Jiri Pirko 2016-01-07 1130 if (!do_notification) :::::: The code at line 1122 was first introduced by commit :::::: 8a1ab5d766396aad0e60cc8796646a1171b419c8 mlxsw: spectrum: Implement FDB add/remove/dump for LAG :::::: TO: Jiri Pirko <jiri@mellanox.com> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch net-next 2/2] mlxsw: spectrum: remove FDB entry in case we get unknown object notification 2016-01-07 10:27 ` kbuild test robot @ 2016-01-07 10:47 ` Jiri Pirko 0 siblings, 0 replies; 4+ messages in thread From: Jiri Pirko @ 2016-01-07 10:47 UTC (permalink / raw) To: kbuild test robot Cc: kbuild-all, netdev, davem, idosch, eladr, yotamg, ogerlitz Thu, Jan 07, 2016 at 11:27:09AM CET, lkp@intel.com wrote: >Hi Jiri, > >[auto build test WARNING on net-next/master] > >url: https://github.com/0day-ci/linux/commits/Jiri-Pirko/mlxsw-spectrum-pass-local_port-to-mlxsw_sp_port_fdb_uc_op/20160107-172927 > > >coccinelle warnings: (new ones prefixed by >>) > >>> drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:1122:32-40: ERROR: mlxsw_sp_port is NULL but dereferenced. > drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:1062:35-43: ERROR: mlxsw_sp_port is NULL but dereferenced. Fixing this and sending v2. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-07 10:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-01-07 9:25 [patch net-next 1/2] mlxsw: spectrum: pass local_port to mlxsw_sp_port_fdb_uc_op Jiri Pirko 2016-01-07 9:25 ` [patch net-next 2/2] mlxsw: spectrum: remove FDB entry in case we get unknown object notification Jiri Pirko 2016-01-07 10:27 ` kbuild test robot 2016-01-07 10:47 ` Jiri Pirko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox