summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2009-07-07 15:03:11 +0200
committerMichael Brown2009-07-18 00:06:33 +0200
commitb4155c4ab541693f35f2efe76d6dc75dd4cb7825 (patch)
treee90bc2a5f9b2213cb4bbdd837e161dd796b7f8d5
parent[ipoib] Clarify new role of IPoIB peer cache as for MAC addresses only (diff)
downloadipxe-b4155c4ab541693f35f2efe76d6dc75dd4cb7825.tar.gz
ipxe-b4155c4ab541693f35f2efe76d6dc75dd4cb7825.tar.xz
ipxe-b4155c4ab541693f35f2efe76d6dc75dd4cb7825.zip
[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.
-rw-r--r--src/drivers/net/ipoib.c10
-rw-r--r--src/net/infiniband.c6
-rw-r--r--src/net/infiniband/ib_gma.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index bf778879..4b9f1e0b 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -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;
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 497c20f6..369d490a 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -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: "
diff --git a/src/net/infiniband/ib_gma.c b/src/net/infiniband/ib_gma.c
index 2baae25c..d599ea32 100644
--- a/src/net/infiniband/ib_gma.c
+++ b/src/net/infiniband/ib_gma.c
@@ -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 ) {