2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-25 19:08:35 +00:00

[infiniband] Include destination address vector in ib_complete_recv()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2012-08-31 01:48:49 +01:00
parent cbe41cb31b
commit f54a61e434
11 changed files with 55 additions and 22 deletions

View File

@ -1525,6 +1525,7 @@ static int arbel_complete ( struct ib_device *ibdev,
struct arbel_recv_work_queue *arbel_recv_wq;
struct arbelprm_recv_wqe *recv_wqe;
struct io_buffer *iobuf;
struct ib_address_vector recv_dest;
struct ib_address_vector recv_source;
struct ib_global_route_header *grh;
struct ib_address_vector *source;
@ -1608,6 +1609,8 @@ static int arbel_complete ( struct ib_device *ibdev,
l_key, ARBEL_INVALID_LKEY );
assert ( len <= iob_tailroom ( iobuf ) );
iob_put ( iobuf, len );
memset ( &recv_dest, 0, sizeof ( recv_dest ) );
recv_dest.qpn = qpn;
switch ( qp->type ) {
case IB_QPT_SMI:
case IB_QPT_GSI:
@ -1621,7 +1624,10 @@ static int arbel_complete ( struct ib_device *ibdev,
source->qpn = MLX_GET ( &cqe->normal, rqpn );
source->lid = MLX_GET ( &cqe->normal, rlid );
source->sl = MLX_GET ( &cqe->normal, sl );
source->gid_present = MLX_GET ( &cqe->normal, g );
recv_dest.gid_present = source->gid_present =
MLX_GET ( &cqe->normal, g );
memcpy ( &recv_dest.gid, &grh->dgid,
sizeof ( recv_dest.gid ) );
memcpy ( &source->gid, &grh->sgid,
sizeof ( source->gid ) );
break;
@ -1633,7 +1639,7 @@ static int arbel_complete ( struct ib_device *ibdev,
return -EINVAL;
}
/* Hand off to completion handler */
ib_complete_recv ( ibdev, qp, source, iobuf, rc );
ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
}
return rc;

View File

@ -1677,6 +1677,7 @@ static int hermon_complete ( struct ib_device *ibdev,
struct ib_work_queue *wq;
struct ib_queue_pair *qp;
struct io_buffer *iobuf;
struct ib_address_vector recv_dest;
struct ib_address_vector recv_source;
struct ib_global_route_header *grh;
struct ib_address_vector *source;
@ -1737,6 +1738,8 @@ static int hermon_complete ( struct ib_device *ibdev,
len = MLX_GET ( &cqe->normal, byte_cnt );
assert ( len <= iob_tailroom ( iobuf ) );
iob_put ( iobuf, len );
memset ( &recv_dest, 0, sizeof ( recv_dest ) );
recv_dest.qpn = qpn;
memset ( &recv_source, 0, sizeof ( recv_source ) );
switch ( qp->type ) {
case IB_QPT_SMI:
@ -1750,7 +1753,10 @@ static int hermon_complete ( struct ib_device *ibdev,
source->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
source->lid = MLX_GET ( &cqe->normal, slid_smac47_32 );
source->sl = MLX_GET ( &cqe->normal, sl );
source->gid_present = MLX_GET ( &cqe->normal, g );
recv_dest.gid_present = source->gid_present =
MLX_GET ( &cqe->normal, g );
memcpy ( &recv_dest.gid, &grh->dgid,
sizeof ( recv_dest.gid ) );
memcpy ( &source->gid, &grh->sgid,
sizeof ( source->gid ) );
break;
@ -1768,7 +1774,7 @@ static int hermon_complete ( struct ib_device *ibdev,
return -EINVAL;
}
/* Hand off to completion handler */
ib_complete_recv ( ibdev, qp, source, iobuf, rc );
ib_complete_recv ( ibdev, qp, &recv_dest, source, iobuf, rc );
}
return rc;
@ -3155,12 +3161,14 @@ static void hermon_eth_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void hermon_eth_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *dest __unused,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct net_device *netdev = ib_qp_get_ownerdata ( qp );

View File

@ -1170,6 +1170,7 @@ static void linda_complete_recv ( struct ib_device *ibdev,
struct io_buffer headers;
struct io_buffer *iobuf;
struct ib_queue_pair *intended_qp;
struct ib_address_vector dest;
struct ib_address_vector source;
unsigned int rcvtype;
unsigned int pktlen;
@ -1238,7 +1239,7 @@ static void linda_complete_recv ( struct ib_device *ibdev,
qp0 = ( qp->qpn == 0 );
intended_qp = NULL;
if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &intended_qp : NULL ),
&payload_len, &source ) ) != 0 ) {
&payload_len, &dest, &source ) ) != 0 ) {
DBGC ( linda, "Linda %p could not parse headers: %s\n",
linda, strerror ( rc ) );
err = 1;
@ -1295,11 +1296,11 @@ static void linda_complete_recv ( struct ib_device *ibdev,
qp->recv.fill--;
intended_qp->recv.fill++;
}
ib_complete_recv ( ibdev, intended_qp, &source,
ib_complete_recv ( ibdev, intended_qp, &dest, &source,
iobuf, rc);
} else {
/* Completing on a skipped-over eager buffer */
ib_complete_recv ( ibdev, qp, &source, iobuf,
ib_complete_recv ( ibdev, qp, &dest, &source, iobuf,
-ECANCELED );
}

View File

@ -1413,6 +1413,7 @@ static void qib7322_complete_recv ( struct ib_device *ibdev,
struct io_buffer headers;
struct io_buffer *iobuf;
struct ib_queue_pair *intended_qp;
struct ib_address_vector dest;
struct ib_address_vector source;
unsigned int rcvtype;
unsigned int pktlen;
@ -1474,7 +1475,7 @@ static void qib7322_complete_recv ( struct ib_device *ibdev,
qp0 = ( qp->qpn == 0 );
intended_qp = NULL;
if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &intended_qp : NULL ),
&payload_len, &source ) ) != 0 ) {
&payload_len, &dest, &source ) ) != 0 ) {
DBGC ( qib7322, "QIB7322 %p could not parse headers: %s\n",
qib7322, strerror ( rc ) );
err = 1;
@ -1531,11 +1532,11 @@ static void qib7322_complete_recv ( struct ib_device *ibdev,
qp->recv.fill--;
intended_qp->recv.fill++;
}
ib_complete_recv ( ibdev, intended_qp, &source,
ib_complete_recv ( ibdev, intended_qp, &dest, &source,
iobuf, rc);
} else {
/* Completing on a skipped-over eager buffer */
ib_complete_recv ( ibdev, qp, &source, iobuf,
ib_complete_recv ( ibdev, qp, &dest, &source, iobuf,
-ECANCELED );
}

View File

@ -480,12 +480,14 @@ static void ipoib_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *dest __unused,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );

View File

@ -155,6 +155,7 @@ extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
const struct ib_address_vector *dest );
extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair **qp, size_t *payload_len,
struct ib_address_vector *dest,
struct ib_address_vector *source );
#endif /* _IPXE_IB_PACKET_H */

