david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[infiniband] Make qkey and rate optional parameters to ib_post_send()

The queue key is stored as a property of the queue pair, and so can
optionally be added by the Infiniband core at the time of calling
ib_post_send(), rather than always having to be specified by the
caller.

This allows IPoIB to avoid explicitly keeping track of the data queue
key.
This commit is contained in:
Michael Brown 2009-07-07 14:03:11 +01:00
parent 8aa2591c06
commit b4155c4ab5
3 changed files with 10 additions and 10 deletions

View File

@ -67,8 +67,6 @@ struct ipoib_device {
struct ib_queue_set meta;
/** Broadcast MAC */
struct ipoib_mac broadcast;
/** Data queue key */
unsigned long data_qkey;
/** Attached to multicast group
*
* This flag indicates whether or not we have attached our
@ -433,7 +431,6 @@ static int ipoib_transmit ( struct net_device *netdev,
/* Construct address vector */
memset ( &av, 0, sizeof ( av ) );
av.qpn = ntohl ( dest->mac.qpn );
av.qkey = ipoib->data_qkey;
av.gid_present = 1;
memcpy ( &av.gid, &dest->mac.gid, sizeof ( av.gid ) );
if ( ( rc = ib_resolve_path ( ibdev, &av ) ) != 0 ) {
@ -540,18 +537,19 @@ static void ipoib_meta_complete_send ( struct ib_device *ibdev __unused,
*/
static void ipoib_recv_mc_member_record ( struct ipoib_device *ipoib,
struct ib_mc_member_record *mc_member_record ) {
unsigned long data_qkey;
int joined;
int rc;
/* Record parameters */
joined = ( mc_member_record->scope__join_state & 0x0f );
ipoib->data_qkey = ntohl ( mc_member_record->qkey );
data_qkey = ntohl ( mc_member_record->qkey );
DBGC ( ipoib, "IPoIB %p %s broadcast group: qkey %lx\n",
ipoib, ( joined ? "joined" : "left" ), ipoib->data_qkey );
ipoib, ( joined ? "joined" : "left" ), data_qkey );
/* Update data queue pair qkey */
if ( ( rc = ib_modify_qp ( ipoib->ibdev, ipoib->data.qp,
IB_MODIFY_QKEY, ipoib->data_qkey ) ) != 0 ){
IB_MODIFY_QKEY, data_qkey ) ) != 0 ){
DBGC ( ipoib, "IPoIB %p could not update data qkey: %s\n",
ipoib, strerror ( rc ) );
return;

View File

@ -360,6 +360,12 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
return -ENOBUFS;
}
/* Fill in optional parameters in address vector */
if ( ! av->qkey )
av->qkey = qp->qkey;
if ( ! av->rate )
av->rate = IB_RATE_2_5;
/* Post to hardware */
if ( ( rc = ibdev->op->post_send ( ibdev, qp, av, iobuf ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx could not post send WQE: "

View File

@ -197,10 +197,6 @@ static void ib_gma_complete_recv ( struct ib_device *ibdev,
}
}
/* Construct return address */
av->qkey = ( ( av->qpn == IB_QPN_SMA ) ? IB_QKEY_SMA : IB_QKEY_GMA );
av->rate = IB_RATE_2_5;
/* Send MAD response, if applicable */
if ( ( rc = ib_post_send ( ibdev, qp, av,
iob_disown ( iobuf ) ) ) != 0 ) {