@@ -113,15 +113,19 @@ struct mlxsw_sp_fid_ops {
113
113
const struct mlxsw_sp_port * mlxsw_sp_port );
114
114
};
115
115
116
+ struct mlxsw_sp_fid_flood_profile {
117
+ const struct mlxsw_sp_flood_table * flood_tables ;
118
+ int nr_flood_tables ;
119
+ };
120
+
116
121
struct mlxsw_sp_fid_family {
117
122
enum mlxsw_sp_fid_type type ;
118
123
size_t fid_size ;
119
124
u16 start_index ;
120
125
u16 end_index ;
121
126
struct list_head fids_list ;
122
127
unsigned long * fids_bitmap ;
123
- const struct mlxsw_sp_flood_table * flood_tables ;
124
- int nr_flood_tables ;
128
+ const struct mlxsw_sp_fid_flood_profile * flood_profile ;
125
129
enum mlxsw_sp_rif_type rif_type ;
126
130
const struct mlxsw_sp_fid_ops * ops ;
127
131
struct mlxsw_sp * mlxsw_sp ;
@@ -331,10 +335,13 @@ mlxsw_sp_fid_flood_table_lookup(const struct mlxsw_sp_fid *fid,
331
335
struct mlxsw_sp_fid_family * fid_family = fid -> fid_family ;
332
336
int i ;
333
337
334
- for (i = 0 ; i < fid_family -> nr_flood_tables ; i ++ ) {
335
- if (fid_family -> flood_tables [i ].packet_type != packet_type )
338
+ for (i = 0 ; i < fid_family -> flood_profile -> nr_flood_tables ; i ++ ) {
339
+ const struct mlxsw_sp_flood_table * flood_table ;
340
+
341
+ flood_table = & fid_family -> flood_profile -> flood_tables [i ];
342
+ if (flood_table -> packet_type != packet_type )
336
343
continue ;
337
- return & fid_family -> flood_tables [ i ] ;
344
+ return flood_table ;
338
345
}
339
346
340
347
return NULL ;
@@ -352,7 +359,7 @@ mlxsw_sp_fid_8021d_pgt_size(const struct mlxsw_sp_fid_family *fid_family,
352
359
{
353
360
u16 num_fids = mlxsw_sp_fid_family_num_fids (fid_family );
354
361
355
- * p_pgt_size = num_fids * fid_family -> nr_flood_tables ;
362
+ * p_pgt_size = num_fids * fid_family -> flood_profile -> nr_flood_tables ;
356
363
return 0 ;
357
364
}
358
365
@@ -382,7 +389,7 @@ int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
382
389
const struct mlxsw_sp_flood_table * flood_table ;
383
390
u16 mid_index ;
384
391
385
- if (WARN_ON (!fid_family -> flood_tables ))
392
+ if (WARN_ON (!fid_family -> flood_profile ))
386
393
return - EINVAL ;
387
394
388
395
flood_table = mlxsw_sp_fid_flood_table_lookup (fid , packet_type );
@@ -1177,6 +1184,12 @@ static const struct mlxsw_sp_flood_table mlxsw_sp_fid_8021d_flood_tables[] = {
1177
1184
},
1178
1185
};
1179
1186
1187
+ static const
1188
+ struct mlxsw_sp_fid_flood_profile mlxsw_sp_fid_8021d_flood_profile = {
1189
+ .flood_tables = mlxsw_sp_fid_8021d_flood_tables ,
1190
+ .nr_flood_tables = ARRAY_SIZE (mlxsw_sp_fid_8021d_flood_tables ),
1191
+ };
1192
+
1180
1193
static bool
1181
1194
mlxsw_sp_fid_8021q_compare (const struct mlxsw_sp_fid * fid , const void * arg )
1182
1195
{
@@ -1526,8 +1539,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp1_fid_8021q_family = {
1526
1539
.fid_size = sizeof (struct mlxsw_sp_fid_8021q ),
1527
1540
.start_index = MLXSW_SP_FID_8021Q_START ,
1528
1541
.end_index = MLXSW_SP_FID_8021Q_END ,
1529
- .flood_tables = mlxsw_sp_fid_8021d_flood_tables ,
1530
- .nr_flood_tables = ARRAY_SIZE (mlxsw_sp_fid_8021d_flood_tables ),
1542
+ .flood_profile = & mlxsw_sp_fid_8021d_flood_profile ,
1531
1543
.rif_type = MLXSW_SP_RIF_TYPE_VLAN ,
1532
1544
.ops = & mlxsw_sp_fid_8021q_ops_ctl ,
1533
1545
.flood_rsp = false,
@@ -1540,8 +1552,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp1_fid_8021d_family = {
1540
1552
.fid_size = sizeof (struct mlxsw_sp_fid_8021d ),
1541
1553
.start_index = MLXSW_SP_FID_8021D_START ,
1542
1554
.end_index = MLXSW_SP_FID_8021D_END ,
1543
- .flood_tables = mlxsw_sp_fid_8021d_flood_tables ,
1544
- .nr_flood_tables = ARRAY_SIZE (mlxsw_sp_fid_8021d_flood_tables ),
1555
+ .flood_profile = & mlxsw_sp_fid_8021d_flood_profile ,
1545
1556
.rif_type = MLXSW_SP_RIF_TYPE_FID ,
1546
1557
.ops = & mlxsw_sp_fid_8021d_ops_ctl ,
1547
1558
.bridge_type = MLXSW_REG_BRIDGE_TYPE_1 ,
@@ -1580,8 +1591,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_8021q_family_ctl = {
1580
1591
.fid_size = sizeof (struct mlxsw_sp_fid_8021q ),
1581
1592
.start_index = MLXSW_SP_FID_8021Q_START ,
1582
1593
.end_index = MLXSW_SP_FID_8021Q_END ,
1583
- .flood_tables = mlxsw_sp_fid_8021d_flood_tables ,
1584
- .nr_flood_tables = ARRAY_SIZE (mlxsw_sp_fid_8021d_flood_tables ),
1594
+ .flood_profile = & mlxsw_sp_fid_8021d_flood_profile ,
1585
1595
.rif_type = MLXSW_SP_RIF_TYPE_VLAN ,
1586
1596
.ops = & mlxsw_sp_fid_8021q_ops_ctl ,
1587
1597
.flood_rsp = false,
@@ -1594,8 +1604,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp2_fid_8021d_family_ctl = {
1594
1604
.fid_size = sizeof (struct mlxsw_sp_fid_8021d ),
1595
1605
.start_index = MLXSW_SP_FID_8021D_START ,
1596
1606
.end_index = MLXSW_SP_FID_8021D_END ,
1597
- .flood_tables = mlxsw_sp_fid_8021d_flood_tables ,
1598
- .nr_flood_tables = ARRAY_SIZE (mlxsw_sp_fid_8021d_flood_tables ),
1607
+ .flood_profile = & mlxsw_sp_fid_8021d_flood_profile ,
1599
1608
.rif_type = MLXSW_SP_RIF_TYPE_FID ,
1600
1609
.ops = & mlxsw_sp_fid_8021d_ops_ctl ,
1601
1610
.bridge_type = MLXSW_REG_BRIDGE_TYPE_1 ,
@@ -1761,10 +1770,13 @@ mlxsw_sp_fid_flood_tables_init(struct mlxsw_sp_fid_family *fid_family)
1761
1770
if (err )
1762
1771
return err ;
1763
1772
1764
- for (i = 0 ; i < fid_family -> nr_flood_tables ; i ++ ) {
1773
+ if (!fid_family -> flood_profile )
1774
+ return 0 ;
1775
+
1776
+ for (i = 0 ; i < fid_family -> flood_profile -> nr_flood_tables ; i ++ ) {
1765
1777
const struct mlxsw_sp_flood_table * flood_table ;
1766
1778
1767
- flood_table = & fid_family -> flood_tables [i ];
1779
+ flood_table = & fid_family -> flood_profile -> flood_tables [i ];
1768
1780
if (fid_family -> ops -> flood_table_init ) {
1769
1781
err = fid_family -> ops -> flood_table_init (fid_family ,
1770
1782
flood_table );
@@ -1813,7 +1825,7 @@ static int mlxsw_sp_fid_family_register(struct mlxsw_sp *mlxsw_sp,
1813
1825
goto err_alloc_fids_bitmap ;
1814
1826
}
1815
1827
1816
- if (fid_family -> flood_tables ) {
1828
+ if (fid_family -> flood_profile ) {
1817
1829
err = mlxsw_sp_fid_flood_tables_init (fid_family );
1818
1830
if (err )
1819
1831
goto err_fid_flood_tables_init ;
@@ -1836,7 +1848,7 @@ mlxsw_sp_fid_family_unregister(struct mlxsw_sp *mlxsw_sp,
1836
1848
{
1837
1849
mlxsw_sp -> fid_core -> fid_family_arr [fid_family -> type ] = NULL ;
1838
1850
1839
- if (fid_family -> flood_tables )
1851
+ if (fid_family -> flood_profile )
1840
1852
mlxsw_sp_fid_flood_tables_fini (fid_family );
1841
1853
1842
1854
bitmap_free (fid_family -> fids_bitmap );
0 commit comments