aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_mad.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-02-02 13:04:19 -0500
committerRoland Dreier <rolandd@cisco.com>2006-03-20 13:08:10 -0500
commit6dfc3901b04d1b79fa982d6de6d5af3b50c6cea8 (patch)
treef4918637c0d7c4b5c7fe4a4deb84e44ed3663dc6 /drivers/infiniband/hw/mthca/mthca_mad.c
parentc5bcbbb9fe00128d500c2f473d5ddc8d8c2c53a7 (diff)
IB/mthca: Add modify_device method to set node description
Add a modify_device method to mthca, which implements setting the node description. This makes the writable "node_desc" sysfs attribute work for Mellanox HCAs. Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_mad.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mad.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c
index 1229c604c6e0..4ace6a392f41 100644
--- a/drivers/infiniband/hw/mthca/mthca_mad.c
+++ b/drivers/infiniband/hw/mthca/mthca_mad.c
@@ -109,6 +109,19 @@ static void smp_snoop(struct ib_device *ibdev,
109 } 109 }
110} 110}
111 111
112static void node_desc_override(struct ib_device *dev,
113 struct ib_mad *mad)
114{
115 if ((mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED ||
116 mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) &&
117 mad->mad_hdr.method == IB_MGMT_METHOD_GET_RESP &&
118 mad->mad_hdr.attr_id == IB_SMP_ATTR_NODE_DESC) {
119 mutex_lock(&to_mdev(dev)->cap_mask_mutex);
120 memcpy(((struct ib_smp *) mad)->data, dev->node_desc, 64);
121 mutex_unlock(&to_mdev(dev)->cap_mask_mutex);
122 }
123}
124
112static void forward_trap(struct mthca_dev *dev, 125static void forward_trap(struct mthca_dev *dev,
113 u8 port_num, 126 u8 port_num,
114 struct ib_mad *mad) 127 struct ib_mad *mad)
@@ -207,8 +220,10 @@ int mthca_process_mad(struct ib_device *ibdev,
207 return IB_MAD_RESULT_FAILURE; 220 return IB_MAD_RESULT_FAILURE;
208 } 221 }
209 222
210 if (!out_mad->mad_hdr.status) 223 if (!out_mad->mad_hdr.status) {
211 smp_snoop(ibdev, port_num, in_mad); 224 smp_snoop(ibdev, port_num, in_mad);
225 node_desc_override(ibdev, out_mad);
226 }
212 227
213 /* set return bit in status of directed route responses */ 228 /* set return bit in status of directed route responses */
214 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) 229 if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)