Commit 9ad13a42 authored by Ira Weiny's avatar Ira Weiny Committed by Roland Dreier

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: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 7ef5d4b0
...@@ -214,58 +214,95 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -214,58 +214,95 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
/* Validate parameters */ /* Validate parameters */
qpn = get_spl_qp_index(qp_type); qpn = get_spl_qp_index(qp_type);
if (qpn == -1) if (qpn == -1) {
dev_notice(&device->dev,
"ib_register_mad_agent: invalid QP Type %d\n",
qp_type);
goto error1; goto error1;
}
if (rmpp_version && rmpp_version != IB_MGMT_RMPP_VERSION) if (rmpp_version && rmpp_version != IB_MGMT_RMPP_VERSION) {
dev_notice(&device->dev,
"ib_register_mad_agent: invalid RMPP Version %u\n",
rmpp_version);
goto error1; goto error1;
}
/* Validate MAD registration request if supplied */ /* Validate MAD registration request if supplied */
if (mad_reg_req) { if (mad_reg_req) {
if (mad_reg_req->mgmt_class_version >= MAX_MGMT_VERSION) if (mad_reg_req->mgmt_class_version >= MAX_MGMT_VERSION) {
dev_notice(&device->dev,
"ib_register_mad_agent: invalid Class Version %u\n",
mad_reg_req->mgmt_class_version);
goto error1; goto error1;
if (!recv_handler) }
if (!recv_handler) {
dev_notice(&device->dev,
"ib_register_mad_agent: no recv_handler\n");
goto error1; goto error1;
}
if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) { if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) {
/* /*
* IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE is the only * IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE is the only
* one in this range currently allowed * one in this range currently allowed
*/ */
if (mad_reg_req->mgmt_class != if (mad_reg_req->mgmt_class !=
IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) {
dev_notice(&device->dev,
"ib_register_mad_agent: Invalid Mgmt Class 0x%x\n",
mad_reg_req->mgmt_class);
goto error1; goto error1;
}
} else if (mad_reg_req->mgmt_class == 0) { } else if (mad_reg_req->mgmt_class == 0) {
/* /*
* Class 0 is reserved in IBA and is used for * Class 0 is reserved in IBA and is used for
* aliasing of IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE * aliasing of IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE
*/ */
dev_notice(&device->dev,
"ib_register_mad_agent: Invalid Mgmt Class 0\n");
goto error1; goto error1;
} else if (is_vendor_class(mad_reg_req->mgmt_class)) { } else if (is_vendor_class(mad_reg_req->mgmt_class)) {
/* /*
* If class is in "new" vendor range, * If class is in "new" vendor range,
* ensure supplied OUI is not zero * ensure supplied OUI is not zero
*/ */
if (!is_vendor_oui(mad_reg_req->oui)) if (!is_vendor_oui(mad_reg_req->oui)) {
dev_notice(&device->dev,
"ib_register_mad_agent: No OUI specified for class 0x%x\n",
mad_reg_req->mgmt_class);
goto error1; goto error1;
}
} }
/* Make sure class supplied is consistent with RMPP */ /* Make sure class supplied is consistent with RMPP */
if (!ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) { if (!ib_is_mad_class_rmpp(mad_reg_req->mgmt_class)) {
if (rmpp_version) if (rmpp_version) {
dev_notice(&device->dev,
"ib_register_mad_agent: RMPP version for non-RMPP class 0x%x\n",
mad_reg_req->mgmt_class);
goto error1; goto error1;
}
} }
/* Make sure class supplied is consistent with QP type */ /* Make sure class supplied is consistent with QP type */
if (qp_type == IB_QPT_SMI) { if (qp_type == IB_QPT_SMI) {
if ((mad_reg_req->mgmt_class != if ((mad_reg_req->mgmt_class !=
IB_MGMT_CLASS_SUBN_LID_ROUTED) && IB_MGMT_CLASS_SUBN_LID_ROUTED) &&
(mad_reg_req->mgmt_class != (mad_reg_req->mgmt_class !=
IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) {
dev_notice(&device->dev,
"ib_register_mad_agent: Invalid SM QP type: class 0x%x\n",
mad_reg_req->mgmt_class);
goto error1; goto error1;
}
} else { } else {
if ((mad_reg_req->mgmt_class == if ((mad_reg_req->mgmt_class ==
IB_MGMT_CLASS_SUBN_LID_ROUTED) || IB_MGMT_CLASS_SUBN_LID_ROUTED) ||
(mad_reg_req->mgmt_class == (mad_reg_req->mgmt_class ==
IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)) {
dev_notice(&device->dev,
"ib_register_mad_agent: Invalid GS QP type: class 0x%x\n",
mad_reg_req->mgmt_class);
goto error1; goto error1;
}
} }
} else { } else {
/* No registration request supplied */ /* No registration request supplied */
...@@ -276,6 +313,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -276,6 +313,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
/* Validate device and port */ /* Validate device and port */
port_priv = ib_get_mad_port(device, port_num); port_priv = ib_get_mad_port(device, port_num);
if (!port_priv) { if (!port_priv) {
dev_notice(&device->dev, "ib_register_mad_agent: Invalid port\n");
ret = ERR_PTR(-ENODEV); ret = ERR_PTR(-ENODEV);
goto error1; goto error1;
} }
...@@ -283,6 +321,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -283,6 +321,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
/* Verify the QP requested is supported. For example, Ethernet devices /* Verify the QP requested is supported. For example, Ethernet devices
* will not have QP0 */ * will not have QP0 */
if (!port_priv->qp_info[qpn].qp) { if (!port_priv->qp_info[qpn].qp) {
dev_notice(&device->dev,
"ib_register_mad_agent: QP %d not supported\n", qpn);
ret = ERR_PTR(-EPROTONOSUPPORT); ret = ERR_PTR(-EPROTONOSUPPORT);
goto error1; goto error1;
} }
......
...@@ -616,6 +616,8 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg, ...@@ -616,6 +616,8 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg,
mutex_lock(&file->mutex); mutex_lock(&file->mutex);
if (!file->port->ib_dev) { if (!file->port->ib_dev) {
dev_notice(file->port->dev,
"ib_umad_reg_agent: invalid device\n");
ret = -EPIPE; ret = -EPIPE;
goto out; goto out;
} }
...@@ -626,6 +628,9 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg, ...@@ -626,6 +628,9 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg,
} }
if (ureq.qpn != 0 && ureq.qpn != 1) { if (ureq.qpn != 0 && ureq.qpn != 1) {
dev_notice(file->port->dev,
"ib_umad_reg_agent: invalid QPN %d specified\n",
ureq.qpn);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -634,6 +639,9 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg, ...@@ -634,6 +639,9 @@ static int ib_umad_reg_agent(struct ib_umad_file *file, void __user *arg,
if (!__get_agent(file, agent_id)) if (!__get_agent(file, agent_id))
goto found; goto found;
dev_notice(file->port->dev,
"ib_umad_reg_agent: Max Agents (%u) reached\n",
IB_UMAD_MAX_AGENTS);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment