aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-03-12 17:55:16 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-12 17:55:16 -0400
commitc7fce569fd954d527643f48f5645ccf8fd51813e (patch)
tree1881c7dfab78650f58956d87b9f10994c37fc70a /drivers
parent4ec850e5dfec092b26cf3b7d5a6c9e444ea4babd (diff)
parent426aa1fc622527d7941d0e1b0032b6bd697534e4 (diff)
Merge branch 'mlxsw-Various-fixes'
Ido Schimmel says: ==================== mlxsw: Various fixes Patch #1 fixes the recently introduced QSFP thermal zones to correctly work with split ports, where several ports are mapped to the same module. Patch #2 initializes the base MAC in the minimal driver. The driver is using the base MAC as its parent ID and without initializing it, it is reported as all zeroes to user space. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core_thermal.c21
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/minimal.c18
2 files changed, 29 insertions, 10 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 0b85c7252f9e..472f63f9fac5 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -111,7 +111,6 @@ struct mlxsw_thermal {
111 struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS]; 111 struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
112 enum thermal_device_mode mode; 112 enum thermal_device_mode mode;
113 struct mlxsw_thermal_module *tz_module_arr; 113 struct mlxsw_thermal_module *tz_module_arr;
114 unsigned int tz_module_num;
115}; 114};
116 115
117static inline u8 mlxsw_state_to_duty(int state) 116static inline u8 mlxsw_state_to_duty(int state)
@@ -711,6 +710,9 @@ mlxsw_thermal_module_init(struct device *dev, struct mlxsw_core *core,
711 710
712 module = mlxsw_reg_pmlp_module_get(pmlp_pl, 0); 711 module = mlxsw_reg_pmlp_module_get(pmlp_pl, 0);
713 module_tz = &thermal->tz_module_arr[module]; 712 module_tz = &thermal->tz_module_arr[module];
713 /* Skip if parent is already set (case of port split). */
714 if (module_tz->parent)
715 return 0;
714 module_tz->module = module; 716 module_tz->module = module;
715 module_tz->parent = thermal; 717 module_tz->parent = thermal;
716 memcpy(module_tz->trips, default_thermal_trips, 718 memcpy(module_tz->trips, default_thermal_trips,
@@ -718,13 +720,7 @@ mlxsw_thermal_module_init(struct device *dev, struct mlxsw_core *core,
718 /* Initialize all trip point. */ 720 /* Initialize all trip point. */
719 mlxsw_thermal_module_trips_reset(module_tz); 721 mlxsw_thermal_module_trips_reset(module_tz);
720 /* Update trip point according to the module data. */ 722 /* Update trip point according to the module data. */
721 err = mlxsw_thermal_module_trips_update(dev, core, module_tz); 723 return mlxsw_thermal_module_trips_update(dev, core, module_tz);
722 if (err)
723 return err;
724
725 thermal->tz_module_num++;
726
727 return 0;
728} 724}
729 725
730static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz) 726static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz)
@@ -732,6 +728,7 @@ static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz)
732 if (module_tz && module_tz->tzdev) { 728 if (module_tz && module_tz->tzdev) {
733 mlxsw_thermal_module_tz_fini(module_tz->tzdev); 729 mlxsw_thermal_module_tz_fini(module_tz->tzdev);
734 module_tz->tzdev = NULL; 730 module_tz->tzdev = NULL;
731 module_tz->parent = NULL;
735 } 732 }
736} 733}
737 734
@@ -740,6 +737,7 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
740 struct mlxsw_thermal *thermal) 737 struct mlxsw_thermal *thermal)
741{ 738{
742 unsigned int module_count = mlxsw_core_max_ports(core); 739 unsigned int module_count = mlxsw_core_max_ports(core);
740 struct mlxsw_thermal_module *module_tz;
743 int i, err; 741 int i, err;
744 742
745 thermal->tz_module_arr = kcalloc(module_count, 743 thermal->tz_module_arr = kcalloc(module_count,
@@ -754,8 +752,11 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
754 goto err_unreg_tz_module_arr; 752 goto err_unreg_tz_module_arr;
755 } 753 }
756 754
757 for (i = 0; i < thermal->tz_module_num; i++) { 755 for (i = 0; i < module_count - 1; i++) {
758 err = mlxsw_thermal_module_tz_init(&thermal->tz_module_arr[i]); 756 module_tz = &thermal->tz_module_arr[i];
757 if (!module_tz->parent)
758 continue;
759 err = mlxsw_thermal_module_tz_init(module_tz);
759 if (err) 760 if (err)
760 goto err_unreg_tz_module_arr; 761 goto err_unreg_tz_module_arr;
761 } 762 }
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 68bee9572a1b..00c390024350 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -34,6 +34,18 @@ struct mlxsw_m_port {
34 u8 module; 34 u8 module;
35}; 35};
36 36
37static int mlxsw_m_base_mac_get(struct mlxsw_m *mlxsw_m)
38{
39 char spad_pl[MLXSW_REG_SPAD_LEN] = {0};
40 int err;
41
42 err = mlxsw_reg_query(mlxsw_m->core, MLXSW_REG(spad), spad_pl);
43 if (err)
44 return err;
45 mlxsw_reg_spad_base_mac_memcpy_from(spad_pl, mlxsw_m->base_mac);
46 return 0;
47}
48
37static int mlxsw_m_port_dummy_open_stop(struct net_device *dev) 49static int mlxsw_m_port_dummy_open_stop(struct net_device *dev)
38{ 50{
39 return 0; 51 return 0;
@@ -314,6 +326,12 @@ static int mlxsw_m_init(struct mlxsw_core *mlxsw_core,
314 mlxsw_m->core = mlxsw_core; 326 mlxsw_m->core = mlxsw_core;
315 mlxsw_m->bus_info = mlxsw_bus_info; 327 mlxsw_m->bus_info = mlxsw_bus_info;
316 328
329 err = mlxsw_m_base_mac_get(mlxsw_m);
330 if (err) {
331 dev_err(mlxsw_m->bus_info->dev, "Failed to get base mac\n");
332 return err;
333 }
334
317 err = mlxsw_m_ports_create(mlxsw_m); 335 err = mlxsw_m_ports_create(mlxsw_m);
318 if (err) { 336 if (err) {
319 dev_err(mlxsw_m->bus_info->dev, "Failed to create ports\n"); 337 dev_err(mlxsw_m->bus_info->dev, "Failed to create ports\n");