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 <mkubecek@suse.cz> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
This commit is contained in:
parent
96608c1672
commit
e39e9a86b9
|
@ -199,6 +199,7 @@ Kernel to userspace:
|
||||||
``ETHTOOL_MSG_LINKMODES_NTF`` link modes notification
|
``ETHTOOL_MSG_LINKMODES_NTF`` link modes notification
|
||||||
``ETHTOOL_MSG_LINKSTATE_GET_REPLY`` link state info
|
``ETHTOOL_MSG_LINKSTATE_GET_REPLY`` link state info
|
||||||
``ETHTOOL_MSG_DEBUG_GET_REPLY`` debugging settings
|
``ETHTOOL_MSG_DEBUG_GET_REPLY`` debugging settings
|
||||||
|
``ETHTOOL_MSG_DEBUG_NTF`` debugging settings notification
|
||||||
===================================== ================================
|
===================================== ================================
|
||||||
|
|
||||||
``GET`` requests are sent by userspace applications to retrieve device
|
``GET`` requests are sent by userspace applications to retrieve device
|
||||||
|
|
|
@ -38,6 +38,7 @@ enum {
|
||||||
ETHTOOL_MSG_LINKMODES_NTF,
|
ETHTOOL_MSG_LINKMODES_NTF,
|
||||||
ETHTOOL_MSG_LINKSTATE_GET_REPLY,
|
ETHTOOL_MSG_LINKSTATE_GET_REPLY,
|
||||||
ETHTOOL_MSG_DEBUG_GET_REPLY,
|
ETHTOOL_MSG_DEBUG_GET_REPLY,
|
||||||
|
ETHTOOL_MSG_DEBUG_NTF,
|
||||||
|
|
||||||
/* add new constants above here */
|
/* add new constants above here */
|
||||||
__ETHTOOL_MSG_KERNEL_CNT,
|
__ETHTOOL_MSG_KERNEL_CNT,
|
||||||
|
|
|
@ -123,6 +123,7 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
|
||||||
goto out_ops;
|
goto out_ops;
|
||||||
|
|
||||||
dev->ethtool_ops->set_msglevel(dev, msg_mask);
|
dev->ethtool_ops->set_msglevel(dev, msg_mask);
|
||||||
|
ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL);
|
||||||
|
|
||||||
out_ops:
|
out_ops:
|
||||||
ethnl_ops_complete(dev);
|
ethnl_ops_complete(dev);
|
||||||
|
|
|
@ -2546,6 +2546,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
|
||||||
case ETHTOOL_SMSGLVL:
|
case ETHTOOL_SMSGLVL:
|
||||||
rc = ethtool_set_value_void(dev, useraddr,
|
rc = ethtool_set_value_void(dev, useraddr,
|
||||||
dev->ethtool_ops->set_msglevel);
|
dev->ethtool_ops->set_msglevel);
|
||||||
|
if (!rc)
|
||||||
|
ethtool_notify(dev, ETHTOOL_MSG_DEBUG_NTF, NULL);
|
||||||
break;
|
break;
|
||||||
case ETHTOOL_GEEE:
|
case ETHTOOL_GEEE:
|
||||||
rc = ethtool_get_eee(dev, useraddr);
|
rc = ethtool_get_eee(dev, useraddr);
|
||||||
|
|
|
@ -526,6 +526,7 @@ static const struct ethnl_request_ops *
|
||||||
ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {
|
ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {
|
||||||
[ETHTOOL_MSG_LINKINFO_NTF] = ðnl_linkinfo_request_ops,
|
[ETHTOOL_MSG_LINKINFO_NTF] = ðnl_linkinfo_request_ops,
|
||||||
[ETHTOOL_MSG_LINKMODES_NTF] = ðnl_linkmodes_request_ops,
|
[ETHTOOL_MSG_LINKMODES_NTF] = ðnl_linkmodes_request_ops,
|
||||||
|
[ETHTOOL_MSG_DEBUG_NTF] = ðnl_debug_request_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* default notification handler */
|
/* default notification handler */
|
||||||
|
@ -609,6 +610,7 @@ typedef void (*ethnl_notify_handler_t)(struct net_device *dev, unsigned int cmd,
|
||||||
static const ethnl_notify_handler_t ethnl_notify_handlers[] = {
|
static const ethnl_notify_handler_t ethnl_notify_handlers[] = {
|
||||||
[ETHTOOL_MSG_LINKINFO_NTF] = ethnl_default_notify,
|
[ETHTOOL_MSG_LINKINFO_NTF] = ethnl_default_notify,
|
||||||
[ETHTOOL_MSG_LINKMODES_NTF] = ethnl_default_notify,
|
[ETHTOOL_MSG_LINKMODES_NTF] = ethnl_default_notify,
|
||||||
|
[ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)
|
void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data)
|
||||||
|
|
Loading…
Reference in New Issue