mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RE: [ofa-general] [PATCH 2.6 6/8] RDMA/nes: Fix rdma connectionestablishment on big-endian platforms
  2008-02-21 14:29 [PATCH 2.6 6/8] RDMA/nes: Fix rdma connection establishment on big-endian platforms gstreiff
@ 2008-02-21 13:46 ` Glenn Streiff
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Streiff @ 2008-02-21 13:46 UTC (permalink / raw)
  To: rdreier; +Cc: linux-kernel, general, Faisal Latif

You'll notice I have two "6/8" patches.  This is the
bogus one.  No one told me this job required ability to count.

Glenn

> -----Original Message-----
> From: general-bounces@lists.openfabrics.org
> [mailto:general-bounces@lists.openfabrics.org]On Behalf Of
> gstreiff@neteffect.com
> Sent: Thursday, February 21, 2008 8:30 AM
> To: rdreier@cisco.com
> Cc: linux-kernel@vger.kernel.org; 
> general@lists.openfabrics.org; Faisal
> Latif
> Subject: [ofa-general] [PATCH 2.6 6/8] RDMA/nes: Fix rdma
> connectionestablishment on big-endian platforms
> 
> 
> From: Faisal Latif <flatif@neteffect.com>
> 
> With commit ef19454bd437b2ba, behavior of crc32c changes on
> big-endian platforms.
> 
> Our algorithm expects previous behavior otherwise we have
> rdma connection establishment failure on big-endian platforms
> like ppc64.  Applying cpu_to_le32() to value returned by
> crc32c() to get previous behavior.
> 
> Signed-off-by: Faisal Latif <flatif@neteffect.com>
> Signed-off-by: Glenn Streiff <gstreiff@neteffect.com>
> 
> ---
>  drivers/infiniband/hw/nes/nes.h    |   14 ++++++++++++++
>  drivers/infiniband/hw/nes/nes_cm.c |    5 +++--
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/nes/nes.h 
> b/drivers/infiniband/hw/nes/nes.h
> index fd57e8a..b0d3c52 100644
> --- a/drivers/infiniband/hw/nes/nes.h
> +++ b/drivers/infiniband/hw/nes/nes.h
> @@ -285,6 +285,20 @@ struct nes_device {
>  };
>  
>  
> +static inline u32 get_crc_value(struct nes_v4_quad* nes_quad)
> +{
> +	u32 crc_value;
> +	crc_value = crc32c(~0, (void *)nes_quad, sizeof (struct 
> nes_v4_quad));
> +
> +	/*
> +	* With commit ef19454bd437b2ba, behavior of crc32c changes on
> +	* big-endian platforms.  Our algorithm expects previous behavior
> +	* otherwise we have rdma connection establishment issue 
> on ppc64.
> +	*/
> +	crc_value = cpu_to_le32(crc_value);
> +	return crc_value;
> +}
> +
>  static inline void
>  set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value)
>  {
> diff --git a/drivers/infiniband/hw/nes/nes_cm.c 
> b/drivers/infiniband/hw/nes/nes_cm.c
> index 6c298aa..1f042d1 100644
> --- a/drivers/infiniband/hw/nes/nes_cm.c
> +++ b/drivers/infiniband/hw/nes/nes_cm.c
> @@ -2320,6 +2320,7 @@ int nes_accept(struct iw_cm_id *cm_id, 
> struct iw_cm_conn_param *conn_param)
>  	struct iw_cm_event cm_event;
>  	struct nes_hw_qp_wqe *wqe;
>  	struct nes_v4_quad nes_quad;
> +	u32 crc_value;
>  	int ret;
>  
>  	ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
> @@ -2436,8 +2437,8 @@ int nes_accept(struct iw_cm_id *cm_id, 
> struct iw_cm_conn_param *conn_param)
>  	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, CRC = 0x%08X\n",
>  			nesqp->hte_index, nesqp->hte_index & 
> adapter->hte_index_mask);
>  
> _______________________________________________
> general mailing list
> general@lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit 
http://openib.org/mailman/listinfo/openib-general

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2.6 6/8] RDMA/nes: Fix rdma connection establishment on big-endian platforms
@ 2008-02-21 14:29 gstreiff
  2008-02-21 13:46 ` [ofa-general] [PATCH 2.6 6/8] RDMA/nes: Fix rdma connectionestablishment " Glenn Streiff
  0 siblings, 1 reply; 2+ messages in thread
From: gstreiff @ 2008-02-21 14:29 UTC (permalink / raw)
  To: rdreier; +Cc: flatif, general, linux-kernel

From: Faisal Latif <flatif@neteffect.com>

With commit ef19454bd437b2ba, behavior of crc32c changes on
big-endian platforms.

Our algorithm expects previous behavior otherwise we have
rdma connection establishment failure on big-endian platforms
like ppc64.  Applying cpu_to_le32() to value returned by
crc32c() to get previous behavior.

Signed-off-by: Faisal Latif <flatif@neteffect.com>
Signed-off-by: Glenn Streiff <gstreiff@neteffect.com>

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

diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index fd57e8a..b0d3c52 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -285,6 +285,20 @@ struct nes_device {
 };
 
 
+static inline u32 get_crc_value(struct nes_v4_quad* nes_quad)
+{
+	u32 crc_value;
+	crc_value = crc32c(~0, (void *)nes_quad, sizeof (struct nes_v4_quad));
+
+	/*
+	* With commit ef19454bd437b2ba, behavior of crc32c changes on
+	* big-endian platforms.  Our algorithm expects previous behavior
+	* otherwise we have rdma connection establishment issue on ppc64.
+	*/
+	crc_value = cpu_to_le32(crc_value);
+	return crc_value;
+}
+
 static inline void
 set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value)
 {
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 6c298aa..1f042d1 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -2320,6 +2320,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	struct iw_cm_event cm_event;
 	struct nes_hw_qp_wqe *wqe;
 	struct nes_v4_quad nes_quad;
+	u32 crc_value;
 	int ret;
 
 	ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
@@ -2436,8 +2437,8 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	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, CRC = 0x%08X\n",
 			nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-21 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-21 14:29 [PATCH 2.6 6/8] RDMA/nes: Fix rdma connection establishment on big-endian platforms gstreiff
2008-02-21 13:46 ` [ofa-general] [PATCH 2.6 6/8] RDMA/nes: Fix rdma connectionestablishment " Glenn Streiff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®