From patchwork Mon May 14 20:04:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 159149 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 78C08B7028 for ; Tue, 15 May 2012 06:04:44 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932333Ab2ENUEm (ORCPT ); Mon, 14 May 2012 16:04:42 -0400 Received: from eu1sys200aog112.obsmtp.com ([207.126.144.133]:55661 "HELO eu1sys200aog112.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757626Ab2ENUEZ (ORCPT ); Mon, 14 May 2012 16:04:25 -0400 Received: from mtlsws123.lab.mtl.com ([82.166.227.17]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKT7FlRDz5Fg2sB/cO2EIZkU6OXnbmUpnx@postini.com; Mon, 14 May 2012 20:04:25 UTC Received: from r-vnc04.lab.mtl.com (r-vnc04.lab.mtl.com [10.208.0.116]) by mtlsws123.lab.mtl.com (8.13.8/8.13.8) with ESMTP id q4EK4Fxq029384; Mon, 14 May 2012 23:04:19 +0300 From: Or Gerlitz To: davem@davemloft.net Cc: roland@kernel.org, netdev@vger.kernel.org, Jack Morgenstein , Or Gerlitz Subject: [PATCH net-next 2/8] net/mlx4_core: Fix init_port mask state for slaves Date: Mon, 14 May 2012 23:04:07 +0300 Message-Id: <1337025853-26685-3-git-send-email-ogerlitz@mellanox.com> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1337025853-26685-1-git-send-email-ogerlitz@mellanox.com> References: <1337025853-26685-1-git-send-email-ogerlitz@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jack Morgenstein In function mlx4_INIT_PORT_wrapper, the port state mask for the slave is only set if we are invoking the INIT_PORT fw command. However, the reference count for the (initialized) port is incremented anyway. This creates a problem in that when we have multiple slaves, then the CLOSE_PORT command will never be invoked. The reason is that in the CLOSE_PORT wrapper, if the port-state mask is zero for the slave (which it is), the wrapper returns without doing anything. The only slave which will not return immediately in the CLOSE_PORT wrapper is that slave for which INIT_PORT was invoked. The fix is to not have the port-state mask setting depend on the logic for calling the INIT_PORT fw command. Signed-off-by: Jack Morgenstein Signed-off-by: Or Gerlitz --- drivers/net/ethernet/mellanox/mlx4/fw.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 2a02ba5..24429a9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c @@ -1164,9 +1164,8 @@ int mlx4_INIT_PORT_wrapper(struct mlx4_dev *dev, int slave, MLX4_CMD_TIME_CLASS_A, MLX4_CMD_NATIVE); if (err) return err; - priv->mfunc.master.slave_state[slave].init_port_mask |= - (1 << port); } + priv->mfunc.master.slave_state[slave].init_port_mask |= (1 << port); ++priv->mfunc.master.init_port_ref[port]; return 0; }