Commit f9d08f1e authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

RDMA/core: Rate limit MAD error messages

While registering a mad agent, a user space can trigger various errors
and flood the logs.

Therefore, decrease verbosity and rate limit such error messages.
While we are at it, use __func__ to print function name.
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 142a9c28
...@@ -227,30 +227,30 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -227,30 +227,30 @@ 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, dev_dbg_ratelimited(&device->dev, "%s: invalid QP Type %d\n",
"ib_register_mad_agent: invalid QP Type %d\n", __func__, qp_type);
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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: invalid RMPP Version %u\n", "%s: invalid RMPP Version %u\n",
rmpp_version); __func__, 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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: invalid Class Version %u\n", "%s: invalid Class Version %u\n",
__func__,
mad_reg_req->mgmt_class_version); mad_reg_req->mgmt_class_version);
goto error1; goto error1;
} }
if (!recv_handler) { if (!recv_handler) {
dev_notice(&device->dev, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: no recv_handler\n"); "%s: no recv_handler\n", __func__);
goto error1; goto error1;
} }
if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) { if (mad_reg_req->mgmt_class >= MAX_MGMT_CLASS) {
...@@ -260,9 +260,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -260,9 +260,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
*/ */
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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: Invalid Mgmt Class 0x%x\n", "%s: Invalid Mgmt Class 0x%x\n",
mad_reg_req->mgmt_class); __func__, 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) {
...@@ -270,8 +270,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -270,8 +270,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
* 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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: Invalid Mgmt Class 0\n"); "%s: Invalid Mgmt Class 0\n",
__func__);
goto error1; goto error1;
} else if (is_vendor_class(mad_reg_req->mgmt_class)) { } else if (is_vendor_class(mad_reg_req->mgmt_class)) {
/* /*
...@@ -279,8 +280,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -279,8 +280,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
* 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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: No OUI specified for class 0x%x\n", "%s: No OUI specified for class 0x%x\n",
__func__,
mad_reg_req->mgmt_class); mad_reg_req->mgmt_class);
goto error1; goto error1;
} }
...@@ -288,9 +290,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -288,9 +290,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
/* 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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: RMPP version for non-RMPP class 0x%x\n", "%s: RMPP version for non-RMPP class 0x%x\n",
mad_reg_req->mgmt_class); __func__, mad_reg_req->mgmt_class);
goto error1; goto error1;
} }
} }
...@@ -301,9 +303,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -301,9 +303,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: Invalid SM QP type: class 0x%x\n", "%s: Invalid SM QP type: class 0x%x\n",
mad_reg_req->mgmt_class); __func__, mad_reg_req->mgmt_class);
goto error1; goto error1;
} }
} else { } else {
...@@ -311,9 +313,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -311,9 +313,9 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
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, dev_dbg_ratelimited(&device->dev,
"ib_register_mad_agent: Invalid GS QP type: class 0x%x\n", "%s: Invalid GS QP type: class 0x%x\n",
mad_reg_req->mgmt_class); __func__, mad_reg_req->mgmt_class);
goto error1; goto error1;
} }
} }
...@@ -328,18 +330,18 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ...@@ -328,18 +330,18 @@ 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, dev_dbg_ratelimited(&device->dev, "%s: Invalid port %d\n",
"ib_register_mad_agent: Invalid port %d\n", __func__, port_num);
port_num);
ret = ERR_PTR(-ENODEV); ret = ERR_PTR(-ENODEV);
goto error1; goto error1;
} }
/* 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, dev_dbg_ratelimited(&device->dev, "%s: QP %d not supported\n",
"ib_register_mad_agent: QP %d not supported\n", qpn); __func__, qpn);
ret = ERR_PTR(-EPROTONOSUPPORT); ret = ERR_PTR(-EPROTONOSUPPORT);
goto error1; goto error1;
} }
......
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