Commit 111dcba3 authored by Michal Kubecek's avatar Michal Kubecek Committed by David S. Miller

ethtool: add PRIVFLAGS_NTF notification

Send ETHTOOL_MSG_PRIVFLAGS_NTF notification whenever private flags of
a network device are modified using ETHTOOL_MSG_PRIVFLAGS_SET netlink
message or ETHTOOL_SPFLAGS ioctl request.
Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f265d799
...@@ -51,6 +51,7 @@ enum { ...@@ -51,6 +51,7 @@ enum {
ETHTOOL_MSG_FEATURES_SET_REPLY, ETHTOOL_MSG_FEATURES_SET_REPLY,
ETHTOOL_MSG_FEATURES_NTF, ETHTOOL_MSG_FEATURES_NTF,
ETHTOOL_MSG_PRIVFLAGS_GET_REPLY, ETHTOOL_MSG_PRIVFLAGS_GET_REPLY,
ETHTOOL_MSG_PRIVFLAGS_NTF,
/* add new constants above here */ /* add new constants above here */
__ETHTOOL_MSG_KERNEL_CNT, __ETHTOOL_MSG_KERNEL_CNT,
......
...@@ -2716,6 +2716,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) ...@@ -2716,6 +2716,8 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
case ETHTOOL_GPFLAGS: case ETHTOOL_GPFLAGS:
rc = ethtool_get_value(dev, useraddr, ethcmd, rc = ethtool_get_value(dev, useraddr, ethcmd,
dev->ethtool_ops->get_priv_flags); dev->ethtool_ops->get_priv_flags);
if (!rc)
ethtool_notify(dev, ETHTOOL_MSG_PRIVFLAGS_NTF, NULL);
break; break;
case ETHTOOL_SPFLAGS: case ETHTOOL_SPFLAGS:
rc = ethtool_set_value(dev, useraddr, rc = ethtool_set_value(dev, useraddr,
......
...@@ -530,6 +530,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = { ...@@ -530,6 +530,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = {
[ETHTOOL_MSG_DEBUG_NTF] = &ethnl_debug_request_ops, [ETHTOOL_MSG_DEBUG_NTF] = &ethnl_debug_request_ops,
[ETHTOOL_MSG_WOL_NTF] = &ethnl_wol_request_ops, [ETHTOOL_MSG_WOL_NTF] = &ethnl_wol_request_ops,
[ETHTOOL_MSG_FEATURES_NTF] = &ethnl_features_request_ops, [ETHTOOL_MSG_FEATURES_NTF] = &ethnl_features_request_ops,
[ETHTOOL_MSG_PRIVFLAGS_NTF] = &ethnl_privflags_request_ops,
}; };
/* default notification handler */ /* default notification handler */
...@@ -616,6 +617,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = { ...@@ -616,6 +617,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = {
[ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify, [ETHTOOL_MSG_DEBUG_NTF] = ethnl_default_notify,
[ETHTOOL_MSG_WOL_NTF] = ethnl_default_notify, [ETHTOOL_MSG_WOL_NTF] = ethnl_default_notify,
[ETHTOOL_MSG_FEATURES_NTF] = ethnl_default_notify, [ETHTOOL_MSG_FEATURES_NTF] = ethnl_default_notify,
[ETHTOOL_MSG_PRIVFLAGS_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)
......
...@@ -194,6 +194,9 @@ int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info) ...@@ -194,6 +194,9 @@ int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info)
if (ret < 0 || !mod) if (ret < 0 || !mod)
goto out_free; goto out_free;
ret = ops->set_priv_flags(dev, flags); ret = ops->set_priv_flags(dev, flags);
if (ret < 0)
goto out_free;
ethtool_notify(dev, ETHTOOL_MSG_PRIVFLAGS_NTF, NULL);
out_free: out_free:
kfree(names); kfree(names);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment