netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015
@ 2015-07-22 13:53 Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 1/4] net/mlx4_core: Use sink counter for the VF default as fallback Or Gerlitz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-07-22 13:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Tal Alon, Or Gerlitz

Hi Dave,

Just few mlx4 fixes.. the fix related to propagating port state
changes to VF should go to -stable of >= 3.11, all the rest just
to 4.2-rc

Or.

Ido Shamay (1):
  net/mlx4_en: Remove BUG_ON assert when checking if ring is full

Jack Morgenstein (2):
  net/mlx4_core: Fix wrong index in propagating port change event to VFs
  net/mlx4_core: Relieve cpu load average on the port sending flow

Or Gerlitz (1):
  net/mlx4_core: Use sink counter for the VF default as fallback

 drivers/net/ethernet/mellanox/mlx4/cmd.c   | 17 +++++++++++++++--
 drivers/net/ethernet/mellanox/mlx4/en_rx.c |  1 -
 drivers/net/ethernet/mellanox/mlx4/eq.c    |  4 ++--
 drivers/net/ethernet/mellanox/mlx4/main.c  |  5 +++++
 4 files changed, 22 insertions(+), 5 deletions(-)

-- 
2.3.7

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

* [PATCH net 1/4] net/mlx4_core: Use sink counter for the VF default as fallback
  2015-07-22 13:53 [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 Or Gerlitz
@ 2015-07-22 13:53 ` Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 2/4] net/mlx4_core: Fix wrong index in propagating port change event to VFs Or Gerlitz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-07-22 13:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Tal Alon, Or Gerlitz, Eran Ben Elisha

Some old PF drivers don't let VFs allocate counters, in that case, use
the sink counter so the VF can load and operate properly.

Fixes: 6de5f7f6a1fa ('net/mlx4_core: Allocate default counter per port')
Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 12fbfcb..29c2a01 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2273,6 +2273,11 @@ static int mlx4_allocate_default_counters(struct mlx4_dev *dev)
 		} else if (err == -ENOENT) {
 			err = 0;
 			continue;
+		} else if (mlx4_is_slave(dev) && err == -EINVAL) {
+			priv->def_counter[port] = MLX4_SINK_COUNTER_INDEX(dev);
+			mlx4_warn(dev, "can't allocate counter from old PF driver, using index %d\n",
+				  MLX4_SINK_COUNTER_INDEX(dev));
+			err = 0;
 		} else {
 			mlx4_err(dev, "%s: failed to allocate default counter port %d err %d\n",
 				 __func__, port + 1, err);
-- 
2.3.7

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

* [PATCH net 2/4] net/mlx4_core: Fix wrong index in propagating port change event to VFs
  2015-07-22 13:53 [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 1/4] net/mlx4_core: Use sink counter for the VF default as fallback Or Gerlitz
@ 2015-07-22 13:53 ` Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 3/4] net/mlx4_core: Relieve cpu load average on the port sending flow Or Gerlitz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-07-22 13:53 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Jack Morgenstein, Matan Barak,
	Or Gerlitz

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

The port-change event processing in procedure mlx4_eq_int() uses "slave"
as the vf_oper array index. Since the value of "slave" is the PF function
index, the result is that the PF link state is used for deciding to
propagate the event for all the VFs. The VF link state should be used,
so the VF function index should be used here.

Fixes: 948e306d7d64 ('net/mlx4: Add VF link state support')
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/eq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index aae13ad..8e81e53 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -601,7 +601,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
 							continue;
 						mlx4_dbg(dev, "%s: Sending MLX4_PORT_CHANGE_SUBTYPE_DOWN to slave: %d, port:%d\n",
 							 __func__, i, port);
