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
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+1−0
@@ -38,6 +38,7 @@ enum { · 37 unmodified lines
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+1−0
@@ -123,6 +123,7 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info) · 122 unmodified lines
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+2−0
@@ -2545,6 +2545,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) · 2544 unmodified lines
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+2−0
@@ -524,6 +524,7 @@ static const struct ethnl_request_ops * · 523 unmodified lines
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, · 77 unmodified lines
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)