[ewg] [PATCH] RDMA/nes: Fix cm_event_connected() for big-endian platforms

gstreiff at neteffect.com gstreiff at neteffect.com
Thu Feb 21 18:25:13 PST 2008


We recently added portabiliity/helper function get_crc_value()
to nes_accept().  This should also be deployed to
cm_event_connected.  Otherwise rmda connection establishment 
will fail on big-endian platforms such as ppc64.

This remediation was triggered by change near 2.6.23 to
lib/crc32.c with commit ef19454bd437b2ba.  

Prior to the commit we might get the following return value from
crc32c() on ppc64:

   0xc69c51fd

After the commit:

   0xfd519cc6

So the helper function does an _le32 on the value so we have
good interop between kernels at different rev levels for
example.

Signed-off-by: Glenn Streiff <gstreiff at neteffect.com>

---
 drivers/infiniband/hw/nes/nes_cm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 0c5dd5b..4705dbc 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -2752,6 +2752,7 @@ void cm_event_connected(struct nes_cm_event *event)
 	struct iw_cm_event cm_event;
 	struct nes_hw_qp_wqe *wqe;
 	struct nes_v4_quad nes_quad;
+	u32 crc_value;
 	int ret;
 
 	/* get all our handles */
@@ -2829,8 +2830,8 @@ void cm_event_connected(struct nes_cm_event *event)
 	nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
 
 	/* Produce hash key */
-	nesqp->hte_index = cpu_to_be32(
-			crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff);
+	crc_value = get_crc_value(&nes_quad);
+	nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff);
 	nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n",
 			nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask);
 



More information about the ewg mailing list