Send ETHTOOL_MSG_PAUSE_NTF notification whenever pause parameters of a network device are modified using ETHTOOL_MSG_PAUSE_SET netlink message or ETHTOOL_SPAUSEPARAM ioctl request.
Unified · Split
| @@ -228,6 +228,7 @@ Kernel to userspace: · 227 unmodified lines | |||
| 228 | ``ETHTOOL_MSG_COALESCE_GET_REPLY`` coalescing parameters | 228 | ``ETHTOOL_MSG_COALESCE_GET_REPLY`` coalescing parameters |
| 229 | ``ETHTOOL_MSG_COALESCE_NTF`` coalescing parameters | 229 | ``ETHTOOL_MSG_COALESCE_NTF`` coalescing parameters |
| 230 | ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters | 230 | ``ETHTOOL_MSG_PAUSE_GET_REPLY`` pause parameters |
| 231 | ``ETHTOOL_MSG_PAUSE_NTF`` pause parameters | ||
| 231 | ===================================== ================================= | 232 | ===================================== ================================= |
| 232 | 233 | ||
| 233 | ``GET`` requests are sent by userspace applications to retrieve device | 234 | ``GET`` requests are sent by userspace applications to retrieve device |
| @@ -67,6 +67,7 @@ enum { · 66 unmodified lines | |||
| 67 | ETHTOOL_MSG_COALESCE_GET_REPLY, | 67 | ETHTOOL_MSG_COALESCE_GET_REPLY, |
| 68 | ETHTOOL_MSG_COALESCE_NTF, | 68 | ETHTOOL_MSG_COALESCE_NTF, |
| 69 | ETHTOOL_MSG_PAUSE_GET_REPLY, | 69 | ETHTOOL_MSG_PAUSE_GET_REPLY, |
| 70 | ETHTOOL_MSG_PAUSE_NTF, | ||
| 70 | 71 | ||
| 71 | /* add new constants above here */ | 72 | /* add new constants above here */ |
| 72 | __ETHTOOL_MSG_KERNEL_CNT, | 73 | __ETHTOOL_MSG_KERNEL_CNT, |
| @@ -1705,6 +1705,7 @@ static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) · 1704 unmodified lines | |||
| 1705 | static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) | 1705 | static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) |
| 1706 | { | 1706 | { |
| 1707 | struct ethtool_pauseparam pauseparam; | 1707 | struct ethtool_pauseparam pauseparam; |
| 1708 | int ret; | ||
| 1708 | 1709 | ||
| 1709 | if (!dev->ethtool_ops->set_pauseparam) | 1710 | if (!dev->ethtool_ops->set_pauseparam) |
| 1710 | return -EOPNOTSUPP; | 1711 | return -EOPNOTSUPP; |
| @@ -1712,7 +1713,10 @@ static int ethtool_set_pauseparam(struct net_device *dev, void __user *useraddr) · 1 unmodified line | |||
| 1712 | if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) | 1713 | if (copy_from_user(&pauseparam, useraddr, sizeof(pauseparam))) |
| 1713 | return -EFAULT; | 1714 | return -EFAULT; |
| 1714 | 1715 | ||
| 1715 | return dev->ethtool_ops->set_pauseparam(dev, &pauseparam); | 1716 | ret = dev->ethtool_ops->set_pauseparam(dev, &pauseparam); |
| 1717 | if (!ret) | ||
| 1718 | ethtool_notify(dev, ETHTOOL_MSG_PAUSE_NTF, NULL); | ||
| 1719 | return ret; | ||
| 1716 | } | 1720 | } |
| 1717 | 1721 | ||
| 1718 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) | 1722 | static int ethtool_self_test(struct net_device *dev, char __user *useraddr) |
| @@ -546,6 +546,7 @@ ethnl_default_notify_ops[ETHTOOL_MSG_KERNEL_MAX + 1] = { · 545 unmodified lines | |||
| 546 | [ETHTOOL_MSG_RINGS_NTF] = ðnl_rings_request_ops, | 546 | [ETHTOOL_MSG_RINGS_NTF] = ðnl_rings_request_ops, |
| 547 | [ETHTOOL_MSG_CHANNELS_NTF] = ðnl_channels_request_ops, | 547 | [ETHTOOL_MSG_CHANNELS_NTF] = ðnl_channels_request_ops, |
| 548 | [ETHTOOL_MSG_COALESCE_NTF] = ðnl_coalesce_request_ops, | 548 | [ETHTOOL_MSG_COALESCE_NTF] = ðnl_coalesce_request_ops, |
| 549 | [ETHTOOL_MSG_PAUSE_NTF] = ðnl_pause_request_ops, | ||
| 549 | }; | 550 | }; |
| 550 | 551 | ||
| 551 | /* default notification handler */ | 552 | /* default notification handler */ |
| @@ -636,6 +637,7 @@ static const ethnl_notify_handler_t ethnl_notify_handlers[] = { · 84 unmodified lines | |||
| 636 | [ETHTOOL_MSG_RINGS_NTF] = ethnl_default_notify, | 637 | [ETHTOOL_MSG_RINGS_NTF] = ethnl_default_notify, |
| 637 | [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify, | 638 | [ETHTOOL_MSG_CHANNELS_NTF] = ethnl_default_notify, |
| 638 | [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify, | 639 | [ETHTOOL_MSG_COALESCE_NTF] = ethnl_default_notify, |
| 640 | [ETHTOOL_MSG_PAUSE_NTF] = ethnl_default_notify, | ||
| 639 | }; | 641 | }; |
| 640 | 642 | ||
| 641 | void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data) | 643 | void ethtool_notify(struct net_device *dev, unsigned int cmd, const void *data) |
| @@ -131,6 +131,9 @@ int ethnl_set_pause(struct sk_buff *skb, struct genl_info *info) · 130 unmodified lines | |||
| 131 | goto out_ops; | 131 | goto out_ops; |
| 132 | 132 | ||
| 133 | ret = dev->ethtool_ops->set_pauseparam(dev, ¶ms); | 133 | ret = dev->ethtool_ops->set_pauseparam(dev, ¶ms); |
| 134 | if (ret < 0) | ||
| 135 | goto out_ops; | ||
| 136 | ethtool_notify(dev, ETHTOOL_MSG_PAUSE_NTF, NULL); | ||
| 134 | 137 | ||
| 135 | out_ops: | 138 | out_ops: |
| 136 | ethnl_ops_complete(dev); | 139 | ethnl_ops_complete(dev); |