Re: [PATCH v6 01/13] iWarp wire packet format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----"Jason Gunthorpe" <jgg@xxxxxxxx> wrote: -----

>To: "Leon Romanovsky" <leon@xxxxxxxxxx>
>From: "Jason Gunthorpe" <jgg@xxxxxxxx>
>Date: 03/26/2019 01:29PM
>Cc: "Bernard Metzler" <bmt@xxxxxxxxxxxxxx>,
>linux-rdma@xxxxxxxxxxxxxxx
>Subject: Re: [PATCH v6 01/13] iWarp wire packet format
>
>On Tue, Mar 26, 2019 at 11:30:06AM +0200, Leon Romanovsky wrote:
>> On Mon, Mar 25, 2019 at 06:10:34PM +0100, Bernard Metzler wrote:
>> > Signed-off-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx>
>> >  drivers/infiniband/sw/siw/iwarp.h | 369
>++++++++++++++++++++++++++++++
>> >  1 file changed, 369 insertions(+)
>> >  create mode 100644 drivers/infiniband/sw/siw/iwarp.h
>> >
>> > diff --git a/drivers/infiniband/sw/siw/iwarp.h
>b/drivers/infiniband/sw/siw/iwarp.h
>> > new file mode 100644
>> > index 000000000000..5f12806e9109
>> > +++ b/drivers/infiniband/sw/siw/iwarp.h
>> > @@ -0,0 +1,369 @@
>> > +/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
>> > +
>> > +/* Authors: Bernard Metzler <bmt@xxxxxxxxxxxxxx> */
>> > +/* Copyright (c) 2008-2019, IBM Corporation */
>> > +
>> > +#ifndef _IWARP_H
>> > +#define _IWARP_H
>> > +
>> > +#include <rdma/rdma_user_cm.h> /* RDMA_MAX_PRIVATE_DATA */
>> > +#include <linux/types.h>
>> > +#include <asm/byteorder.h>
>> 
>> <...>
>> 
>> > +struct iwarp_terminate {
>> > +	struct iwarp_ctrl ctrl;
>> > +	__be32 rsvd;
>> > +	__be32 ddp_qn;
>> > +	__be32 ddp_msn;
>> > +	__be32 ddp_mo;
>> > +#if defined(__LITTLE_ENDIAN_BITFIELD)
>> > +	__u16 layer : 4, etype : 4, ecode : 8;
>> > +	__u16 flag_m : 1, flag_d : 1, flag_r : 1, reserved : 13;
>> > +#elif defined(__BIG_ENDIAN_BITFIELD)
>> > +	__u16 etype : 4, layer : 4, ecode : 8;
>> > +	__u16 reserved : 13, flag_r : 1, flag_d : 1, flag_m : 1;
>> > +#else
>> > +#error "undefined byte order"
>> > +#endif
>> 
>> I would expect different layout in struct above.
>> 
>> #if defined(__LITTLE_ENDIAN_BITFIELD)
>> 	__u16 layer : 4, etype : 4, ecode : 8;
>> 	__u16 flag_m : 1, flag_d : 1, flag_r : 1, reserved : 13;
>> #elif defined(__BIG_ENDIAN_BITFIELD)
>> 	__u16 ecode : 8, etype : 4, layer : 4;
>
>Really this should be written as
>
>#if defined(__LITTLE_ENDIAN_BITFIELD)
>u8 layer:4;
>u8 etype:4;
>#elif defined(__BIG_ENDIAN_BITFIELD)
>u8 etype:4;
>u8 layer:4;
>#endif
>u8 ecode;
>

Right, and to avoid confusion, I'll better make
it as simple as:

struct iwarp_terminate {
        struct iwarp_ctrl ctrl;
        __be32 rsvd;
        __be32 ddp_qn;
        __be32 ddp_msn;
        __be32 ddp_mo;
#if defined(__LITTLE_ENDIAN_BITFIELD)
        __be32 layer : 4;
        __be32 etype : 4;
        __be32 ecode : 8;
        __be32 flag_m : 1;
        __be32 flag_d : 1;
        __be32 flag_r : 1;
        __be32 reserved : 13;
#elif defined(__BIG_ENDIAN_BITFIELD)
        __be32 reserved : 13;
        __be32 flag_r : 1;
        __be32 flag_d : 1;
        __be32 flag_m : 1;
        __be32 ecode : 8;
        __be32 etype : 4;
        __be32 layer : 4;
#else
#error "undefined byte order"
#endif
};

Many thanks,
Bernard.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux