History

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.

Michal Kubecek committed 6 years ago

Commit 6c5bc8f1 parent fd77be75 files · +12 −1Browse files

Unified · Split

5 files
  1. Documentation/networking/ethtool-netlink.rst +1 −0
  2. include/uapi/linux/ethtool_netlink.h +1 −0
  3. net/ethtool/eee.c +3 −0
  4. net/ethtool/ioctl.c +5 −1
  5. net/ethtool/netlink.c +2 −0
Documentation/networking/ethtool-netlink.rst+1−0
@@ -232,6 +232,7 @@ Kernel to userspace: · 231 unmodified lines
232 ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters232 ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters
233 ``ETHTOOL_MSG_PAUSE_NTF`` pause parameters233 ``ETHTOOL_MSG_PAUSE_NTF`` pause parameters
234 ``ETHTOOL_MSG_EEE_GET_REPLY`` EEE settings234 ``ETHTOOL_MSG_EEE_GET_REPLY`` EEE settings
235 ``ETHTOOL_MSG_EEE_NTF`` EEE settings
235 ===================================== =================================236 ===================================== =================================
236 237
237``GET`` requests are sent by userspace applications to retrieve device238``GET`` requests are sent by userspace applications to retrieve device
include/uapi/linux/ethtool_netlink.h+1−0
@@ -71,6 +71,7 @@ enum { · 70 unmodified lines
71 ETHTOOL_MSG_PAUSE_GET_REPLY,71 ETHTOOL_MSG_PAUSE_GET_REPLY,
72 ETHTOOL_MSG_PAUSE_NTF,72 ETHTOOL_MSG_PAUSE_NTF,
73 ETHTOOL_MSG_EEE_GET_REPLY,73 ETHTOOL_MSG_EEE_GET_REPLY,
74 ETHTOOL_MSG_EEE_NTF,
74 75
75 /* add new constants above here */76 /* add new constants above here */
76 __ETHTOOL_MSG_KERNEL_CNT,77 __ETHTOOL_MSG_KERNEL_CNT,
net/ethtool/eee.c+3−0
@@ -192,6 +192,9 @@ int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info) · 191 unmodified lines
192 goto out_ops;192 goto out_ops;
193 193
194 ret = dev->ethtool_ops->set_eee(dev, &eee);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
196out_ops:199out_ops:
197 ethnl_ops_complete(dev);200 ethnl_ops_complete(dev);
net/ethtool/ioctl.c+5−1
@@ -1354,6 +1354,7 @@ static int ethtool_get_eee(struct net_device *dev, char __user *useraddr) · 1353 unmodified lines
1354static int ethtool_set_eee(struct net_device *dev, char __user *useraddr)1354static int ethtool_set_eee(struct net_device *dev, char __user *useraddr)
1355{1355{
1356 struct ethtool_eee edata;1356 struct ethtool_eee edata;
1357 int ret;
1357 1358
1358 if (!dev->ethtool_ops->set_eee)1359 if (!dev->ethtool_ops->set_eee)
1359 return -EOPNOTSUPP;1360 return -EOPNOTSUPP;
@@ -1361,7 +1362,10 @@ static int ethtool_set_eee(struct net_device *dev, char __user *useraddr) · 1 unmodified line
1361 if (copy_from_user(&edata, useraddr, sizeof(edata)))1362 if (copy_from_user(&edata, useraddr, sizeof(edata)))
1362 return -EFAULT;1363 return -EFAULT;
1363 1364
1364 return dev->ethtool_ops->set_eee(dev, &edata);1365 ret = dev->ethtool_ops->set_eee(dev, &edata);
1366 if (!ret)
1367 ethtool_notify(dev, ETHTOOL_MSG_EEE_NTF, NULL);
1368 return ret;
1365}1369}
1366 1370
1367static int ethtool_nway_reset(struct net_device *dev)1371static int ethtool_nway_reset(struct net_device *dev)
net/ethtool/netlink.c+2−0
@@ -548,6 +548,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = { · 547 unmodified lines
548 [ETHTOOL_MSG_CHANNELS_NTF] = &ethnl_channels_request_ops,548 [ETHTOOL_MSG_CHANNELS_NTF] = &ethnl_channels_request_ops,
549 [ETHTOOL_MSG_COALESCE_NTF] = &ethnl_coalesce_request_ops,549 [ETHTOOL_MSG_COALESCE_NTF] = &ethnl_coalesce_request_ops,
550 [ETHTOOL_MSG_PAUSE_NTF] = &ethnl_pause_request_ops,550 [ETHTOOL_MSG_PAUSE_NTF] = &ethnl_pause_request_ops,
551 [ETHTOOL_MSG_EEE_NTF] = &ethnl_eee_request_ops,
551};552};
552 553
553/* default notification handler */554/* default notification handler */
@@ -639,6 +640,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = { · 85 unmodified lines
639 [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify,640 [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify,
640 [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify,641 [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify,
641 [ETHTOOL_MSG_PAUSE_NTF] = ethnl_default_notify,642 [ETHTOOL_MSG_PAUSE_NTF] = ethnl_default_notify,
643 [ETHTOOL_MSG_EEE_NTF] = ethnl_default_notify,
642};644};
643 645
644void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)646void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t