Skip to content

Commit 1ec4864

Browse files
amirvdavem330
authored andcommitted
net/mlx4_en: Fixed crash when port type is changed
timecounter_init() was was called only after first potential timecounter_read(). Moved mlx4_en_init_timestamp() before mlx4_en_init_netdev() Signed-off-by: Amir Vadai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5600090 commit 1ec4864

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/ethernet/mellanox/mlx4/en_main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
264264
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH)
265265
mdev->port_cnt++;
266266

267+
/* Initialize time stamp mechanism */
268+
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
269+
mlx4_en_init_timestamp(mdev);
270+
267271
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) {
268272
if (!dev->caps.comp_pool) {
269273
mdev->profile.prof[i].rx_ring_num =
@@ -301,10 +305,6 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
301305
mdev->pndev[i] = NULL;
302306
}
303307

304-
/* Initialize time stamp mechanism */
305-
if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
306-
mlx4_en_init_timestamp(mdev);
307-
308308
return mdev;
309309

310310
err_mr:

0 commit comments

Comments
 (0)