diff mbox series

[net-next,5/6] net: hns3: Add support for some CMIS transceiver modules

Message ID 20231211020816.69434-6-shaojijie@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series There are some features for the HNS3 ethernet driver | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang fail Errors and warnings before: 1142 this patch: 21
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 1142 this patch: 19
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jijie Shao Dec. 11, 2023, 2:08 a.m. UTC
From: Hao Lan <lanhao@huawei.com>

Add two more SFF-8024 Identifier Values that according to the standard
support the Common Management Interface Specification (CMIS) memory map
so the hns3 driver will be able to dump, parse and print their EEPROM
contents.This two SFF-8024 Identifier Values are SFF8024_ID_QSFP_DD (0x18)
and SFF8024_ID_QSFP_PLUS_CMIS (0x1E).

Signed-off-by: Hao Lan <lanhao@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 8 ++++++++
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h | 2 ++
 2 files changed, 10 insertions(+)

Comments

Jakub Kicinski Dec. 12, 2023, 3:21 a.m. UTC | #1
On Mon, 11 Dec 2023 10:08:15 +0800 Jijie Shao wrote:
> Add two more SFF-8024 Identifier Values that according to the standard
> support the Common Management Interface Specification (CMIS) memory map
> so the hns3 driver will be able to dump, parse and print their EEPROM
> contents.This two SFF-8024 Identifier Values are SFF8024_ID_QSFP_DD (0x18)
> and SFF8024_ID_QSFP_PLUS_CMIS (0x1E).

Hm, you don't implement the ethtool get_module_eeprom_by_page op?
I thought for QSFP DD page support was basically required.
Jijie Shao Dec. 12, 2023, 11:09 a.m. UTC | #2
on 2023/12/12 11:21, Jakub Kicinski wrote:
> On Mon, 11 Dec 2023 10:08:15 +0800 Jijie Shao wrote:
>> Add two more SFF-8024 Identifier Values that according to the standard
>> support the Common Management Interface Specification (CMIS) memory map
>> so the hns3 driver will be able to dump, parse and print their EEPROM
>> contents.This two SFF-8024 Identifier Values are SFF8024_ID_QSFP_DD (0x18)
>> and SFF8024_ID_QSFP_PLUS_CMIS (0x1E).
> Hm, you don't implement the ethtool get_module_eeprom_by_page op?
> I thought for QSFP DD page support was basically required.

Yeah, the ethtool op was ignored. And it will be added in v2.
Ido Schimmel Dec. 13, 2023, 11:02 a.m. UTC | #3
On Mon, Dec 11, 2023 at 07:21:22PM -0800, Jakub Kicinski wrote:
> On Mon, 11 Dec 2023 10:08:15 +0800 Jijie Shao wrote:
> > Add two more SFF-8024 Identifier Values that according to the standard
> > support the Common Management Interface Specification (CMIS) memory map
> > so the hns3 driver will be able to dump, parse and print their EEPROM
> > contents.This two SFF-8024 Identifier Values are SFF8024_ID_QSFP_DD (0x18)
> > and SFF8024_ID_QSFP_PLUS_CMIS (0x1E).
> 
> Hm, you don't implement the ethtool get_module_eeprom_by_page op?
> I thought for QSFP DD page support was basically required.

You can read the first few pages with the legacy interface, but for the
rest you need the get_module_eeprom_by_page op. My recommendation is to
implement the new op and abandon the old ones.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 38e796f61475..eed6c6393801 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1819,6 +1819,14 @@  static int hns3_get_module_info(struct net_device *netdev,
 		modinfo->type = ETH_MODULE_SFF_8636;
 		modinfo->eeprom_len = ETH_MODULE_SFF_8636_MAX_LEN;
 		break;
+	case SFF8024_ID_QSFP_DD:
+	case SFF8024_ID_QSFP_PLUS_CMIS:
+		modinfo->type = ETH_MODULE_SFF_8636;
+		if (sfp_type.flat_mem & HNS3_CMIS_FLAT_MEMORY)
+			modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN;
+		else
+			modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
+		break;
 	default:
 		netdev_err(netdev, "Optical module unknown: %#x\n",
 			   sfp_type.type);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h
index da207d1d9aa9..34504ed2c086 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h
@@ -12,9 +12,11 @@  struct hns3_stats {
 	int stats_offset;
 };
 
+#define HNS3_CMIS_FLAT_MEMORY	BIT(7)
 struct hns3_sfp_type {
 	u8 type;
 	u8 ext_type;
+	u8 flat_mem;
 };
 
 struct hns3_pflag_desc {