From 04ceaafd2fd5702236c1120f0ebf6c12faaa37ff Mon Sep 17 00:00:00 2001 From: Vladimir Sokolovsky Date: Wed, 22 Feb 2012 13:10:29 +0200 Subject: [PATCH] compat: backport __ethtool_get_settings [linux-2.6] (master)$ \ git describe --contains 4bc71cb983fd2844e603bf633df2bb53385182d2 v3.2-rc1~129^2~289 Signed-off-by: Vladimir Sokolovsky --- compat/compat-3.2.c | 16 ++++++++++++++++ include/linux/compat-3.2.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/compat/compat-3.2.c b/compat/compat-3.2.c index 80f5597..dd85387 100644 --- a/compat/compat-3.2.c +++ b/compat/compat-3.2.c @@ -1,5 +1,6 @@ /* * Copyright 2012 Luis R. Rodriguez + * Copyright (c) 2012 Mellanox Technologies. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -10,6 +11,8 @@ #include #include +#include +#include int __netdev_printk(const char *level, const struct net_device *dev, struct va_format *vaf) @@ -32,3 +35,16 @@ int __netdev_printk(const char *level, const struct net_device *dev, return r; } EXPORT_SYMBOL(__netdev_printk); + +int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + ASSERT_RTNL(); + + if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings) + return -EOPNOTSUPP; + + memset(cmd, 0, sizeof(struct ethtool_cmd)); + cmd->cmd = ETHTOOL_GSET; + return dev->ethtool_ops->get_settings(dev, cmd); +} +EXPORT_SYMBOL(__ethtool_get_settings); diff --git a/include/linux/compat-3.2.h b/include/linux/compat-3.2.h index cb14f0b..fd8d1f9 100644 --- a/include/linux/compat-3.2.h +++ b/include/linux/compat-3.2.h @@ -7,9 +7,13 @@ #include #include +#include #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0) +extern int __ethtool_get_settings(struct net_device *dev, + struct ethtool_cmd *cmd); + /** * skb_frag_page - retrieve the page refered to by a paged fragment * @frag: the paged fragment -- 2.46.0