On Thu, Nov 21, 2019 at 08:12:29PM +0200, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@xxxxxxxxxxxx> > > There is no separation between RDMA-CM wire format as it is declared in > IBTA and kernel logic which implements needed support. Such situation > causes to many mistakes in conversion between big-endian (wire format) > and CPU format used by kernel. It also mixes RDMA core code with > combination of uXX and beXX variables. > > The idea that all accesses to IBA definitions will go through special > GET/SET macros to ensure that no conversion mistakes are done. > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > drivers/infiniband/core/cm_msgs.h | 6 +- > include/rdma/iba.h | 137 ++++++++++++++++++++++++++++++ > 2 files changed, 138 insertions(+), 5 deletions(-) > create mode 100644 include/rdma/iba.h > > diff --git a/drivers/infiniband/core/cm_msgs.h b/drivers/infiniband/core/cm_msgs.h > index 92d7260ac913..9bc468833831 100644 > --- a/drivers/infiniband/core/cm_msgs.h > +++ b/drivers/infiniband/core/cm_msgs.h > @@ -8,14 +8,10 @@ > #ifndef CM_MSGS_H > #define CM_MSGS_H > > +#include <rdma/iba.h> > #include <rdma/ib_mad.h> > #include <rdma/ib_cm.h> > > -/* > - * Parameters to routines below should be in network-byte order, and values > - * are returned in network-byte order. > - */ > - > #define IB_CM_CLASS_VERSION 2 /* IB specification 1.2 */ > > struct cm_req_msg { > diff --git a/include/rdma/iba.h b/include/rdma/iba.h > new file mode 100644 > index 000000000000..454dbaa452a7 > --- /dev/null > +++ b/include/rdma/iba.h > @@ -0,0 +1,137 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ > +/* > + * Copyright (c) 2019, Mellanox Technologies inc. All rights reserved. > + */ > +#ifndef _IBA_DEFS_H_ > +#define _IBA_DEFS_H_ > + > +#include <linux/kernel.h> > +#include <linux/bitfield.h> Got report from LKP, there is a need to add "#include <asm/unaligned.h>" for sparc build. Thanks