[infiniband] Assign names to Infiniband devices for debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/46/head
Michael Brown 2016-03-04 09:17:08 +00:00
parent ff13eeb747
commit d7794dcac7
8 changed files with 140 additions and 118 deletions

View File

@ -388,6 +388,9 @@ struct ib_device_operations {
union ib_mad *mad ); union ib_mad *mad );
}; };
/** Maximum length of an Infiniband device name */
#define IBDEV_NAME_LEN 8
/** An Infiniband device */ /** An Infiniband device */
struct ib_device { struct ib_device {
/** Reference counter */ /** Reference counter */
@ -396,6 +399,10 @@ struct ib_device {
struct list_head list; struct list_head list;
/** List of open Infiniband devices */ /** List of open Infiniband devices */
struct list_head open_list; struct list_head open_list;
/** Index of this Infiniband device */
unsigned int index;
/** Name of this Infiniband device */
char name[IBDEV_NAME_LEN];
/** Underlying device */ /** Underlying device */
struct device *dev; struct device *dev;
/** List of completion queues */ /** List of completion queues */

View File

@ -54,6 +54,9 @@ struct list_head ib_devices = LIST_HEAD_INIT ( ib_devices );
/** List of open Infiniband devices, in reverse order of opening */ /** List of open Infiniband devices, in reverse order of opening */
static struct list_head open_ib_devices = LIST_HEAD_INIT ( open_ib_devices ); static struct list_head open_ib_devices = LIST_HEAD_INIT ( open_ib_devices );
/** Infiniband device index */
static unsigned int ibdev_index = 0;
/** Post send work queue entry profiler */ /** Post send work queue entry profiler */
static struct profiler ib_post_send_profiler __profiler = static struct profiler ib_post_send_profiler __profiler =
{ .name = "ib.post_send" }; { .name = "ib.post_send" };
@ -97,7 +100,7 @@ ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
struct ib_completion_queue *cq; struct ib_completion_queue *cq;
int rc; int rc;
DBGC ( ibdev, "IBDEV %p creating completion queue\n", ibdev ); DBGC ( ibdev, "IBDEV %s creating completion queue\n", ibdev->name );
/* Allocate and initialise data structure */ /* Allocate and initialise data structure */
cq = zalloc ( sizeof ( *cq ) ); cq = zalloc ( sizeof ( *cq ) );
@ -111,13 +114,13 @@ ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
/* Perform device-specific initialisation and get CQN */ /* Perform device-specific initialisation and get CQN */
if ( ( rc = ibdev->op->create_cq ( ibdev, cq ) ) != 0 ) { if ( ( rc = ibdev->op->create_cq ( ibdev, cq ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not initialise completion " DBGC ( ibdev, "IBDEV %s could not initialise completion "
"queue: %s\n", ibdev, strerror ( rc ) ); "queue: %s\n", ibdev->name, strerror ( rc ) );
goto err_dev_create_cq; goto err_dev_create_cq;
} }
DBGC ( ibdev, "IBDEV %p created %d-entry completion queue %p (%p) " DBGC ( ibdev, "IBDEV %s created %d-entry completion queue %p (%p) "
"with CQN %#lx\n", ibdev, num_cqes, cq, "with CQN %#lx\n", ibdev->name, num_cqes, cq,
ib_cq_get_drvdata ( cq ), cq->cqn ); ib_cq_get_drvdata ( cq ), cq->cqn );
return cq; return cq;
@ -137,8 +140,8 @@ ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
*/ */
void ib_destroy_cq ( struct ib_device *ibdev, void ib_destroy_cq ( struct ib_device *ibdev,
struct ib_completion_queue *cq ) { struct ib_completion_queue *cq ) {
DBGC ( ibdev, "IBDEV %p destroying completion queue %#lx\n", DBGC ( ibdev, "IBDEV %s destroying completion queue %#lx\n",
ibdev, cq->cqn ); ibdev->name, cq->cqn );
assert ( list_empty ( &cq->work_queues ) ); assert ( list_empty ( &cq->work_queues ) );
ibdev->op->destroy_cq ( ibdev, cq ); ibdev->op->destroy_cq ( ibdev, cq );
list_del ( &cq->list ); list_del ( &cq->list );
@ -198,7 +201,7 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
size_t total_size; size_t total_size;
int rc; int rc;
DBGC ( ibdev, "IBDEV %p creating queue pair\n", ibdev ); DBGC ( ibdev, "IBDEV %s creating queue pair\n", ibdev->name );
/* Allocate and initialise data structure */ /* Allocate and initialise data structure */
total_size = ( sizeof ( *qp ) + total_size = ( sizeof ( *qp ) +
@ -229,17 +232,17 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
/* Perform device-specific initialisation and get QPN */ /* Perform device-specific initialisation and get QPN */
if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) { if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not initialise queue pair: " DBGC ( ibdev, "IBDEV %s could not initialise queue pair: "
"%s\n", ibdev, strerror ( rc ) ); "%s\n", ibdev->name, strerror ( rc ) );
goto err_dev_create_qp; goto err_dev_create_qp;
} }
DBGC ( ibdev, "IBDEV %p created queue pair %p (%p) with QPN %#lx\n", DBGC ( ibdev, "IBDEV %s created queue pair %p (%p) with QPN %#lx\n",
ibdev, qp, ib_qp_get_drvdata ( qp ), qp->qpn ); ibdev->name, qp, ib_qp_get_drvdata ( qp ), qp->qpn );
DBGC ( ibdev, "IBDEV %p QPN %#lx has %d send entries at [%p,%p)\n", DBGC ( ibdev, "IBDEV %s QPN %#lx has %d send entries at [%p,%p)\n",
ibdev, qp->qpn, num_send_wqes, qp->send.iobufs, ibdev->name, qp->qpn, num_send_wqes, qp->send.iobufs,
qp->recv.iobufs ); qp->recv.iobufs );
DBGC ( ibdev, "IBDEV %p QPN %#lx has %d receive entries at [%p,%p)\n", DBGC ( ibdev, "IBDEV %s QPN %#lx has %d receive entries at [%p,%p)\n",
ibdev, qp->qpn, num_recv_wqes, qp->recv.iobufs, ibdev->name, qp->qpn, num_recv_wqes, qp->recv.iobufs,
( ( ( void * ) qp ) + total_size ) ); ( ( ( void * ) qp ) + total_size ) );
/* Calculate externally-visible QPN */ /* Calculate externally-visible QPN */
@ -255,8 +258,8 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
break; break;
} }
if ( qp->ext_qpn != qp->qpn ) { if ( qp->ext_qpn != qp->qpn ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx has external QPN %#lx\n", DBGC ( ibdev, "IBDEV %s QPN %#lx has external QPN %#lx\n",
ibdev, qp->qpn, qp->ext_qpn ); ibdev->name, qp->qpn, qp->ext_qpn );
} }
return qp; return qp;
@ -281,11 +284,11 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) { int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
int rc; int rc;
DBGC ( ibdev, "IBDEV %p modifying QPN %#lx\n", ibdev, qp->qpn ); DBGC ( ibdev, "IBDEV %s modifying QPN %#lx\n", ibdev->name, qp->qpn );
if ( ( rc = ibdev->op->modify_qp ( ibdev, qp ) ) != 0 ) { if ( ( rc = ibdev->op->modify_qp ( ibdev, qp ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not modify QPN %#lx: %s\n", DBGC ( ibdev, "IBDEV %s could not modify QPN %#lx: %s\n",
ibdev, qp->qpn, strerror ( rc ) ); ibdev->name, qp->qpn, strerror ( rc ) );
return rc; return rc;
} }
@ -302,8 +305,8 @@ void ib_destroy_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
struct io_buffer *iobuf; struct io_buffer *iobuf;
unsigned int i; unsigned int i;
DBGC ( ibdev, "IBDEV %p destroying QPN %#lx\n", DBGC ( ibdev, "IBDEV %s destroying QPN %#lx\n",
ibdev, qp->qpn ); ibdev->name, qp->qpn );
assert ( list_empty ( &qp->mgids ) ); assert ( list_empty ( &qp->mgids ) );
@ -411,8 +414,8 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
/* Check queue fill level */ /* Check queue fill level */
if ( qp->send.fill >= qp->send.num_wqes ) { if ( qp->send.fill >= qp->send.num_wqes ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx send queue full\n", DBGC ( ibdev, "IBDEV %s QPN %#lx send queue full\n",
ibdev, qp->qpn ); ibdev->name, qp->qpn );
return -ENOBUFS; return -ENOBUFS;
} }
@ -432,8 +435,8 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
/* Post to hardware */ /* Post to hardware */
if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) { if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx could not post send WQE: " DBGC ( ibdev, "IBDEV %s QPN %#lx could not post send WQE: "
"%s\n", ibdev, qp->qpn, strerror ( rc ) ); "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
return rc; return rc;
} }
@ -463,22 +466,22 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
/* Check packet length */ /* Check packet length */
if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) { if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx wrong RX buffer size (%zd)\n", DBGC ( ibdev, "IBDEV %s QPN %#lx wrong RX buffer size (%zd)\n",
ibdev, qp->qpn, iob_tailroom ( iobuf ) ); ibdev->name, qp->qpn, iob_tailroom ( iobuf ) );
return -EINVAL; return -EINVAL;
} }
/* Check queue fill level */ /* Check queue fill level */
if ( qp->recv.fill >= qp->recv.num_wqes ) { if ( qp->recv.fill >= qp->recv.num_wqes ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx receive queue full\n", DBGC ( ibdev, "IBDEV %s QPN %#lx receive queue full\n",
ibdev, qp->qpn ); ibdev->name, qp->qpn );
return -ENOBUFS; return -ENOBUFS;
} }
/* Post to hardware */ /* Post to hardware */
if ( ( rc = ibdev->op->post_recv ( ibdev, qp, iobuf ) ) != 0 ) { if ( ( rc = ibdev->op->post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx could not post receive WQE: " DBGC ( ibdev, "IBDEV %s QPN %#lx could not post receive WQE: "
"%s\n", ibdev, qp->qpn, strerror ( rc ) ); "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
return rc; return rc;
} }
@ -556,8 +559,8 @@ void ib_refill_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
/* Post I/O buffer */ /* Post I/O buffer */
if ( ( rc = ib_post_recv ( ibdev, qp, iobuf ) ) != 0 ) { if ( ( rc = ib_post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not refill: %s\n", DBGC ( ibdev, "IBDEV %s could not refill: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
free_iob ( iobuf ); free_iob ( iobuf );
/* Give up */ /* Give up */
return; return;
@ -623,8 +626,8 @@ static void ib_notify ( struct ib_device *ibdev ) {
*/ */
void ib_link_state_changed ( struct ib_device *ibdev ) { void ib_link_state_changed ( struct ib_device *ibdev ) {
DBGC ( ibdev, "IBDEV %p link state is %s\n", DBGC ( ibdev, "IBDEV %s link state is %s\n",
ibdev, ib_link_state_text ( ibdev ) ); ibdev->name, ib_link_state_text ( ibdev ) );
/* Notify drivers of link state change */ /* Notify drivers of link state change */
ib_notify ( ibdev ); ib_notify ( ibdev );
@ -647,30 +650,30 @@ int ib_open ( struct ib_device *ibdev ) {
/* Open device */ /* Open device */
if ( ( rc = ibdev->op->open ( ibdev ) ) != 0 ) { if ( ( rc = ibdev->op->open ( ibdev ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not open: %s\n", DBGC ( ibdev, "IBDEV %s could not open: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
goto err_open; goto err_open;
} }
/* Create subnet management interface */ /* Create subnet management interface */
ibdev->smi = ib_create_mi ( ibdev, IB_QPT_SMI ); ibdev->smi = ib_create_mi ( ibdev, IB_QPT_SMI );
if ( ! ibdev->smi ) { if ( ! ibdev->smi ) {
DBGC ( ibdev, "IBDEV %p could not create SMI\n", ibdev ); DBGC ( ibdev, "IBDEV %s could not create SMI\n", ibdev->name );
rc = -ENOMEM; rc = -ENOMEM;
goto err_create_smi; goto err_create_smi;
} }
/* Create subnet management agent */ /* Create subnet management agent */
if ( ( rc = ib_create_sma ( ibdev, ibdev->smi ) ) != 0 ) { if ( ( rc = ib_create_sma ( ibdev, ibdev->smi ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not create SMA: %s\n", DBGC ( ibdev, "IBDEV %s could not create SMA: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
goto err_create_sma; goto err_create_sma;
} }
/* Create general services interface */ /* Create general services interface */
ibdev->gsi = ib_create_mi ( ibdev, IB_QPT_GSI ); ibdev->gsi = ib_create_mi ( ibdev, IB_QPT_GSI );
if ( ! ibdev->gsi ) { if ( ! ibdev->gsi ) {
DBGC ( ibdev, "IBDEV %p could not create GSI\n", ibdev ); DBGC ( ibdev, "IBDEV %s could not create GSI\n", ibdev->name );
rc = -ENOMEM; rc = -ENOMEM;
goto err_create_gsi; goto err_create_gsi;
} }
@ -833,14 +836,14 @@ int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad ) {
/* Adapters with embedded SMAs do not need to support this method */ /* Adapters with embedded SMAs do not need to support this method */
if ( ! ibdev->op->set_port_info ) { if ( ! ibdev->op->set_port_info ) {
DBGC ( ibdev, "IBDEV %p does not support setting port " DBGC ( ibdev, "IBDEV %s does not support setting port "
"information\n", ibdev ); "information\n", ibdev->name );
return -ENOTSUP; return -ENOTSUP;
} }
if ( ( rc = ibdev->op->set_port_info ( ibdev, mad ) ) != 0 ) { if ( ( rc = ibdev->op->set_port_info ( ibdev, mad ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not set port information: %s\n", DBGC ( ibdev, "IBDEV %s could not set port information: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
return rc; return rc;
} }
@ -858,14 +861,14 @@ int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad ) {
/* Adapters with embedded SMAs do not need to support this method */ /* Adapters with embedded SMAs do not need to support this method */
if ( ! ibdev->op->set_pkey_table ) { if ( ! ibdev->op->set_pkey_table ) {
DBGC ( ibdev, "IBDEV %p does not support setting partition " DBGC ( ibdev, "IBDEV %s does not support setting partition "
"key table\n", ibdev ); "key table\n", ibdev->name );
return -ENOTSUP; return -ENOTSUP;
} }
if ( ( rc = ibdev->op->set_pkey_table ( ibdev, mad ) ) != 0 ) { if ( ( rc = ibdev->op->set_pkey_table ( ibdev, mad ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not set partition key table: " DBGC ( ibdev, "IBDEV %s could not set partition key table: "
"%s\n", ibdev, strerror ( rc ) ); "%s\n", ibdev->name, strerror ( rc ) );
return rc; return rc;
} }
@ -954,17 +957,24 @@ int register_ibdev ( struct ib_device *ibdev ) {
struct ib_driver *driver; struct ib_driver *driver;
int rc; int rc;
/* Record device index and create device name */
if ( ibdev->name[0] == '\0' ) {
snprintf ( ibdev->name, sizeof ( ibdev->name ), "inf%d",
ibdev_index );
}
ibdev->index = ++ibdev_index;
/* Add to device list */ /* Add to device list */
ibdev_get ( ibdev ); ibdev_get ( ibdev );
list_add_tail ( &ibdev->list, &ib_devices ); list_add_tail ( &ibdev->list, &ib_devices );
DBGC ( ibdev, "IBDEV %p registered (phys %s)\n", ibdev, DBGC ( ibdev, "IBDEV %s registered (phys %s)\n", ibdev->name,
ibdev->dev->name ); ibdev->dev->name );
/* Probe device */ /* Probe device */
for_each_table_entry ( driver, IB_DRIVERS ) { for_each_table_entry ( driver, IB_DRIVERS ) {
if ( ( rc = driver->probe ( ibdev ) ) != 0 ) { if ( ( rc = driver->probe ( ibdev ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not add %s device: %s\n", DBGC ( ibdev, "IBDEV %s could not add %s device: %s\n",
ibdev, driver->name, strerror ( rc ) ); ibdev->name, driver->name, strerror ( rc ) );
goto err_probe; goto err_probe;
} }
} }
@ -994,7 +1004,11 @@ void unregister_ibdev ( struct ib_device *ibdev ) {
/* Remove from device list */ /* Remove from device list */
list_del ( &ibdev->list ); list_del ( &ibdev->list );
ibdev_put ( ibdev ); ibdev_put ( ibdev );
DBGC ( ibdev, "IBDEV %p unregistered\n", ibdev ); DBGC ( ibdev, "IBDEV %s unregistered\n", ibdev->name );
/* Reset device index if no devices remain */
if ( list_empty ( &ib_devices ) )
ibdev_index = 0;
} }
/** /**

View File

@ -466,8 +466,8 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
/* Add to list of connections */ /* Add to list of connections */
list_add ( &conn->list, &ib_cm_conns ); list_add ( &conn->list, &ib_cm_conns );
DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n", DBGC ( conn, "CM %p created for IBDEV %s QPN %lx\n",
conn, ibdev, qp->qpn ); conn, ibdev->name, qp->qpn );
DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n", DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n",
conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) ); conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );

View File

@ -94,23 +94,23 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) )) if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
rc = -ENOTCONN; rc = -ENOTCONN;
if ( rc != 0 ) { if ( rc != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %lx join failed: %s\n", DBGC ( ibdev, "IBDEV %s QPN %lx join failed: %s\n",
ibdev, qp->qpn, strerror ( rc ) ); ibdev->name, qp->qpn, strerror ( rc ) );
goto out; goto out;
} }
/* Extract values from MAD */ /* Extract values from MAD */
joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP ); joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
qkey = ntohl ( mc_member_record->qkey ); qkey = ntohl ( mc_member_record->qkey );
DBGC ( ibdev, "IBDEV %p QPN %lx %s " IB_GID_FMT " qkey %lx\n", DBGC ( ibdev, "IBDEV %s QPN %lx %s " IB_GID_FMT " qkey %lx\n",
ibdev, qp->qpn, ( joined ? "joined" : "left" ), ibdev->name, qp->qpn, ( joined ? "joined" : "left" ),
IB_GID_ARGS ( gid ), qkey ); IB_GID_ARGS ( gid ), qkey );
/* Set queue key */ /* Set queue key */
qp->qkey = qkey; qp->qkey = qkey;
if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) { if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %lx could not modify qkey: %s\n", DBGC ( ibdev, "IBDEV %s QPN %lx could not modify qkey: %s\n",
ibdev, qp->qpn, strerror ( rc ) ); ibdev->name, qp->qpn, strerror ( rc ) );
goto out; goto out;
} }
@ -147,8 +147,8 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
union ib_mad mad; union ib_mad mad;
int rc; int rc;
DBGC ( ibdev, "IBDEV %p QPN %lx joining " IB_GID_FMT "\n", DBGC ( ibdev, "IBDEV %s QPN %lx joining " IB_GID_FMT "\n",
ibdev, qp->qpn, IB_GID_ARGS ( gid ) ); ibdev->name, qp->qpn, IB_GID_ARGS ( gid ) );
/* Sanity check */ /* Sanity check */
assert ( qp != NULL ); assert ( qp != NULL );
@ -160,8 +160,8 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
/* Attach queue pair to multicast GID */ /* Attach queue pair to multicast GID */
if ( ( rc = ib_mcast_attach ( ibdev, qp, gid ) ) != 0 ) { if ( ( rc = ib_mcast_attach ( ibdev, qp, gid ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %lx could not attach: %s\n", DBGC ( ibdev, "IBDEV %s QPN %lx could not attach: %s\n",
ibdev, qp->qpn, strerror ( rc ) ); ibdev->name, qp->qpn, strerror ( rc ) );
goto err_mcast_attach; goto err_mcast_attach;
} }
@ -170,8 +170,8 @@ int ib_mcast_join ( struct ib_device *ibdev, struct ib_queue_pair *qp,
membership->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, NULL, membership->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, NULL,
&ib_mcast_op ); &ib_mcast_op );
if ( ! membership->madx ) { if ( ! membership->madx ) {
DBGC ( ibdev, "IBDEV %p QPN %lx could not create join " DBGC ( ibdev, "IBDEV %s QPN %lx could not create join "
"transaction\n", ibdev, qp->qpn ); "transaction\n", ibdev->name, qp->qpn );
rc = -ENOMEM; rc = -ENOMEM;
goto err_create_madx; goto err_create_madx;
} }
@ -199,8 +199,8 @@ void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
union ib_mad mad; union ib_mad mad;
int rc; int rc;
DBGC ( ibdev, "IBDEV %p QPN %lx leaving " IB_GID_FMT "\n", DBGC ( ibdev, "IBDEV %s QPN %lx leaving " IB_GID_FMT "\n",
ibdev, qp->qpn, IB_GID_ARGS ( gid ) ); ibdev->name, qp->qpn, IB_GID_ARGS ( gid ) );
/* Sanity check */ /* Sanity check */
assert ( qp != NULL ); assert ( qp != NULL );
@ -217,7 +217,7 @@ void ib_mcast_leave ( struct ib_device *ibdev, struct ib_queue_pair *qp,
/* Send a single group leave MAD */ /* Send a single group leave MAD */
ib_mcast_mad ( ibdev, &membership->gid, 0, &mad ); ib_mcast_mad ( ibdev, &membership->gid, 0, &mad );
if ( ( rc = ib_mi_send ( ibdev, ibdev->gsi, &mad, NULL ) ) != 0 ) { if ( ( rc = ib_mi_send ( ibdev, ibdev->gsi, &mad, NULL ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %lx could not send leave request: " DBGC ( ibdev, "IBDEV %s QPN %lx could not send leave request: "
"%s\n", ibdev, qp->qpn, strerror ( rc ) ); "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
} }
} }

