mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-25 11:32:24 +00:00
net: hold netdev instance lock during sysfs operations
Most of them are already covered by the converted dev_xxx APIs. Add the locking wrappers for the remaining ones. Cc: Saeed Mahameed <saeed@kernel.org> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250305163732.2766420-9-sdf@fomichev.me Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
ffb7ed19ac
commit
ad7c7b2172
@@ -252,3 +252,68 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_set_mtu);
|
||||
|
||||
/**
|
||||
* dev_disable_lro() - disable Large Receive Offload on a device
|
||||
* @dev: device
|
||||
*
|
||||
* Disable Large Receive Offload (LRO) on a net device. Must be
|
||||
* called under RTNL. This is needed if received packets may be
|
||||
* forwarded to another interface.
|
||||
*/
|
||||
void dev_disable_lro(struct net_device *dev)
|
||||
{
|
||||
netdev_lock_ops(dev);
|
||||
netif_disable_lro(dev);
|
||||
netdev_unlock_ops(dev);
|
||||
}
|
||||
EXPORT_SYMBOL(dev_disable_lro);
|
||||
|
||||
/**
|
||||
* dev_set_allmulti() - update allmulti count on a device
|
||||
* @dev: device
|
||||
* @inc: modifier
|
||||
*
|
||||
* Add or remove reception of all multicast frames to a device. While the
|
||||
* count in the device remains above zero the interface remains listening
|
||||
* to all interfaces. Once it hits zero the device reverts back to normal
|
||||
* filtering operation. A negative @inc value is used to drop the counter
|
||||
* when releasing a resource needing all multicasts.
|
||||
*
|
||||
* Return: 0 on success, -errno on failure.
|
||||
*/
|
||||
|
||||
int dev_set_allmulti(struct net_device *dev, int inc)
|
||||
{
|
||||
int ret;
|
||||
|
||||
netdev_lock_ops(dev);
|
||||
ret = netif_set_allmulti(dev, inc, true);
|
||||
netdev_unlock_ops(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_set_allmulti);
|
||||
|
||||
/**
|
||||
* dev_set_mac_address() - change Media Access Control Address
|
||||
* @dev: device
|
||||
* @sa: new address
|
||||
* @extack: netlink extended ack
|
||||
*
|
||||
* Change the hardware (MAC) address of the device
|
||||
*
|
||||
* Return: 0 on success, -errno on failure.
|
||||
*/
|
||||
int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int ret;
|
||||
|
||||
netdev_lock_ops(dev);
|
||||
ret = netif_set_mac_address(dev, sa, extack);
|
||||
netdev_unlock_ops(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_set_mac_address);
|
||||
|
||||
Reference in New Issue
Block a user