History

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.

Michal Kubecek committed 6 years ago

Commit 0bda7af1 parent e54d04e5 files · +7 −0Browse 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/debug.c +1 −0
  4. net/ethtool/ioctl.c +2 −0
  5. net/ethtool/netlink.c +2 −0
Documentation/networking/ethtool-netlink.rst+1−0
@@ -199,6 +199,7 @@ Kernel to userspace: · 198 unmodified lines
199 ``ETHTOOL_MSG_LINKMODES_NTF`` link modes notification199 ``ETHTOOL_MSG_LINKMODES_NTF`` link modes notification
200 ``ETHTOOL_MSG_LINKSTATE_GET_REPLY`` link state info200 ``ETHTOOL_MSG_LINKSTATE_GET_REPLY`` link state info
201 ``ETHTOOL_MSG_DEBUG_GET_REPLY`` debugging settings201 ``ETHTOOL_MSG_DEBUG_GET_REPLY`` debugging settings
202 ``ETHTOOL_MSG_DEBUG_NTF`` debugging settings notification
202 ===================================== ================================203 ===================================== ================================
203 204
204``GET`` requests are sent by userspace applications to retrieve device205``GET`` requests are sent by userspace applications to retrieve device
include/uapi/linux/ethtool_netlink.h+1−0
@@ -38,6 +38,7 @@ enum { · 37 unmodified lines
38 ETHTOOL_MSG_LINKMODES_NTF,38 ETHTOOL_MSG_LINKMODES_NTF,
39 ETHTOOL_MSG_LINKSTATE_GET_REPLY,39 ETHTOOL_MSG_LINKSTATE_GET_REPLY,
40 ETHTOOL_MSG_DEBUG_GET_REPLY,40 ETHTOOL_MSG_DEBUG_GET_REPLY,
41 ETHTOOL_MSG_DEBUG_NTF,
41 42
42 /* add new constants above here */43 /* add new constants above here */
43 __ETHTOOL_MSG_KERNEL_CNT,44 __ETHTOOL_MSG_KERNEL_CNT,
net/ethtool/debug.c+1−0
@@ -123,6 +123,7 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info) · 122 unmodified lines
123 goto out_ops;123 goto out_ops;
124 124
125 dev->ethtool_ops->set_msglevel(dev, msg_mask);125 dev->ethtool_ops->set_msglevel(dev, msg_mask);
126 ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL);
126 127
127out_ops:128out_ops:
128 ethnl_ops_complete(dev);129 ethnl_ops_complete(dev);
net/ethtool/ioctl.c+2−0
@@ -2545,6 +2545,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) · 2544 unmodified lines
2545 case ETHTOOL_SMSGLVL:2545 case ETHTOOL_SMSGLVL:
2546 rc = ethtool_set_value_void(dev, useraddr,2546 rc = ethtool_set_value_void(dev, useraddr,
2547 dev->ethtool_ops->set_msglevel);2547 dev->ethtool_ops->set_msglevel);
2548 if (!rc)
2549 ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL);
2548 break;2550 break;
2549 case ETHTOOL_GEEE:2551 case ETHTOOL_GEEE:
2550 rc = ethtool_get_eee(dev, useraddr);2552 rc = ethtool_get_eee(dev, useraddr);
net/ethtool/netlink.c+2−0
@@ -524,6 +524,7 @@ static const struct ethnl_request_ops * · 523 unmodified lines
524ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {524ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {
525 [ETHTOOL_MSG_LINKINFO_NTF] = &ethnl_linkinfo_request_ops,525 [ETHTOOL_MSG_LINKINFO_NTF] = &ethnl_linkinfo_request_ops,
526 [ETHTOOL_MSG_LINKMODES_NTF] = &ethnl_linkmodes_request_ops,526 [ETHTOOL_MSG_LINKMODES_NTF] = &ethnl_linkmodes_request_ops,
527 [ETHTOOL_MSG_DEBUG_NTF] = &ethnl_debug_request_ops,
527};528};
528 529
529/* default notification handler */530/* default notification handler */
@@ -607,6 +608,7 @@ typedef void (*ethnl_notify_handler_t)(struct net_device *dev, unsigned int cmd, · 77 unmodified lines
607static const ethnl_notify_handler_t ethnl_notify_handlers[] = {608static const ethnl_notify_handler_t ethnl_notify_handlers[] = {
608 [ETHTOOL_MSG_LINKINFO_NTF] = ethnl_default_notify,609 [ETHTOOL_MSG_LINKINFO_NTF] = ethnl_default_notify,
609 [ETHTOOL_MSG_LINKMODES_NTF] = ethnl_default_notify,610 [ETHTOOL_MSG_LINKMODES_NTF] = ethnl_default_notify,
611 [ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify,
610};612};
611 613
612void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)614void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)