mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 12:30:20 +03:00
[infiniband] Include destination address vector in ib_complete_recv()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 ) ) ),
|
||||
|
||||
Reference in New Issue
Block a user