ib_mad: Add modules name to messages Index: ib_mad_priv.h =================================================================== --- ib_mad_priv.h (revision 965) +++ ib_mad_priv.h (working copy) @@ -61,6 +61,9 @@ #include <ib_mad.h> #include <ib_smi.h> + +#define PFX "ib_mad: " + #define IB_MAD_QPS_CORE 2 /* Always QP0 and QP1 as a minimum */ /* QP and CQ parameters */ Index: ib_mad.c =================================================================== --- ib_mad.c (revision 966) +++ ib_mad.c (working copy) @@ -308,7 +308,7 @@ &port_priv->send_posted_mad_list); port_priv->send_posted_mad_count++; } else { - printk(KERN_NOTICE "ib_post_send failed ret = %d\n", ret); + printk(KERN_NOTICE PFX "ib_post_send failed ret = %d\n", ret); *bad_send_wr = send_wr; } spin_unlock_irqrestore(&port_priv->send_list_lock, flags); @@ -353,7 +353,7 @@ GFP_ATOMIC : GFP_KERNEL); if (!mad_send_wr) { *bad_send_wr = cur_send_wr; - printk(KERN_ERR "No memory for " + printk(KERN_ERR PFX "No memory for " "ib_mad_send_wr_private\n"); return -ENOMEM; } @@ -432,7 +432,7 @@ void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, void *buf) { - printk(KERN_ERR "ib_coalesce_recv_mad() not implemented yet\n"); + printk(KERN_ERR PFX "ib_coalesce_recv_mad() not implemented yet\n"); } EXPORT_SYMBOL(ib_coalesce_recv_mad); @@ -449,7 +449,7 @@ int ib_process_mad_wc(struct ib_mad_agent *mad_agent, struct ib_wc *wc) { - printk(KERN_ERR "ib_process_mad_wc() not implemented yet\n"); + printk(KERN_ERR PFX "ib_process_mad_wc() not implemented yet\n"); return 0; } EXPORT_SYMBOL(ib_process_mad_wc); @@ -471,7 +471,7 @@ i = find_next_bit(mad_reg_req->method_mask, IB_MGMT_MAX_METHODS, 1+i)) { if ((*method)->agent[i]) { - printk(KERN_ERR "Method %d already in use\n", i); + printk(KERN_ERR PFX "Method %d already in use\n", i); return -EINVAL; } } @@ -483,7 +483,7 @@ /* Allocate management method table */ *method = kmalloc(sizeof **method, GFP_KERNEL); if (!*method) { - printk(KERN_ERR "No memory for ib_mad_mgmt_method_table\n"); + printk(KERN_ERR PFX "No memory for ib_mad_mgmt_method_table\n"); return -ENOMEM; } /* Clear management method table */ @@ -556,7 +556,7 @@ /* Allocate management class table for "new" class version */ *class = kmalloc(sizeof **class, GFP_KERNEL); if (!*class) { - printk(KERN_ERR "No memory for " + printk(KERN_ERR PFX "No memory for " "ib_mad_mgmt_class_table\n"); goto error1; } @@ -628,8 +628,8 @@ port_priv = agent_priv->port_priv; class = port_priv->version[agent_priv->reg_req->mgmt_class_version]; if (!class) { - printk(KERN_ERR "No class table yet MAD registration request " - "supplied\n"); + printk(KERN_ERR PFX "No class table yet MAD registration " + "request supplied\n"); goto ret; } @@ -713,21 +713,21 @@ } } if (!mad_agent) { - printk(KERN_ERR "No client 0x%x for received MAD on " - "port %d\n", hi_tid, port_priv->port_num); + printk(KERN_ERR PFX "No client 0x%x for received MAD " + "on port %d\n", hi_tid, port_priv->port_num); goto ret; } } else { /* Routing is based on version, class, and method */ if (mad->mad_hdr.class_version >= MAX_MGMT_VERSION) { - printk(KERN_ERR "MAD received with unsupported class " - "version %d on port %d\n", + printk(KERN_ERR PFX "MAD received with unsupported " + "class version %d on port %d\n", mad->mad_hdr.class_version, port_priv->port_num); goto ret; } version = port_priv->version[mad->mad_hdr.class_version]; if (!version) { - printk(KERN_ERR "MAD received on port %d for class " + printk(KERN_ERR PFX "MAD received on port %d for class " "version %d with no client\n", port_priv->port_num, mad->mad_hdr.class_version); goto ret; @@ -735,7 +735,7 @@ class = version->method_table[convert_mgmt_class( mad->mad_hdr.mgmt_class)]; if (!class) { - printk(KERN_ERR "MAD received on port %d for class " + printk(KERN_ERR PFX "MAD received on port %d for class " "%d with no client\n", port_priv->port_num, mad->mad_hdr.mgmt_class); goto ret; @@ -754,7 +754,7 @@ /* Make sure MAD base version is understood */ if (mad->mad_hdr.base_version != IB_MGMT_BASE_VERSION) { - printk(KERN_ERR "MAD received with unsupported base " + printk(KERN_ERR PFX "MAD received with unsupported base " "version %d\n", mad->mad_hdr.base_version); goto ret; } @@ -874,7 +874,8 @@ qp_num = wrid.wrid_field.qpn; qpn = convert_qpnum(qp_num); if (qpn == -1) { - printk(KERN_ERR "Packet received on unknown QPN %d\n", qp_num); + printk(KERN_ERR PFX "Packet received on unknown QPN %d\n", + qp_num); ib_mad_post_receive_mad(port_priv, port_priv->qp[qp_num]); return; } @@ -899,7 +900,7 @@ port_priv->recv_posted_mad_count[qpn]--; } else { - printk(KERN_ERR "Receive completion WR ID 0x%Lx on QP %d " + printk(KERN_ERR PFX "Receive completion WR ID 0x%Lx on QP %d " "with no posted receive\n", wc->wr_id, qp_num); spin_unlock_irqrestore(&port_priv->recv_list_lock, flags); ib_mad_post_receive_mad(port_priv, port_priv->qp[qp_num]); @@ -931,8 +932,8 @@ solicited); if (!mad_agent) { spin_unlock_irqrestore(&port_priv->reg_lock, flags); - printk(KERN_NOTICE "No matching mad agent found for received " - "MAD on port %d\n", port_priv->port_num); + printk(KERN_NOTICE PFX "No matching mad agent found for " + "received MAD on port %d\n", port_priv->port_num); } else { atomic_inc(&mad_agent->refcount); spin_unlock_irqrestore(&port_priv->reg_lock, flags); @@ -1025,8 +1026,8 @@ /* Completion corresponds to first entry on posted MAD send list */ spin_lock_irqsave(&port_priv->send_list_lock, flags); if (list_empty(&port_priv->send_posted_mad_list)) { - printk(KERN_ERR "Send completion WR ID 0x%Lx but send list " - "is empty\n", wc->wr_id); + printk(KERN_ERR PFX "Send completion WR ID 0x%Lx but send " + "list is empty\n", wc->wr_id); goto error; } @@ -1037,7 +1038,7 @@ mad_send_wr = container_of(send_wr, struct ib_mad_send_wr_private, send_list); if (wc->wr_id != (unsigned long)mad_send_wr) { - printk(KERN_ERR "Send completion WR ID 0x%Lx doesn't match " + printk(KERN_ERR PFX "Send completion WR ID 0x%Lx doesn't match " "posted send WR ID 0x%lx\n", wc->wr_id, (unsigned long)mad_send_wr); @@ -1068,26 +1069,26 @@ ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP); while (ib_poll_cq(port_priv->cq, 1, &wc) == 1) { - printk(KERN_DEBUG "Completion opcode 0x%x WRID 0x%Lx\n", + printk(KERN_DEBUG PFX "Completion opcode 0x%x WRID 0x%Lx\n", wc.opcode, wc.wr_id); switch (wc.opcode) { case IB_WC_SEND: if (wc.status != IB_WC_SUCCESS) - printk(KERN_ERR "Send completion error %d\n", + printk(KERN_ERR PFX "Send completion error %d\n", wc.status); ib_mad_send_done_handler(port_priv, &wc); break; case IB_WC_RECV: if (wc.status != IB_WC_SUCCESS) - printk(KERN_ERR "Recv completion error %d\n", + printk(KERN_ERR PFX "Recv completion error %d\n", wc.status); ib_mad_recv_done_handler(port_priv, &wc); break; default: - printk(KERN_ERR "Wrong Opcode 0x%x on completion\n", + printk(KERN_ERR PFX "Wrong Opcode 0x%x on completion\n", wc.opcode); if (wc.status) { - printk(KERN_ERR "Completion error %d\n", + printk(KERN_ERR PFX "Completion error %d\n", wc.status); } } @@ -1233,7 +1234,7 @@ port_priv->device->name, port_priv->port_num); if (IS_ERR(port_priv->mad_thread)) { - printk(KERN_ERR "Couldn't start ib_mad thread for %s port %d\n", + printk(KERN_ERR PFX "Couldn't start ib_mad thread for %s port %d\n", port_priv->device->name, port_priv->port_num); return PTR_ERR(port_priv->mad_thread); } @@ -1264,7 +1265,7 @@ qpn = convert_qpnum(qp->qp_num); if (qpn == -1) { - printk(KERN_ERR "Post receive to invalid QPN %d\n", qp->qp_num); + printk(KERN_ERR PFX "Post receive to invalid QPN %d\n", qp->qp_num); return -EINVAL; } @@ -1279,7 +1280,7 @@ (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL); if (!mad_priv) { - printk(KERN_ERR "No memory for receive buffer\n"); + printk(KERN_ERR PFX "No memory for receive buffer\n"); return -ENOMEM; } @@ -1326,7 +1327,7 @@ spin_unlock_irqrestore(&port_priv->recv_list_lock, flags); kmem_cache_free(ib_mad_cache, mad_priv); - printk(KERN_NOTICE "ib_post_recv WRID 0x%Lx failed ret = %d\n", + printk(KERN_NOTICE PFX "ib_post_recv WRID 0x%Lx failed ret = %d\n", recv_wr.wr_id, ret); return -EINVAL; } @@ -1345,8 +1346,8 @@ for (j = 0; j < IB_MAD_QPS_CORE; j++) { if (ib_mad_post_receive_mad(port_priv, port_priv->qp[j])) { - printk(KERN_ERR "receive post %d failed on %s " - "port %d\n", i + 1, + printk(KERN_ERR PFX "receive post %d failed " + "on %s port %d\n", i + 1, port_priv->device->name, port_priv->port_num); } @@ -1425,7 +1426,7 @@ attr = kmalloc(sizeof *attr, GFP_KERNEL); if (!attr) { - printk(KERN_ERR "Couldn't allocate memory for ib_qp_attr\n"); + printk(KERN_ERR PFX "Couldn't allocate memory for ib_qp_attr\n"); return -ENOMEM; } @@ -1445,7 +1446,7 @@ ret = ib_modify_qp(qp, attr, attr_mask, &qp_cap); kfree(attr); - printk(KERN_DEBUG "ib_mad_change_qp_state_to_init ret = %d\n", ret); + printk(KERN_DEBUG PFX "ib_mad_change_qp_state_to_init ret = %d\n", ret); return ret; } @@ -1461,7 +1462,7 @@ attr = kmalloc(sizeof *attr, GFP_KERNEL); if (!attr) { - printk(KERN_ERR "Couldn't allocate memory for ib_qp_attr\n"); + printk(KERN_ERR PFX "Couldn't allocate memory for ib_qp_attr\n"); return -ENOMEM; } @@ -1471,7 +1472,7 @@ ret = ib_modify_qp(qp, attr, attr_mask, &qp_cap); kfree(attr); - printk(KERN_DEBUG "ib_mad_change_qp_state_to_rtr ret = %d\n", ret); + printk(KERN_DEBUG PFX "ib_mad_change_qp_state_to_rtr ret = %d\n", ret); return ret; } @@ -1487,7 +1488,7 @@ attr = kmalloc(sizeof *attr, GFP_KERNEL); if (!attr) { - printk(KERN_ERR "Couldn't allocate memory for ib_qp_attr\n"); + printk(KERN_ERR PFX "Couldn't allocate memory for ib_qp_attr\n"); return -ENOMEM; } @@ -1498,7 +1499,7 @@ ret = ib_modify_qp(qp, attr, attr_mask, &qp_cap); kfree(attr); - printk(KERN_DEBUG "ib_mad_change_qp_state_to_rts ret = %d\n", ret); + printk(KERN_DEBUG PFX "ib_mad_change_qp_state_to_rts ret = %d\n", ret); return ret; } @@ -1514,7 +1515,7 @@ attr = kmalloc(sizeof *attr, GFP_KERNEL); if (!attr) { - printk(KERN_ERR "Couldn't allocate memory for ib_qp_attr\n"); + printk(KERN_ERR PFX "Couldn't allocate memory for ib_qp_attr\n"); return -ENOMEM; } @@ -1524,7 +1525,7 @@ ret = ib_modify_qp(qp, attr, attr_mask, &qp_cap); kfree(attr); - printk(KERN_DEBUG "ib_mad_change_qp_state_to_reset ret = %d\n", ret); + printk(KERN_DEBUG PFX "ib_mad_change_qp_state_to_reset ret = %d\n", ret); return ret; } @@ -1538,7 +1539,7 @@ for (i = 0; i < IB_MAD_QPS_CORE; i++) { ret = ib_mad_change_qp_state_to_init(port_priv->qp[i]); if (ret) { - printk(KERN_ERR "Couldn't change QP%d state to " + printk(KERN_ERR PFX "Couldn't change QP%d state to " "INIT\n", i); return ret; } @@ -1546,27 +1547,27 @@ ret = ib_mad_post_receive_mads(port_priv); if (ret) { - printk(KERN_ERR "Couldn't post receive requests\n"); + printk(KERN_ERR PFX "Couldn't post receive requests\n"); goto error; } ret = ib_req_notify_cq(port_priv->cq, IB_CQ_NEXT_COMP); if (ret) { - printk(KERN_ERR "Failed to request completion notification\n"); + printk(KERN_ERR PFX "Failed to request completion notification\n"); goto error; } for (i = 0; i < IB_MAD_QPS_CORE; i++) { ret = ib_mad_change_qp_state_to_rtr(port_priv->qp[i]); if (ret) { - printk(KERN_ERR "Couldn't change QP%d state to " + printk(KERN_ERR PFX "Couldn't change QP%d state to " "RTR\n", i); goto error; } ret = ib_mad_change_qp_state_to_rts(port_priv->qp[i]); if (ret) { - printk(KERN_ERR "Couldn't change QP%d state to " + printk(KERN_ERR PFX "Couldn't change QP%d state to " "RTS\n", i); goto error; } @@ -1578,8 +1579,8 @@ for (i = 0; i < IB_MAD_QPS_CORE; i++) { ret2 = ib_mad_change_qp_state_to_reset(port_priv->qp[i]); if (ret2) { - printk(KERN_ERR "ib_mad_port_start: Couldn't change " - "QP%d state to RESET\n", i); + printk(KERN_ERR PFX "ib_mad_port_start: Couldn't " + "change QP%d state to RESET\n", i); } } @@ -1596,8 +1597,8 @@ for (i = 0; i < IB_MAD_QPS_CORE; i++) { ret = ib_mad_change_qp_state_to_reset(port_priv->qp[i]); if (ret) { - printk(KERN_ERR "ib_mad_port_stop: Couldn't change %s " - "port %d QP%d state to RESET\n", + printk(KERN_ERR PFX "ib_mad_port_stop: Couldn't change " + "%s port %d QP%d state to RESET\n", port_priv->device->name, port_priv->port_num, i); } } @@ -1633,7 +1634,7 @@ } spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); if (port_priv) { - printk(KERN_DEBUG "%s port %d already open\n", + printk(KERN_DEBUG PFX "%s port %d already open\n", device->name, port_num); return 0; } @@ -1641,7 +1642,7 @@ /* Create new device info */ port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL); if (!port_priv) { - printk(KERN_ERR "No memory for ib_mad_port_private\n"); + printk(KERN_ERR PFX "No memory for ib_mad_port_private\n"); return -ENOMEM; } @@ -1659,14 +1660,14 @@ ib_mad_thread_completion_handler, NULL, port_priv, cq_size); if (IS_ERR(port_priv->cq)) { - printk(KERN_ERR "Couldn't create ib_mad CQ\n"); + printk(KERN_ERR PFX "Couldn't create ib_mad CQ\n"); ret = PTR_ERR(port_priv->cq); goto error3; } port_priv->pd = ib_alloc_pd(device); if (IS_ERR(port_priv->pd)) { - printk(KERN_ERR "Couldn't create ib_mad PD\n"); + printk(KERN_ERR PFX "Couldn't create ib_mad PD\n"); ret = PTR_ERR(port_priv->pd); goto error4; } @@ -1674,7 +1675,7 @@ port_priv->mr = ib_reg_phys_mr(port_priv->pd, &buf_list, 1, IB_ACCESS_LOCAL_WRITE, &iova); if (IS_ERR(port_priv->mr)) { - printk(KERN_ERR "Couldn't register ib_mad MR\n"); + printk(KERN_ERR PFX "Couldn't register ib_mad MR\n"); ret = PTR_ERR(port_priv->mr); goto error5; } @@ -1694,14 +1695,14 @@ port_priv->qp[i] = ib_create_qp(port_priv->pd, &qp_init_attr, &qp_cap); if (IS_ERR(port_priv->qp[i])) { - printk(KERN_ERR "Couldn't create ib_mad QP%d\n", i); + printk(KERN_ERR PFX "Couldn't create ib_mad QP%d\n", i); ret = PTR_ERR(port_priv->qp[i]); if (i == 0) goto error6; else goto error7; } - printk(KERN_DEBUG "Created ib_mad QP %d\n", + printk(KERN_DEBUG PFX "Created ib_mad QP %d\n", port_priv->qp[i]->qp_num); } @@ -1723,7 +1724,7 @@ ret = ib_mad_port_start(port_priv); if (ret) { - printk(KERN_ERR "Couldn't start port\n"); + printk(KERN_ERR PFX "Couldn't start port\n"); goto error8; } @@ -1768,7 +1769,7 @@ } if (port_priv == NULL) { - printk(KERN_ERR "Port %d not found\n", port_num); + printk(KERN_ERR PFX "Port %d not found\n", port_num); spin_unlock_irqrestore(&ib_mad_port_list_lock, flags); return -ENODEV; } @@ -1797,7 +1798,7 @@ ret = ib_query_device(device, &device_attr); if (ret) { - printk(KERN_ERR "Couldn't query device %s\n", device->name); + printk(KERN_ERR PFX "Couldn't query device %s\n", device->name); goto error_device_query; } @@ -1811,7 +1812,7 @@ for (i = 0; i < num_ports; i++, cur_port++) { ret = ib_mad_port_open(device, cur_port); if (ret) { - printk(KERN_ERR "Couldn't open %s port %d\n", + printk(KERN_ERR PFX "Couldn't open %s port %d\n", device->name, cur_port); goto error_device_open; } @@ -1824,7 +1825,7 @@ cur_port--; ret2 = ib_mad_port_close(device, cur_port); if (ret2) { - printk(KERN_ERR "Couldn't close %s port %d\n", + printk(KERN_ERR PFX "Couldn't close %s port %d\n", device->name, cur_port); } i--; @@ -1841,7 +1842,7 @@ ret = ib_query_device(device, &device_attr); if (ret) { - printk(KERN_ERR "Couldn't query device %s\n", device->name); + printk(KERN_ERR PFX "Couldn't query device %s\n", device->name); goto error_device_query; } @@ -1855,7 +1856,7 @@ for (i = 0; i < num_ports; i++, cur_port++) { ret2 = ib_mad_port_close(device, cur_port); if (ret2) { - printk(KERN_ERR "Couldn't close %s port %d\n", + printk(KERN_ERR PFX "Couldn't close %s port %d\n", device->name, cur_port); if (!ret) ret = ret2; @@ -1881,14 +1882,14 @@ NULL, NULL); if (!ib_mad_cache) { - printk(KERN_ERR "Couldn't create ib_mad cache\n"); + printk(KERN_ERR PFX "Couldn't create ib_mad cache\n"); return -ENOMEM; } INIT_LIST_HEAD(&ib_mad_port_list); if (ib_register_client(&mad_client)) { - printk(KERN_ERR "Couldn't register ib_mad client\n"); + printk(KERN_ERR PFX "Couldn't register ib_mad client\n"); return -EINVAL; } @@ -1900,7 +1901,7 @@ ib_unregister_client(&mad_client); if (kmem_cache_destroy(ib_mad_cache)) { - printk(KERN_DEBUG "Failed to destroy ib_mad cache\n"); + printk(KERN_DEBUG PFX "Failed to destroy ib_mad cache\n"); } }
_______________________________________________ openib-general mailing list [EMAIL PROTECTED] http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general