aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2014-08-08 19:00:54 -0400
committerRoland Dreier <roland@purestorage.com>2014-08-10 23:36:00 -0400
commit9ad13a423484725324fb2c5c5ab527d6bf9d84cc (patch)
treea32aeb578a1bc47bd016a7cc8dad65b1a85d9bfa /drivers/infiniband
parent7ef5d4b0463c095a994890131918d3301d8404ee (diff)
IB/mad: Add dev_notice messages for various umad/mad registration failures
Registration failures can be difficult to debug from userspace. This gives more visibility. Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/mad.c58
-rw-r--r--drivers/infiniband/core/user_mad.c8
2 files changed, 57 insertions, 9 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 08f430319fc8..f46995d4f54b 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -214,58 +214,95 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
214 214
215 /* Validate parameters */ 215 /* Validate parameters */
216 qpn = get_spl_qp_index(qp_type); 216 qpn = get_spl_qp_index(qp_type);
217 if (qpn == -1) 217 if (qpn == -1) {
218 dev_notice(&device->dev,
219 "ib_register_mad_agent: invalid QP Type %d\n",
220 qp_type);
218 goto error1; 221 goto error1;
222 }
219 223
220 if (rmpp_version && rmpp_version != IB_MGMT_RMPP_VERSION) 224 if (rmpp_version && rmpp_version != IB_MGMT_RMPP_VERSION) {
225 dev_notice(&device->dev,
226 "ib_register_mad_agent: invalid RMPP Version %u\n",
227 rmpp_version);
221 goto error1; 228 goto error1;
229 }
222 230
223 /* Validate MAD registration request if supplied */ 231 /* Validate MAD registration request if supplied */
224 if (mad_reg_req) { 232 if (mad_reg_req) {
225 if (mad_reg_req->mgmt_class_version >= MAX_MGMT_VERSION) 233 if (mad_reg_req->mgmt_class_version >= MAX_MGMT_VERSION) {
234 dev_notice(&device->dev,
235 "ib_register_mad_agent: invalid Class Version %u\n",
236 mad_reg_req->mgmt_class_version);
226 goto error1; 237 goto error1;
227 if (!recv_handler) 238 }
239 if (!recv_handler) {
240 dev_notice(&device->dev,
241 "ib_register_mad_agent: no recv_handler\n");
228 goto error1; 242 goto error1;
243 }
229 if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) { 244 if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) {
230 /* 245 /*
231 * IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE is the only 246 * IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE is the only
232 * one in this range currently allowed 247 * one in this range currently allowed
233 */ 248 */
234 if (mad_reg_req->mgmt_class != 249 if (mad_reg_req->mgmt_class !=
235 IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) 250 IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) {
251 dev_notice(&device->dev,
252 "ib_register_mad_agent: Invalid Mgmt Class 0x%x\n",
253 mad_reg_req->mgmt_class);
236 goto error1; 254 goto error1;
255 }
237 } else if (mad_reg_req->mgmt_class == 0) { 256 } else if (mad_reg_req->mgmt_class == 0) {
238 /* 257 /*
239 * Class 0 is reserved in IBA and is used for 258 * Class 0 is reserved in IBA and is used for
240 * aliasing of IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 259 * aliasing of IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE
241 */ 260 */
261 dev_notice(&device->dev,
262 "ib_register_mad_agent: Invalid Mgmt Class 0\n");
242 goto error1; 263 goto error1;
243 } else if (is_vendor_class(mad_reg_req->mgmt_class)) { 264 } else if (is_vendor_class(mad_reg_req->mgmt_class)) {
244 /* 265 /*
245 * If class is in "new" vendor range, 266 * If class is in "new" vendor range,
246 * ensure supplied OUI is not zero 267 * ensure supplied OUI is not zero
247 */ 268 */
248 if (!is_vendor_oui(mad_reg_req->oui)) 269 if (!is_vendor_oui(mad_reg_req->oui)) {
270 dev_notice(&device->dev,
271 "ib_register_mad_agent: No OUI specified for class 0x%x\n",
272 mad_reg_req->mgmt_class);
249 goto error1; 273 goto error1;
274 }
250 } 275 }
251 /* Make sure class supplied is consistent with RMPP */ 276 /* Make sure class supplied is consistent with RMPP */
252 if (!ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) { 277 if (!ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) {
253 if (rmpp_version) 278 if (rmpp_version) {
279 dev_notice(&device->dev,
280 "ib_register_mad_agent: RMPP version for non-RMPP class 0x%x\n",
281 mad_reg_req->mgmt_class);
254 goto error1; 282 goto error1;
283 }
255 } 284 }
256 /* Make sure class supplied is consistent with QP type */ 285 /* Make sure class supplied is consistent with QP type */
257 if (qp_type == IB_QPT_SMI) { 286 if (qp_type == IB_QPT_SMI) {
258 if ((mad_reg_req->mgmt_class != 287 if ((mad_reg_req->mgmt_class !=
259 IB_MGMT_CLASS_SUBN_LID_ROUTED) && 288 IB_MGMT_CLASS_SUBN_LID_ROUTED) &&
260 (mad_reg_req->mgmt_class != 289 (mad_reg_req->mgmt_class !=
261 IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) 290 IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) {
291 dev_notice(&device->dev,
292 "ib_register_mad_agent: Invalid SM QP type: class 0x%x\n",
293 mad_reg_req->mgmt_class);
262 goto error1; 294 goto error1;
295 }
263 } else { 296 } else {
264 if ((mad_reg_req->mgmt_class == 297 if ((mad_reg_req->mgmt_class ==
265 IB_MGMT_CLASS_SUBN_LID_ROUTED) || 298 IB_MGMT_CLASS_SUBN_LID_ROUTED) ||
266 (mad_reg_req->mgmt_class == 299 (mad_reg_req->mgmt_class ==
267 IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) 300 IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) {
301 dev_notice(&device->dev,
302 "ib_register_mad_agent: Invalid GS QP type: class 0x%x\n",
303 mad_reg_req->mgmt_class);
268 goto error1; 304 goto error1;
305 }
269 } 306 }
270 } else { 307 } else {
271 /* No registration request supplied */ 308 /* No registration request supplied */
@@ -276,6 +313,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
276 /* Validate device and port */ 313 /* Validate device and port */
277 port_priv = ib_get_mad_port(device, port_num); 314 port_priv = ib_get_mad_port(device, port_num);
278 if (!port_priv) { 315 if (!port_priv) {
316 dev_notice(&device->dev, "ib_register_mad_agent: Invalid port\n");
279 ret = ERR_PTR(-ENODEV); 317 ret = ERR_PTR(-ENODEV);
280 goto error1; 318 goto error1;
281 } 319 }
@@ -283,6 +321,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
283 /* Verify the QP requested is supported. For example, Ethernet devices 321 /* Verify the QP requested is supported. For example, Ethernet devices
284 * will not have QP0 */ 322 * will not have QP0 */
285 if (!port_priv->qp_info[qpn].qp) { 323 if (!port_priv->qp_info[qpn].qp) {
324 dev_notice(&device->dev,
325 "ib_register_mad_agent: QP %d not supported\n", qpn);
286 ret = ERR_PTR(-EPROTONOSUPPORT); 326 ret = ERR_PTR(-EPROTONOSUPPORT);
287 goto error1; 327 goto error1;
288 } 328 }
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 6be596dc360a..ea90a3ebb9c2 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -616,6 +616,8 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg,
616 mutex_lock(&file->mutex); 616 mutex_lock(&file->mutex);
617 617
618 if (!file->port->ib_dev) { 618 if (!file->port->ib_dev) {
619 dev_notice(file->port->dev,
620 "ib_umad_reg_agent: invalid device\n");
619 ret = -EPIPE; 621 ret = -EPIPE;
620 goto out; 622 goto out;
621 } 623 }
@@ -626,6 +628,9 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg,
626 } 628 }
627 629
628 if (ureq.qpn != 0 && ureq.qpn != 1) { 630 if (ureq.qpn != 0 && ureq.qpn != 1) {
631 dev_notice(file->port->dev,
632 "ib_umad_reg_agent: invalid QPN %d specified\n",
633 ureq.qpn);
629 ret = -EINVAL; 634 ret = -EINVAL;
630 goto out; 635 goto out;
631 } 636 }
@@ -634,6 +639,9 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg,
634 if (!__get_agent(file, agent_id)) 639 if (!__get_agent(file, agent_id))
635 goto found; 640 goto found;
636 641
642 dev_notice(file->port->dev,
643 "ib_umad_reg_agent: Max Agents (%u) reached\n",
644 IB_UMAD_MAX_AGENTS);
637 ret = -ENOMEM; 645 ret = -ENOMEM;
638 goto out; 646 goto out;
639 647