diff options
author | Edward Cree <ecree.xilinx@gmail.com> | 2022-07-28 21:57:50 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-07-30 07:22:06 +0300 |
commit | 77eb40749d73fe347c47d6903874a924840ff8d5 (patch) | |
tree | dd859ff59175f367f51d468e2e9b34b01c99ae58 /drivers/net/ethernet/sfc/ef100_nic.c | |
parent | 67ab160ed08f5bb55aff55aa41e6bde56cb83661 (diff) | |
download | linux-77eb40749d73fe347c47d6903874a924840ff8d5.tar.xz |
sfc: move table locking into filter_table_{probe,remove} methods
We need to be able to drop the efx->filter_sem in ef100_filter_table_up()
so that we can call functions that insert filters (and thus take that
rwsem for read), which means the efx->type->filter_table_probe method
needs to be responsible for taking the lock in the first place.
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/sfc/ef100_nic.c')
-rw-r--r-- | drivers/net/ethernet/sfc/ef100_nic.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 25cd43e3fcf7..5fe18b383e20 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -375,26 +375,32 @@ static int ef100_filter_table_up(struct efx_nic *efx) { int rc; + down_write(&efx->filter_sem); rc = efx_mcdi_filter_add_vlan(efx, EFX_FILTER_VID_UNSPEC); - if (rc) { - efx_mcdi_filter_table_down(efx); - return rc; - } + if (rc) + goto fail_unspec; rc = efx_mcdi_filter_add_vlan(efx, 0); - if (rc) { - efx_mcdi_filter_del_vlan(efx, EFX_FILTER_VID_UNSPEC); - efx_mcdi_filter_table_down(efx); - } + if (rc) + goto fail_vlan0; + up_write(&efx->filter_sem); + return 0; +fail_vlan0: + efx_mcdi_filter_del_vlan(efx, EFX_FILTER_VID_UNSPEC); +fail_unspec: + efx_mcdi_filter_table_down(efx); + up_write(&efx->filter_sem); return rc; } static void ef100_filter_table_down(struct efx_nic *efx) { + down_write(&efx->filter_sem); efx_mcdi_filter_del_vlan(efx, 0); efx_mcdi_filter_del_vlan(efx, EFX_FILTER_VID_UNSPEC); efx_mcdi_filter_table_down(efx); + up_write(&efx->filter_sem); } /* Other |