Skip to content

Commit 253833d

Browse files
committed
Merge branch 'udp_tunnel-remove-rtnl_lock-dependency'
Stanislav Fomichev says: ==================== udp_tunnel: remove rtnl_lock dependency Recently bnxt had to grow back a bunch of rtnl dependencies because of udp_tunnel's infra. Add separate (global) mutext to protect udp_tunnel state. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents a335569 + 850d924 commit 253833d

File tree

22 files changed

+176
-172
lines changed

22 files changed

+176
-172
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10219,8 +10219,7 @@ static int bnx2x_udp_tunnel_sync(struct net_device *netdev, unsigned int table)
1021910219

1022010220
static const struct udp_tunnel_nic_info bnx2x_udp_tunnels = {
1022110221
.sync_table = bnx2x_udp_tunnel_sync,
10222-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
10223-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
10222+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
1022410223
.tables = {
1022510224
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
1022610225
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14055,38 +14055,23 @@ static void bnxt_unlock_sp(struct bnxt *bp)
1405514055
netdev_unlock(bp->dev);
1405614056
}
1405714057

14058-
/* Same as bnxt_lock_sp() with additional rtnl_lock */
14059-
static void bnxt_rtnl_lock_sp(struct bnxt *bp)
14060-
{
14061-
clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
14062-
rtnl_lock();
14063-
netdev_lock(bp->dev);
14064-
}
14065-
14066-
static void bnxt_rtnl_unlock_sp(struct bnxt *bp)
14067-
{
14068-
set_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
14069-
netdev_unlock(bp->dev);
14070-
rtnl_unlock();
14071-
}
14072-
1407314058
/* Only called from bnxt_sp_task() */
1407414059
static void bnxt_reset(struct bnxt *bp, bool silent)
1407514060
{
14076-
bnxt_rtnl_lock_sp(bp);
14061+
bnxt_lock_sp(bp);
1407714062
if (test_bit(BNXT_STATE_OPEN, &bp->state))
1407814063
bnxt_reset_task(bp, silent);
14079-
bnxt_rtnl_unlock_sp(bp);
14064+
bnxt_unlock_sp(bp);
1408014065
}
1408114066

1408214067
/* Only called from bnxt_sp_task() */
1408314068
static void bnxt_rx_ring_reset(struct bnxt *bp)
1408414069
{
1408514070
int i;
1408614071

14087-
bnxt_rtnl_lock_sp(bp);
14072+
bnxt_lock_sp(bp);
1408814073
if (!test_bit(BNXT_STATE_OPEN, &bp->state)) {
14089-
bnxt_rtnl_unlock_sp(bp);
14074+
bnxt_unlock_sp(bp);
1409014075
return;
1409114076
}
1409214077
/* Disable and flush TPA before resetting the RX ring */
@@ -14125,7 +14110,7 @@ static void bnxt_rx_ring_reset(struct bnxt *bp)
1412514110
}
1412614111
if (bp->flags & BNXT_FLAG_TPA)
1412714112
bnxt_set_tpa(bp, true);
14128-
bnxt_rtnl_unlock_sp(bp);
14113+
bnxt_unlock_sp(bp);
1412914114
}
1413014115

