From: Moshe Shemesh <moshe@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Adrian Pop <pop.adrian61@gmail.com>,
"Michal Kubecek" <mkubecek@suse.cz>
Cc: <netdev@vger.kernel.org>, Vladyslav Tarasiuk <vladyslavt@nvidia.com>
Subject: [PATCH net-next 5/8] net: ethtool: Export helpers for getting EEPROM info
Date: Fri, 9 Apr 2021 11:06:38 +0300 [thread overview]
Message-ID: <1617955601-21055-6-git-send-email-moshe@nvidia.com> (raw)
In-Reply-To: <1617955601-21055-1-git-send-email-moshe@nvidia.com>
From: Andrew Lunn <andrew@lunn.ch>
There are two ways to retrieve information from SFP EEPROMs. Many
devices make use of the common code, and assign the sfp_bus pointer in
the netdev to point to the bus holding the SFP device. Some MAC
drivers directly implement ops in there ethool structure.
Export within net/ethtool the two helpers used to call these methods,
so that they can also be used in the new netlink code.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
net/ethtool/common.h | 5 +++++
net/ethtool/ioctl.c | 14 +++++++-------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/net/ethtool/common.h b/net/ethtool/common.h
index a9d071248698..2dc2b80aea5f 100644
--- a/net/ethtool/common.h
+++ b/net/ethtool/common.h
@@ -47,4 +47,9 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info);
extern const struct ethtool_phy_ops *ethtool_phy_ops;
+int ethtool_get_module_info_call(struct net_device *dev,
+ struct ethtool_modinfo *modinfo);
+int ethtool_get_module_eeprom_call(struct net_device *dev,
+ struct ethtool_eeprom *ee, u8 *data);
+
#endif /* _ETHTOOL_COMMON_H */
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 26b3e7086075..eec8e588894b 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -2204,8 +2204,8 @@ static int ethtool_get_ts_info(struct net_device *dev, void __user *useraddr)
return 0;
}
-static int __ethtool_get_module_info(struct net_device *dev,
- struct ethtool_modinfo *modinfo)
+int ethtool_get_module_info_call(struct net_device *dev,
+ struct ethtool_modinfo *modinfo)
{
const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev;
@@ -2231,7 +2231,7 @@ static int ethtool_get_module_info(struct net_device *dev,
if (copy_from_user(&modinfo, useraddr, sizeof(modinfo)))
return -EFAULT;
- ret = __ethtool_get_module_info(dev, &modinfo);
+ ret = ethtool_get_module_info_call(dev, &modinfo);
if (ret)
return ret;
@@ -2241,8 +2241,8 @@ static int ethtool_get_module_info(struct net_device *dev,
return 0;
}
-static int __ethtool_get_module_eeprom(struct net_device *dev,
- struct ethtool_eeprom *ee, u8 *data)
+int ethtool_get_module_eeprom_call(struct net_device *dev,
+ struct ethtool_eeprom *ee, u8 *data)
{
const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev;
@@ -2265,12 +2265,12 @@ static int ethtool_get_module_eeprom(struct net_device *dev,
int ret;
struct ethtool_modinfo modinfo;
- ret = __ethtool_get_module_info(dev, &modinfo);
+ ret = ethtool_get_module_info_call(dev, &modinfo);
if (ret)
return ret;
return ethtool_get_any_eeprom(dev, useraddr,
- __ethtool_get_module_eeprom,
+ ethtool_get_module_eeprom_call,
modinfo.eeprom_len);
}
--
2.26.2
next prev parent reply other threads:[~2021-04-09 8:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 8:06 [PATCH net-next 0/8] ethtool: Extend module EEPROM dump API Moshe Shemesh
2021-04-09 8:06 ` [PATCH net-next 1/8] ethtool: Allow network drivers to dump arbitrary EEPROM data Moshe Shemesh
2021-04-09 8:06 ` [PATCH net-next 2/8] net/mlx5: Refactor module EEPROM query Moshe Shemesh
2021-04-09 8:06 ` [PATCH net-next 3/8] net/mlx5: Implement get_module_eeprom_by_page() Moshe Shemesh
2021-04-09 8:06 ` [PATCH net-next 4/8] net/mlx5: Add support for DSFP module EEPROM dumps Moshe Shemesh
2021-04-09 8:06 ` Moshe Shemesh [this message]
2021-04-09 8:06 ` [PATCH net-next 6/8] ethtool: Add fallback to get_module_eeprom from netlink command Moshe Shemesh
2021-04-09 8:06 ` [PATCH net-next 7/8] phy: sfp: add netlink SFP support to generic SFP code Moshe Shemesh
2021-04-09 8:06 ` [PATCH net-next 8/8] ethtool: wire in generic SFP module access Moshe Shemesh
2021-04-12 0:10 ` [PATCH net-next 0/8] ethtool: Extend module EEPROM dump API patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1617955601-21055-6-git-send-email-moshe@nvidia.com \
--to=moshe@nvidia.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pop.adrian61@gmail.com \
--cc=vladyslavt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.