Commit d54151aa authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: ethtool: create and export ethtool_dev_mm_supported()

Create a wrapper over __ethtool_dev_mm_supported() which also calls
ethnl_ops_begin() and ethnl_ops_complete(). It can be used by other code
layers, such as tc, to make sure that preemptible TCs are supported
(this is true if an underlying MAC Merge layer exists).
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarFerenc Fejes <fejes@inf.elte.hu>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 85a4abed
...@@ -39,6 +39,7 @@ void ethtool_aggregate_pause_stats(struct net_device *dev, ...@@ -39,6 +39,7 @@ void ethtool_aggregate_pause_stats(struct net_device *dev,
struct ethtool_pause_stats *pause_stats); struct ethtool_pause_stats *pause_stats);
void ethtool_aggregate_rmon_stats(struct net_device *dev, void ethtool_aggregate_rmon_stats(struct net_device *dev,
struct ethtool_rmon_stats *rmon_stats); struct ethtool_rmon_stats *rmon_stats);
bool ethtool_dev_mm_supported(struct net_device *dev);
#else #else
static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd) static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd)
...@@ -112,5 +113,10 @@ ethtool_aggregate_rmon_stats(struct net_device *dev, ...@@ -112,5 +113,10 @@ ethtool_aggregate_rmon_stats(struct net_device *dev,
{ {
} }
static inline bool ethtool_dev_mm_supported(struct net_device *dev)
{
return false;
}
#endif /* IS_ENABLED(CONFIG_ETHTOOL_NETLINK) */ #endif /* IS_ENABLED(CONFIG_ETHTOOL_NETLINK) */
#endif /* _LINUX_ETHTOOL_NETLINK_H_ */ #endif /* _LINUX_ETHTOOL_NETLINK_H_ */
...@@ -249,3 +249,26 @@ bool __ethtool_dev_mm_supported(struct net_device *dev) ...@@ -249,3 +249,26 @@ bool __ethtool_dev_mm_supported(struct net_device *dev)
return !ret; return !ret;
} }
bool ethtool_dev_mm_supported(struct net_device *dev)
{
const struct ethtool_ops *ops = dev->ethtool_ops;
bool supported;
int ret;
ASSERT_RTNL();
if (!ops)
return false;
ret = ethnl_ops_begin(dev);
if (ret < 0)
return false;
supported = __ethtool_dev_mm_supported(dev);
ethnl_ops_complete(dev);
return supported;
}
EXPORT_SYMBOL_GPL(ethtool_dev_mm_supported);
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