david/ipxe
Archived
1
0

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

View File

@ -1677,6 +1677,7 @@ static int hermon_complete ( struct ib_device *ibdev,
struct ib_work_queue *wq; struct ib_work_queue *wq;
struct ib_queue_pair *qp; struct ib_queue_pair *qp;
struct io_buffer *iobuf; struct io_buffer *iobuf;
struct ib_address_vector recv_dest;
struct ib_address_vector recv_source; struct ib_address_vector recv_source;
struct ib_global_route_header *grh; struct ib_global_route_header *grh;
struct ib_address_vector *source; struct ib_address_vector *source;
@ -1737,6 +1738,8 @@ static int hermon_complete ( struct ib_device *ibdev,
len = MLX_GET ( &cqe->normal, byte_cnt ); len = MLX_GET ( &cqe->normal, byte_cnt );
assert ( len <= iob_tailroom ( iobuf ) ); assert ( len <= iob_tailroom ( iobuf ) );
iob_put ( iobuf, len ); iob_put ( iobuf, len );
memset ( &recv_dest, 0, sizeof ( recv_dest ) );
recv_dest.qpn = qpn;
memset ( &recv_source, 0, sizeof ( recv_source ) ); memset ( &recv_source, 0, sizeof ( recv_source ) );
switch ( qp->type ) { switch ( qp->type ) {
case IB_QPT_SMI: 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->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
source->lid = MLX_GET ( &cqe->normal, slid_smac47_32 ); source->lid = MLX_GET ( &cqe->normal, slid_smac47_32 );
source->sl = MLX_GET ( &cqe->normal, sl ); 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, memcpy ( &source->gid, &grh->sgid,
sizeof ( source->gid ) ); sizeof ( source->gid ) );
break; break;
@ -1768,7 +1774,7 @@ static int hermon_complete ( struct ib_device *ibdev,
return -EINVAL; return -EINVAL;
} }
/* Hand off to completion handler */ /* 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; return rc;
@ -3155,12 +3161,14 @@ static void hermon_eth_complete_send ( struct ib_device *ibdev __unused,
* *
* @v ibdev Infiniband device * @v ibdev Infiniband device
* @v qp Queue pair * @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL * @v source Source address vector, or NULL
* @v iobuf I/O buffer * @v iobuf I/O buffer
* @v rc Completion status code * @v rc Completion status code
*/ */
static void hermon_eth_complete_recv ( struct ib_device *ibdev __unused, static void hermon_eth_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_address_vector *dest __unused,
struct ib_address_vector *source, struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) { struct io_buffer *iobuf, int rc ) {
struct net_device *netdev = ib_qp_get_ownerdata ( qp ); 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 headers;
struct io_buffer *iobuf; struct io_buffer *iobuf;
struct ib_queue_pair *intended_qp; struct ib_queue_pair *intended_qp;
struct ib_address_vector dest;
struct ib_address_vector source; struct ib_address_vector source;
unsigned int rcvtype; unsigned int rcvtype;
unsigned int pktlen; unsigned int pktlen;
@ -1238,7 +1239,7 @@ static void linda_complete_recv ( struct ib_device *ibdev,
qp0 = ( qp->qpn == 0 ); qp0 = ( qp->qpn == 0 );
intended_qp = NULL; intended_qp = NULL;
if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &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", DBGC ( linda, "Linda %p could not parse headers: %s\n",
linda, strerror ( rc ) ); linda, strerror ( rc ) );
err = 1; err = 1;
@ -1295,11 +1296,11 @@ static void linda_complete_recv ( struct ib_device *ibdev,
qp->recv.fill--; qp->recv.fill--;
intended_qp->recv.fill++; intended_qp->recv.fill++;
} }
ib_complete_recv ( ibdev, intended_qp, &source, ib_complete_recv ( ibdev, intended_qp, &dest, &source,
iobuf, rc); iobuf, rc);
} else { } else {
/* Completing on a skipped-over eager buffer */ /* Completing on a skipped-over eager buffer */
ib_complete_recv ( ibdev, qp, &source, iobuf, ib_complete_recv ( ibdev, qp, &dest, &source, iobuf,
-ECANCELED ); -ECANCELED );
} }

