Commit a9d5e3d7 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-next'

Ido Schimmel says:

====================
mlxsw: spectrum: Adjustments to port split and label port

Jiri says:

This patchset includes patches that prepare the driver to support modular
systems.

PLLP register is introduced to get front panel port label which is no
longer equivalent to "module + 1" for modular systems, where the
numbering is per line card.

So far for all systems all front panel ports had same format and could
be split to the same number of subports. This is no longer true for
modular systems, where every line card can have different types of front
panel ports.

The PMTDB register is introduced to easily query FW for split
capabilities of particular front panel port. It is generic for use in
modular and non-modular systems.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 13bb8429 cd92d79d
...@@ -2944,44 +2944,6 @@ bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core) ...@@ -2944,44 +2944,6 @@ bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core)
return mlxsw_core->is_initialized; return mlxsw_core->is_initialized;
} }
int mlxsw_core_module_max_width(struct mlxsw_core *mlxsw_core, u8 module)
{
enum mlxsw_reg_pmtm_module_type module_type;
char pmtm_pl[MLXSW_REG_PMTM_LEN];
int err;
mlxsw_reg_pmtm_pack(pmtm_pl, module);
err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(pmtm), pmtm_pl);
if (err)
return err;
mlxsw_reg_pmtm_unpack(pmtm_pl, &module_type);
/* Here we need to get the module width according to the module type. */
switch (module_type) {
case MLXSW_REG_PMTM_MODULE_TYPE_C2C8X:
case MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD:
case MLXSW_REG_PMTM_MODULE_TYPE_OSFP:
return 8;
case MLXSW_REG_PMTM_MODULE_TYPE_C2C4X:
case MLXSW_REG_PMTM_MODULE_TYPE_BP_4X:
case MLXSW_REG_PMTM_MODULE_TYPE_QSFP:
return 4;
case MLXSW_REG_PMTM_MODULE_TYPE_C2C2X:
case MLXSW_REG_PMTM_MODULE_TYPE_BP_2X:
case MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD:
case MLXSW_REG_PMTM_MODULE_TYPE_DSFP:
return 2;
case MLXSW_REG_PMTM_MODULE_TYPE_C2C1X:
case MLXSW_REG_PMTM_MODULE_TYPE_BP_1X:
case MLXSW_REG_PMTM_MODULE_TYPE_SFP:
return 1;
default:
return -EINVAL;
}
}
EXPORT_SYMBOL(mlxsw_core_module_max_width);
static void mlxsw_core_buf_dump_dbg(struct mlxsw_core *mlxsw_core, static void mlxsw_core_buf_dump_dbg(struct mlxsw_core *mlxsw_core,
const char *buf, size_t size) const char *buf, size_t size)
{ {
......
...@@ -250,7 +250,6 @@ mlxsw_core_port_devlink_port_get(struct mlxsw_core *mlxsw_core, ...@@ -250,7 +250,6 @@ mlxsw_core_port_devlink_port_get(struct mlxsw_core *mlxsw_core,
bool mlxsw_core_port_is_xm(const struct mlxsw_core *mlxsw_core, u8 local_port); bool mlxsw_core_port_is_xm(const struct mlxsw_core *mlxsw_core, u8 local_port);
struct mlxsw_env *mlxsw_core_env(const struct mlxsw_core *mlxsw_core); struct mlxsw_env *mlxsw_core_env(const struct mlxsw_core *mlxsw_core);
bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core); bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core);
int mlxsw_core_module_max_width(struct mlxsw_core *mlxsw_core, u8 module);
int mlxsw_core_schedule_dw(struct delayed_work *dwork, unsigned long delay); int mlxsw_core_schedule_dw(struct delayed_work *dwork, unsigned long delay);
bool mlxsw_core_schedule_work(struct work_struct *work); bool mlxsw_core_schedule_work(struct work_struct *work);
......
...@@ -5766,6 +5766,69 @@ static inline void mlxsw_reg_pplr_pack(char *payload, u8 local_port, ...@@ -5766,6 +5766,69 @@ static inline void mlxsw_reg_pplr_pack(char *payload, u8 local_port,
MLXSW_REG_PPLR_LB_TYPE_BIT_PHY_LOCAL : 0); MLXSW_REG_PPLR_LB_TYPE_BIT_PHY_LOCAL : 0);
} }
/* PMTDB - Port Module To local DataBase Register
* ----------------------------------------------
* The PMTDB register allows to query the possible module<->local port
* mapping than can be used in PMLP. It does not represent the actual/current
* mapping of the local to module. Actual mapping is only defined by PMLP.
*/
#define MLXSW_REG_PMTDB_ID 0x501A
#define MLXSW_REG_PMTDB_LEN 0x40
MLXSW_REG_DEFINE(pmtdb, MLXSW_REG_PMTDB_ID, MLXSW_REG_PMTDB_LEN);
/* reg_pmtdb_slot_index
* Slot index (0: Main board).
* Access: Index
*/
MLXSW_ITEM32(reg, pmtdb, slot_index, 0x00, 24, 4);
/* reg_pmtdb_module
* Module number.
* Access: Index
*/
MLXSW_ITEM32(reg, pmtdb, module, 0x00, 16, 8);
/* reg_pmtdb_ports_width
* Port's width
* Access: Index
*/
MLXSW_ITEM32(reg, pmtdb, ports_width, 0x00, 12, 4);
/* reg_pmtdb_num_ports
* Number of ports in a single module (split/breakout)
* Access: Index
*/
MLXSW_ITEM32(reg, pmtdb, num_ports, 0x00, 8, 4);
enum mlxsw_reg_pmtdb_status {
MLXSW_REG_PMTDB_STATUS_SUCCESS,
};
/* reg_pmtdb_status
* Status
* Access: RO
*/
MLXSW_ITEM32(reg, pmtdb, status, 0x00, 0, 4);
/* reg_pmtdb_port_num
* The local_port value which can be assigned to the module.
* In case of more than one port, port<x> represent the /<x> port of
* the module.
* Access: RO
*/
MLXSW_ITEM16_INDEXED(reg, pmtdb, port_num, 0x04, 0, 8, 0x02, 0x00, false);
static inline void mlxsw_reg_pmtdb_pack(char *payload, u8 slot_index, u8 module,
u8 ports_width, u8 num_ports)
{
MLXSW_REG_ZERO(pmtdb, payload);
mlxsw_reg_pmtdb_slot_index_set(payload, slot_index);
mlxsw_reg_pmtdb_module_set(payload, module);
mlxsw_reg_pmtdb_ports_width_set(payload, ports_width);
mlxsw_reg_pmtdb_num_ports_set(payload, num_ports);
}
/* PMPE - Port Module Plug/Unplug Event Register /* PMPE - Port Module Plug/Unplug Event Register
* --------------------------------------------- * ---------------------------------------------
* This register reports any operational status change of a module. * This register reports any operational status change of a module.
...@@ -5860,67 +5923,51 @@ static inline void mlxsw_reg_pddr_pack(char *payload, u8 local_port, ...@@ -5860,67 +5923,51 @@ static inline void mlxsw_reg_pddr_pack(char *payload, u8 local_port,
mlxsw_reg_pddr_page_select_set(payload, page_select); mlxsw_reg_pddr_page_select_set(payload, page_select);
} }
/* PMTM - Port Module Type Mapping Register /* PLLP - Port Local port to Label Port mapping Register
* ---------------------------------------- * -----------------------------------------------------
* The PMTM allows query or configuration of module types. * The PLLP register returns the mapping from Local Port into Label Port.
*/ */
#define MLXSW_REG_PMTM_ID 0x5067 #define MLXSW_REG_PLLP_ID 0x504A
#define MLXSW_REG_PMTM_LEN 0x10 #define MLXSW_REG_PLLP_LEN 0x10
MLXSW_REG_DEFINE(pmtm, MLXSW_REG_PMTM_ID, MLXSW_REG_PMTM_LEN); MLXSW_REG_DEFINE(pllp, MLXSW_REG_PLLP_ID, MLXSW_REG_PLLP_LEN);
/* reg_pmtm_module /* reg_pllp_local_port
* Module number. * Local port number.
* Access: Index * Access: Index
*/ */
MLXSW_ITEM32(reg, pmtm, module, 0x00, 16, 8); MLXSW_ITEM32(reg, pllp, local_port, 0x00, 16, 8);
enum mlxsw_reg_pmtm_module_type { /* reg_pllp_label_port
/* Backplane with 4 lanes */ * Front panel label of the port.
MLXSW_REG_PMTM_MODULE_TYPE_BP_4X, * Access: RO
/* QSFP */ */
MLXSW_REG_PMTM_MODULE_TYPE_QSFP, MLXSW_ITEM32(reg, pllp, label_port, 0x00, 0, 8);
/* SFP */
MLXSW_REG_PMTM_MODULE_TYPE_SFP,
/* Backplane with single lane */
MLXSW_REG_PMTM_MODULE_TYPE_BP_1X = 4,
/* Backplane with two lane */
MLXSW_REG_PMTM_MODULE_TYPE_BP_2X = 8,
/* Chip2Chip4x */
MLXSW_REG_PMTM_MODULE_TYPE_C2C4X = 10,
/* Chip2Chip2x */
MLXSW_REG_PMTM_MODULE_TYPE_C2C2X,
/* Chip2Chip1x */
MLXSW_REG_PMTM_MODULE_TYPE_C2C1X,
/* QSFP-DD */
MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD = 14,
/* OSFP */
MLXSW_REG_PMTM_MODULE_TYPE_OSFP,
/* SFP-DD */
MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD,
/* DSFP */
MLXSW_REG_PMTM_MODULE_TYPE_DSFP,
/* Chip2Chip8x */
MLXSW_REG_PMTM_MODULE_TYPE_C2C8X,
};
/* reg_pmtm_module_type /* reg_pllp_split_num
* Module type. * Label split mapping for local_port.
* Access: RW * Access: RO
*/ */
MLXSW_ITEM32(reg, pmtm, module_type, 0x04, 0, 4); MLXSW_ITEM32(reg, pllp, split_num, 0x04, 0, 4);
static inline void mlxsw_reg_pmtm_pack(char *payload, u8 module) /* reg_pllp_slot_index
* Slot index (0: Main board).
* Access: RO
*/
MLXSW_ITEM32(reg, pllp, slot_index, 0x08, 0, 4);
static inline void mlxsw_reg_pllp_pack(char *payload, u8 local_port)
{ {
MLXSW_REG_ZERO(pmtm, payload); MLXSW_REG_ZERO(pllp, payload);
mlxsw_reg_pmtm_module_set(payload, module); mlxsw_reg_pllp_local_port_set(payload, local_port);
} }
static inline void static inline void mlxsw_reg_pllp_unpack(char *payload, u8 *label_port,
mlxsw_reg_pmtm_unpack(char *payload, u8 *split_num, u8 *slot_index)
enum mlxsw_reg_pmtm_module_type *module_type)
{ {
*module_type = mlxsw_reg_pmtm_module_type_get(payload); *label_port = mlxsw_reg_pllp_label_port_get(payload);
*split_num = mlxsw_reg_pllp_split_num_get(payload);
*slot_index = mlxsw_reg_pllp_slot_index_get(payload);
} }
/* HTGT - Host Trap Group Table /* HTGT - Host Trap Group Table
...@@ -12200,9 +12247,10 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { ...@@ -12200,9 +12247,10 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
MLXSW_REG(pspa), MLXSW_REG(pspa),
MLXSW_REG(pmaos), MLXSW_REG(pmaos),
MLXSW_REG(pplr), MLXSW_REG(pplr),
MLXSW_REG(pmtdb),
MLXSW_REG(pmpe), MLXSW_REG(pmpe),
MLXSW_REG(pddr), MLXSW_REG(pddr),
MLXSW_REG(pmtm), MLXSW_REG(pllp),
MLXSW_REG(htgt), MLXSW_REG(htgt),
MLXSW_REG(hpkt), MLXSW_REG(hpkt),
MLXSW_REG(rgcr), MLXSW_REG(rgcr),
......
...@@ -25,9 +25,6 @@ enum mlxsw_res_id { ...@@ -25,9 +25,6 @@ enum mlxsw_res_id {
MLXSW_RES_ID_MAX_SYSTEM_PORT, MLXSW_RES_ID_MAX_SYSTEM_PORT,
MLXSW_RES_ID_MAX_LAG, MLXSW_RES_ID_MAX_LAG,
MLXSW_RES_ID_MAX_LAG_MEMBERS, MLXSW_RES_ID_MAX_LAG_MEMBERS,
MLXSW_RES_ID_LOCAL_PORTS_IN_1X,
MLXSW_RES_ID_LOCAL_PORTS_IN_2X,
MLXSW_RES_ID_LOCAL_PORTS_IN_4X,
MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER, MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER,
MLXSW_RES_ID_CELL_SIZE, MLXSW_RES_ID_CELL_SIZE,
MLXSW_RES_ID_MAX_HEADROOM_SIZE, MLXSW_RES_ID_MAX_HEADROOM_SIZE,
...@@ -84,9 +81,6 @@ static u16 mlxsw_res_ids[] = { ...@@ -84,9 +81,6 @@ static u16 mlxsw_res_ids[] = {
[MLXSW_RES_ID_MAX_SYSTEM_PORT] = 0x2502, [MLXSW_RES_ID_MAX_SYSTEM_PORT] = 0x2502,
[MLXSW_RES_ID_MAX_LAG] = 0x2520, [MLXSW_RES_ID_MAX_LAG] = 0x2520,
[MLXSW_RES_ID_MAX_LAG_MEMBERS] = 0x2521, [MLXSW_RES_ID_MAX_LAG_MEMBERS] = 0x2521,
[MLXSW_RES_ID_LOCAL_PORTS_IN_1X] = 0x2610,
[MLXSW_RES_ID_LOCAL_PORTS_IN_2X] = 0x2611,
[MLXSW_RES_ID_LOCAL_PORTS_IN_4X] = 0x2612,
[MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER] = 0x2805, /* Bytes */ [MLXSW_RES_ID_GUARANTEED_SHARED_BUFFER] = 0x2805, /* Bytes */
[MLXSW_RES_ID_CELL_SIZE] = 0x2803, /* Bytes */ [MLXSW_RES_ID_CELL_SIZE] = 0x2803, /* Bytes */
[MLXSW_RES_ID_MAX_HEADROOM_SIZE] = 0x2811, /* Bytes */ [MLXSW_RES_ID_MAX_HEADROOM_SIZE] = 0x2811, /* Bytes */
......
...@@ -144,7 +144,8 @@ struct mlxsw_sp_mall_entry; ...@@ -144,7 +144,8 @@ struct mlxsw_sp_mall_entry;
struct mlxsw_sp_port_mapping { struct mlxsw_sp_port_mapping {
u8 module; u8 module;
u8 width; u8 width; /* Number of lanes used by the port */
u8 module_width; /* Number of lanes in the module (static) */
u8 lane; u8 lane;
}; };
...@@ -345,7 +346,6 @@ struct mlxsw_sp_port { ...@@ -345,7 +346,6 @@ struct mlxsw_sp_port {
u16 egr_types; u16 egr_types;
struct mlxsw_sp_ptp_port_stats stats; struct mlxsw_sp_ptp_port_stats stats;
} ptp; } ptp;
u8 split_base_local_port;
int max_mtu; int max_mtu;
u32 max_speed; u32 max_speed;
struct mlxsw_sp_hdroom *hdroom; struct mlxsw_sp_hdroom *hdroom;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment