Skip to content

Commit 1ead750

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
udp_tunnel: remove rtnl_lock dependency
Drivers that are using ops lock and don't depend on RTNL lock still need to manage it because udp_tunnel's RTNL dependency. Introduce new udp_tunnel_nic_lock and use it instead of rtnl_lock. Drop non-UDP_TUNNEL_NIC_INFO_MAY_SLEEP mode from udp_tunnel infra (udp_tunnel_nic_device_sync_work needs to grab udp_tunnel_nic_lock mutex and might sleep). Cover more places in v4: - netlink - udp_tunnel_notify_add_rx_port (ndo_open) - triggers udp_tunnel_nic_device_sync_work - udp_tunnel_notify_del_rx_port (ndo_stop) - triggers udp_tunnel_nic_device_sync_work - udp_tunnel_get_rx_info (__netdev_update_features) - triggers NETDEV_UDP_TUNNEL_PUSH_INFO - udp_tunnel_drop_rx_info (__netdev_update_features) - triggers NETDEV_UDP_TUNNEL_DROP_INFO - udp_tunnel_nic_reset_ntf (ndo_open) - notifiers - udp_tunnel_nic_netdevice_event, depending on the event: - triggers NETDEV_UDP_TUNNEL_PUSH_INFO - triggers NETDEV_UDP_TUNNEL_DROP_INFO - ethnl_tunnel_info_reply_size - udp_tunnel_nic_set_port_priv (two intel drivers) Cc: Michael Chan <[email protected]> Suggested-by: Jakub Kicinski <[email protected]> Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent df5425b commit 1ead750

File tree

16 files changed

+142
-73
lines changed

16 files changed

+142
-73
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: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15573,17 +15573,15 @@ static int bnxt_udp_tunnel_unset_port(struct net_device *netdev, unsigned int ta
1557315573
static const struct udp_tunnel_nic_info bnxt_udp_tunnels = {
1557415574
.set_port = bnxt_udp_tunnel_set_port,
1557515575
.unset_port = bnxt_udp_tunnel_unset_port,
15576-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
15577-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
15576+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
1557815577
.tables = {
1557915578
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
1558015579
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },
1558115580
},
1558215581
}, bnxt_udp_tunnels_p7 = {
1558315582
.set_port = bnxt_udp_tunnel_set_port,
1558415583
.unset_port = bnxt_udp_tunnel_unset_port,
15585-
.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
15586-
UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
15584+
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
1558715585
.tables = {
1558815586
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
1558915587
{ .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, },

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)