[PATCH v2 net-next 3/3] ionic: add module eeprom channel data to ionic_if and ethtool

Shannon Nelson posted 3 patches 8 months, 1 week ago
[PATCH v2 net-next 3/3] ionic: add module eeprom channel data to ionic_if and ethtool
Posted by Shannon Nelson 8 months, 1 week ago
Make the CMIS module type's page 17 channel data available for
ethtool to request.  As done previously, carve space for this
data from the port_info reserved space.

In the future, if additional pages are needed, a new firmware
AdminQ command will be added for accessing random pages.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 3 +++
 drivers/net/ethernet/pensando/ionic/ionic_if.h      | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index 0d2ef808237b..92f30ff2d631 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -999,6 +999,9 @@ static int ionic_get_module_eeprom_by_page(struct net_device *netdev,
 	case 2:
 		src = &idev->port_info->sprom_page2[page_data->offset - 128];
 		break;
+	case 17:
+		src = &idev->port_info->sprom_page17[page_data->offset - 128];
+		break;
 	default:
 		return -EOPNOTSUPP;
 	}
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_if.h b/drivers/net/ethernet/pensando/ionic/ionic_if.h
index 23218208b711..f1ddbe9994a3 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_if.h
+++ b/drivers/net/ethernet/pensando/ionic/ionic_if.h
@@ -2842,6 +2842,7 @@ union ionic_port_identity {
  * @sprom_epage:     Extended Transceiver sprom
  * @sprom_page1:     Extended Transceiver sprom, page 1
  * @sprom_page2:     Extended Transceiver sprom, page 2
+ * @sprom_page17:    Extended Transceiver sprom, page 17
  * @rsvd:            reserved byte(s)
  * @pb_stats:        uplink pb drop stats
  */
@@ -2853,13 +2854,14 @@ struct ionic_port_info {
 		struct ionic_mgmt_port_stats mgmt_stats;
 	};
 	union {
-		u8     sprom_epage[256];
+		u8     sprom_epage[384];
 		struct {
 			u8 sprom_page1[128];
 			u8 sprom_page2[128];
+			u8 sprom_page17[128];
 		};
 	};
-	u8     rsvd[504];
+	u8     rsvd[376];
 
 	/* pb_stats must start at 2k offset */
 	struct ionic_port_pb_stats  pb_stats;
-- 
2.17.1
Re: [PATCH v2 net-next 3/3] ionic: add module eeprom channel data to ionic_if and ethtool
Posted by Simon Horman 8 months ago
On Tue, Apr 15, 2025 at 04:13:16PM -0700, Shannon Nelson wrote:
> Make the CMIS module type's page 17 channel data available for
> ethtool to request.  As done previously, carve space for this
> data from the port_info reserved space.
> 
> In the future, if additional pages are needed, a new firmware
> AdminQ command will be added for accessing random pages.
> 
> Reviewed-by: Brett Creeley <brett.creeley@amd.com>
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>

Reviewed-by: Simon Horman <horms@kernel.org>