Commit 19ae6124 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum: Add another flood table for vFIDs

We previously used only one flood table for packets classified to vFIDs.
However, since we are going to add support for bridges between VLAN
interfaces (mapped to vFIDs) we need to add one more flood table.

That way we can separate the flooding domain of unknown unicast traffic
from all the rest and support flood control (as we do with the 802.1Q
bridge).
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c06a94ef
...@@ -679,7 +679,7 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -679,7 +679,7 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
if (!vfid->nr_vports) { if (!vfid->nr_vports) {
err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, err = mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid,
true); true, false);
if (err) { if (err) {
netdev_err(dev, "Failed to setup flooding for vFID=%d\n", netdev_err(dev, "Failed to setup flooding for vFID=%d\n",
vfid->vfid); vfid->vfid);
...@@ -747,7 +747,8 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -747,7 +747,8 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port); mlxsw_sp_port_vlan_mode_trans(mlxsw_sp_port);
err_port_vp_mode_trans: err_port_vp_mode_trans:
if (!vfid->nr_vports) if (!vfid->nr_vports)
mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, false); mlxsw_sp_vport_flood_set(mlxsw_sp_vport, vfid->vfid, false,
false);
err_vport_flood_set: err_vport_flood_set:
mlxsw_sp_port_vport_destroy(mlxsw_sp_vport); mlxsw_sp_port_vport_destroy(mlxsw_sp_vport);
err_port_vport_create: err_port_vport_create:
...@@ -1788,16 +1789,15 @@ static int __mlxsw_sp_flood_init(struct mlxsw_core *mlxsw_core, ...@@ -1788,16 +1789,15 @@ static int __mlxsw_sp_flood_init(struct mlxsw_core *mlxsw_core,
enum mlxsw_sp_flood_table flood_table; enum mlxsw_sp_flood_table flood_table;
char sfgc_pl[MLXSW_REG_SFGC_LEN]; char sfgc_pl[MLXSW_REG_SFGC_LEN];
if (bridge_type == MLXSW_REG_SFGC_BRIDGE_TYPE_VFID) { if (bridge_type == MLXSW_REG_SFGC_BRIDGE_TYPE_VFID)
table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID; table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID;
flood_table = 0; else
} else {
table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID_OFFEST; table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID_OFFEST;
if (type == MLXSW_REG_SFGC_TYPE_UNKNOWN_UNICAST)
flood_table = MLXSW_SP_FLOOD_TABLE_UC; if (type == MLXSW_REG_SFGC_TYPE_UNKNOWN_UNICAST)
else flood_table = MLXSW_SP_FLOOD_TABLE_UC;
flood_table = MLXSW_SP_FLOOD_TABLE_BM; else
} flood_table = MLXSW_SP_FLOOD_TABLE_BM;
mlxsw_reg_sfgc_pack(sfgc_pl, type, bridge_type, table_type, mlxsw_reg_sfgc_pack(sfgc_pl, type, bridge_type, table_type,
flood_table); flood_table);
...@@ -1808,9 +1808,6 @@ static int mlxsw_sp_flood_init(struct mlxsw_sp *mlxsw_sp) ...@@ -1808,9 +1808,6 @@ static int mlxsw_sp_flood_init(struct mlxsw_sp *mlxsw_sp)
{ {
int type, err; int type, err;
/* For non-offloaded netdevs, flood all traffic types to CPU
* port.
*/
for (type = 0; type < MLXSW_REG_SFGC_TYPE_MAX; type++) { for (type = 0; type < MLXSW_REG_SFGC_TYPE_MAX; type++) {
if (type == MLXSW_REG_SFGC_TYPE_RESERVED) if (type == MLXSW_REG_SFGC_TYPE_RESERVED)
continue; continue;
...@@ -1819,15 +1816,6 @@ static int mlxsw_sp_flood_init(struct mlxsw_sp *mlxsw_sp) ...@@ -1819,15 +1816,6 @@ static int mlxsw_sp_flood_init(struct mlxsw_sp *mlxsw_sp)
MLXSW_REG_SFGC_BRIDGE_TYPE_VFID); MLXSW_REG_SFGC_BRIDGE_TYPE_VFID);
if (err) if (err)
return err; return err;
}
/* For bridged ports, use one flooding table for unknown unicast
* traffic and a second table for unregistered multicast and
* broadcast.
*/
for (type = 0; type < MLXSW_REG_SFGC_TYPE_MAX; type++) {
if (type == MLXSW_REG_SFGC_TYPE_RESERVED)
continue;
err = __mlxsw_sp_flood_init(mlxsw_sp->core, type, err = __mlxsw_sp_flood_init(mlxsw_sp->core, type,
MLXSW_REG_SFGC_BRIDGE_TYPE_1Q_FID); MLXSW_REG_SFGC_BRIDGE_TYPE_1Q_FID);
...@@ -1958,8 +1946,8 @@ static struct mlxsw_config_profile mlxsw_sp_config_profile = { ...@@ -1958,8 +1946,8 @@ static struct mlxsw_config_profile mlxsw_sp_config_profile = {
.flood_mode = 3, .flood_mode = 3,
.max_fid_offset_flood_tables = 2, .max_fid_offset_flood_tables = 2,
.fid_offset_flood_table_size = VLAN_N_VID - 1, .fid_offset_flood_table_size = VLAN_N_VID - 1,
.max_fid_flood_tables = 1, .max_fid_flood_tables = 2,
.fid_flood_table_size = VLAN_N_VID, .fid_flood_table_size = MLXSW_SP_VFID_MAX,
.used_max_ib_mc = 1, .used_max_ib_mc = 1,
.max_ib_mc = 0, .max_ib_mc = 0,
.used_max_pkey = 1, .used_max_pkey = 1,
......
...@@ -200,6 +200,6 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto, ...@@ -200,6 +200,6 @@ int mlxsw_sp_port_add_vid(struct net_device *dev, __be16 __always_unused proto,
int mlxsw_sp_port_kill_vid(struct net_device *dev, int mlxsw_sp_port_kill_vid(struct net_device *dev,
__be16 __always_unused proto, u16 vid); __be16 __always_unused proto, u16 vid);
int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid, int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid,
bool set); bool set, bool only_uc);
#endif #endif
...@@ -193,12 +193,13 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -193,12 +193,13 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
} }
int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid, int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 vfid,
bool set) bool set, bool only_uc)
{ {
/* In case of vFIDs, index into the flooding table is relative to /* In case of vFIDs, index into the flooding table is relative to
* the start of the vFIDs range. * the start of the vFIDs range.
*/ */
return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, true); return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set,
only_uc);
} }
static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment