On Tue, Mar 3, 2020 at 10:45 AM Leon Romanovsky <leon@xxxxxxxxxx> wrote: > > On Fri, Feb 21, 2020 at 11:46:59AM +0100, Jack Wang wrote: > > From: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx> > > > > These are common private headers with rtrs protocol structures, > > logging, sysfs and other helper functions, which are used on > > both client and server sides. > > > > Signed-off-by: Danil Kipnis <danil.kipnis@xxxxxxxxxxxxxxx> > > Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx> > > --- > > drivers/infiniband/ulp/rtrs/rtrs-log.h | 28 ++ > > drivers/infiniband/ulp/rtrs/rtrs-pri.h | 401 +++++++++++++++++++++++++ > > 2 files changed, 429 insertions(+) > > create mode 100644 drivers/infiniband/ulp/rtrs/rtrs-log.h > > create mode 100644 drivers/infiniband/ulp/rtrs/rtrs-pri.h > > > > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-log.h b/drivers/infiniband/ulp/rtrs/rtrs-log.h > > new file mode 100644 > > index 000000000000..53c785b992f2 > > --- /dev/null > > +++ b/drivers/infiniband/ulp/rtrs/rtrs-log.h > > @@ -0,0 +1,28 @@ > > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > > +/* > > + * RDMA Transport Layer > > + * > > + * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved. > > + * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved. > > + * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved. > > + */ > > +#ifndef RTRS_LOG_H > > +#define RTRS_LOG_H > > + > > +#define rtrs_log(fn, obj, fmt, ...) \ > > + fn("<%s>: " fmt, obj->sessname, ##__VA_ARGS__) > > + > > +#define rtrs_err(obj, fmt, ...) \ > > + rtrs_log(pr_err, obj, fmt, ##__VA_ARGS__) > > +#define rtrs_err_rl(obj, fmt, ...) \ > > + rtrs_log(pr_err_ratelimited, obj, fmt, ##__VA_ARGS__) > > +#define rtrs_wrn(obj, fmt, ...) \ > > + rtrs_log(pr_warn, obj, fmt, ##__VA_ARGS__) > > +#define rtrs_wrn_rl(obj, fmt, ...) \ > > + rtrs_log(pr_warn_ratelimited, obj, fmt, ##__VA_ARGS__) > > +#define rtrs_info(obj, fmt, ...) \ > > + rtrs_log(pr_info, obj, fmt, ##__VA_ARGS__) > > +#define rtrs_info_rl(obj, fmt, ...) \ > > + rtrs_log(pr_info_ratelimited, obj, fmt, ##__VA_ARGS__) > > + > > +#endif /* RTRS_LOG_H */ > > diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h > > new file mode 100644 > > index 000000000000..aecf01a7d8dc > > --- /dev/null > > +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h > > @@ -0,0 +1,401 @@ > > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > > +/* > > + * RDMA Transport Layer > > + * > > + * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved. > > + * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved. > > + * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved. > > + */ > > + > > +#ifndef RTRS_PRI_H > > +#define RTRS_PRI_H > > + > > +#include <linux/uuid.h> > > +#include <rdma/rdma_cm.h> > > +#include <rdma/ib_verbs.h> > > +#include <rdma/ib.h> > > + > > +#include "rtrs.h" > > + > > +#define RTRS_PROTO_VER_MAJOR 2 > > +#define RTRS_PROTO_VER_MINOR 0 > > I think that Jason once said that new submission starts from "1". > There is no RTRS_PROTO_VER_MAJOR == 1 in the wild. sorry, v2 protocol is already in our production, we can simple change back to v1 > > +#define STAT_ATTR(type, stat, print, reset) \ > > +STAT_STORE_FUNC(type, stat, reset) \ > > +STAT_SHOW_FUNC(type, stat, print) \ > > +static struct kobj_attribute stat##_attr = __ATTR_RW(stat) > > It is very strange that you needed to implement _store()/_show() primitives. > Why is that? We define the MICRO to save some line of code when implementing the stats like rdma/reconects/etc, sess rtrs-clt-sysfs.c/srts-srv-sysfs.c Thanks!