[openib-general] [PATCH] mthca: fill in missing fields in send completion

Michael S. Tsirkin mst at mellanox.co.il
Wed Mar 23 06:25:03 PST 2005


Fill in missing fields in the send completion.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>

Index: infiniband/hw/mthca/mthca_dev.h
===================================================================
--- infiniband/hw/mthca/mthca_dev.h	(revision 2035)
+++ infiniband/hw/mthca/mthca_dev.h	(working copy)
@@ -88,6 +88,19 @@ enum {
 	MTHCA_NUM_EQ
 };
 
+enum {
+	MTHCA_OPCODE_NOP            = 0x00,
+	MTHCA_OPCODE_RDMA_WRITE     = 0x08,
+	MTHCA_OPCODE_RDMA_WRITE_IMM = 0x09,
+	MTHCA_OPCODE_SEND           = 0x0a,
+	MTHCA_OPCODE_SEND_IMM       = 0x0b,
+	MTHCA_OPCODE_RDMA_READ      = 0x10,
+	MTHCA_OPCODE_ATOMIC_CS      = 0x11,
+	MTHCA_OPCODE_ATOMIC_FA      = 0x12,
+	MTHCA_OPCODE_BIND_MW        = 0x18,
+	MTHCA_OPCODE_INVALID        = 0xff
+};
+
 struct mthca_cmd {
 	int                       use_events;
 	struct semaphore          hcr_sem;
Index: infiniband/hw/mthca/mthca_cq.c
===================================================================
--- infiniband/hw/mthca/mthca_cq.c	(revision 2035)
+++ infiniband/hw/mthca/mthca_cq.c	(working copy)
@@ -473,7 +473,46 @@ static inline int mthca_poll_one(struct 
 	}
 
 	if (is_send) {
-		entry->opcode = IB_WC_SEND; /* XXX */
+		switch (cqe->opcode) {
+		case MTHCA_OPCODE_RDMA_WRITE:
+			entry->opcode = IB_WC_RDMA_WRITE;
+			entry->wc_flags = 0;
+			break;
+		case MTHCA_OPCODE_RDMA_WRITE_IMM:
+			entry->opcode = IB_WC_RDMA_WRITE;
+			entry->wc_flags = IB_WC_WITH_IMM;
+			break;
+		case MTHCA_OPCODE_SEND:
+			entry->opcode = IB_WC_SEND;
+			entry->wc_flags = 0;
+			break;
+		case MTHCA_OPCODE_SEND_IMM:
+			entry->opcode = IB_WC_SEND;
+			entry->wc_flags = IB_WC_WITH_IMM;
+			break;
+		case MTHCA_OPCODE_RDMA_READ:
+			entry->opcode = IB_WC_RDMA_READ;
+			entry->wc_flags = 0;
+			entry->byte_len = be32_to_cpu(cqe->byte_cnt);
+			break;
+		case MTHCA_OPCODE_ATOMIC_CS:
+			entry->opcode = IB_WC_COMP_SWAP;
+			entry->wc_flags = 0;
+			entry->byte_len = be32_to_cpu(cqe->byte_cnt);
+			break;
+		case MTHCA_OPCODE_ATOMIC_FA:
+			entry->opcode = IB_WC_FETCH_ADD;
+			entry->wc_flags = 0;
+			entry->byte_len = be32_to_cpu(cqe->byte_cnt);
+			break;
+		case MTHCA_OPCODE_BIND_MW:
+			entry->opcode = IB_WC_BIND_MW;
+			entry->wc_flags = 0;
+			break;
+		default:
+			entry->opcode = MTHCA_OPCODE_INVALID;
+			break;
+		}
 	} else {
 		entry->byte_len = be32_to_cpu(cqe->byte_cnt);
 		switch (cqe->opcode & 0x1f) {
Index: infiniband/hw/mthca/mthca_qp.c
===================================================================
--- infiniband/hw/mthca/mthca_qp.c	(revision 2035)
+++ infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -171,19 +171,6 @@ enum {
 };
 
 enum {
-	MTHCA_OPCODE_NOP            = 0x00,
-	MTHCA_OPCODE_RDMA_WRITE     = 0x08,
-	MTHCA_OPCODE_RDMA_WRITE_IMM = 0x09,
-	MTHCA_OPCODE_SEND           = 0x0a,
-	MTHCA_OPCODE_SEND_IMM       = 0x0b,
-	MTHCA_OPCODE_RDMA_READ      = 0x10,
-	MTHCA_OPCODE_ATOMIC_CS      = 0x11,
-	MTHCA_OPCODE_ATOMIC_FA      = 0x12,
-	MTHCA_OPCODE_BIND_MW        = 0x18,
-	MTHCA_OPCODE_INVALID        = 0xff
-};
-
-enum {
 	MTHCA_NEXT_DBD       = 1 << 7,
 	MTHCA_NEXT_FENCE     = 1 << 6,
 	MTHCA_NEXT_CQ_UPDATE = 1 << 3,

-- 
MST - Michael S. Tsirkin



More information about the general mailing list