[openib-general] Re: [PATCH] replace grh_flag with ah_flags in ib_ah

Sean Hefty mshefty at ichips.intel.com
Wed Sep 8 14:28:47 PDT 2004


On Wed, 8 Sep 2004 13:57:22 -0700
Sean Hefty <mshefty at ichips.intel.com> wrote:

> convert the WC bit fields to flags

This patch should replace the WC bit fields with flags.

- Sean

Index: infiniband/include/ib_verbs.h
===================================================================
--- infiniband/include/ib_verbs.h	(revision 756)
+++ infiniband/include/ib_verbs.h	(working copy)
@@ -263,6 +263,11 @@
 	IB_WC_RECV_RDMA_WITH_IMM
 };
 
+enum ib_wc_flags {
+	IB_WC_GRH		= 1,
+	IB_WC_WITH_IMM		= (1<<1)
+};
+
 struct ib_wc {
 	u64			wr_id;
 	enum ib_wc_status	status;
@@ -271,8 +276,7 @@
 	u32			byte_len;
 	u32			imm_data;
 	u32			src_qp;
-	int			grh_flag:1;
-	int			imm_data_valid:1;
+	int			wc_flags;
 	u16			pkey_index;
 	u16			slid;
 	u8			sl;
Index: infiniband/core/mad_ib.c
===================================================================
--- infiniband/core/mad_ib.c	(revision 756)
+++ infiniband/core/mad_ib.c	(working copy)
@@ -230,7 +230,7 @@
 		mad->sqpn       = entry->src_qp;
 		mad->dqpn       = wrid.field.qpn;
 
-		if (entry->grh_flag) {
+		if (entry->wc_flags & IB_WC_GRH) {
 			u32 *grh = (void *) mad - IB_MAD_GRH_SIZE;
 			mad->has_grh = 1;
 			/* First 32 bytes of GRH have 4 bits of
Index: infiniband/hw/mthca/mthca_cq.c
===================================================================
--- infiniband/hw/mthca/mthca_cq.c	(revision 756)
+++ infiniband/hw/mthca/mthca_cq.c	(working copy)
@@ -459,18 +459,18 @@
 		switch (cqe->opcode & 0x1f) {
 		case IB_OPCODE_SEND_LAST_WITH_IMMEDIATE:
 		case IB_OPCODE_SEND_ONLY_WITH_IMMEDIATE:
-			entry->imm_data_valid = 1;
+			entry->wc_flags = IB_WC_WITH_IMM;
 			entry->imm_data = cqe->imm_etype_pkey_eec;
 			entry->opcode = IB_WC_RECV;
 			break;
 		case IB_OPCODE_RDMA_WRITE_LAST_WITH_IMMEDIATE:
 		case IB_OPCODE_RDMA_WRITE_ONLY_WITH_IMMEDIATE:
-			entry->imm_data_valid = 1;
+			entry->wc_flags = IB_WC_WITH_IMM;
 			entry->imm_data = cqe->imm_etype_pkey_eec;
 			entry->opcode = IB_WC_RECV_RDMA_WITH_IMM;
 			break;
 		default:
-			entry->imm_data_valid = 0;
+			entry->wc_flags = 0;
 			entry->opcode = IB_WC_RECV;
 			break;
 		}
@@ -479,7 +479,8 @@
 		entry->src_qp 	   = be32_to_cpu(cqe->rqpn) & 0xffffff;
 		entry->dlid_path_bits = be16_to_cpu(cqe->sl_g_mlpath) & 0x7f;
 		entry->pkey_index  = be32_to_cpu(cqe->imm_etype_pkey_eec) >> 16;
-		entry->grh_flag    = !!(be16_to_cpu(cqe->sl_g_mlpath) & 0x80);
+		entry->wc_flags    |= ((be16_to_cpu(cqe->sl_g_mlpath) & 0x80) ?
+					IB_WC_GRH : 0);
 	}
 
 	entry->status = IB_WC_SUCCESS;



More information about the general mailing list