linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] octeontx2-pf: Add support to read eeprom information
@ 2024-01-25 11:21 Hariprasad Kelam
  2024-01-26  2:38 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Hariprasad Kelam @ 2024-01-25 11:21 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: pabeni, kuba, edumazet, davem, sbhatta, gakula, sgoutham

Add support to read/decode EEPROM module information using ethtool.

Usage: ethtool -m <interface>

Signed-off-by: Christina Jacob <cjacob@marvell.com>
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 .../marvell/octeontx2/nic/otx2_ethtool.c      | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index 2928898c7f8d..8e4e22a2817b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -1185,6 +1185,37 @@ static void otx2_get_link_mode_info(u64 link_mode_bmap,
 			      otx2_link_modes);
 }
 
+static int otx2_get_module_info(struct net_device *netdev,
+				struct ethtool_modinfo *modinfo)
+{
+	struct otx2_nic *pfvf = netdev_priv(netdev);
+	struct cgx_fw_data *rsp;
+
+	rsp = otx2_get_fwdata(pfvf);
+	if (IS_ERR(rsp))
+		return PTR_ERR(rsp);
+
+	modinfo->type = rsp->fwdata.sfp_eeprom.sff_id;
+	modinfo->eeprom_len = SFP_EEPROM_SIZE;
+	return 0;
+}
+
+static int otx2_get_module_eeprom(struct net_device *netdev,
+				  struct ethtool_eeprom *ee,
+				  u8 *data)
+{
+	struct otx2_nic *pfvf = netdev_priv(netdev);
+	struct cgx_fw_data *rsp;
+
+	rsp = otx2_get_fwdata(pfvf);
+	if (IS_ERR(rsp))
+		return PTR_ERR(rsp);
+
+	memcpy(data, &rsp->fwdata.sfp_eeprom.buf, ee->len);
+
+	return 0;
+}
+
 static int otx2_get_link_ksettings(struct net_device *netdev,
 				   struct ethtool_link_ksettings *cmd)
 {
@@ -1343,6 +1374,8 @@ static const struct ethtool_ops otx2_ethtool_ops = {
 	.set_fecparam		= otx2_set_fecparam,
 	.get_link_ksettings     = otx2_get_link_ksettings,
 	.set_link_ksettings     = otx2_set_link_ksettings,
+	.get_module_info	= otx2_get_module_info,
+	.get_module_eeprom	= otx2_get_module_eeprom,
 };
 
 void otx2_set_ethtool_ops(struct net_device *netdev)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next PATCH] octeontx2-pf: Add support to read eeprom information
  2024-01-25 11:21 [net-next PATCH] octeontx2-pf: Add support to read eeprom information Hariprasad Kelam
@ 2024-01-26  2:38 ` Andrew Lunn
  2024-01-31 11:37   ` Hariprasad Kelam
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2024-01-26  2:38 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: netdev, linux-kernel, pabeni, kuba, edumazet, davem, sbhatta,
	gakula, sgoutham

On Thu, Jan 25, 2024 at 04:51:33PM +0530, Hariprasad Kelam wrote:
> Add support to read/decode EEPROM module information using ethtool.

It looks like you have a very primitive firmware here, which can only
return the first page of the SFPs EEPROM. What are your plans to make
this fully featured? Ideally you should not be using this API, but the
newer API which indicates what page you would like to read.

> Signed-off-by: Christina Jacob <cjacob@marvell.com>
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>

These seem to be in the wrong order.

      Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next PATCH] octeontx2-pf: Add support to read eeprom information
  2024-01-26  2:38 ` Andrew Lunn
@ 2024-01-31 11:37   ` Hariprasad Kelam
  0 siblings, 0 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2024-01-31 11:37 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, linux-kernel, pabeni, kuba, edumazet, davem,
	Subbaraya Sundeep Bhatta, Geethasowjanya Akula,
	Sunil Kovvuri Goutham



> On Thu, Jan 25, 2024 at 04:51:33PM +0530, Hariprasad Kelam wrote:
> > Add support to read/decode EEPROM module information using ethtool.
> 
> It looks like you have a very primitive firmware here, which can only return the
> first page of the SFPs EEPROM. What are your plans to make this fully
> featured? Ideally you should not be using this API, but the newer API which
> indicates what page you would like to read.
> 
 Our firmware currently supports reading only first page.  
Will submit V2 which uses new API considering the len/offset fields.

> > Signed-off-by: Christina Jacob <cjacob@marvell.com>
> > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> > Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
> 
> These seem to be in the wrong order.
> 
     I will fix in next version.
Thanks,
Hariprasad k
>       Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-31 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 11:21 [net-next PATCH] octeontx2-pf: Add support to read eeprom information Hariprasad Kelam
2024-01-26  2:38 ` Andrew Lunn
2024-01-31 11:37   ` Hariprasad Kelam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).