* [PATCH net 0/4] mlx4 driver fixes for 4.0-rc
@ 2015-03-18 14:24 Or Gerlitz
2015-03-18 14:24 ` [PATCH net 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:24 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.
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 | 23 +++++++++++++++++++----
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, 27 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net 1/4] IB/mlx4: Verify net device validity on port change event
2015-03-18 14:24 [PATCH net 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
@ 2015-03-18 14:24 ` Or Gerlitz
2015-03-18 14:24 ` [PATCH net 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display Or Gerlitz
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:24 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] 7+ messages in thread
* [PATCH net 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display
2015-03-18 14:24 [PATCH net 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
2015-03-18 14:24 ` [PATCH net 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
@ 2015-03-18 14:24 ` Or Gerlitz
2015-03-18 14:24 ` [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
2015-03-18 14:24 ` [PATCH net 4/4] net/mlx4_en: Set statistics bitmap at port init Or Gerlitz
3 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:24 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] 7+ messages in thread
* [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow
2015-03-18 14:24 [PATCH net 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
2015-03-18 14:24 ` [PATCH net 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
2015-03-18 14:24 ` [PATCH net 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display Or Gerlitz
@ 2015-03-18 14:24 ` Or Gerlitz
2015-03-18 14:36 ` Sergei Shtylyov
2015-03-18 14:24 ` [PATCH net 4/4] net/mlx4_en: Set statistics bitmap at port init Or Gerlitz
3 siblings, 1 reply; 7+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:24 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 | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index c761971..40850f1 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -64,6 +64,17 @@ enum {
#define GUID_TBL_BLK_NUM_ENTRIES 8
#define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
+#define MAX_BE32 0xffffffffULL
+#define MAX_BE16 0xffffUL
+
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_32BIT_COUNTER(counter, value) do {\
+ if ((value) > MAX_BE32) \
+ counter = cpu_to_be32(MAX_BE32); \
+ else \
+ counter = cpu_to_be32(value); \
+} while (0)
+
struct mlx4_mad_rcv_buf {
struct ib_grh grh;
u8 payload[256];
@@ -806,10 +817,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] 7+ messages in thread
* [PATCH net 4/4] net/mlx4_en: Set statistics bitmap at port init
2015-03-18 14:24 [PATCH net 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
` (2 preceding siblings ...)
2015-03-18 14:24 ` [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
@ 2015-03-18 14:24 ` Or Gerlitz
3 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:24 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] 7+ messages in thread
* Re: [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow
2015-03-18 14:24 ` [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
@ 2015-03-18 14:36 ` Sergei Shtylyov
2015-03-18 14:44 ` Or Gerlitz
0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2015-03-18 14:36 UTC (permalink / raw)
To: Or Gerlitz, David S. Miller
Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Majd Dibbiny,
Eran Ben Elisha
Hello.
On 3/18/2015 5:24 PM, Or Gerlitz wrote:
> 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 | 23 +++++++++++++++++++----
> 1 files changed, 19 insertions(+), 4 deletions(-)
> diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
> index c761971..40850f1 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -64,6 +64,17 @@ enum {
> #define GUID_TBL_BLK_NUM_ENTRIES 8
> #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
>
> +#define MAX_BE32 0xffffffffULL
> +#define MAX_BE16 0xffffUL
Aren't U{16|32}_MAX from <linux/kernel.h> good enough?
And I'm not seeing wheer MAX_BE16 is used...
[...]
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow
2015-03-18 14:36 ` Sergei Shtylyov
@ 2015-03-18 14:44 ` Or Gerlitz
0 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-03-18 14:44 UTC (permalink / raw)
To: Sergei Shtylyov, David S. Miller
Cc: netdev, Amir Vadai, Tal Alon, Hadar Har-Zion, Majd Dibbiny,
Eran Ben Elisha
On 3/18/2015 4:36 PM, Sergei Shtylyov wrote:
>> diff --git a/drivers/infiniband/hw/mlx4/mad.c
>> b/drivers/infiniband/hw/mlx4/mad.c
>> index c761971..40850f1 100644
>> --- a/drivers/infiniband/hw/mlx4/mad.c
>> +++ b/drivers/infiniband/hw/mlx4/mad.c
>> @@ -64,6 +64,17 @@ enum {
>> #define GUID_TBL_BLK_NUM_ENTRIES 8
>> #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE *
>> GUID_TBL_BLK_NUM_ENTRIES)
>>
>> +#define MAX_BE32 0xffffffffULL
>> +#define MAX_BE16 0xffffUL
>
> Aren't U{16|32}_MAX from <linux/kernel.h> good enough?
> And I'm not seeing wheer MAX_BE16 is used...
>
> [...]
sure, I will roll now quick fix for both issues...thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-18 14:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18 14:24 [PATCH net 0/4] mlx4 driver fixes for 4.0-rc Or Gerlitz
2015-03-18 14:24 ` [PATCH net 1/4] IB/mlx4: Verify net device validity on port change event Or Gerlitz
2015-03-18 14:24 ` [PATCH net 2/4] net/mlx4_en: Fix off-by-one in ethtool statistics display Or Gerlitz
2015-03-18 14:24 ` [PATCH net 3/4] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Or Gerlitz
2015-03-18 14:36 ` Sergei Shtylyov
2015-03-18 14:44 ` Or Gerlitz
2015-03-18 14:24 ` [PATCH net 4/4] net/mlx4_en: Set statistics bitmap at port init Or Gerlitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).