Skip to content

Commit 91a72ad

Browse files
gal-pressmanSaeed Mahameed
authored andcommitted
net/mlx5: Remove initial segmentation duplicate definitions
Device definitions belong in mlx5_ifc, remove the duplicates in mlx5_core.h. Signed-off-by: Gal Pressman <[email protected]> Reviewed-by: Jianbo Liu <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent bcad0e5 commit 91a72ad

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,18 +366,18 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev)
366366
return -EIO;
367367
}
368368

369-
mlx5_set_nic_state(dev, MLX5_NIC_IFC_DISABLED);
369+
mlx5_set_nic_state(dev, MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED);
370370

371371
/* Loop until device state turns to disable */
372372
end = jiffies + msecs_to_jiffies(delay_ms);
373373
do {
374-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
374+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
375375
break;
376376

377377
cond_resched();
378378
} while (!time_after(jiffies, end));
379379

380-
if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) {
380+
if (mlx5_get_nic_state(dev) != MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) {
381381
dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n",
382382
mlx5_get_nic_state(dev), delay_ms);
383383
return -EIO;

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ u32 mlx5_health_check_fatal_sensors(struct mlx5_core_dev *dev)
116116
return MLX5_SENSOR_PCI_COMM_ERR;
117117
if (pci_channel_offline(dev->pdev))
118118
return MLX5_SENSOR_PCI_ERR;
119-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
119+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
120120
return MLX5_SENSOR_NIC_DISABLED;
121-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_SW_RESET)
121+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET)
122122
return MLX5_SENSOR_NIC_SW_RESET;
123123
if (sensor_fw_synd_rfr(dev))
124124
return MLX5_SENSOR_FW_SYND_RFR;
@@ -185,7 +185,7 @@ static bool reset_fw_if_needed(struct mlx5_core_dev *dev)
185185
/* Write the NIC interface field to initiate the reset, the command
186186
* interface address also resides here, don't overwrite it.
187187
*/
188-
mlx5_set_nic_state(dev, MLX5_NIC_IFC_SW_RESET);
188+
mlx5_set_nic_state(dev, MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET);
189189

190190
return true;
191191
}
@@ -246,13 +246,13 @@ void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
246246
/* Recover from SW reset */
247247
end = jiffies + msecs_to_jiffies(delay_ms);
248248
do {
249-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
249+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
250250
break;
251251

252252
msleep(20);
253253
} while (!time_after(jiffies, end));
254254

255-
if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) {
255+
if (mlx5_get_nic_state(dev) != MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) {
256256
dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n",
257257
mlx5_get_nic_state(dev), delay_ms);
258258
}
@@ -272,26 +272,26 @@ static void mlx5_handle_bad_state(struct mlx5_core_dev *dev)
272272
u8 nic_interface = mlx5_get_nic_state(dev);
273273

274274
switch (nic_interface) {
275-
case MLX5_NIC_IFC_FULL:
275+
case MLX5_INITIAL_SEG_NIC_INTERFACE_FULL_DRIVER:
276276
mlx5_core_warn(dev, "Expected to see disabled NIC but it is full driver\n");
277277
break;
278278

279-
case MLX5_NIC_IFC_DISABLED:
279+
case MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED:
280280
mlx5_core_warn(dev, "starting teardown\n");
281281
break;
282282

283-
case MLX5_NIC_IFC_NO_DRAM_NIC:
283+
case MLX5_INITIAL_SEG_NIC_INTERFACE_NO_DRAM_NIC:
284284
mlx5_core_warn(dev, "Expected to see disabled NIC but it is no dram nic\n");
285285
break;
286286

287-
case MLX5_NIC_IFC_SW_RESET:
287+
case MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET:
288288
/* The IFC mode field is 3 bits, so it will read 0x7 in 2 cases:
289289
* 1. PCI has been disabled (ie. PCI-AER, PF driver unloaded
290290
* and this is a VF), this is not recoverable by SW reset.
291291
* Logging of this is handled elsewhere.
292292
* 2. FW reset has been issued by another function, driver can
293293
* be reloaded to recover after the mode switches to
294-
* MLX5_NIC_IFC_DISABLED.
294+
* MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED.
295295
*/
296296
if (dev->priv.health.fatal_error != MLX5_SENSOR_PCI_COMM_ERR)
297297
mlx5_core_warn(dev, "NIC SW reset in progress\n");

drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,6 @@ static inline int mlx5_rescan_drivers(struct mlx5_core_dev *dev)
312312
return ret;
313313
}
314314

315-
enum {
316-
MLX5_NIC_IFC_FULL = 0,
317-
MLX5_NIC_IFC_DISABLED = 1,
318-
MLX5_NIC_IFC_NO_DRAM_NIC = 2,
319-
MLX5_NIC_IFC_SW_RESET = 7
320-
};
321-
322315
u8 mlx5_get_nic_state(struct mlx5_core_dev *dev);
323316
void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state);
324317

include/linux/mlx5/mlx5_ifc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10661,6 +10661,7 @@ enum {
1066110661
MLX5_INITIAL_SEG_NIC_INTERFACE_FULL_DRIVER = 0x0,
1066210662
MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED = 0x1,
1066310663
MLX5_INITIAL_SEG_NIC_INTERFACE_NO_DRAM_NIC = 0x2,
10664+
MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET = 0x7,
1066410665
};
1066510666

1066610667
enum {

0 commit comments

Comments
 (0)