@@ -76,7 +76,7 @@ struct mlxsw_sp_flood_table {
76
76
};
77
77
78
78
struct mlxsw_sp_fid_ops {
79
- void (* setup )(struct mlxsw_sp_fid * fid , const void * arg );
79
+ int (* setup )(struct mlxsw_sp_fid * fid , const void * arg );
80
80
int (* configure )(struct mlxsw_sp_fid * fid );
81
81
void (* deconfigure )(struct mlxsw_sp_fid * fid );
82
82
int (* index_alloc )(struct mlxsw_sp_fid * fid , const void * arg ,
@@ -417,12 +417,13 @@ u16 mlxsw_sp_fid_8021q_vid(const struct mlxsw_sp_fid *fid)
417
417
return mlxsw_sp_fid_8021q_fid (fid )-> vid ;
418
418
}
419
419
420
- static void mlxsw_sp_fid_8021q_setup (struct mlxsw_sp_fid * fid , const void * arg )
420
+ static int mlxsw_sp_fid_8021q_setup (struct mlxsw_sp_fid * fid , const void * arg )
421
421
{
422
422
u16 vid = * (u16 * ) arg ;
423
423
424
424
mlxsw_sp_fid_8021q_fid (fid )-> vid = vid ;
425
425
fid -> fid_offset = fid -> fid_index - fid -> fid_family -> start_index ;
426
+ return 0 ;
426
427
}
427
428
428
429
static enum mlxsw_reg_sfmr_op mlxsw_sp_sfmr_op (bool valid )
@@ -785,12 +786,13 @@ mlxsw_sp_fid_8021d_fid(const struct mlxsw_sp_fid *fid)
785
786
return container_of (fid , struct mlxsw_sp_fid_8021d , common );
786
787
}
787
788
788
- static void mlxsw_sp_fid_8021d_setup (struct mlxsw_sp_fid * fid , const void * arg )
789
+ static int mlxsw_sp_fid_8021d_setup (struct mlxsw_sp_fid * fid , const void * arg )
789
790
{
790
791
int br_ifindex = * (int * ) arg ;
791
792
792
793
mlxsw_sp_fid_8021d_fid (fid )-> br_ifindex = br_ifindex ;
793
794
fid -> fid_offset = fid -> fid_index - fid -> fid_family -> start_index ;
795
+ return 0 ;
794
796
}
795
797
796
798
static int mlxsw_sp_fid_8021d_configure (struct mlxsw_sp_fid * fid )
@@ -1127,11 +1129,12 @@ mlxsw_sp_fid_8021q_fdb_clear_offload(const struct mlxsw_sp_fid *fid,
1127
1129
br_fdb_clear_offload (nve_dev , mlxsw_sp_fid_8021q_vid (fid ));
1128
1130
}
1129
1131
1130
- static void mlxsw_sp_fid_rfid_setup_ctl (struct mlxsw_sp_fid * fid ,
1131
- const void * arg )
1132
+ static int mlxsw_sp_fid_rfid_setup_ctl (struct mlxsw_sp_fid * fid ,
1133
+ const void * arg )
1132
1134
{
1133
1135
/* In controlled mode, the FW takes care of FID placement. */
1134
1136
fid -> fid_offset = 0 ;
1137
+ return 0 ;
1135
1138
}
1136
1139
1137
1140
static int mlxsw_sp_fid_rfid_configure (struct mlxsw_sp_fid * fid )
@@ -1272,9 +1275,10 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_rfid_ops_ctl = {
1272
1275
.vid_to_fid_rif_update = mlxsw_sp_fid_rfid_vid_to_fid_rif_update ,
1273
1276
};
1274
1277
1275
- static void mlxsw_sp_fid_dummy_setup (struct mlxsw_sp_fid * fid , const void * arg )
1278
+ static int mlxsw_sp_fid_dummy_setup (struct mlxsw_sp_fid * fid , const void * arg )
1276
1279
{
1277
1280
fid -> fid_offset = 0 ;
1281
+ return 0 ;
1278
1282
}
1279
1283
1280
1284
static int mlxsw_sp_fid_dummy_configure (struct mlxsw_sp_fid * fid )
@@ -1590,7 +1594,9 @@ static struct mlxsw_sp_fid *mlxsw_sp_fid_get(struct mlxsw_sp *mlxsw_sp,
1590
1594
fid -> fid_index = fid_index ;
1591
1595
__set_bit (fid_index - fid_family -> start_index , fid_family -> fids_bitmap );
1592
1596
1593
- fid -> fid_family -> ops -> setup (fid , arg );
1597
+ err = fid -> fid_family -> ops -> setup (fid , arg );
1598
+ if (err )
1599
+ goto err_setup ;
1594
1600
1595
1601
err = fid -> fid_family -> ops -> configure (fid );
1596
1602
if (err )
@@ -1608,6 +1614,7 @@ static struct mlxsw_sp_fid *mlxsw_sp_fid_get(struct mlxsw_sp *mlxsw_sp,
1608
1614
err_rhashtable_insert :
1609
1615
fid -> fid_family -> ops -> deconfigure (fid );
1610
1616
err_configure :
1617
+ err_setup :
1611
1618
__clear_bit (fid_index - fid_family -> start_index ,
1612
1619
fid_family -> fids_bitmap );
1613
1620
err_index_alloc :
0 commit comments