]> git.openfabrics.org - ~emulex/compat-rdma.git/commitdiff
mlx4_en: Fixed crash when port type is change
authorVladimir Sokolovsky <vlad@mellanox.com>
Tue, 5 Aug 2014 07:41:33 +0000 (10:41 +0300)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 6 Aug 2014 12:31:26 +0000 (15:31 +0300)
Taken from the upstream kernel commit
1ec4864b10171b0691ee196d7006ae56d2c153f2

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 <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
linux-next-cherry-picks/0103-net-mlx4_en-Fixed-crash-when-port-type-is-changed.patch [new file with mode: 0644]

diff --git a/linux-next-cherry-picks/0103-net-mlx4_en-Fixed-crash-when-port-type-is-changed.patch b/linux-next-cherry-picks/0103-net-mlx4_en-Fixed-crash-when-port-type-is-changed.patch
new file mode 100644 (file)
index 0000000..0f7eaa0
--- /dev/null
@@ -0,0 +1,44 @@
+From 1ec4864b10171b0691ee196d7006ae56d2c153f2 Mon Sep 17 00:00:00 2001
+From: Amir Vadai <amirv@mellanox.com>
+Date: Thu, 7 Nov 2013 11:08:30 +0200
+Subject: [PATCH] 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 <amirv@mellanox.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/mellanox/mlx4/en_main.c |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
+index a071cda..0d087b0 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
+@@ -264,6 +264,10 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
+       mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH)
+               mdev->port_cnt++;
++      /* Initialize time stamp mechanism */
++      if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
++              mlx4_en_init_timestamp(mdev);
++
+       mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) {
+               if (!dev->caps.comp_pool) {
+                       mdev->profile.prof[i].rx_ring_num =
+@@ -301,10 +305,6 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
+                       mdev->pndev[i] = NULL;
+       }
+-      /* Initialize time stamp mechanism */
+-      if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS)
+-              mlx4_en_init_timestamp(mdev);
+-
+       return mdev;
+ err_mr:
+-- 
+1.7.1
+