All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jinpu Wang <jinpu.wang@profitbricks.com>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: linux-block@vger.kernel.org,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Doug Ledford <dledford@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	hch <hch@lst.de>, Fabian Holler <mail@fholler.de>,
	Milind Dumbare <Milind.dumbare@gmail.com>,
	Michael Wang <yun.wang@profitbricks.com>,
	Kleber Souza <kleber.souza@profitbricks.com>,
	Danil Kipnis <danil.kipnis@profitbricks.com>,
	Roman Pen <roman.penyaev@profitbricks.com>
Subject: Re: [PATCH 01/28] ibtrs: add header shared between ibtrs_client and ibtrs_server
Date: Fri, 24 Mar 2017 13:54:04 +0100	[thread overview]
Message-ID: <CAMGffEn7Q+Tchaj4RXV1zMk0MzHqGRv=0W5Vd1G_-GvZaG8tPA@mail.gmail.com> (raw)
In-Reply-To: <20170324123546.GG3571@linux-x5ow.site>

>> +
>> +#define XX(a) case (a): return #a
>
> please no macros with retun in them and XX isn't quite too descriptive as
> well.
>
> [...]
>
>> +static inline const char *ib_wc_opcode_str(enum ib_wc_opcode opcode)
>> +{
>> +     switch (opcode) {
>> +     XX(IB_WC_SEND);
>> +     XX(IB_WC_RDMA_WRITE);
>> +     XX(IB_WC_RDMA_READ);
>> +     XX(IB_WC_COMP_SWAP);
>> +     XX(IB_WC_FETCH_ADD);
>> +     /* recv-side); inbound completion */
>> +     XX(IB_WC_RECV);
>> +     XX(IB_WC_RECV_RDMA_WITH_IMM);
>> +     default: return "IB_WC_OPCODE_UNKNOWN";
>> +     }
>> +}
>
> How about:
>
> struct {
>         char *name;
>         enum ib_wc_opcode opcode;
> } ib_wc_opcode_table[] =3D {
>         { stringyfy(IB_WC_SEND), IB_WC_SEND },
>         { stringyfy(IB_WC_RDMA_WRITE), IB_WC_RDMA_WRITE },
>         { stringyfy(IB_WC_RDMA_READ ), IB_WC_RDMA_READ }
>         { stringyfy(IB_WC_COMP_SWAP), IB_WC_COMP_SWAP },
>         { stringyfy(IB_WC_FETCH_ADD), IB_WC_FETCH_ADD },
>         { stringyfy(IB_WC_RECV), IB_WC_RECV },
>         { stringyfy(IB_WC_RECV_RDMA_WITH_IMM), IB_WC_RECV_RDMA_WITH_IMM }=
,
>         { NULL, 0 },
> };
>
> static inline const char *ib_wc_opcode_str(enum ib_wc_opcode opcode)
> {
>         int i;
>
>         for (i =3D 0; i < ARRAY_SIZE(ib_wc_opcode_table); i++)
>                 if (ib_wc_opcode_table[i].opcode =3D=3D opcode)
>                         return ib_wc_opcode_table[i].name;
>
>         return "IB_WC_OPCODE_UNKNOWN";
> }
>
Looks nice, might be better to put it into ib_verbs.h?

>
> [...]
>
>> +/**
>> + * struct ibtrs_msg_hdr - Common header of all IBTRS messages
>> + * @type:    Message type, valid values see: enum ibtrs_msg_types
>> + * @tsize:   Total size of transferred data
>> + *
>> + * Don't move the first 8 padding bytes! It's a workaround for a kernel=
 bug.
>> + * See IBNBD-610 for details
>
> What about resolving the kernel bug instead of making workarounds?
I tried to send a patch upsteam, but was rejected by Sean.
http://www.spinics.net/lists/linux-rdma/msg22381.html

>
>> + *
>> + * DO NOT CHANGE!
>> + */
>> +struct ibtrs_msg_hdr {
>> +     u8                      __padding1;
>> +     u8                      type;
>> +     u16                     __padding2;
>> +     u32                     tsize;
>> +};
>
> [...]
>
> --
> Johannes Thumshirn                                          Storage
> jthumshirn@suse.de                                +49 911 74053 689
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg
> GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton
> HRB 21284 (AG N=C3=BCrnberg)
> Key fingerprint =3D EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

Thanks Johannes for review.


--=20
Jack Wang
Linux Kernel Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Tel:       +49 30 577 008  042
Fax:      +49 30 577 008 299
Email:    jinpu.wang@profitbricks.com
URL:      https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Gesch=C3=A4ftsf=C3=BChrer: Achim Weiss

WARNING: multiple messages have this Message-ID (diff)
From: Jinpu Wang <jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
To: Johannes Thumshirn <jthumshirn-l3A5Bk7waGM@public.gmane.org>
Cc: linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	hch <hch-jcswGhMUV9g@public.gmane.org>,
	Fabian Holler <mail-99BIx50xQYGELgA04lAiVw@public.gmane.org>,
	Milind Dumbare
	<Milind.dumbare-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Michael Wang <yun.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>,
	Kleber Souza
	<kleber.souza-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>,
	Danil Kipnis
	<danil.kipnis-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>,
	Roman Pen <roman.penyaev-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
Subject: Re: [PATCH 01/28] ibtrs: add header shared between ibtrs_client and ibtrs_server
Date: Fri, 24 Mar 2017 13:54:04 +0100	[thread overview]
Message-ID: <CAMGffEn7Q+Tchaj4RXV1zMk0MzHqGRv=0W5Vd1G_-GvZaG8tPA@mail.gmail.com> (raw)
In-Reply-To: <20170324123546.GG3571-qw2SdCWA0PpjqqEj2zc+bA@public.gmane.org>

>> +
>> +#define XX(a) case (a): return #a
>
> please no macros with retun in them and XX isn't quite too descriptive as
> well.
>
> [...]
>
>> +static inline const char *ib_wc_opcode_str(enum ib_wc_opcode opcode)
>> +{
>> +     switch (opcode) {
>> +     XX(IB_WC_SEND);
>> +     XX(IB_WC_RDMA_WRITE);
>> +     XX(IB_WC_RDMA_READ);
>> +     XX(IB_WC_COMP_SWAP);
>> +     XX(IB_WC_FETCH_ADD);
>> +     /* recv-side); inbound completion */
>> +     XX(IB_WC_RECV);
>> +     XX(IB_WC_RECV_RDMA_WITH_IMM);
>> +     default: return "IB_WC_OPCODE_UNKNOWN";
>> +     }
>> +}
>
> How about:
>
> struct {
>         char *name;
>         enum ib_wc_opcode opcode;
> } ib_wc_opcode_table[] = {
>         { stringyfy(IB_WC_SEND), IB_WC_SEND },
>         { stringyfy(IB_WC_RDMA_WRITE), IB_WC_RDMA_WRITE },
>         { stringyfy(IB_WC_RDMA_READ ), IB_WC_RDMA_READ }
>         { stringyfy(IB_WC_COMP_SWAP), IB_WC_COMP_SWAP },
>         { stringyfy(IB_WC_FETCH_ADD), IB_WC_FETCH_ADD },
>         { stringyfy(IB_WC_RECV), IB_WC_RECV },
>         { stringyfy(IB_WC_RECV_RDMA_WITH_IMM), IB_WC_RECV_RDMA_WITH_IMM },
>         { NULL, 0 },
> };
>
> static inline const char *ib_wc_opcode_str(enum ib_wc_opcode opcode)
> {
>         int i;
>
>         for (i = 0; i < ARRAY_SIZE(ib_wc_opcode_table); i++)
>                 if (ib_wc_opcode_table[i].opcode == opcode)
>                         return ib_wc_opcode_table[i].name;
>
>         return "IB_WC_OPCODE_UNKNOWN";
> }
>
Looks nice, might be better to put it into ib_verbs.h?

>
> [...]
>
>> +/**
>> + * struct ibtrs_msg_hdr - Common header of all IBTRS messages
>> + * @type:    Message type, valid values see: enum ibtrs_msg_types
>> + * @tsize:   Total size of transferred data
>> + *
>> + * Don't move the first 8 padding bytes! It's a workaround for a kernel bug.
>> + * See IBNBD-610 for details
>
> What about resolving the kernel bug instead of making workarounds?
I tried to send a patch upsteam, but was rejected by Sean.
http://www.spinics.net/lists/linux-rdma/msg22381.html

>
>> + *
>> + * DO NOT CHANGE!
>> + */
>> +struct ibtrs_msg_hdr {
>> +     u8                      __padding1;
>> +     u8                      type;
>> +     u16                     __padding2;
>> +     u32                     tsize;
>> +};
>
> [...]
>
> --
> Johannes Thumshirn                                          Storage
> jthumshirn-l3A5Bk7waGM@public.gmane.org                                +49 911 74053 689
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: Felix Imendörffer, Jane Smithard, Graham Norton
> HRB 21284 (AG Nürnberg)
> Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

Thanks Johannes for review.


-- 
Jack Wang
Linux Kernel Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Tel:       +49 30 577 008  042
Fax:      +49 30 577 008 299
Email:    jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org
URL:      https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-03-24 12:54 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 10:45 [RFC PATCH 00/28] INFINIBAND NETWORK BLOCK DEVICE (IBNBD) Jack Wang
2017-03-24 10:45 ` Jack Wang
2017-03-24 10:45 ` [PATCH 01/28] ibtrs: add header shared between ibtrs_client and ibtrs_server Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 12:35   ` Johannes Thumshirn
2017-03-24 12:35     ` Johannes Thumshirn
2017-03-24 12:54     ` Jinpu Wang [this message]
2017-03-24 12:54       ` Jinpu Wang
2017-03-24 14:31       ` Johannes Thumshirn
2017-03-24 14:31         ` Johannes Thumshirn
2017-03-24 14:35         ` Jinpu Wang
2017-03-24 14:35           ` Jinpu Wang
2017-03-24 10:45 ` [PATCH 02/28] ibtrs: add header for log MICROs " Jack Wang
2017-03-24 10:45 ` [PATCH 03/28] ibtrs_lib: add common functions shared by client and server Jack Wang
2017-03-24 10:45 ` [PATCH 04/28] ibtrs_clt: add header file for exported interface Jack Wang
2017-03-24 10:45 ` [PATCH 05/28] ibtrs_clt: main functionality of ibtrs_client Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 06/28] ibtrs_clt: add header file shared only in ibtrs_client Jack Wang
2017-03-24 10:45 ` [PATCH 07/28] ibtrs_clt: add files for sysfs interface Jack Wang
2017-03-24 10:45 ` [PATCH 08/28] ibtrs_clt: add Makefile and Kconfig Jack Wang
2017-03-25  5:51   ` kbuild test robot
2017-03-25  5:51     ` kbuild test robot
2017-03-25  6:55   ` kbuild test robot
2017-03-25  6:55     ` kbuild test robot
2017-03-24 10:45 ` [PATCH 09/28] ibtrs_srv: add header file for exported interface Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 10/28] ibtrs_srv: add main functionality for ibtrs_server Jack Wang
2017-03-24 10:45 ` [PATCH 11/28] ibtrs_srv: add header shared in ibtrs_server Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 12/28] ibtrs_srv: add sysfs interface Jack Wang
2017-03-24 10:45 ` [PATCH 13/28] ibtrs_srv: add Makefile and Kconfig Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-25  7:55   ` kbuild test robot
2017-03-25  7:55     ` kbuild test robot
2017-03-25 10:54   ` kbuild test robot
2017-03-25 10:54     ` kbuild test robot
2017-03-24 10:45 ` [PATCH 14/28] ibnbd: add headers shared by ibnbd_client and ibnbd_server Jack Wang
2017-03-24 10:45 ` [PATCH 15/28] ibnbd: add shared library functions Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 16/28] ibnbd_clt: add main functionality of ibnbd_client Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 17/28] ibnbd_clt: add header shared in ibnbd_client Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 18/28] ibnbd_clt: add sysfs interface Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 19/28] ibnbd_clt: add log helpers Jack Wang
2017-03-24 10:45 ` [PATCH 20/28] ibnbd_clt: add Makefile and Kconfig Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-25  8:38   ` kbuild test robot
2017-03-25  8:38     ` kbuild test robot
2017-03-25 11:17   ` kbuild test robot
2017-03-25 11:17     ` kbuild test robot
2017-03-24 10:45 ` [PATCH 21/28] ibnbd_srv: add header shared in ibnbd_server Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 22/28] ibnbd_srv: add main functionality Jack Wang
2017-03-24 10:45 ` [PATCH 23/28] ibnbd_srv: add abstraction for submit IO to file or block device Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 24/28] ibnbd_srv: add log helpers Jack Wang
2017-03-24 10:45 ` [PATCH 25/28] ibnbd_srv: add sysfs interface Jack Wang
2017-03-24 10:45   ` Jack Wang
2017-03-24 10:45 ` [PATCH 26/28] ibnbd_srv: add Makefile and Kconfig Jack Wang
2017-03-25  9:27   ` kbuild test robot
2017-03-25  9:27     ` kbuild test robot
2017-03-24 10:45 ` [PATCH 27/28] ibnbd: add doc for how to use ibnbd and sysfs interface Jack Wang
2017-03-25  7:44   ` kbuild test robot
2017-03-25  7:44     ` kbuild test robot
2017-03-24 10:45 ` [PATCH 28/28] MAINTRAINERS: Add maintainer for IBNBD/IBTRS Jack Wang
2017-03-24 12:15 ` [RFC PATCH 00/28] INFINIBAND NETWORK BLOCK DEVICE (IBNBD) Johannes Thumshirn
2017-03-24 12:15   ` Johannes Thumshirn
2017-03-24 12:46   ` Jinpu Wang
2017-03-24 12:46     ` Jinpu Wang
2017-03-24 12:48     ` Johannes Thumshirn
2017-03-24 12:48       ` Johannes Thumshirn
2017-03-24 13:31     ` Bart Van Assche
2017-03-24 13:31       ` Bart Van Assche
2017-03-24 14:24       ` Jinpu Wang
2017-03-24 14:24         ` Jinpu Wang
2017-03-24 14:20 ` Steve Wise
2017-03-24 14:20   ` Steve Wise
2017-03-24 14:37   ` Jinpu Wang
2017-03-24 14:37     ` Jinpu Wang
2017-03-27  2:20 ` Sagi Grimberg
2017-03-27  2:20   ` Sagi Grimberg
2017-03-27 10:21   ` Jinpu Wang
2017-03-27 10:21     ` Jinpu Wang
2017-03-28 14:17     ` Roman Penyaev
2017-03-28 14:17       ` Roman Penyaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMGffEn7Q+Tchaj4RXV1zMk0MzHqGRv=0W5Vd1G_-GvZaG8tPA@mail.gmail.com' \
    --to=jinpu.wang@profitbricks.com \
    --cc=Milind.dumbare@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=danil.kipnis@profitbricks.com \
    --cc=dledford@redhat.com \
    --cc=hch@lst.de \
    --cc=jthumshirn@suse.de \
    --cc=kleber.souza@profitbricks.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mail@fholler.de \
    --cc=roman.penyaev@profitbricks.com \
    --cc=yun.wang@profitbricks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.