summaryrefslogtreecommitdiff
path: root/net/ethtool/mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ethtool/mm.c')
-rw-r--r--net/ethtool/mm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/ethtool/mm.c b/net/ethtool/mm.c
index 76b209ad53d2..809d196665c6 100644
--- a/net/ethtool/mm.c
+++ b/net/ethtool/mm.c
@@ -253,3 +253,19 @@ out_dev_put:
ethnl_parse_header_dev_put(&req_info);
return ret;
}
+
+/* Returns whether a given device supports the MAC merge layer
+ * (has an eMAC and a pMAC). Must be called under rtnl_lock() and
+ * ethnl_ops_begin().
+ */
+bool __ethtool_dev_mm_supported(struct net_device *dev)
+{
+ const struct ethtool_ops *ops = dev->ethtool_ops;
+ struct ethtool_mm_state state = {};
+ int ret = -EOPNOTSUPP;
+
+ if (ops && ops->get_mm)
+ ret = ops->get_mm(dev, &state);
+
+ return !!ret;
+}