Skip to content

Commit 6c5bc8f

Browse files
mkubecekdavem330
authored andcommitted
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>
1 parent fd77be7 commit 6c5bc8f

5 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎Documentation/networking/ethtool-netlink.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ Kernel to userspace:
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‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ enum {
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‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info)
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‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,14 +1354,18 @@ static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)
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;
13601361

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‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {
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[] = {
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)

0 commit comments

Comments
 (0)