Skip to content

Commit 271907e

Browse files
gal-pressmanSaeed Mahameed
authored andcommitted
net/mlx5: Query the maximum MCIA register read size from firmware
The MCIA register supports either 12 or 32 dwords, use the correct value by querying the capability from the MCAM register. Signed-off-by: Gal Pressman <[email protected]> Reviewed-by: Maxim Mikityanskiy <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent fbf6836 commit 271907e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/port.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,12 @@ static void mlx5_sfp_eeprom_params_set(u16 *i2c_addr, int *page_num, u16 *offset
365365
*offset -= MLX5_EEPROM_PAGE_LENGTH;
366366
}
367367

368+
static int mlx5_mcia_max_bytes(struct mlx5_core_dev *dev)
369+
{
370+
/* mcia supports either 12 dwords or 32 dwords */
371+
return (MLX5_CAP_MCAM_FEATURE(dev, mcia_32dwords) ? 32 : 12) * sizeof(u32);
372+
}
373+
368374
static int mlx5_query_mcia(struct mlx5_core_dev *dev,
369375
struct mlx5_module_eeprom_query_params *params, u8 *data)
370376
{
@@ -374,7 +380,7 @@ static int mlx5_query_mcia(struct mlx5_core_dev *dev,
374380
void *ptr;
375381
u16 size;
376382

377-
size = min_t(int, params->size, MLX5_EEPROM_MAX_BYTES);
383+
size = min_t(int, params->size, mlx5_mcia_max_bytes(dev));
378384

379385
MLX5_SET(mcia_reg, in, l, 0);
380386
MLX5_SET(mcia_reg, in, size, size);

include/linux/mlx5/mlx5_ifc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9691,7 +9691,9 @@ struct mlx5_ifc_pcam_reg_bits {
96919691
};
96929692

96939693
struct mlx5_ifc_mcam_enhanced_features_bits {
9694-
u8 reserved_at_0[0x6a];
9694+
u8 reserved_at_0[0x5d];
9695+
u8 mcia_32dwords[0x1];
9696+
u8 reserved_at_5e[0xc];
96959697
u8 reset_state[0x1];
96969698
u8 ptpcyc2realtime_modify[0x1];
96979699
u8 reserved_at_6c[0x2];

include/linux/mlx5/port.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ enum mlx5_an_status {
5656
MLX5_AN_LINK_DOWN = 4,
5757
};
5858

59-
#define MLX5_EEPROM_MAX_BYTES 32
6059
#define MLX5_EEPROM_IDENTIFIER_BYTE_MASK 0x000000ff
6160
#define MLX5_I2C_ADDR_LOW 0x50
6261
#define MLX5_I2C_ADDR_HIGH 0x51

0 commit comments

Comments
 (0)