[infiniband] Use explicit "source" and "dest" address vector parameter names

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2012-08-31 00:47:37 +01:00
parent f747fac3e1
commit cbe41cb31b
11 changed files with 159 additions and 153 deletions

View File

@@ -263,7 +263,6 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av New address vector, if applicable
* @ret rc Return status code
*/
int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
@@ -384,14 +383,14 @@ struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*/
int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf ) {
struct ib_address_vector av_copy;
struct ib_address_vector dest_copy;
int rc;
/* Check queue fill level */
@@ -402,21 +401,21 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
}
/* Use default address vector if none specified */
if ( ! av )
av = &qp->av;
if ( ! dest )
dest = &qp->av;
/* Make modifiable copy of address vector */
memcpy ( &av_copy, av, sizeof ( av_copy ) );
av = &av_copy;
memcpy ( &dest_copy, dest, sizeof ( dest_copy ) );
dest = &dest_copy;
/* Fill in optional parameters in address vector */
if ( ! av->qkey )
av->qkey = qp->qkey;
if ( ! av->rate )
av->rate = IB_RATE_2_5;
if ( ! dest->qkey )
dest->qkey = qp->qkey;
if ( ! dest->rate )
dest->rate = IB_RATE_2_5;
/* Post to hardware */
if ( ( rc = ibdev->op->post_send ( ibdev, qp, av, iobuf ) ) != 0 ) {
if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx could not post send WQE: "
"%s\n", ibdev, qp->qpn, strerror ( rc ) );
return rc;
@@ -487,16 +486,16 @@ void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
if ( qp->recv.cq->op->complete_recv ) {
qp->recv.cq->op->complete_recv ( ibdev, qp, av, iobuf, rc );
qp->recv.cq->op->complete_recv ( ibdev, qp, source, iobuf, rc );
} else {
free_iob ( iobuf );
}

View File

