diff mbox

IB/hfi1: fix pstateinfo from returning improperly byteswapped value

Message ID 1441776501-5881-1-git-send-email-ira.weiny@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Ira Weiny Sept. 9, 2015, 5:28 a.m. UTC
From: Ira Weiny <ira.weiny@intel.com>

Byteswap link_width_downgrade_*_active values before sending on the wire.  In
addition properly define the Port State Info structure.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Christian Gomez <christian.gomez@intel.com>
Signed-off-by: Rimmer, Todd <todd.rimmer@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 drivers/staging/rdma/hfi1/mad.c | 4 ++--
 include/rdma/opa_port_info.h    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Marciniszyn, Mike Sept. 9, 2015, 2:38 p.m. UTC | #1
> Subject: [PATCH] IB/hfi1: fix pstateinfo from returning improperly
> byteswapped value
> 
> From: Ira Weiny <ira.weiny@intel.com>
> 
> Byteswap link_width_downgrade_*_active values before sending on the
> wire.  In addition properly define the Port State Info structure.
> 
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Reviewed-by: Christian Gomez <christian.gomez@intel.com>
> Signed-off-by: Rimmer, Todd <todd.rimmer@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> ---

Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Sept. 18, 2015, 3:41 p.m. UTC | #2
On 09/09/2015 01:28 AM, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> Byteswap link_width_downgrade_*_active values before sending on the wire.  In
> addition properly define the Port State Info structure.
> 
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Reviewed-by: Christian Gomez <christian.gomez@intel.com>
> Signed-off-by: Rimmer, Todd <todd.rimmer@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c
index 37269eb90c34..b2c1b72d38ce 100644
--- a/drivers/staging/rdma/hfi1/mad.c
+++ b/drivers/staging/rdma/hfi1/mad.c
@@ -1717,9 +1717,9 @@  static int __subn_get_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
 	psi->port_states.portphysstate_portstate =
 		(hfi1_ibphys_portstate(ppd) << 4) | (lstate & 0xf);
 	psi->link_width_downgrade_tx_active =
-	  ppd->link_width_downgrade_tx_active;
+		cpu_to_be16(ppd->link_width_downgrade_tx_active);
 	psi->link_width_downgrade_rx_active =
-	  ppd->link_width_downgrade_rx_active;
+		cpu_to_be16(ppd->link_width_downgrade_rx_active);
 	if (resp_len)
 		*resp_len += sizeof(struct opa_port_state_info);
 
diff --git a/include/rdma/opa_port_info.h b/include/rdma/opa_port_info.h
index 391dae1931c0..a0fa975cd1c1 100644
--- a/include/rdma/opa_port_info.h
+++ b/include/rdma/opa_port_info.h
@@ -294,8 +294,8 @@  struct opa_port_states {
 
 struct opa_port_state_info {
 	struct opa_port_states port_states;
-	u16 link_width_downgrade_tx_active;
-	u16 link_width_downgrade_rx_active;
+	__be16 link_width_downgrade_tx_active;
+	__be16 link_width_downgrade_rx_active;
 };
 
 struct opa_port_info {