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

ethtool: add EEE_NTF notification

Send ETHTOOL_MSG_EEE_NTF notification whenever EEE settings of a network
device are modified using ETHTOOL_MSG_EEE_SET netlink message or
ETHTOOL_SEEE 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
6c5bc8fe fd77be7b

+12 -1
+1
Documentation/networking/ethtool-netlink.rst
··· 232 232 ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters 233 233 ``ETHTOOL_MSG_PAUSE_NTF`` pause parameters 234 234 ``ETHTOOL_MSG_EEE_GET_REPLY`` EEE settings 235 + ``ETHTOOL_MSG_EEE_NTF`` EEE settings 235 236 ===================================== ================================= 236 237 237 238 ``GET`` requests are sent by userspace applications to retrieve device
+1
include/uapi/linux/ethtool_netlink.h
··· 71 71 ETHTOOL_MSG_PAUSE_GET_REPLY, 72 72 ETHTOOL_MSG_PAUSE_NTF, 73 73 ETHTOOL_MSG_EEE_GET_REPLY, 74 + ETHTOOL_MSG_EEE_NTF, 74 75 75 76 /* add new constants above here */ 76 77 __ETHTOOL_MSG_KERNEL_CNT,
+3
net/ethtool/eee.c
··· 192 192 goto out_ops; 193 193 194 194 ret = dev->ethtool_ops->set_eee(dev, &eee); 195 + if (ret < 0) 196 + goto out_ops; 197 + ethtool_notify(dev, ETHTOOL_MSG_EEE_NTF, NULL); 195 198 196 199 out_ops: 197 200 ethnl_ops_complete(dev);
+5 -1
net/ethtool/ioctl.c
··· 1354 1354 static int ethtool_set_eee(struct net_device *dev, char __user *useraddr) 1355 1355 { 1356 1356 struct ethtool_eee edata; 1357 + int ret; 1357 1358 1358 1359 if (!dev->ethtool_ops->set_eee) 1359 1360 return -EOPNOTSUPP; ··· 1362 1361 if (copy_from_user(&edata, useraddr, sizeof(edata))) 1363 1362 return -EFAULT; 1364 1363 1365 - return dev->ethtool_ops->set_eee(dev, &edata); 1364 + ret = dev->ethtool_ops->set_eee(dev, &edata); 1365 + if (!ret) 1366 + ethtool_notify(dev, ETHTOOL_MSG_EEE_NTF, NULL); 1367 + return ret; 1366 1368 } 1367 1369 1368 1370 static int ethtool_nway_reset(struct net_device *dev)
+2
net/ethtool/netlink.c
··· 548 548 [ETHTOOL_MSG_CHANNELS_NTF] = &ethnl_channels_request_ops, 549 549 [ETHTOOL_MSG_COALESCE_NTF] = &ethnl_coalesce_request_ops, 550 550 [ETHTOOL_MSG_PAUSE_NTF] = &ethnl_pause_request_ops, 551 + [ETHTOOL_MSG_EEE_NTF] = &ethnl_eee_request_ops, 551 552 }; 552 553 553 554 /* default notification handler */ ··· 640 639 [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify, 641 640 [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify, 642 641 [ETHTOOL_MSG_PAUSE_NTF] = ethnl_default_notify, 642 + [ETHTOOL_MSG_EEE_NTF] = ethnl_default_notify, 643 643 }; 644 644 645 645 void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)