-						s_info = &priv->mfunc.master.vf_oper[slave].vport[port].state;
+						s_info = &priv->mfunc.master.vf_oper[i].vport[port].state;
 						if (IFLA_VF_LINK_STATE_AUTO == s_info->link_state) {
 							eqe->event.port_change.port =
 								cpu_to_be32(
@@ -640,7 +640,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
 							continue;
 						if (i == mlx4_master_func_num(dev))
 							continue;
-						s_info = &priv->mfunc.master.vf_oper[slave].vport[port].state;
+						s_info = &priv->mfunc.master.vf_oper[i].vport[port].state;
 						if (IFLA_VF_LINK_STATE_AUTO == s_info->link_state) {
 							eqe->event.port_change.port =
 								cpu_to_be32(
-- 
2.3.7

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

* [PATCH net 3/4] net/mlx4_core: Relieve cpu load average on the port sending flow
  2015-07-22 13:53 [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 1/4] net/mlx4_core: Use sink counter for the VF default as fallback Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 2/4] net/mlx4_core: Fix wrong index in propagating port change event to VFs Or Gerlitz
@ 2015-07-22 13:53 ` Or Gerlitz
  2015-07-22 13:53 ` [PATCH net 4/4] net/mlx4_en: Remove BUG_ON assert when checking if ring is full Or Gerlitz
  2015-07-26 23:30 ` [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-07-22 13:53 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Jack Morgenstein, Or Gerlitz

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

When a port is not attached, the FW requires a longer than usual time to
execute the SENSE_PORT command. In the command flow, the
wait_for_completion_timeout call used in mlx4_cmd_wait puts the kernel
thread into the uninterruptible state during this time. This, in turn,
due to the computation method, causes the CPU load average to increase.

Fix this by using wait_for_completion_interruptible_timeout() for the
SENSE_PORT command, which puts the thread in the interruptible state.
In this state, the thread does not contribute to the CPU load average.

Treat the interrupted case as if the SENSE_PORT command returned
port_type = NONE.

Fix suggested by Gideon Naim <gideonn@mellanox.com> and
Bart Van Assche <bart.vanassche@sandisk.com>.


Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 8204013..0a32020 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -686,6 +686,7 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
 {
 	struct mlx4_cmd *cmd = &mlx4_priv(dev)->cmd;
 	struct mlx4_cmd_context *context;
+	long ret_wait;
 	int err = 0;
 
 	down(&cmd->event_sem);
@@ -711,8 +712,20 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
 	if (err)
 		goto out_reset;
 
-	if (!wait_for_completion_timeout(&context->done,
-					 msecs_to_jiffies(timeout))) {
+	if (op == MLX4_CMD_SENSE_PORT) {
+		ret_wait =
+			wait_for_completion_interruptible_timeout(&context->done,
+								  msecs_to_jiffies(timeout));
+		if (ret_wait < 0) {
+			context->fw_status = 0;
+			context->out_param = 0;
+			context->result = 0;
+		}
+	} else {
+		ret_wait = (long)wait_for_completion_timeout(&context->done,
+							     msecs_to_jiffies(timeout));
+	}
+	if (!ret_wait) {
 		mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n",
 			  op);
 		if (op == MLX4_CMD_NOP) {
-- 
2.3.7

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

* [PATCH net 4/4] net/mlx4_en: Remove BUG_ON assert when checking if ring is full
  2015-07-22 13:53 [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 Or Gerlitz
                   ` (2 preceding siblings ...)
  2015-07-22 13:53 ` [PATCH net 3/4] net/mlx4_core: Relieve cpu load average on the port sending flow Or Gerlitz
@ 2015-07-22 13:53 ` Or Gerlitz
  2015-07-26 23:30 ` [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-07-22 13:53 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Tal Alon, Ido Shamay, Eugenia Emantayev,
	Or Gerlitz

From: Ido Shamay <idos@mellanox.com>

In mlx4_en_is_ring_empty we check if ring surpassed its size.
Since the prod and cons indicators are u32, there might be a state where
prod wrapped around and cons, making this assert false, although no
actual bug exists (other code segment can cope with this state).

Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 7a4f20b..9c145dd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -246,7 +246,6 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
 
 static inline bool mlx4_en_is_ring_empty(struct mlx4_en_rx_ring *ring)
 {
-	BUG_ON((u32)(ring->prod - ring->cons) > ring->actual_size);
 	return ring->prod == ring->cons;
 }
 
-- 
2.3.7

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

* Re: [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015
  2015-07-22 13:53 [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 Or Gerlitz
                   ` (3 preceding siblings ...)
  2015-07-22 13:53 ` [PATCH net 4/4] net/mlx4_en: Remove BUG_ON assert when checking if ring is full Or Gerlitz
@ 2015-07-26 23:30 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-07-26 23:30 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev, amirv, talal

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Wed, 22 Jul 2015 16:53:45 +0300

> Just few mlx4 fixes.. the fix related to propagating port state
> changes to VF should go to -stable of >= 3.11, all the rest just
> to 4.2-rc

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

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

end of thread, other threads:[~2015-07-26 23:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 13:53 [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 Or Gerlitz
2015-07-22 13:53 ` [PATCH net 1/4] net/mlx4_core: Use sink counter for the VF default as fallback Or Gerlitz
2015-07-22 13:53 ` [PATCH net 2/4] net/mlx4_core: Fix wrong index in propagating port change event to VFs Or Gerlitz
2015-07-22 13:53 ` [PATCH net 3/4] net/mlx4_core: Relieve cpu load average on the port sending flow Or Gerlitz
2015-07-22 13:53 ` [PATCH net 4/4] net/mlx4_en: Remove BUG_ON assert when checking if ring is full Or Gerlitz
2015-07-26 23:30 ` [PATCH net 0/4] mlx4 driver fixes, July 22nd 2015 David Miller

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).