All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc
@ 2015-03-18 14:51 Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Or Gerlitz

Hi Dave, 

Just few small fixes for the 4.0 rc cycle.

The fix from Moni addresses an issue from 4.0-rc1 so we
just need it for net.

Eran's fix for off-by-one should go to 3.19.y too.

Or.

changes from V0:
  - addressed feedback from Sergei removed redundant defines 
    from the PMA patch

Eran Ben Elisha (2):
  net/mlx4_en: Fix off-by-one in ethtool statistics display
  net/mlx4_en: Set statistics bitmap at port init

Majd Dibbiny (1):
  IB/mlx4: Saturate RoCE port PMA counters in case of overflow

Moni Shoua (1):
  IB/mlx4: Verify net device validity on port change event

 drivers/infiniband/hw/mlx4/mad.c               |   20 ++++++++++++++++----
 drivers/infiniband/hw/mlx4/main.c              |    6 +++++-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    4 ++--
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   |    2 +-
 4 files changed, 24 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net V1 1/4] IB/mlx4: Verify net device validity on port change event
  2015-03-18 14:51 [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
@ 2015-03-18 14:51 ` Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display Or Gerlitz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:51 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Moni Shoua, Or Gerlitz

From: Moni Shoua <monis@mellanox.com>

Processing an event is done in a different context from the one when
the event was dispatched. This requires a check that the slave
net device is still valid when the event is being processed. The check is done
under the iboe lock which ensure correctness.

Fixes: a57500903093 ('IB/mlx4: Add port aggregation support')
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/infiniband/hw/mlx4/main.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index ac6e2b7..b972c0b 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2697,8 +2697,12 @@ static void handle_bonded_port_state_event(struct work_struct *work)
 	spin_lock_bh(&ibdev->iboe.lock);
 	for (i = 0; i < MLX4_MAX_PORTS; ++i) {
 		struct net_device *curr_netdev = ibdev->iboe.netdevs[i];
+		enum ib_port_state curr_port_state;
 
-		enum ib_port_state curr_port_state =
+		if (!curr_netdev)
+			continue;
+
+		curr_port_state =
 			(netif_running(curr_netdev) &&
 			 netif_carrier_ok(curr_netdev)) ?
 			IB_PORT_ACTIVE : IB_PORT_DOWN;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net V1 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display
  2015-03-18 14:51 [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
@ 2015-03-18 14:51 ` Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:51 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Eran Ben Elisha,
	Or Gerlitz

From: Eran Ben Elisha <eranbe@mellanox.com>

NUM_PORT_STATS was 9 instead of 10, which caused off-by-one bug when
displaying the statistics starting from tx_chksum_offload in ethtool.

Fixes: f8c6455bb04b ('net/mlx4_en: Extend checksum offloading by CHECKSUM COMPLETE')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 2a8268e..ebbe244 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -453,7 +453,7 @@ struct mlx4_en_port_stats {
 	unsigned long rx_chksum_none;
 	unsigned long rx_chksum_complete;
 	unsigned long tx_chksum_offload;
-#define NUM_PORT_STATS		9
+#define NUM_PORT_STATS		10
 };
 
 struct mlx4_en_perf_stats {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net V1 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow
  2015-03-18 14:51 [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display Or Gerlitz
@ 2015-03-18 14:51 ` Or Gerlitz
  2015-03-18 14:51 ` [PATCH net V1 4/4] net/mlx4_en: Set statistics bitmap at port init Or Gerlitz
  2015-03-18 19:23 ` [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:51 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Majd Dibbiny,
	Eran Ben Elisha, Or Gerlitz

From: Majd Dibbiny <majd@mellanox.com>

For RoCE ports, we set the u32 PMA values based on u64 HCA counters. In case of
overflow, according to the IB spec, we have to saturate a counter to its
max value, do that.

Fixes: c37791349cc7 ('IB/mlx4: Support PMA counters for IBoE')
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/infiniband/hw/mlx4/mad.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index c761971..5904026 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -64,6 +64,14 @@ enum {
 #define GUID_TBL_BLK_NUM_ENTRIES 8
 #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
 
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_32BIT_COUNTER(counter, value) do {\
+	if ((value) > U32_MAX)			 \
+		counter = cpu_to_be32(U32_MAX); \
+	else					 \
+		counter = cpu_to_be32(value);	 \
+} while (0)
+
 struct mlx4_mad_rcv_buf {
 	struct ib_grh grh;
 	u8 payload[256];
@@ -806,10 +814,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
 static void edit_counter(struct mlx4_counter *cnt,
 					struct ib_pma_portcounters *pma_cnt)
 {
-	pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2));
-	pma_cnt->port_rcv_data  = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2));
-	pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames));
-	pma_cnt->port_rcv_packets  = cpu_to_be32(be64_to_cpu(cnt->rx_frames));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data,
+			     (be64_to_cpu(cnt->tx_bytes) >> 2));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data,
+			     (be64_to_cpu(cnt->rx_bytes) >> 2));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets,
+			     be64_to_cpu(cnt->tx_frames));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets,
+			     be64_to_cpu(cnt->rx_frames));
 }
 
 static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net V1 4/4] net/mlx4_en: Set statistics bitmap at port init
  2015-03-18 14:51 [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
                   ` (2 preceding siblings ...)
  2015-03-18 14:51 ` [PATCH net V1 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
@ 2015-03-18 14:51 ` Or Gerlitz
  2015-03-18 19:23 ` [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:51 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Eran Ben Elisha,
	Or Gerlitz

From: Eran Ben Elisha <eranbe@mellanox.com>

Port statistics bitmap will now be initialized at port init.  Even before
starting the port, statistics are visible to the user and must be properly masked.

Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 2a210c4..ebce5bb 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1698,8 +1698,6 @@ int mlx4_en_start_port(struct net_device *dev)
 	/* Schedule multicast task to populate multicast list */
 	queue_work(mdev->workqueue, &priv->rx_mode_task);
 
-	mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
-
 #ifdef CONFIG_MLX4_EN_VXLAN
 	if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)
 		vxlan_get_rx_port(dev);
@@ -2853,6 +2851,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 		queue_delayed_work(mdev->workqueue, &priv->service_task,
 				   SERVICE_TASK_DELAY);
 
+	mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
+
 	return 0;
 
 out:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc
  2015-03-18 14:51 [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
                   ` (3 preceding siblings ...)
  2015-03-18 14:51 ` [PATCH net V1 4/4] net/mlx4_en: Set statistics bitmap at port init Or Gerlitz
@ 2015-03-18 19:23 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-03-18 19:23 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, amirv, talal, hadarh

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Wed, 18 Mar 2015 16:51:34 +0200

> Just few small fixes for the 4.0 rc cycle.
> 
> The fix from Moni addresses an issue from 4.0-rc1 so we
> just need it for net.
> 
> Eran's fix for off-by-one should go to 3.19.y too.

All applied and patch #2 queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-18 19:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 14:51 [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
2015-03-18 14:51 ` [PATCH net V1 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
2015-03-18 14:51 ` [PATCH net V1 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display Or Gerlitz
2015-03-18 14:51 ` [PATCH net V1 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
2015-03-18 14:51 ` [PATCH net V1 4/4] net/mlx4_en: Set statistics bitmap at port init Or Gerlitz
2015-03-18 19:23 ` [PATCH net V1 0/4] mlx4 driver fixes for 4.0-rc David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.