.. | .. |
---|
30 | 30 | struct mlxsw_sib_port **ports; |
---|
31 | 31 | struct mlxsw_core *core; |
---|
32 | 32 | const struct mlxsw_bus_info *bus_info; |
---|
| 33 | + u8 hw_id[ETH_ALEN]; |
---|
33 | 34 | }; |
---|
34 | 35 | |
---|
35 | 36 | struct mlxsw_sib_port { |
---|
.. | .. |
---|
100 | 101 | mlxsw_tx_v1_hdr_control_tclass_set(txhdr, 1); |
---|
101 | 102 | mlxsw_tx_v1_hdr_port_mid_set(txhdr, tx_info->local_port); |
---|
102 | 103 | mlxsw_tx_v1_hdr_type_set(txhdr, MLXSW_TXHDR_TYPE_CONTROL); |
---|
| 104 | +} |
---|
| 105 | + |
---|
| 106 | +static int mlxsw_sib_hw_id_get(struct mlxsw_sib *mlxsw_sib) |
---|
| 107 | +{ |
---|
| 108 | + char spad_pl[MLXSW_REG_SPAD_LEN] = {0}; |
---|
| 109 | + int err; |
---|
| 110 | + |
---|
| 111 | + err = mlxsw_reg_query(mlxsw_sib->core, MLXSW_REG(spad), spad_pl); |
---|
| 112 | + if (err) |
---|
| 113 | + return err; |
---|
| 114 | + mlxsw_reg_spad_base_mac_memcpy_from(spad_pl, mlxsw_sib->hw_id); |
---|
| 115 | + return 0; |
---|
103 | 116 | } |
---|
104 | 117 | |
---|
105 | 118 | static int |
---|
.. | .. |
---|
267 | 280 | { |
---|
268 | 281 | int err; |
---|
269 | 282 | |
---|
270 | | - err = mlxsw_core_port_init(mlxsw_sib->core, local_port); |
---|
| 283 | + err = mlxsw_core_port_init(mlxsw_sib->core, local_port, |
---|
| 284 | + module + 1, false, 0, false, 0, |
---|
| 285 | + mlxsw_sib->hw_id, sizeof(mlxsw_sib->hw_id)); |
---|
271 | 286 | if (err) { |
---|
272 | 287 | dev_err(mlxsw_sib->bus_info->dev, "Port %d: Failed to init core port\n", |
---|
273 | 288 | local_port); |
---|
.. | .. |
---|
431 | 446 | } |
---|
432 | 447 | |
---|
433 | 448 | static int mlxsw_sib_init(struct mlxsw_core *mlxsw_core, |
---|
434 | | - const struct mlxsw_bus_info *mlxsw_bus_info) |
---|
| 449 | + const struct mlxsw_bus_info *mlxsw_bus_info, |
---|
| 450 | + struct netlink_ext_ack *extack) |
---|
435 | 451 | { |
---|
436 | 452 | struct mlxsw_sib *mlxsw_sib = mlxsw_core_driver_priv(mlxsw_core); |
---|
437 | 453 | int err; |
---|
.. | .. |
---|
439 | 455 | mlxsw_sib->core = mlxsw_core; |
---|
440 | 456 | mlxsw_sib->bus_info = mlxsw_bus_info; |
---|
441 | 457 | |
---|
| 458 | + err = mlxsw_sib_hw_id_get(mlxsw_sib); |
---|
| 459 | + if (err) { |
---|
| 460 | + dev_err(mlxsw_sib->bus_info->dev, "Failed to get switch HW ID\n"); |
---|
| 461 | + return err; |
---|
| 462 | + } |
---|
| 463 | + |
---|
442 | 464 | err = mlxsw_sib_ports_create(mlxsw_sib); |
---|
443 | 465 | if (err) { |
---|
444 | 466 | dev_err(mlxsw_sib->bus_info->dev, "Failed to create ports\n"); |
---|