Skip to content

Commit 83de788

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum: Add mlxsw_sp_fid_ops.fdb_clear_offload
If there are any offloaded FDB entries at bridge master of an NVE device at the time that it's un-offloaded, their offloaded marks need to be cleared. How that is done depends on whether the bridge in question is vlan aware. Therefore add a per-FID-type operation. Implement the operation for the 802.1q and 802.1d bridges. Add and publish a function mlxsw_sp_fid_fdb_clear_offload() to dispatch to the new operation according to FID type. Signed-off-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b73ef0e commit 83de788

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ int mlxsw_sp_fid_vni_set(struct mlxsw_sp_fid *fid, enum mlxsw_sp_nve_type type,
763763
__be32 vni, int nve_ifindex);
764764
void mlxsw_sp_fid_vni_clear(struct mlxsw_sp_fid *fid);
765765
bool mlxsw_sp_fid_vni_is_set(const struct mlxsw_sp_fid *fid);
766+
void mlxsw_sp_fid_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
767+
const struct net_device *nve_dev);
766768
int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
767769
enum mlxsw_sp_flood_type packet_type, u8 local_port,
768770
bool member);

drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ struct mlxsw_sp_fid_ops {
8585
int (*nve_flood_index_set)(struct mlxsw_sp_fid *fid,
8686
u32 nve_flood_index);
8787
void (*nve_flood_index_clear)(struct mlxsw_sp_fid *fid);
88+
void (*fdb_clear_offload)(const struct mlxsw_sp_fid *fid,
89+
const struct net_device *nve_dev);
8890
};
8991

9092
struct mlxsw_sp_fid_family {
@@ -277,6 +279,16 @@ bool mlxsw_sp_fid_vni_is_set(const struct mlxsw_sp_fid *fid)
277279
return fid->vni_valid;
278280
}
279281

282+
void mlxsw_sp_fid_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
283+
const struct net_device *nve_dev)
284+
{
285+
struct mlxsw_sp_fid_family *fid_family = fid->fid_family;
286+
const struct mlxsw_sp_fid_ops *ops = fid_family->ops;
287+
288+
if (ops->fdb_clear_offload)
289+
ops->fdb_clear_offload(fid, nve_dev);
290+
}
291+
280292
static const struct mlxsw_sp_flood_table *
281293
mlxsw_sp_fid_flood_table_lookup(const struct mlxsw_sp_fid *fid,
282294
enum mlxsw_sp_flood_type packet_type)
@@ -766,6 +778,13 @@ static void mlxsw_sp_fid_8021d_nve_flood_index_clear(struct mlxsw_sp_fid *fid)
766778
fid->vni_valid, 0, false);
767779
}
768780

781+
static void
782+
mlxsw_sp_fid_8021d_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
783+
const struct net_device *nve_dev)
784+
{
785+
br_fdb_clear_offload(nve_dev, 0);
786+
}
787+
769788
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021d_ops = {
770789
.setup = mlxsw_sp_fid_8021d_setup,
771790
.configure = mlxsw_sp_fid_8021d_configure,
@@ -779,6 +798,7 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021d_ops = {
779798
.vni_clear = mlxsw_sp_fid_8021d_vni_clear,
780799
.nve_flood_index_set = mlxsw_sp_fid_8021d_nve_flood_index_set,
781800
.nve_flood_index_clear = mlxsw_sp_fid_8021d_nve_flood_index_clear,
801+
.fdb_clear_offload = mlxsw_sp_fid_8021d_fdb_clear_offload,
782802
};
783803

784804
static const struct mlxsw_sp_flood_table mlxsw_sp_fid_8021d_flood_tables[] = {
@@ -815,6 +835,13 @@ static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021d_family = {
815835
.lag_vid_valid = 1,
816836
};
817837

838+
static void
839+
mlxsw_sp_fid_8021q_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
840+
const struct net_device *nve_dev)
841+
{
842+
br_fdb_clear_offload(nve_dev, mlxsw_sp_fid_8021q_vid(fid));
843+
}
844+
818845
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_emu_ops = {
819846
.setup = mlxsw_sp_fid_8021q_setup,
820847
.configure = mlxsw_sp_fid_8021d_configure,
@@ -828,6 +855,7 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_emu_ops = {
828855
.vni_clear = mlxsw_sp_fid_8021d_vni_clear,
829856
.nve_flood_index_set = mlxsw_sp_fid_8021d_nve_flood_index_set,
830857
.nve_flood_index_clear = mlxsw_sp_fid_8021d_nve_flood_index_clear,
858+
.fdb_clear_offload = mlxsw_sp_fid_8021q_fdb_clear_offload,
831859
};
832860

833861
/* There are 4K-2 emulated 802.1Q FIDs, starting right after the 802.1D FIDs */

0 commit comments

Comments
 (0)