View File

@ -63,8 +63,8 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
unsigned int vl; unsigned int vl;
unsigned int lnh; unsigned int lnh;
DBGC2 ( ibdev, "IBDEV %p TX %04x:%08lx => %04x:%08lx (key %08lx)\n", DBGC2 ( ibdev, "IBDEV %s TX %04x:%08lx => %04x:%08lx (key %08lx)\n",
ibdev, ibdev->lid, qp->ext_qpn, dest->lid, dest->qpn, ibdev->name, ibdev->lid, qp->ext_qpn, dest->lid, dest->qpn,
dest->qkey ); dest->qkey );
/* Calculate packet length */ /* Calculate packet length */
@ -152,8 +152,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
/* Extract LRH */ /* Extract LRH */
if ( iob_len ( iobuf ) < sizeof ( *lrh ) ) { if ( iob_len ( iobuf ) < sizeof ( *lrh ) ) {
DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) for LRH\n", DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) for LRH\n",
ibdev, iob_len ( iobuf ) ); ibdev->name, iob_len ( iobuf ) );
return -EINVAL; return -EINVAL;
} }
lrh = iobuf->data; lrh = iobuf->data;
@ -166,16 +166,16 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
/* Reject unsupported packets */ /* Reject unsupported packets */
if ( ! ( ( lnh == IB_LNH_BTH ) || ( lnh == IB_LNH_GRH ) ) ) { if ( ! ( ( lnh == IB_LNH_BTH ) || ( lnh == IB_LNH_GRH ) ) ) {
DBGC ( ibdev, "IBDEV %p RX unsupported LNH %x\n", DBGC ( ibdev, "IBDEV %s RX unsupported LNH %x\n",
ibdev, lnh ); ibdev->name, lnh );
return -ENOTSUP; return -ENOTSUP;
} }
/* Extract GRH, if present */ /* Extract GRH, if present */
if ( lnh == IB_LNH_GRH ) { if ( lnh == IB_LNH_GRH ) {
if ( iob_len ( iobuf ) < sizeof ( *grh ) ) { if ( iob_len ( iobuf ) < sizeof ( *grh ) ) {
DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) " DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) "
"for GRH\n", ibdev, iob_len ( iobuf ) ); "for GRH\n", ibdev->name, iob_len ( iobuf ) );
return -EINVAL; return -EINVAL;
} }
grh = iobuf->data; grh = iobuf->data;
@ -190,23 +190,23 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
/* Extract BTH */ /* Extract BTH */
if ( iob_len ( iobuf ) < sizeof ( *bth ) ) { if ( iob_len ( iobuf ) < sizeof ( *bth ) ) {
DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) for BTH\n", DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) for BTH\n",
ibdev, iob_len ( iobuf ) ); ibdev->name, iob_len ( iobuf ) );
return -EINVAL; return -EINVAL;
} }
bth = iobuf->data; bth = iobuf->data;
iob_pull ( iobuf, sizeof ( *bth ) ); iob_pull ( iobuf, sizeof ( *bth ) );
if ( bth->opcode != BTH_OPCODE_UD_SEND ) { if ( bth->opcode != BTH_OPCODE_UD_SEND ) {
DBGC ( ibdev, "IBDEV %p unsupported BTH opcode %x\n", DBGC ( ibdev, "IBDEV %s unsupported BTH opcode %x\n",
ibdev, bth->opcode ); ibdev->name, bth->opcode );
return -ENOTSUP; return -ENOTSUP;
} }
dest->qpn = ntohl ( bth->dest_qp ); dest->qpn = ntohl ( bth->dest_qp );
/* Extract DETH */ /* Extract DETH */
if ( iob_len ( iobuf ) < sizeof ( *deth ) ) { if ( iob_len ( iobuf ) < sizeof ( *deth ) ) {
DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) for DETH\n", DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) for DETH\n",
ibdev, iob_len ( iobuf ) ); ibdev->name, iob_len ( iobuf ) );
return -EINVAL; return -EINVAL;
} }
deth = iobuf->data; deth = iobuf->data;
@ -226,23 +226,24 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
if ( qp ) { if ( qp ) {
if ( IB_LID_MULTICAST ( dest->lid ) && grh ) { if ( IB_LID_MULTICAST ( dest->lid ) && grh ) {
if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){ if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
DBGC ( ibdev, "IBDEV %p RX for unknown MGID " DBGC ( ibdev, "IBDEV %s RX for unknown MGID "
IB_GID_FMT "\n", IB_GID_FMT "\n", ibdev->name,
ibdev, IB_GID_ARGS ( &grh->dgid ) ); IB_GID_ARGS ( &grh->dgid ) );
return -ENODEV; return -ENODEV;
} }
} else { } else {
if ( ! ( *qp = ib_find_qp_qpn ( ibdev, dest->qpn ) ) ) { if ( ! ( *qp = ib_find_qp_qpn ( ibdev, dest->qpn ) ) ) {
DBGC ( ibdev, "IBDEV %p RX for nonexistent " DBGC ( ibdev, "IBDEV %s RX for nonexistent "
"QPN %lx\n", ibdev, dest->qpn ); "QPN %lx\n", ibdev->name, dest->qpn );
return -ENODEV; return -ENODEV;
} }
} }
assert ( *qp ); assert ( *qp );
} }
DBGC2 ( ibdev, "IBDEV %p RX %04x:%08lx <= %04x:%08lx (key %08x)\n", DBGC2 ( ibdev, "IBDEV %s RX %04x:%08lx <= %04x:%08lx (key %08x)\n",
ibdev, dest->lid, ( IB_LID_MULTICAST ( dest->lid ) ? ibdev->name, dest->lid,
( IB_LID_MULTICAST ( dest->lid ) ?
( qp ? (*qp)->ext_qpn : -1UL ) : dest->qpn ), ( qp ? (*qp)->ext_qpn : -1UL ) : dest->qpn ),
source->lid, source->qpn, ntohl ( deth->qkey ) ); source->lid, source->qpn, ntohl ( deth->qkey ) );
DBGCP_HDA ( ibdev, 0, DBGCP_HDA ( ibdev, 0,

View File

@ -61,9 +61,9 @@ static void ib_path_complete ( struct ib_device *ibdev,
if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) )) if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
rc = -ENETUNREACH; rc = -ENETUNREACH;
if ( rc != 0 ) { if ( rc != 0 ) {
DBGC ( ibdev, "IBDEV %p path lookup for " IB_GID_FMT DBGC ( ibdev, "IBDEV %s path lookup for " IB_GID_FMT
" failed: %s\n", " failed: %s\n",
ibdev, IB_GID_ARGS ( dgid ), strerror ( rc ) ); ibdev->name, IB_GID_ARGS ( dgid ), strerror ( rc ) );
goto out; goto out;
} }
@ -71,9 +71,9 @@ static void ib_path_complete ( struct ib_device *ibdev,
path->av.lid = ntohs ( pathrec->dlid ); path->av.lid = ntohs ( pathrec->dlid );
path->av.sl = ( pathrec->reserved__sl & 0x0f ); path->av.sl = ( pathrec->reserved__sl & 0x0f );
path->av.rate = ( pathrec->rate_selector__rate & 0x3f ); path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
DBGC ( ibdev, "IBDEV %p path to " IB_GID_FMT " is %04x sl %d rate " DBGC ( ibdev, "IBDEV %s path to " IB_GID_FMT " is %04x sl %d rate "
"%d\n", ibdev, IB_GID_ARGS ( dgid ), path->av.lid, path->av.sl, "%d\n", ibdev->name, IB_GID_ARGS ( dgid ), path->av.lid,
path->av.rate ); path->av.sl, path->av.rate );
out: out:
/* Destroy the completed transaction */ /* Destroy the completed transaction */
@ -247,8 +247,8 @@ int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
/* Sanity check */ /* Sanity check */
if ( ! av->gid_present ) { if ( ! av->gid_present ) {
DBGC ( ibdev, "IBDEV %p attempt to look up path without GID\n", DBGC ( ibdev, "IBDEV %s attempt to look up path without GID\n",
ibdev ); ibdev->name );
return -EINVAL; return -EINVAL;
} }
@ -259,11 +259,11 @@ int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
av->lid = cached->path->av.lid; av->lid = cached->path->av.lid;
av->rate = cached->path->av.rate; av->rate = cached->path->av.rate;
av->sl = cached->path->av.sl; av->sl = cached->path->av.sl;
DBGC2 ( ibdev, "IBDEV %p cache hit for " IB_GID_FMT "\n", DBGC2 ( ibdev, "IBDEV %s cache hit for " IB_GID_FMT "\n",
ibdev, IB_GID_ARGS ( gid ) ); ibdev->name, IB_GID_ARGS ( gid ) );
return 0; return 0;
} }
DBGC ( ibdev, "IBDEV %p cache miss for " IB_GID_FMT "%s\n", ibdev, DBGC ( ibdev, "IBDEV %s cache miss for " IB_GID_FMT "%s\n", ibdev->name,
IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) ); IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) );
/* If lookup is already in progress, do nothing */ /* If lookup is already in progress, do nothing */
@ -282,8 +282,8 @@ int ib_resolve_path ( struct ib_device *ibdev, struct ib_address_vector *av ) {
/* Create new path */ /* Create new path */
cached->path = ib_create_path ( ibdev, av, &ib_cached_path_op ); cached->path = ib_create_path ( ibdev, av, &ib_cached_path_op );
if ( ! cached->path ) { if ( ! cached->path ) {
DBGC ( ibdev, "IBDEV %p could not create path\n", DBGC ( ibdev, "IBDEV %s could not create path\n",
ibdev ); ibdev->name );
return -ENOMEM; return -ENOMEM;
} }
ib_path_set_ownerdata ( cached->path, cached ); ib_path_set_ownerdata ( cached->path, cached );

View File

@ -358,7 +358,7 @@ struct ib_mad_agent ib_sma_agent[] __ib_mad_agent = {
int ib_create_sma ( struct ib_device *ibdev, struct ib_mad_interface *mi ) { int ib_create_sma ( struct ib_device *ibdev, struct ib_mad_interface *mi ) {
/* Nothing to do */ /* Nothing to do */
DBGC ( ibdev, "IBDEV %p SMA using SMI %p\n", ibdev, mi ); DBGC ( ibdev, "IBDEV %s SMA using SMI %p\n", ibdev->name, mi );
return 0; return 0;
} }

View File

@ -86,8 +86,8 @@ static int ib_smc_get_node_info ( struct ib_device *ibdev,
/* Issue MAD */ /* Issue MAD */
if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_NODE_INFO ), 0, if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_NODE_INFO ), 0,
local_mad, mad ) ) != 0 ) { local_mad, mad ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not get node info: %s\n", DBGC ( ibdev, "IBDEV %s could not get node info: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
return rc; return rc;
} }
return 0; return 0;
@ -109,8 +109,8 @@ static int ib_smc_get_port_info ( struct ib_device *ibdev,
/* Issue MAD */ /* Issue MAD */
if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PORT_INFO ), if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PORT_INFO ),
htonl ( ibdev->port ), local_mad, mad )) !=0){ htonl ( ibdev->port ), local_mad, mad )) !=0){
DBGC ( ibdev, "IBDEV %p could not get port info: %s\n", DBGC ( ibdev, "IBDEV %s could not get port info: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
return rc; return rc;
} }
return 0; return 0;
@ -132,8 +132,8 @@ static int ib_smc_get_guid_info ( struct ib_device *ibdev,
/* Issue MAD */ /* Issue MAD */
if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_GUID_INFO ), 0, if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_GUID_INFO ), 0,
local_mad, mad ) ) != 0 ) { local_mad, mad ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not get GUID info: %s\n", DBGC ( ibdev, "IBDEV %s could not get GUID info: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
return rc; return rc;
} }
return 0; return 0;
@ -155,8 +155,8 @@ static int ib_smc_get_pkey_table ( struct ib_device *ibdev,
/* Issue MAD */ /* Issue MAD */
if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PKEY_TABLE ), 0, if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PKEY_TABLE ), 0,
local_mad, mad ) ) != 0 ) { local_mad, mad ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p could not get pkey table: %s\n", DBGC ( ibdev, "IBDEV %s could not get pkey table: %s\n",
ibdev, strerror ( rc ) ); ibdev->name, strerror ( rc ) );
return rc; return rc;
} }
return 0; return 0;
@ -216,8 +216,8 @@ static int ib_smc_get ( struct ib_device *ibdev, ib_local_mad_t local_mad ) {
return rc; return rc;
ibdev->pkey = ntohs ( pkey_table->pkey[0] ); ibdev->pkey = ntohs ( pkey_table->pkey[0] );
DBGC ( ibdev, "IBDEV %p port GID is " IB_GID_FMT "\n", DBGC ( ibdev, "IBDEV %s port GID is " IB_GID_FMT "\n",
ibdev, IB_GID_ARGS ( &ibdev->gid ) ); ibdev->name, IB_GID_ARGS ( &ibdev->gid ) );
return 0; return 0;
} }