aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_provider.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_provider.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c77
1 files changed, 11 insertions, 66 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 1e0b4b6074ad..365fe0e14192 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -63,8 +63,6 @@ static int mthca_query_device(struct ib_device *ibdev,
63 int err = -ENOMEM; 63 int err = -ENOMEM;
64 struct mthca_dev *mdev = to_mdev(ibdev); 64 struct mthca_dev *mdev = to_mdev(ibdev);
65 65
66 u8 status;
67
68 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 66 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
69 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 67 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
70 if (!in_mad || !out_mad) 68 if (!in_mad || !out_mad)
@@ -78,14 +76,9 @@ static int mthca_query_device(struct ib_device *ibdev,
78 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; 76 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO;
79 77
80 err = mthca_MAD_IFC(mdev, 1, 1, 78 err = mthca_MAD_IFC(mdev, 1, 1,
81 1, NULL, NULL, in_mad, out_mad, 79 1, NULL, NULL, in_mad, out_mad);
82 &status);
83 if (err) 80 if (err)
84 goto out; 81 goto out;
85 if (status) {
86 err = -EINVAL;
87 goto out;
88 }
89 82
90 props->device_cap_flags = mdev->device_cap_flags; 83 props->device_cap_flags = mdev->device_cap_flags;
91 props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) & 84 props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) &
@@ -141,7 +134,6 @@ static int mthca_query_port(struct ib_device *ibdev,
141 struct ib_smp *in_mad = NULL; 134 struct ib_smp *in_mad = NULL;
142 struct ib_smp *out_mad = NULL; 135 struct ib_smp *out_mad = NULL;
143 int err = -ENOMEM; 136 int err = -ENOMEM;
144 u8 status;
145 137
146 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 138 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
147 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 139 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
@@ -155,14 +147,9 @@ static int mthca_query_port(struct ib_device *ibdev,
155 in_mad->attr_mod = cpu_to_be32(port); 147 in_mad->attr_mod = cpu_to_be32(port);
156 148
157 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1, 149 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1,
158 port, NULL, NULL, in_mad, out_mad, 150 port, NULL, NULL, in_mad, out_mad);
159 &status);
160 if (err) 151 if (err)
161 goto out; 152 goto out;
162 if (status) {
163 err = -EINVAL;
164 goto out;
165 }
166 153
167 props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16)); 154 props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
168 props->lmc = out_mad->data[34] & 0x7; 155 props->lmc = out_mad->data[34] & 0x7;
@@ -214,7 +201,6 @@ static int mthca_modify_port(struct ib_device *ibdev,
214 struct mthca_set_ib_param set_ib; 201 struct mthca_set_ib_param set_ib;
215 struct ib_port_attr attr; 202 struct ib_port_attr attr;
216 int err; 203 int err;
217 u8 status;
218 204
219 if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) 205 if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex))
220 return -ERESTARTSYS; 206 return -ERESTARTSYS;
@@ -229,14 +215,9 @@ static int mthca_modify_port(struct ib_device *ibdev,
229 set_ib.cap_mask = (attr.port_cap_flags | props->set_port_cap_mask) & 215 set_ib.cap_mask = (attr.port_cap_flags | props->set_port_cap_mask) &
230 ~props->clr_port_cap_mask; 216 ~props->clr_port_cap_mask;
231 217
232 err = mthca_SET_IB(to_mdev(ibdev), &set_ib, port, &status); 218 err = mthca_SET_IB(to_mdev(ibdev), &set_ib, port);
233 if (err) 219 if (err)
234 goto out; 220 goto out;
235 if (status) {
236 err = -EINVAL;
237 goto out;
238 }
239
240out: 221out:
241 mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex); 222 mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex);
242 return err; 223 return err;
@@ -248,7 +229,6 @@ static int mthca_query_pkey(struct ib_device *ibdev,
248 struct ib_smp *in_mad = NULL; 229 struct ib_smp *in_mad = NULL;
249 struct ib_smp *out_mad = NULL; 230 struct ib_smp *out_mad = NULL;
250 int err = -ENOMEM; 231 int err = -ENOMEM;
251 u8 status;
252 232
253 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 233 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
254 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 234 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
@@ -260,14 +240,9 @@ static int mthca_query_pkey(struct ib_device *ibdev,
260 in_mad->attr_mod = cpu_to_be32(index / 32); 240 in_mad->attr_mod = cpu_to_be32(index / 32);
261 241
262 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1, 242 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1,
263 port, NULL, NULL, in_mad, out_mad, 243 port, NULL, NULL, in_mad, out_mad);
264 &status);
265 if (err) 244 if (err)
266 goto out; 245 goto out;
267 if (status) {
268 err = -EINVAL;
269 goto out;
270 }
271 246
272 *pkey = be16_to_cpu(((__be16 *) out_mad->data)[index % 32]); 247 *pkey = be16_to_cpu(((__be16 *) out_mad->data)[index % 32]);
273 248
@@ -283,7 +258,6 @@ static int mthca_query_gid(struct ib_device *ibdev, u8 port,
283 struct ib_smp *in_mad = NULL; 258 struct ib_smp *in_mad = NULL;
284 struct ib_smp *out_mad = NULL; 259 struct ib_smp *out_mad = NULL;
285 int err = -ENOMEM; 260 int err = -ENOMEM;
286 u8 status;
287 261
288 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 262 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
289 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 263 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
@@ -295,14 +269,9 @@ static int mthca_query_gid(struct ib_device *ibdev, u8 port,
295 in_mad->attr_mod = cpu_to_be32(port); 269 in_mad->attr_mod = cpu_to_be32(port);
296 270
297 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1, 271 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1,
298 port, NULL, NULL, in_mad, out_mad, 272 port, NULL, NULL, in_mad, out_mad);
299 &status);
300 if (err) 273 if (err)
301 goto out; 274 goto out;
302 if (status) {
303 err = -EINVAL;
304 goto out;
305 }
306 275
307 memcpy(gid->raw, out_mad->data + 8, 8); 276 memcpy(gid->raw, out_mad->data + 8, 8);
308 277
@@ -311,14 +280,9 @@ static int mthca_query_gid(struct ib_device *ibdev, u8 port,
311 in_mad->attr_mod = cpu_to_be32(index / 8); 280 in_mad->attr_mod = cpu_to_be32(index / 8);
312 281
313 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1, 282 err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1,
314 port, NULL, NULL, in_mad, out_mad, 283 port, NULL, NULL, in_mad, out_mad);
315 &status);
316 if (err) 284 if (err)
317 goto out; 285 goto out;
318 if (status) {
319 err = -EINVAL;
320 goto out;
321 }
322 286
323 memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8); 287 memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8);
324 288
@@ -800,7 +764,6 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *uda
800 struct mthca_cq *cq = to_mcq(ibcq); 764 struct mthca_cq *cq = to_mcq(ibcq);
801 struct mthca_resize_cq ucmd; 765 struct mthca_resize_cq ucmd;
802 u32 lkey; 766 u32 lkey;
803 u8 status;
804 int ret; 767 int ret;
805 768
806 if (entries < 1 || entries > dev->limits.max_cqes) 769 if (entries < 1 || entries > dev->limits.max_cqes)
@@ -827,9 +790,7 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *uda
827 lkey = ucmd.lkey; 790 lkey = ucmd.lkey;
828 } 791 }
829 792
830 ret = mthca_RESIZE_CQ(dev, cq->cqn, lkey, ilog2(entries), &status); 793 ret = mthca_RESIZE_CQ(dev, cq->cqn, lkey, ilog2(entries));
831 if (status)
832 ret = -EINVAL;
833 794
834 if (ret) { 795 if (ret) {
835 if (cq->resize_buf) { 796 if (cq->resize_buf) {
@@ -1161,7 +1122,6 @@ static int mthca_unmap_fmr(struct list_head *fmr_list)
1161{ 1122{
1162 struct ib_fmr *fmr; 1123 struct ib_fmr *fmr;
1163 int err; 1124 int err;
1164 u8 status;
1165 struct mthca_dev *mdev = NULL; 1125 struct mthca_dev *mdev = NULL;
1166 1126
1167 list_for_each_entry(fmr, fmr_list, list) { 1127 list_for_each_entry(fmr, fmr_list, list) {
@@ -1182,12 +1142,8 @@ static int mthca_unmap_fmr(struct list_head *fmr_list)
1182 list_for_each_entry(fmr, fmr_list, list) 1142 list_for_each_entry(fmr, fmr_list, list)
1183 mthca_tavor_fmr_unmap(mdev, to_mfmr(fmr)); 1143 mthca_tavor_fmr_unmap(mdev, to_mfmr(fmr));
1184 1144
1185 err = mthca_SYNC_TPT(mdev, &status); 1145 err = mthca_SYNC_TPT(mdev);
1186 if (err) 1146 return err;
1187 return err;
1188 if (status)
1189 return -EINVAL;
1190 return 0;
1191} 1147}
1192 1148
1193static ssize_t show_rev(struct device *device, struct device_attribute *attr, 1149static ssize_t show_rev(struct device *device, struct device_attribute *attr,
@@ -1253,7 +1209,6 @@ static int mthca_init_node_data(struct mthca_dev *dev)
1253 struct ib_smp *in_mad = NULL; 1209 struct ib_smp *in_mad = NULL;
1254 struct ib_smp *out_mad = NULL; 1210 struct ib_smp *out_mad = NULL;
1255 int err = -ENOMEM; 1211 int err = -ENOMEM;
1256 u8 status;
1257 1212
1258 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 1213 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
1259 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 1214 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
@@ -1264,28 +1219,18 @@ static int mthca_init_node_data(struct mthca_dev *dev)
1264 in_mad->attr_id = IB_SMP_ATTR_NODE_DESC; 1219 in_mad->attr_id = IB_SMP_ATTR_NODE_DESC;
1265 1220
1266 err = mthca_MAD_IFC(dev, 1, 1, 1221 err = mthca_MAD_IFC(dev, 1, 1,
1267 1, NULL, NULL, in_mad, out_mad, 1222 1, NULL, NULL, in_mad, out_mad);
1268 &status);
1269 if (err) 1223 if (err)
1270 goto out; 1224 goto out;
1271 if (status) {
1272 err = -EINVAL;
1273 goto out;
1274 }
1275 1225
1276 memcpy(dev->ib_dev.node_desc, out_mad->data, 64); 1226 memcpy(dev->ib_dev.node_desc, out_mad->data, 64);
1277 1227
1278 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO; 1228 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO;
1279 1229
1280 err = mthca_MAD_IFC(dev, 1, 1, 1230 err = mthca_MAD_IFC(dev, 1, 1,
1281 1, NULL, NULL, in_mad, out_mad, 1231 1, NULL, NULL, in_mad, out_mad);
1282 &status);
1283 if (err) 1232 if (err)
1284 goto out; 1233 goto out;
1285 if (status) {
1286 err = -EINVAL;
1287 goto out;
1288 }
1289 1234
1290 if (mthca_is_memfree(dev)) 1235 if (mthca_is_memfree(dev))
1291 dev->rev_id = be32_to_cpup((__be32 *) (out_mad->data + 32)); 1236 dev->rev_id = be32_to_cpup((__be32 *) (out_mad->data + 32));