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

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

 



On Tue, Feb 19, 2019 at 11:08:51AM +0100, Bernard Metzler wrote:
> +/*
> + * DDP/RDMAP Hdr bits & fields
> + */
> +enum {
> +	DDP_FLAG_TAGGED		= cpu_to_be16(0x8000),
> +	DDP_FLAG_LAST		= cpu_to_be16(0x4000),
> +	DDP_MASK_RESERVED	= cpu_to_be16(0x3C00),
> +	DDP_MASK_VERSION	= cpu_to_be16(0x0300),
> +	RDMAP_MASK_VERSION	= cpu_to_be16(0x00C0),
> +	RDMAP_MASK_RESERVED	= cpu_to_be16(0x0030),
> +	RDMAP_MASK_OPCODE	= cpu_to_be16(0x000f)
> +};
> +
> +static inline u8 __ddp_version(struct iwarp_ctrl *ctrl)
> +{
> +	return (u8)(be16_to_cpu(ctrl->ddp_rdmap_ctrl & DDP_MASK_VERSION) >> 8);
> +};

Is this driver sprase clean for endian-ness conversions?

Why write it like the above?

 (be16_to_cpu(ctrl->ddp_rdmap_ctrl) & DDP_MASK_VERSION) >> 8

?

Also no redundent casts please, the u8 does not need to be explicit
here. There are lots of them in this code

Jason



[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