Skip to content

Commit 6af496a

Browse files
mellanoxbmcdavem330
authored andcommitted
mlxsw: core: Add ethtool support for QSFP-DD transceivers
The Quad Small Form Factor Pluggable Double Density (QSFP-DD) hardware specification defines a form factor that supports up to 400 Gbps in aggregate over an 8x50-Gbps electrical interface. The QSFP-DD supports both optical and copper interfaces. Implementation is based on Common Management Interface Specification; Rev 4.0 May 8, 2019. Table 8-2 "Identifier and Status Summary (Lower Page)" from this spec defines "Id and Status" fields located at offsets 00h - 02h. Bit 2 at offset 02h ("Flat_mem") specifies QSFP EEPROM memory mode, which could be "upper memory flat" or "paged". Flat memory mode is coded "1", and indicates that only page 00h is implemented in EEPROM. Paged memory is coded "0" and indicates that pages 00h, 01h, 02h, 10h and 11h are implemented. Pages 10h and 11h are currently not supported by the driver. "Flat" memory mode is used for the passive copper transceivers. For this type only page 00h (256 bytes) is available. "Paged" memory is used for the optical transceivers. For this type pages 00h (256 bytes), 01h (128 bytes) and 02h (128 bytes) are available. Upper page 01h contains static advertising field, while upper page 02h contains the module-defined thresholds and lane-specific monitors. Extend enumerator 'mlxsw_reg_mcia_eeprom_module_info_id' with additional field 'MLXSW_REG_MCIA_EEPROM_MODULE_INFO_TYPE_ID'. This field is used to indicate for QSFP-DD transceiver type which memory mode is to be used. Expose 256 bytes buffer for QSFP-DD passive copper transceiver and 512 bytes buffer for optical. Signed-off-by: Vadim Pasternak <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0082dd8 commit 6af496a

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

drivers/net/ethernet/mellanox/mlxsw/core_env.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ mlxsw_env_query_module_eeprom(struct mlxsw_core *mlxsw_core, int module,
7070
if (qsfp) {
7171
/* When reading upper pages 1, 2 and 3 the offset
7272
* starts at 128. Please refer to "QSFP+ Memory Map"
73-
* figure in SFF-8436 specification for graphical
74-
* depiction.
73+
* figure in SFF-8436 specification and to "CMIS Module
74+
* Memory Map" figure in CMIS specification for
75+
* graphical depiction.
7576
*/
7677
page = MLXSW_REG_MCIA_PAGE_GET(offset);
7778
offset -= MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH * page;
@@ -221,6 +222,22 @@ int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
221222
else
222223
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN / 2;
223224
break;
225+
case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_DD:
226+
/* Use SFF_8636 as base type. ethtool should recognize specific
227+
* type through the identifier value.
228+
*/
229+
modinfo->type = ETH_MODULE_SFF_8636;
230+
/* Verify if module EEPROM is a flat memory. In case of flat
231+
* memory only page 00h (0-255 bytes) can be read. Otherwise
232+
* upper pages 01h and 02h can also be read. Upper pages 10h
233+
* and 11h are currently not supported by the driver.
234+
*/
235+
if (module_info[MLXSW_REG_MCIA_EEPROM_MODULE_INFO_TYPE_ID] &
236+
MLXSW_REG_MCIA_EEPROM_CMIS_FLAT_MEMORY)
237+
modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN;
238+
else
239+
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
240+
break;
224241
default:
225242
return -EINVAL;
226243
}

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8607,6 +8607,7 @@ MLXSW_ITEM32(reg, mcia, size, 0x08, 0, 16);
86078607
#define MLXSW_REG_MCIA_TH_PAGE_NUM 3
86088608
#define MLXSW_REG_MCIA_PAGE0_LO 0
86098609
#define MLXSW_REG_MCIA_TH_PAGE_OFF 0x80
8610+
#define MLXSW_REG_MCIA_EEPROM_CMIS_FLAT_MEMORY BIT(7)
86108611

86118612
enum mlxsw_reg_mcia_eeprom_module_info_rev_id {
86128613
MLXSW_REG_MCIA_EEPROM_MODULE_INFO_REV_ID_UNSPC = 0x00,
@@ -8625,6 +8626,7 @@ enum mlxsw_reg_mcia_eeprom_module_info_id {
86258626
enum mlxsw_reg_mcia_eeprom_module_info {
86268627
MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID,
86278628
MLXSW_REG_MCIA_EEPROM_MODULE_INFO_REV_ID,
8629+
MLXSW_REG_MCIA_EEPROM_MODULE_INFO_TYPE_ID,
86288630
MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE,
86298631
};
86308632

0 commit comments

Comments
 (0)