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
232232 ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters
233233 ``ETHTOOL_MSG_PAUSE_NTF`` pause parameters
234234 ``ETHTOOL_MSG_EEE_GET_REPLY`` EEE settings
235+ ``ETHTOOL_MSG_EEE_NTF`` EEE settings
235236 ===================================== =================================
236237
237238 ``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
7171 ETHTOOL_MSG_PAUSE_GET_REPLY,
7272 ETHTOOL_MSG_PAUSE_NTF,
7373 ETHTOOL_MSG_EEE_GET_REPLY,
74+ ETHTOOL_MSG_EEE_NTF,
7475
7576 /* add new constants above here */
7677 __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
192192 goto out_ops;
193193
194194 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);
195198
196199 out_ops:
197200 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
13541354 static int ethtool_set_eee(struct net_device *dev, char __user *useraddr)
13551355 {
13561356 struct ethtool_eee edata;
1357+ int ret;
13571358
13581359 if (!dev->ethtool_ops->set_eee)
13591360 return -EOPNOTSUPP;
@@ -1361,7 +1362,10 @@ static int ethtool_set_eee(struct net_device *dev, char __user *useraddr) · 1 unmodified line
13611362 if (copy_from_user(&edata, useraddr, sizeof(edata)))
13621363 return -EFAULT;
13631364
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;
13651369 }
13661370
13671371 static 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
548548 [ETHTOOL_MSG_CHANNELS_NTF] = &ethnl_channels_request_ops,
549549 [ETHTOOL_MSG_COALESCE_NTF] = &ethnl_coalesce_request_ops,
550550 [ETHTOOL_MSG_PAUSE_NTF] = &ethnl_pause_request_ops,
551+ [ETHTOOL_MSG_EEE_NTF] = &ethnl_eee_request_ops,
551552 };
552553
553554 /* default notification handler */
@@ -639,6 +640,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = { · 85 unmodified lines
639640 [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify,
640641 [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify,
641642 [ETHTOOL_MSG_PAUSE_NTF] = ethnl_default_notify,
643+ [ETHTOOL_MSG_EEE_NTF] = ethnl_default_notify,
642644 };
643645
644646 void 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