mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
Merge branch 'mlxsw-make-the-driver-ops-locked'
Ido Schimmel says: ==================== mlxsw: Make the driver ops-locked Make the driver ops-locked in order to allow ethtool operations to be invoked without RTNL being held. An ops-locked driver has most of its NDOs, all of its ethtool operations and some net device notifications run with the netdev instance lock held. In the specific case of mlxsw, the driver is not using any functions that acquire this lock nor functions that expect the lock to be held for an ops-locked driver. Therefore, converting its NDOs to run with the lock being held is trivial except for a small quirk which is handled in patch #1. The driver does not generate any net device notifications, so there is no risk of nested notifications of the ops-locked types. For the notifications that run under the instance lock, RTNL is also held, and the driver does not acquire the instance lock itself, so no changes are required in its notifier handling. Ethtool operations can be invoked without RTNL except for two operations that are annotated in patch #2. Lastly, patch #3 converts the driver to be ops-locked. A probe on rtnl_lock() shows it is no longer taken when dumping statistics: # perf probe --add rtnl_lock Before: # perf stat -e probe:rtnl_lock -- ethtool -S swp1 --all-groups [...] 1 probe:rtnl_lock After: # perf stat -e probe:rtnl_lock -- ethtool -S swp1 --all-groups [...] 0 probe:rtnl_lock No issues were reported after running a full regression with a debug config that has lockdep enabled. ==================== Link: https://patch.msgid.link/20260708123933.1303291-1-idosch@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
commit
e0722efbcf
|
|
@ -663,8 +663,11 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,
|
|||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
static void mlxsw_sp_set_rx_mode(struct net_device *dev)
|
||||
static int mlxsw_sp_set_rx_mode_async(struct net_device *dev,
|
||||
struct netdev_hw_addr_list *uc,
|
||||
struct netdev_hw_addr_list *mc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlxsw_sp_port_set_mac_address(struct net_device *dev, void *p)
|
||||
|
|
@ -1191,7 +1194,7 @@ static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
|
|||
.ndo_stop = mlxsw_sp_port_stop,
|
||||
.ndo_start_xmit = mlxsw_sp_port_xmit,
|
||||
.ndo_setup_tc = mlxsw_sp_setup_tc,
|
||||
.ndo_set_rx_mode = mlxsw_sp_set_rx_mode,
|
||||
.ndo_set_rx_mode_async = mlxsw_sp_set_rx_mode_async,
|
||||
.ndo_set_mac_address = mlxsw_sp_port_set_mac_address,
|
||||
.ndo_change_mtu = mlxsw_sp_port_change_mtu,
|
||||
.ndo_get_stats64 = mlxsw_sp_port_get_stats64,
|
||||
|
|
@ -1549,6 +1552,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
|
|||
dev->vlan_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
|
||||
dev->lltx = true;
|
||||
dev->netns_immutable = true;
|
||||
dev->request_ops_lock = true;
|
||||
|
||||
dev->min_mtu = ETH_MIN_MTU;
|
||||
dev->max_mtu = MLXSW_PORT_MAX_MTU - MLXSW_PORT_ETH_FRAME_HDR;
|
||||
|
|
|
|||
|
|
@ -1262,6 +1262,8 @@ mlxsw_sp_set_module_power_mode(struct net_device *dev,
|
|||
|
||||
const struct ethtool_ops mlxsw_sp_port_ethtool_ops = {
|
||||
.cap_link_lanes_supported = true,
|
||||
.op_needs_rtnl = ETHTOOL_OP_NEEDS_RTNL_SPAUSEPARAM |
|
||||
ETHTOOL_OP_NEEDS_RTNL_GLINK,
|
||||
.get_drvinfo = mlxsw_sp_port_get_drvinfo,
|
||||
.get_link = ethtool_op_get_link,
|
||||
.get_link_ext_state = mlxsw_sp_port_get_link_ext_state,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user