View File

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

View File

@ -480,12 +480,14 @@ static void ipoib_complete_send ( struct ib_device *ibdev __unused,
* *
* @v ibdev Infiniband device * @v ibdev Infiniband device
* @v qp Queue pair * @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL * @v source Source address vector, or NULL
* @v iobuf I/O buffer * @v iobuf I/O buffer
* @v rc Completion status code * @v rc Completion status code
*/ */
static void ipoib_complete_recv ( struct ib_device *ibdev __unused, static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_address_vector *dest __unused,
struct ib_address_vector *source, struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) { struct io_buffer *iobuf, int rc ) {
struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp ); 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 ); const struct ib_address_vector *dest );
extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf, extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair **qp, size_t *payload_len, struct ib_queue_pair **qp, size_t *payload_len,
struct ib_address_vector *dest,
struct ib_address_vector *source ); struct ib_address_vector *source );
#endif /* _IPXE_IB_PACKET_H */ #endif /* _IPXE_IB_PACKET_H */

View File

@ -205,12 +205,14 @@ struct ib_completion_queue_operations {
* *
* @v ibdev Infiniband device * @v ibdev Infiniband device
* @v qp Queue pair * @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL * @v source Source address vector, or NULL
* @v iobuf I/O buffer * @v iobuf I/O buffer
* @v rc Completion status code * @v rc Completion status code
*/ */
void ( * complete_recv ) ( struct ib_device *ibdev, void ( * complete_recv ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_address_vector *dest,
struct ib_address_vector *source, struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ); 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 ); struct io_buffer *iobuf, int rc );
extern void ib_complete_recv ( struct ib_device *ibdev, extern void ib_complete_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_address_vector *dest,
struct ib_address_vector *source, struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ); struct io_buffer *iobuf, int rc );
extern void ib_refill_recv ( struct ib_device *ibdev, 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++ ) { for ( i = 0 ; i < qp->recv.num_wqes ; i++ ) {
if ( ( iobuf = qp->recv.iobufs[i] ) != NULL ) { if ( ( iobuf = qp->recv.iobufs[i] ) != NULL ) {
ib_complete_recv ( ibdev, qp, NULL, iobuf, ib_complete_recv ( ibdev, qp, NULL, NULL, iobuf,
-ECANCELED ); -ECANCELED );
} }
} }
@ -486,16 +486,19 @@ void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
* *
* @v ibdev Infiniband device * @v ibdev Infiniband device
* @v qp Queue pair * @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL * @v source Source address vector, or NULL
* @v iobuf I/O buffer * @v iobuf I/O buffer
* @v rc Completion status code * @v rc Completion status code
*/ */
void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp, void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *dest,
struct ib_address_vector *source, struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) { struct io_buffer *iobuf, int rc ) {
if ( qp->recv.cq->op->complete_recv ) { 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 { } else {
free_iob ( iobuf ); 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 ibdev Infiniband device
* @v qp Queue pair * @v qp Queue pair
* @v dest Destination address vector, or NULL
* @v source Source address vector, or NULL * @v source Source address vector, or NULL
* @v iobuf I/O buffer * @v iobuf I/O buffer
* @v rc Completion status code * @v rc Completion status code
*/ */
static void ib_cmrc_complete_recv ( struct ib_device *ibdev __unused, static void ib_cmrc_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_address_vector *dest __unused,
struct ib_address_vector *source __unused, struct ib_address_vector *source __unused,
struct io_buffer *iobuf, int rc ) { struct io_buffer *iobuf, int rc ) {
struct ib_cmrc_connection *cmrc = ib_qp_get_ownerdata ( qp ); 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 ibdev Infiniband device
* @v qp Queue pair * @v qp Queue pair
* @v source Address vector * @v dest Destination address vector
* @v source Source address vector
* @v iobuf I/O buffer * @v iobuf I/O buffer
* @v rc Completion status code * @v rc Completion status code
*/ */
static void ib_mi_complete_recv ( struct ib_device *ibdev, static void ib_mi_complete_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp, struct ib_queue_pair *qp,
struct ib_address_vector *dest __unused,
struct ib_address_vector *source, struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) { struct io_buffer *iobuf, int rc ) {
struct ib_mad_interface *mi = ib_qp_get_ownerdata ( qp ); 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 iobuf I/O buffer containing headers
* @v qp Queue pair to fill in, or NULL * @v qp Queue pair to fill in, or NULL
* @v payload_len Payload length 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 * @v source Source address vector to fill in
* @ret rc Return status code * @ret rc Return status code
*/ */
int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf, int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair **qp, size_t *payload_len, struct ib_queue_pair **qp, size_t *payload_len,
struct ib_address_vector *dest,
struct ib_address_vector *source ) { struct ib_address_vector *source ) {
struct ib_local_route_header *lrh; struct ib_local_route_header *lrh;
struct ib_global_route_header *grh; 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 ); size_t orig_iob_len = iob_len ( iobuf );
unsigned int lnh; unsigned int lnh;
size_t pad_len; size_t pad_len;
unsigned long qpn;
unsigned int lid;
/* Clear return values */ /* Clear return values */
if ( qp ) if ( qp )
*qp = NULL; *qp = NULL;
if ( payload_len ) if ( payload_len )
*payload_len = 0; *payload_len = 0;
memset ( dest, 0, sizeof ( *dest ) );
memset ( source, 0, sizeof ( *source ) ); memset ( source, 0, sizeof ( *source ) );
/* Extract LRH */ /* Extract LRH */
@ -153,10 +154,11 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
} }
lrh = iobuf->data; lrh = iobuf->data;
iob_pull ( iobuf, sizeof ( *lrh ) ); iob_pull ( iobuf, sizeof ( *lrh ) );
dest->lid = ntohs ( lrh->dlid );
dest->sl = ( lrh->sl__lnh >> 4 );
source->lid = ntohs ( lrh->slid ); source->lid = ntohs ( lrh->slid );
source->sl = ( lrh->sl__lnh >> 4 ); source->sl = ( lrh->sl__lnh >> 4 );
lnh = ( lrh->sl__lnh & 0x3 ); lnh = ( lrh->sl__lnh & 0x3 );
lid = ntohs ( lrh->dlid );
/* Reject unsupported packets */ /* Reject unsupported packets */
if ( ! ( ( lnh == IB_LNH_BTH ) || ( lnh == IB_LNH_GRH ) ) ) { 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; grh = iobuf->data;
iob_pull ( iobuf, sizeof ( *grh ) ); iob_pull ( iobuf, sizeof ( *grh ) );
dest->gid_present = 1;
memcpy ( &dest->gid, &grh->dgid, sizeof ( dest->gid ) );
source->gid_present = 1; source->gid_present = 1;
memcpy ( &source->gid, &grh->sgid, sizeof ( source->gid ) ); memcpy ( &source->gid, &grh->sgid, sizeof ( source->gid ) );
} else { } else {
@ -193,7 +197,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
ibdev, bth->opcode ); ibdev, bth->opcode );
return -ENOTSUP; return -ENOTSUP;
} }
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 ) ) {
@ -216,7 +220,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
/* Determine destination QP, if applicable */ /* Determine destination QP, if applicable */
if ( qp ) { if ( qp ) {
if ( IB_LID_MULTICAST ( 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 %p RX for unknown MGID "
IB_GID_FMT "\n", IB_GID_FMT "\n",
@ -224,9 +228,9 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
return -ENODEV; return -ENODEV;
} }
} else { } 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 " DBGC ( ibdev, "IBDEV %p RX for nonexistent "
"QPN %lx\n", ibdev, qpn ); "QPN %lx\n", ibdev, dest->qpn );
return -ENODEV; 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", DBGC2 ( ibdev, "IBDEV %p RX %04x:%08lx <= %04x:%08lx (key %08x)\n",
ibdev, lid, ( IB_LID_MULTICAST( lid ) ? ibdev, dest->lid, ( IB_LID_MULTICAST ( dest->lid ) ?
( qp ? (*qp)->ext_qpn : -1UL ) : 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,
( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ), ( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ),