Skip to content

Commit 0bda7af

Browse files
mkubecekdavem330
authored andcommitted
ethtool: add DEBUG_NTF notification
Send ETHTOOL_MSG_DEBUG_NTF notification message whenever debugging message mask for a device are modified using ETHTOOL_MSG_DEBUG_SET netlink message or ETHTOOL_SMSGLVL ioctl request. The notification message has the same format as reply to DEBUG_GET request. As with other ethtool notifications, netlink requests only trigger the notification if the mask is actually changed while ioctl request trigger it whenever the request results in calling the ethtool_ops handler. Signed-off-by: Michal Kubecek <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e54d04e commit 0bda7af

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

Documentation/networking/ethtool-netlink.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ Kernel to userspace:
199199
``ETHTOOL_MSG_LINKMODES_NTF`` link modes notification
200200
``ETHTOOL_MSG_LINKSTATE_GET_REPLY`` link state info
201201
``ETHTOOL_MSG_DEBUG_GET_REPLY`` debugging settings
202+
``ETHTOOL_MSG_DEBUG_NTF`` debugging settings notification
202203
===================================== ================================
203204

204205
``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
@@ -38,6 +38,7 @@ enum {
3838
ETHTOOL_MSG_LINKMODES_NTF,
3939
ETHTOOL_MSG_LINKSTATE_GET_REPLY,
4040
ETHTOOL_MSG_DEBUG_GET_REPLY,
41+
ETHTOOL_MSG_DEBUG_NTF,
4142

4243
/* add new constants above here */
4344
__ETHTOOL_MSG_KERNEL_CNT,

net/ethtool/debug.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
123123
goto out_ops;
124124

125125
dev->ethtool_ops->set_msglevel(dev, msg_mask);
126+
ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL);
126127

127128
out_ops:
128129
ethnl_ops_complete(dev);

net/ethtool/ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,6 +2545,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
25452545
case ETHTOOL_SMSGLVL:
25462546
rc = ethtool_set_value_void(dev, useraddr,
25472547
dev->ethtool_ops->set_msglevel);
2548+
if (!rc)
2549+
ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL);
25482550
break;
25492551
case ETHTOOL_GEEE:
25502552
rc = ethtool_get_eee(dev, useraddr);

net/ethtool/netlink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ static const struct ethnl_request_ops *
524524
ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {
525525
[ETHTOOL_MSG_LINKINFO_NTF] = &ethnl_linkinfo_request_ops,
526526
[ETHTOOL_MSG_LINKMODES_NTF] = &ethnl_linkmodes_request_ops,
527+
[ETHTOOL_MSG_DEBUG_NTF] = &ethnl_debug_request_ops,
527528
};
528529

529530
/* default notification handler */
@@ -607,6 +608,7 @@ typedef void (*ethnl_notify_handler_t)(struct net_device *dev, unsigned int cmd,
607608
static const ethnl_notify_handler_t ethnl_notify_handlers[] = {
608609
[ETHTOOL_MSG_LINKINFO_NTF] = ethnl_default_notify,
609610
[ETHTOOL_MSG_LINKMODES_NTF] = ethnl_default_notify,
611+
[ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify,
610612
};
611613

612614
void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)

0 commit comments

Comments
 (0)