[openib-general] [PATCH] Add local qp number to ib_wc

Michael S. Tsirkin mst at mellanox.co.il
Tue Jan 4 02:07:24 PST 2005


Hi!
IB spec 1.2 add the qp number as a field in work completion:

	QP Number. Set if the Base Queue Management Extension
	or Shared Receive Queue Extension is supported.

Now my understanding is that we kind of support the BQM since
our post send lets you post multiple work requests.

Further, when more than one qp is mapped to the same cq, it
becomes convenient to have the qp number in the work completion,
to be able to quickly tell whose completion it was.

I would suggest add the ib_qp* to ib_wc, but that may not be valid since
the qp may be removed after poll_cq.

So, lets simply add the qp number to ib_wc. Patch attached. Works fine for me.

MSt


Index: include/ib_verbs.h
===================================================================
--- include/ib_verbs.h	(revision 1399)
+++ include/ib_verbs.h	(working copy)
@@ -339,6 +339,7 @@ struct ib_wc {
 	u32			vendor_err;
 	u32			byte_len;
 	__be32			imm_data;
+	u32			qp_num;
 	u32			src_qp;
 	int			wc_flags;
 	u16			pkey_index;
Index: core/mad.c
===================================================================
--- core/mad.c	(revision 1399)
+++ core/mad.c	(working copy)
@@ -2024,6 +2024,7 @@ static void local_completions(void *data
 			wc.slid = IB_LID_PERMISSIVE;
 			wc.sl = 0;
 			wc.dlid_path_bits = 0;
+			wc.qp_num = IB_QP0;
 			local->mad_priv->header.recv_wc.wc = &wc;
 			local->mad_priv->header.recv_wc.mad_len =
 						sizeof(struct ib_mad);
Index: hw/mthca/mthca_cq.c
===================================================================
--- hw/mthca/mthca_cq.c	(revision 1399)
+++ hw/mthca/mthca_cq.c	(working copy)
@@ -440,6 +440,8 @@ static inline int mthca_poll_one(struct 
 		spin_lock(&(*cur_qp)->lock);
 	}
 
+	entry->qp_num = cur_qp->qpn;
+
 	if (is_send) {
 		wq = &(*cur_qp)->sq;
 		wqe_index = ((be32_to_cpu(cqe->wqe) - (*cur_qp)->send_wqe_offset)



More information about the general mailing list