From patchwork Mon Oct 4 12:11:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jackm X-Patchwork-Id: 228451 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 o94C9kJQ028719 for ; Mon, 4 Oct 2010 12:10:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755092Ab0JDMKW (ORCPT ); Mon, 4 Oct 2010 08:10:22 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:63793 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754380Ab0JDMKV (ORCPT ); Mon, 4 Oct 2010 08:10:21 -0400 Received: by fxm14 with SMTP id 14so1620666fxm.19 for ; Mon, 04 Oct 2010 05:10:17 -0700 (PDT) Received: by 10.223.99.137 with SMTP id u9mr8777968fan.45.1286194217061; Mon, 04 Oct 2010 05:10:17 -0700 (PDT) Received: from mtldesk006.lab.mtl.com ([82.166.227.17]) by mx.google.com with ESMTPS id r10sm2118161faq.29.2010.10.04.05.10.15 (version=SSLv3 cipher=RC4-MD5); Mon, 04 Oct 2010 05:10:16 -0700 (PDT) From: Jack Morgenstein Organization: Mellanox To: rdreier@cisco.com Subject: [PATCH] mlx4: propagate node_description changes down to FW to generate trap 144 Date: Mon, 4 Oct 2010 14:11:34 +0200 User-Agent: KMail/1.9.1 Cc: Or Gerlitz , Hal Rosenstock , tziporet@mellanox.co.il, yaeli@mellanox.co.il, linux-rdma@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201010041411.34956.jackm@dev.mellanox.co.il> 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]); Mon, 04 Oct 2010 12:10:30 +0000 (UTC) Index: infiniband/drivers/infiniband/hw/mlx4/main.c =================================================================== --- infiniband.orig/drivers/infiniband/hw/mlx4/main.c 2010-10-04 10:54:50.000000000 +0200 +++ infiniband/drivers/infiniband/hw/mlx4/main.c 2010-10-04 12:25:46.000000000 +0200 @@ -272,14 +272,31 @@ out: static int mlx4_ib_modify_device(struct ib_device *ibdev, int mask, struct ib_device_modify *props) { + struct mlx4_cmd_mailbox *mailbox; + 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); + mlx4_cmd(to_mdev(ibdev)->dev, mailbox->dma, 1, 0, + MLX4_CMD_SET_NODE, MLX4_CMD_TIME_CLASS_A); + + mlx4_free_cmd_mailbox(to_mdev(ibdev)->dev, mailbox); return 0; } Index: infiniband/include/linux/mlx4/cmd.h =================================================================== --- infiniband.orig/include/linux/mlx4/cmd.h 2010-01-28 09:43:01.000000000 +0200 +++ infiniband/include/linux/mlx4/cmd.h 2010-10-04 11:10:27.000000000 +0200 @@ -57,6 +57,7 @@ enum { MLX4_CMD_QUERY_PORT = 0x43, MLX4_CMD_SENSE_PORT = 0x4d, 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,