Re: [PATCH v2 01/13] iWARP wire packet format definition

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

 



On Fri, Oct 06, 2017 at 08:28:41AM -0400, Bernard Metzler wrote:
> Signed-off-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx>
> ---
>  drivers/infiniband/sw/siw/iwarp.h | 381 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 381 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..379091e3e09f
> --- /dev/null
> +++ b/drivers/infiniband/sw/siw/iwarp.h
> @@ -0,0 +1,381 @@
> +/*
> + * Software iWARP device driver for Linux
> + *
> + * Authors: Bernard Metzler <bmt@xxxxxxxxxxxxxx>
> + *          Fredy Neeser <nfd@xxxxxxxxxxxxxx>
> + *
> + * Copyright (c) 2008-2017, IBM Corporation
> + *
> + * This software is available to you under a choice of one of two
> + * licenses. You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * BSD license below:
> + *
> + *   Redistribution and use in source and binary forms, with or
> + *   without modification, are permitted provided that the following
> + *   conditions are met:
> + *
> + *   - Redistributions of source code must retain the above copyright notice,
> + *     this list of conditions and the following disclaimer.
> + *
> + *   - Redistributions in binary form must reproduce the above copyright
> + *     notice, this list of conditions and the following disclaimer in the
> + *     documentation and/or other materials provided with the distribution.
> + *
> + *   - Neither the name of IBM nor the names of its contributors may be
> + *     used to endorse or promote products derived from this software without
> + *     specific prior written permission.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#ifndef _IWARP_H
> +#define _IWARP_H
> +
> +#include <rdma/rdma_user_cm.h>	/* RDMA_MAX_PRIVATE_DATA */
> +#include <linux/types.h>
> +#include <asm/byteorder.h>
> +
> +
> +#define RDMAP_VERSION		1
> +#define DDP_VERSION		1
> +#define MPA_REVISION_1		1
> +#define MPA_REVISION_2		2
> +#define MPA_MAX_PRIVDATA	RDMA_MAX_PRIVATE_DATA
> +#define MPA_KEY_REQ		"MPA ID Req Frame"
> +#define MPA_KEY_REP		"MPA ID Rep Frame"
> +#define	MPA_IRD_ORD_MASK	0x3fff
> +
> +struct mpa_rr_params {
> +	__be16	bits;
> +	__be16	pd_len;
> +};
> +
> +/*
> + * MPA request/response Hdr bits & fields
> + */
> +enum {
> +	MPA_RR_FLAG_MARKERS	= __cpu_to_be16(0x8000),
> +	MPA_RR_FLAG_CRC		= __cpu_to_be16(0x4000),
> +	MPA_RR_FLAG_REJECT	= __cpu_to_be16(0x2000),
> +	MPA_RR_FLAG_ENHANCED	= __cpu_to_be16(0x1000),
> +	MPA_RR_RESERVED		= __cpu_to_be16(0x0f00),
> +	MPA_RR_MASK_REVISION	= __cpu_to_be16(0x00ff)
> +};
> +
> +/*
> + * MPA request/reply header
> + */
> +struct mpa_rr {
> +	__u8	key[16];
> +	struct mpa_rr_params params;
> +};
> +
> +
> +static inline void __mpa_rr_set_revision(u16 *bits, u8 rev)
> +{
> +	*bits = (*bits & ~MPA_RR_MASK_REVISION)
> +		| (cpu_to_be16(rev) & MPA_RR_MASK_REVISION);
> +}
> +
> +static inline u8 __mpa_rr_revision(u16 mpa_rr_bits)
> +{
> +	u16 rev = mpa_rr_bits & MPA_RR_MASK_REVISION;
> +
> +	return (u8)be16_to_cpu(rev);

It looks wrong "rev" is u16, while be16_to_cpu expect __be16

> +}
> +
> +enum mpa_v2_ctrl {
> +	MPA_V2_PEER_TO_PEER	= __cpu_to_be16(0x8000),
> +	MPA_V2_ZERO_LENGTH_RTR	= __cpu_to_be16(0x4000),
> +	MPA_V2_RDMA_WRITE_RTR	= __cpu_to_be16(0x8000),
> +	MPA_V2_RDMA_READ_RTR	= __cpu_to_be16(0x4000),
> +	MPA_V2_RDMA_NO_RTR	= __cpu_to_be16(0x0000),
> +	MPA_V2_MASK_IRD_ORD	= __cpu_to_be16(0x3fff)
> +};
> +
> +struct mpa_v2_data {
> +	__be16		ird;
> +	__be16		ord;
> +};
> +
> +struct mpa_marker {
> +	__be16	rsvd;
> +	__be16	fpdu_hmd; /* FPDU header-marker distance (= MPA's FPDUPTR) */
> +};
> +
> +/*
> + * maximum MPA trailer
> + */
> +struct mpa_trailer {
> +	char	pad[4];

char -> u8

> +	__be32	crc;
> +};
> +

Attachment: signature.asc
Description: PGP signature


[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