public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ibsim: fix size of slid/dlid fields in sim_request structure
@ 2011-08-05 23:29 Rolf Manderscheid
       [not found] ` <E1QpTpl-00026F-D6-nLM+XIojDeH72zTlGHhC+rDks+cytr/Z@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Rolf Manderscheid @ 2011-08-05 23:29 UTC (permalink / raw)
  To: alexne-VPRAkNaXOzVWk0Htik3J/w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


The code treats them as 16-bit fields (by using htons), make
the structure match.  This also avoids the 32 bits of padding
before the length field.

Signed-off-by: Rolf Manderscheid <rvm-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 include/ibsim.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/ibsim.h b/include/ibsim.h
index 15fc37c..b6b08bd 100644
--- a/include/ibsim.h
+++ b/include/ibsim.h
@@ -62,8 +62,8 @@ struct sim_port {
 #define SIM_CTL_MAX_DATA	64
 
 struct sim_request {
-	uint32_t dlid;
-	uint32_t slid;
+	uint16_t dlid;
+	uint16_t slid;
 	uint32_t dqp;
 	uint32_t sqp;
 	uint32_t status;
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ibsim: fix size of slid/dlid fields in sim_request structure
       [not found] ` <E1QpTpl-00026F-D6-nLM+XIojDeH72zTlGHhC+rDks+cytr/Z@public.gmane.org>
@ 2011-08-09 15:07   ` Alex Netes
       [not found]     ` <20110809150723.GC2056-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Netes @ 2011-08-09 15:07 UTC (permalink / raw)
  To: Rolf Manderscheid; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Rolf,

On 17:29 Fri 05 Aug     , Rolf Manderscheid wrote:
> 
> The code treats them as 16-bit fields (by using htons), make
> the structure match.  This also avoids the 32 bits of padding
> before the length field.
> 

There are more places where lids defined as integer. Why did you choose to
change only these two?

> Signed-off-by: Rolf Manderscheid <rvm-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ---
>  include/ibsim.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/ibsim.h b/include/ibsim.h
> index 15fc37c..b6b08bd 100644
> --- a/include/ibsim.h
> +++ b/include/ibsim.h
> @@ -62,8 +62,8 @@ struct sim_port {
>  #define SIM_CTL_MAX_DATA	64
>  
>  struct sim_request {
> -	uint32_t dlid;
> -	uint32_t slid;
> +	uint16_t dlid;
> +	uint16_t slid;
>  	uint32_t dqp;
>  	uint32_t sqp;
>  	uint32_t status;
> -- 
> 1.7.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ibsim: fix size of slid/dlid fields in sim_request structure
       [not found]     ` <20110809150723.GC2056-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
@ 2011-08-10 17:18       ` Rolf Manderscheid
       [not found]         ` <4E42BD69.6070608-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Rolf Manderscheid @ 2011-08-10 17:18 UTC (permalink / raw)
  To: Alex Netes; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Alex,
> There are more places where lids defined as integer. Why did you choose to
> change only these two?

This structure defines what request packets look like on the wire to the 
simulator.
The motivation for the change is a simulator client for python-rdma, and 
this issue
shows up when creating the structure format strings for the request packets.

     Rolf


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ibsim: fix size of slid/dlid fields in sim_request structure
       [not found]         ` <4E42BD69.6070608-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2011-08-10 19:37           ` Jason Gunthorpe
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2011-08-10 19:37 UTC (permalink / raw)
  To: Rolf Manderscheid; +Cc: Alex Netes, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 10, 2011 at 11:18:33AM -0600, Rolf Manderscheid wrote:
> Hi Alex,
> >There are more places where lids defined as integer. Why did you choose to
> >change only these two?
> 
> This structure defines what request packets look like on the wire to
> the simulator.  The motivation for the change is a simulator client
> for python-rdma, and this issue shows up when creating the structure
> format strings for the request packets.

Also that

uint32_t x = htons(y)

Simply doesn't work when you mix big and little endian. So, the
choices are: switch the type to uint16, or switch to htonl. This is the
reason only this struct was changed - because it is the only place
where htons is being applied incorrectly, while finding all the wrong
htons is a bit harder.

python cares because it cannot easily construct something so malformed :)

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-08-10 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 23:29 [PATCH] ibsim: fix size of slid/dlid fields in sim_request structure Rolf Manderscheid
     [not found] ` <E1QpTpl-00026F-D6-nLM+XIojDeH72zTlGHhC+rDks+cytr/Z@public.gmane.org>
2011-08-09 15:07   ` Alex Netes
     [not found]     ` <20110809150723.GC2056-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
2011-08-10 17:18       ` Rolf Manderscheid
     [not found]         ` <4E42BD69.6070608-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-08-10 19:37           ` Jason Gunthorpe

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