View File

@ -205,12 +205,14 @@ struct ib_completion_queue_operations {
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
void ( * complete_recv ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *dest,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc );
};
@ -511,6 +513,7 @@ extern void ib_complete_send ( struct ib_device *ibdev,
struct io_buffer *iobuf, int rc );
extern void ib_complete_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *dest,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc );
extern void ib_refill_recv ( struct ib_device *ibdev,

View File

@ -304,7 +304,7 @@ void ib_destroy_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
}
for ( i = 0 ; i < qp->recv.num_wqes ; i++ ) {
if ( ( iobuf = qp->recv.iobufs[i] ) != NULL ) {
ib_complete_recv ( ibdev, qp, NULL, iobuf,
ib_complete_recv ( ibdev, qp, NULL, NULL, iobuf,
-ECANCELED );
}
}
@ -486,16 +486,19 @@ void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v dest Destination 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 *dest,
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, source, iobuf, rc );
qp->recv.cq->op->complete_recv ( ibdev, qp, dest, source,
iobuf, rc );
} else {
free_iob ( iobuf );
}

View File

@ -220,12 +220,14 @@ static void ib_cmrc_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v dest Destination 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 *dest __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,12 +112,14 @@ static int ib_mi_handle ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v source Address vector
* @v dest Destination address vector
* @v source 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 *dest __unused,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct ib_mad_interface *mi = ib_qp_get_ownerdata ( qp );

View File

@ -122,11 +122,13 @@ 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 dest Destination 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 *dest,
struct ib_address_vector *source ) {
struct ib_local_route_header *lrh;
struct ib_global_route_header *grh;
@ -135,14 +137,13 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
size_t orig_iob_len = iob_len ( iobuf );
unsigned int lnh;
size_t pad_len;
unsigned long qpn;
unsigned int lid;
/* Clear return values */
if ( qp )
*qp = NULL;
if ( payload_len )
*payload_len = 0;
memset ( dest, 0, sizeof ( *dest ) );
memset ( source, 0, sizeof ( *source ) );
/* Extract LRH */
@ -153,10 +154,11 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
lrh = iobuf->data;
iob_pull ( iobuf, sizeof ( *lrh ) );
dest->lid = ntohs ( lrh->dlid );
dest->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 );
/* Reject unsupported packets */
if ( ! ( ( lnh == IB_LNH_BTH ) || ( lnh == IB_LNH_GRH ) ) ) {
@ -174,6 +176,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
grh = iobuf->data;
iob_pull ( iobuf, sizeof ( *grh ) );
dest->gid_present = 1;
memcpy ( &dest->gid, &grh->dgid, sizeof ( dest->gid ) );
source->gid_present = 1;
memcpy ( &source->gid, &grh->sgid, sizeof ( source->gid ) );
} else {
@ -193,7 +197,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
ibdev, bth->opcode );
return -ENOTSUP;
}
qpn = ntohl ( bth->dest_qp );
dest->qpn = ntohl ( bth->dest_qp );
/* Extract DETH */
if ( iob_len ( iobuf ) < sizeof ( *deth ) ) {
@ -216,7 +220,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
/* Determine destination QP, if applicable */
if ( qp ) {
if ( IB_LID_MULTICAST ( lid ) && grh ) {
if ( IB_LID_MULTICAST ( dest->lid ) && grh ) {
if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
DBGC ( ibdev, "IBDEV %p RX for unknown MGID "
IB_GID_FMT "\n",
@ -224,9 +228,9 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
return -ENODEV;
}
} else {
if ( ! ( *qp = ib_find_qp_qpn ( ibdev, qpn ) ) ) {
if ( ! ( *qp = ib_find_qp_qpn ( ibdev, dest->qpn ) ) ) {
DBGC ( ibdev, "IBDEV %p RX for nonexistent "
"QPN %lx\n", ibdev, qpn );
"QPN %lx\n", ibdev, dest->qpn );
return -ENODEV;
}
}
@ -234,8 +238,8 @@ 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 ),
ibdev, dest->lid, ( IB_LID_MULTICAST ( dest->lid ) ?
( qp ? (*qp)->ext_qpn : -1UL ) : dest->qpn ),
source->lid, source->qpn, ntohl ( deth->qkey ) );
DBGCP_HDA ( ibdev, 0,
( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ),