From patchwork Sun Oct 3 16:01:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Morgenstein X-Patchwork-Id: 227551 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o93G1RU2010892 for ; Sun, 3 Oct 2010 16:01:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752872Ab0JCQBZ (ORCPT ); Sun, 3 Oct 2010 12:01:25 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:54892 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752501Ab0JCQBY convert rfc822-to-8bit (ORCPT ); Sun, 3 Oct 2010 12:01:24 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from jackm@mellanox.co.il) with SMTP; 3 Oct 2010 18:00:24 +0200 Received: from mtlmail.mtl.com ([fe80::691b:6ccb:b71a:c962]) by mtlmail01.mtl.com ([::1]) with mapi; Sun, 3 Oct 2010 18:01:20 +0200 From: Jack Morgenstein To: Or Gerlitz , Yevgeny Kliteynik CC: linux-rdma , Yael Shenhav , Tziporet Koren Date: Sun, 3 Oct 2010 18:01:18 +0200 Subject: RE: mlx4: propagate node_description changes down to FW Thread-Topic: mlx4: propagate node_description changes down to FW Thread-Index: ActjEAbYAKf9e8ZMRLWGBHLrb5mZdgAA3qGQ Message-ID: References: <4CA8A1BF.4050305@Voltaire.com> In-Reply-To: <4CA8A1BF.4050305@Voltaire.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 03 Oct 2010 16:01:27 +0000 (UTC) Index: ofed_kernel/drivers/infiniband/hw/mlx4/main.c =================================================================== --- ofed_kernel.orig/drivers/infiniband/hw/mlx4/main.c 2010-09-27 17:20:54.069787000 +0200 +++ ofed_kernel/drivers/infiniband/hw/mlx4/main.c 2010-09-27 17:21:15.074810000 +0200 @@ -421,14 +421,34 @@ out: static int mlx4_ib_modify_device(struct ib_device *ibdev, int mask, struct ib_device_modify *props) { + struct mlx4_cmd_mailbox *mailbox; + int err; + if (mask & ~IB_DEVICE_MODIFY_NODE_DESC) return -EOPNOTSUPP; - if (mask & IB_DEVICE_MODIFY_NODE_DESC) { - spin_lock(&to_mdev(ibdev)->sm_lock); - memcpy(ibdev->node_desc, props->node_desc, 64); - spin_unlock(&to_mdev(ibdev)->sm_lock); - } + if (!(mask & IB_DEVICE_MODIFY_NODE_DESC)) + return 0; + + spin_lock(&to_mdev(ibdev)->sm_lock); + memcpy(ibdev->node_desc, props->node_desc, 64); + spin_unlock(&to_mdev(ibdev)->sm_lock); + + /* if possible, pass node desc to FW, so it can generate + * a 144 trap. If cmd fails, just ignore. + */ + mailbox = mlx4_alloc_cmd_mailbox(to_mdev(ibdev)->dev); + if (IS_ERR(mailbox)) + return 0; + + memset(mailbox->buf, 0, 256); + memcpy(mailbox->buf, props->node_desc, 64); + err = mlx4_cmd(to_mdev(ibdev)->dev, mailbox->dma, 1, 0, + MLX4_CMD_SET_NODE, MLX4_CMD_TIME_CLASS_A); + if (err) + mlx4_ib_dbg("SET_NODE command failed (%d)", err); + + mlx4_free_cmd_mailbox(to_mdev(ibdev)->dev, mailbox); return 0; } Index: ofed_kernel/include/linux/mlx4/cmd.h =================================================================== --- ofed_kernel.orig/include/linux/mlx4/cmd.h 2010-09-27 17:20:40.519054000 +0200 +++ ofed_kernel/include/linux/mlx4/cmd.h 2010-09-27 17:21:15.081799000 +0200 @@ -58,6 +58,7 @@ enum { MLX4_CMD_SENSE_PORT = 0x4d, MLX4_CMD_HW_HEALTH_CHECK = 0x50, MLX4_CMD_SET_PORT = 0xc, + MLX4_CMD_SET_NODE = 0x5a, MLX4_CMD_ACCESS_DDR = 0x2e, MLX4_CMD_MAP_ICM = 0xffa, MLX4_CMD_UNMAP_ICM = 0xff9, Index: ofed_kernel/drivers/net/mlx4/cmd.c =================================================================== --- ofed_kernel.orig/drivers/net/mlx4/cmd.c 2010-09-27 17:20:32.995814000 +0200 +++ ofed_kernel/drivers/net/mlx4/cmd.c 2010-09-27 17:21:15.088792000 +0200 @@ -242,8 +242,11 @@ static int mlx4_cmd_poll(struct mlx4_dev __raw_readl(hcr + HCR_OUT_PARAM_OFFSET + 4)); stat = be32_to_cpu((__force __be32) __raw_readl(hcr + HCR_STATUS_OFFSET)) >> 24; err = mlx4_status_to_errno(stat); - if (err) - mlx4_err(dev, "command 0x%x failed: fw status = 0x%x\n", op, stat); + if (err) { + if (op != MLX4_CMD_SET_NODE || stat != CMD_STAT_BAD_OP) + mlx4_err(dev, "command 0x%x failed: fw status = 0x%x\n", + op, stat); + } out: up(&priv->cmd.poll_sem); @@ -296,8 +299,9 @@ static int mlx4_cmd_wait(struct mlx4_dev err = context->result; if (err) { - mlx4_err(dev, "command 0x%x failed: fw status = 0x%x\n", - op, context->fw_status); + if (op != MLX4_CMD_SET_NODE || context->fw_status != CMD_STAT_BAD_OP) + mlx4_err(dev, "command 0x%x failed: fw status = 0x%x\n", + op, context->fw_status); goto out; }