Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ethtool: add PAUSE_NTF notification

Send ETHTOOL_MSG_PAUSE_NTF notification whenever pause parameters of
a network device are modified using ETHTOOL_MSG_PAUSE_SET netlink message
or ETHTOOL_SPAUSEPARAM ioctl request.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michal Kubecek and committed by
David S. Miller
bf37faa3 3ab87993

+12 -1
+1
Documentation/networking/ethtool-netlink.rst
··· 228 228 ``ETHTOOL_MSG_COALESCE_GET_REPLY`` coalescing parameters 229 229 ``ETHTOOL_MSG_COALESCE_NTF`` coalescing parameters 230 230 ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters 231 + ``ETHTOOL_MSG_PAUSE_NTF`` pause parameters 231 232 ===================================== ================================= 232 233 233 234 ``GET`` requests are sent by userspace applications to retrieve device
+1
include/uapi/linux/ethtool_netlink.h
··· 67 67 ETHTOOL_MSG_COALESCE_GET_REPLY, 68 68 ETHTOOL_MSG_COALESCE_NTF, 69 69 ETHTOOL_MSG_PAUSE_GET_REPLY, 70 + ETHTOOL_MSG_PAUSE_NTF, 70 71 71 72 /* add new constants above here */ 72 73 __ETHTOOL_MSG_KERNEL_CNT,
+5 -1
net/ethtool/ioctl.c
··· 1705 1705 static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) 1706 1706 { 1707 1707 struct ethtool_pauseparam pauseparam; 1708 + int ret; 1708 1709 1709 1710 if (!dev->ethtool_ops->set_pauseparam) 1710 1711 return -EOPNOTSUPP; ··· 1713 1712 if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) 1714 1713 return -EFAULT; 1715 1714 1716 - return dev->ethtool_ops->set_pauseparam(dev, &pauseparam); 1715 + ret = dev->ethtool_ops->set_pauseparam(dev, &pauseparam); 1716 + if (!ret) 1717 + ethtool_notify(dev, ETHTOOL_MSG_PAUSE_NTF, NULL); 1718 + return ret; 1717 1719 } 1718 1720 1719 1721 static int ethtool_self_test(struct net_device *dev, char __user *useraddr)
+2
net/ethtool/netlink.c
··· 546 546 [ETHTOOL_MSG_RINGS_NTF] = &ethnl_rings_request_ops, 547 547 [ETHTOOL_MSG_CHANNELS_NTF] = &ethnl_channels_request_ops, 548 548 [ETHTOOL_MSG_COALESCE_NTF] = &ethnl_coalesce_request_ops, 549 + [ETHTOOL_MSG_PAUSE_NTF] = &ethnl_pause_request_ops, 549 550 }; 550 551 551 552 /* default notification handler */ ··· 637 636 [ETHTOOL_MSG_RINGS_NTF] = ethnl_default_notify, 638 637 [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify, 639 638 [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify, 639 + [ETHTOOL_MSG_PAUSE_NTF] = ethnl_default_notify, 640 640 }; 641 641 642 642 void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)
+3
net/ethtool/pause.c
··· 131 131 goto out_ops; 132 132 133 133 ret = dev->ethtool_ops->set_pauseparam(dev, &params); 134 + if (ret < 0) 135 + goto out_ops; 136 + ethtool_notify(dev, ETHTOOL_MSG_PAUSE_NTF, NULL); 134 137 135 138 out_ops: 136 139 ethnl_ops_complete(dev);