1413114116
static void bnxt_fw_fatal_close(struct bnxt *bp)
@@ -15017,17 +15002,15 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1501715002
bp->fw_reset_state = BNXT_FW_RESET_STATE_OPENING;
1501815003
fallthrough;
1501915004
case BNXT_FW_RESET_STATE_OPENING:
15020-
while (!rtnl_trylock()) {
15005+
while (!netdev_trylock(bp->dev)) {
1502115006
bnxt_queue_fw_reset_work(bp, HZ / 10);
1502215007
return;
1502315008
}
15024-
netdev_lock(bp->dev);
1502515009
rc = bnxt_open(bp->dev);
1502615010
if (rc) {
1502715011
netdev_err(bp->dev, "bnxt_open() failed during FW reset\n");
1502815012
bnxt_fw_reset_abort(bp, rc);
1502915013
netdev_unlock(bp->dev);
15030-
rtnl_unlock();
1503115014
goto ulp_start;
1503215015
}
1503315016

@@ -15047,7 +15030,6 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1504715030
bnxt_dl_health_fw_status_update(bp, true);
1504815031
}
1504915032
netdev_unlock(bp->dev);
15050-
rtnl_unlock();
1505115033
bnxt_ulp_start(bp, 0);
1505215034
bnxt_reenable_sriov(bp);
1505315035
netdev_lock(bp->dev);
@@ -15573,17 +15555,15 @@ static int bnxt_udp_tunnel_unset_port(struct net_device *netdev, unsigned int ta
1557315555
static const struct udp_tunnel_nic_info bnxt_udp_tunnels = {
1557415556
.set_port = bnxt_udp_tunnel_set_port,
1557515557
.unset_port = bnxt_udp_tunnel_unset_port,
15576-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
15577-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
15558+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
1557815559
.tables = {
1557915560
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
1558015561
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
1558115562
},
1558215563
}, bnxt_udp_tunnels_p7 = {
1558315564
.set_port = bnxt_udp_tunnel_set_port,
1558415565
.unset_port = bnxt_udp_tunnel_unset_port,
15585-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
15586-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
15566+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
1558715567
.tables = {
1558815568
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
1558915569
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
@@ -15998,7 +15978,7 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1599815978
rc);
1599915979
napi_enable_locked(&bnapi->napi);
1600015980
bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
16001-
netif_close(dev);
15981+
bnxt_reset_task(bp, true);
1600215982
return rc;
1600315983
}
1600415984

@@ -16814,7 +16794,6 @@ static int bnxt_resume(struct device *device)
1681416794
struct bnxt *bp = netdev_priv(dev);
1681516795
int rc = 0;
1681616796

16817-
rtnl_lock();
1681816797
netdev_lock(dev);
1681916798
rc = pci_enable_device(bp->pdev);
1682016799
if (rc) {
@@ -16859,7 +16838,6 @@ static int bnxt_resume(struct device *device)
1685916838

1686016839
resume_exit:
1686116840
netdev_unlock(bp->dev);
16862-
rtnl_unlock();
1686316841
bnxt_ulp_start(bp, rc);
1686416842
if (!rc)
1686516843
bnxt_reenable_sriov(bp);
@@ -17025,7 +17003,6 @@ static void bnxt_io_resume(struct pci_dev *pdev)
1702517003
int err;
1702617004

1702717005
netdev_info(bp->dev, "PCI Slot Resume\n");
17028-
rtnl_lock();
1702917006
netdev_lock(netdev);
1703017007

1703117008
err = bnxt_hwrm_func_qcaps(bp);
@@ -17043,7 +17020,6 @@ static void bnxt_io_resume(struct pci_dev *pdev)
1704317020
netif_device_attach(netdev);
1704417021

1704517022
netdev_unlock(netdev);
17046-
rtnl_unlock();
1704717023
bnxt_ulp_start(bp, err);
1704817024
if (!err)
1704917025
bnxt_reenable_sriov(bp);

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4031,8 +4031,7 @@ static int be_vxlan_unset_port(struct net_device *netdev, unsigned int table,
40314031
static const struct udp_tunnel_nic_info be_udp_tunnels = {
40324032
.set_port = be_vxlan_set_port,
40334033
.unset_port = be_vxlan_unset_port,
4034-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
4035-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
4034+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
40364035
.tables = {
40374036
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
40384037
},

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15895,7 +15895,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1589515895

1589615896
pf->udp_tunnel_nic.set_port = i40e_udp_tunnel_set_port;
1589715897
pf->udp_tunnel_nic.unset_port = i40e_udp_tunnel_unset_port;
15898-
pf->udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP;
1589915898
pf->udp_tunnel_nic.shared = &pf->udp_tunnel_shared;
1590015899
pf->udp_tunnel_nic.tables[0].n_entries = I40E_MAX_PF_UDP_OFFLOAD_PORTS;
1590115900
pf->udp_tunnel_nic.tables[0].tunnel_types = UDP_TUNNEL_TYPE_VXLAN |

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4767,7 +4767,6 @@ int ice_init_dev(struct ice_pf *pf)
47674767

47684768
pf->hw.udp_tunnel_nic.set_port = ice_udp_tunnel_set_port;
47694769
pf->hw.udp_tunnel_nic.unset_port = ice_udp_tunnel_unset_port;
4770-
pf->hw.udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP;
47714770
pf->hw.udp_tunnel_nic.shared = &pf->hw.udp_tunnel_shared;
47724771
if (pf->hw.tnl.valid_count[TNL_VXLAN]) {
47734772
pf->hw.udp_tunnel_nic.tables[0].n_entries =

drivers/net/ethernet/mellanox/mlx4/en_netdev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,8 +2670,7 @@ static int mlx4_udp_tunnel_sync(struct net_device *dev, unsigned int table)
26702670

26712671
static const struct udp_tunnel_nic_info mlx4_udp_tunnels = {
26722672
.sync_table = mlx4_udp_tunnel_sync,
2673-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
2674-
UDP_TUNNEL_NIC_INFO_IPV4_ONLY,
2673+
.flags = UDP_TUNNEL_NIC_INFO_IPV4_ONLY,
26752674
.tables = {
26762675
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
26772676
},

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5351,8 +5351,7 @@ void mlx5e_vxlan_set_netdev_info(struct mlx5e_priv *priv)
53515351

53525352
priv->nic_info.set_port = mlx5e_vxlan_set_port;
53535353
priv->nic_info.unset_port = mlx5e_vxlan_unset_port;
5354-
priv->nic_info.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
5355-
UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN;
5354+
priv->nic_info.flags = UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN;
53565355
priv->nic_info.tables[0].tunnel_types = UDP_TUNNEL_TYPE_VXLAN;
53575356
/* Don't count the space hard-coded to the IANA port */
53585357
priv->nic_info.tables[0].n_entries =

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,8 +2394,7 @@ static int nfp_udp_tunnel_sync(struct net_device *netdev, unsigned int table)
23942394

23952395
static const struct udp_tunnel_nic_info nfp_udp_tunnels = {
23962396
.sync_table = nfp_udp_tunnel_sync,
2397-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
2398-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
2397+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
23992398
.tables = {
24002399
{
24012400
.n_entries = NFP_NET_N_VXLAN_PORTS,

drivers/net/ethernet/qlogic/qede/qede_filter.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,20 +987,17 @@ static int qede_udp_tunnel_sync(struct net_device *dev, unsigned int table)
987987

988988
static const struct udp_tunnel_nic_info qede_udp_tunnels_both = {
989989
.sync_table = qede_udp_tunnel_sync,
990-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP,
991990
.tables = {
992991
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
993992
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
994993
},
995994
}, qede_udp_tunnels_vxlan = {
996995
.sync_table = qede_udp_tunnel_sync,
997-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP,
998996
.tables = {
999997
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
1000998
},
1001999
}, qede_udp_tunnels_geneve = {
10021000
.sync_table = qede_udp_tunnel_sync,
1003-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP,
10041001
.tables = {
10051002
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
10061003
},

drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ static int qlcnic_udp_tunnel_sync(struct net_device *dev, unsigned int table)
486486

487487
static const struct udp_tunnel_nic_info qlcnic_udp_tunnels = {
488488
.sync_table = qlcnic_udp_tunnel_sync,
489-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP,
490489
.tables = {
491490
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
492491
},

0 commit comments

Comments
 (0)