@@ -220,13 +220,13 @@ static void ib_cmrc_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void ib_cmrc_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *av __unused,
struct ib_address_vector *source __unused,
struct io_buffer *iobuf, int rc ) {
struct ib_cmrc_connection *cmrc = ib_qp_get_ownerdata ( qp );

View File

@@ -112,13 +112,13 @@ static int ib_mi_handle ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v source Address vector
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void ib_mi_complete_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct ib_mad_interface *mi = ib_qp_get_ownerdata ( qp );
union ib_mad *mad;
@@ -152,7 +152,7 @@ static void ib_mi_complete_recv ( struct ib_device *ibdev,
DBGC2_HDA ( mi, 0, mad, sizeof ( *mad ) );
/* Handle MAD */
if ( ( rc = ib_mi_handle ( ibdev, mi, mad, av ) ) != 0 )
if ( ( rc = ib_mi_handle ( ibdev, mi, mad, source ) ) != 0 )
goto out;
out:

View File

@@ -42,11 +42,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v iobuf I/O buffer to contain headers
* @v qp Queue pair
* @v payload_len Payload length
* @v av Address vector
* @v dest Destination address vector
* @ret rc Return status code
*/
int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair *qp, size_t payload_len,
const struct ib_address_vector *av ) {
const struct ib_address_vector *dest ) {
struct ib_local_route_header *lrh;
struct ib_global_route_header *grh;
struct ib_base_transport_header *bth;
@@ -59,7 +60,8 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
unsigned int lnh;
DBGC2 ( ibdev, "IBDEV %p TX %04x:%08lx => %04x:%08lx (key %08lx)\n",
ibdev, ibdev->lid, qp->ext_qpn, av->lid, av->qpn, av->qkey );
ibdev, ibdev->lid, qp->ext_qpn, dest->lid, dest->qpn,
dest->qkey );
/* Calculate packet length */
pad_len = ( (-payload_len) & 0x3 );
@@ -71,7 +73,7 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
deth = iob_push ( iobuf, sizeof ( *deth ) );
bth = iob_push ( iobuf, sizeof ( *bth ) );
grh_len = ( payload_len + iob_len ( iobuf ) - orig_iob_len );
grh = ( av->gid_present ?
grh = ( dest->gid_present ?
iob_push ( iobuf, sizeof ( *grh ) ) : NULL );
lrh = iob_push ( iobuf, sizeof ( *lrh ) );
lrh_len = ( payload_len + iob_len ( iobuf ) - orig_iob_len );
@@ -80,8 +82,8 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
vl = ( ( qp->ext_qpn == IB_QPN_SMI ) ? IB_VL_SMP : IB_VL_DEFAULT );
lrh->vl__lver = ( vl << 4 );
lnh = ( grh ? IB_LNH_GRH : IB_LNH_BTH );
lrh->sl__lnh = ( ( av->sl << 4 ) | lnh );
lrh->dlid = htons ( av->lid );
lrh->sl__lnh = ( ( dest->sl << 4 ) | lnh );
lrh->dlid = htons ( dest->lid );
lrh->length = htons ( lrh_len >> 2 );
lrh->slid = htons ( ibdev->lid );
@@ -93,18 +95,18 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
grh->nxthdr = IB_GRH_NXTHDR_IBA;
grh->hoplmt = 0;
memcpy ( &grh->sgid, &ibdev->gid, sizeof ( grh->sgid ) );
memcpy ( &grh->dgid, &av->gid, sizeof ( grh->dgid ) );
memcpy ( &grh->dgid, &dest->gid, sizeof ( grh->dgid ) );
}
/* Construct BTH */
bth->opcode = BTH_OPCODE_UD_SEND;
bth->se__m__padcnt__tver = ( pad_len << 4 );
bth->pkey = htons ( ibdev->pkey );
bth->dest_qp = htonl ( av->qpn );
bth->dest_qp = htonl ( dest->qpn );
bth->ack__psn = htonl ( ( qp->send.psn++ ) & 0xffffffUL );
/* Construct DETH */
deth->qkey = htonl ( av->qkey );
deth->qkey = htonl ( dest->qkey );
deth->src_qp = htonl ( qp->ext_qpn );
DBGCP_HDA ( ibdev, 0, iobuf->data,
@@ -120,11 +122,12 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
* @v iobuf I/O buffer containing headers
* @v qp Queue pair to fill in, or NULL
* @v payload_len Payload length to fill in, or NULL
* @v av Address vector to fill in
* @v source Source address vector to fill in
* @ret rc Return status code
*/
int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair **qp, size_t *payload_len,
struct ib_address_vector *av ) {
struct ib_address_vector *source ) {
struct ib_local_route_header *lrh;
struct ib_global_route_header *grh;
struct ib_base_transport_header *bth;
@@ -140,7 +143,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
*qp = NULL;
if ( payload_len )
*payload_len = 0;
memset ( av, 0, sizeof ( *av ) );
memset ( source, 0, sizeof ( *source ) );
/* Extract LRH */
if ( iob_len ( iobuf ) < sizeof ( *lrh ) ) {
@@ -150,8 +153,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
lrh = iobuf->data;
iob_pull ( iobuf, sizeof ( *lrh ) );
av->lid = ntohs ( lrh->slid );
av->sl = ( lrh->sl__lnh >> 4 );
source->lid = ntohs ( lrh->slid );
source->sl = ( lrh->sl__lnh >> 4 );
lnh = ( lrh->sl__lnh & 0x3 );
lid = ntohs ( lrh->dlid );
@@ -171,8 +174,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
grh = iobuf->data;
iob_pull ( iobuf, sizeof ( *grh ) );
av->gid_present = 1;
memcpy ( &av->gid, &grh->sgid, sizeof ( av->gid ) );
source->gid_present = 1;
memcpy ( &source->gid, &grh->sgid, sizeof ( source->gid ) );
} else {
grh = NULL;
}
@@ -200,8 +203,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
deth = iobuf->data;
iob_pull ( iobuf, sizeof ( *deth ) );
av->qpn = ntohl ( deth->src_qp );
av->qkey = ntohl ( deth->qkey );
source->qpn = ntohl ( deth->src_qp );
source->qkey = ntohl ( deth->qkey );
/* Calculate payload length, if applicable */
if ( payload_len ) {
@@ -233,7 +236,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
DBGC2 ( ibdev, "IBDEV %p RX %04x:%08lx <= %04x:%08lx (key %08x)\n",
ibdev, lid, ( IB_LID_MULTICAST( lid ) ?
( qp ? (*qp)->ext_qpn : -1UL ) : qpn ),
av->lid, av->qpn, ntohl ( deth->qkey ) );
source->lid, source->qpn, ntohl ( deth->qkey ) );
DBGCP_HDA ( ibdev, 0,
( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ),
( orig_iob_len - iob_len ( iobuf ) ) );