Message ID | 1450967967-12479-4-git-send-email-hch@lst.de (mailing list archive) |
---|---|
State | Deferred |
Headers | show |
On Thu, Dec 24, 2015 at 03:39:24PM +0100, Christoph Hellwig wrote: > This exposes the WC opcodes supported by uverbs as part of the uapi > headers. It follows the same scheme as the WR opcodes. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > include/rdma/ib_verbs.h | 29 +++++++++++++---------------- > include/uapi/rdma/ib_verbs.h | 16 ++++++++++++++++ > 2 files changed, 29 insertions(+), 16 deletions(-) > > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h > index 5dccc6a..7dce204 100644 > --- a/include/rdma/ib_verbs.h > +++ b/include/rdma/ib_verbs.h > @@ -819,22 +819,19 @@ enum ib_wc_status { > const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status); > > enum ib_wc_opcode { > - IB_WC_SEND, > - IB_WC_RDMA_WRITE, > - IB_WC_RDMA_READ, > - IB_WC_COMP_SWAP, > - IB_WC_FETCH_ADD, > - IB_WC_LSO, > - IB_WC_LOCAL_INV, > - IB_WC_REG_MR, > - IB_WC_MASKED_COMP_SWAP, > - IB_WC_MASKED_FETCH_ADD, > -/* > - * Set value of IB_WC_RECV so consumers can test if a completion is a > - * receive by testing (opcode & IB_WC_RECV). > - */ > - IB_WC_RECV = 1 << 7, > - IB_WC_RECV_RDMA_WITH_IMM > + IB_WC_SEND = IB_UVERBS_WC_SEND, > + IB_WC_RDMA_WRITE = IB_UVERBS_WC_RDMA_WRITE, > + IB_WC_RDMA_READ = IB_UVERBS_WC_RDMA_READ, > + IB_WC_COMP_SWAP = IB_UVERBS_WC_COMP_SWAP, > + IB_WC_FETCH_ADD = IB_UVERBS_WC_FETCH_ADD, > + IB_WC_LSO = IB_UVERBS_WC_SEND_END, > + IB_WC_LOCAL_INV = IB_UVERBS_WC_SEND_END + 1, > + IB_WC_REG_MR = IB_UVERBS_WC_SEND_END + 2, > + IB_WC_MASKED_COMP_SWAP = IB_UVERBS_WC_SEND_END + 3, > + IB_WC_MASKED_FETCH_ADD = IB_UVERBS_WC_SEND_END + 4, As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself. > + > + IB_WC_RECV = IB_UVERBS_WC_RECV, > + IB_WC_RECV_RDMA_WITH_IMM = IB_UVERBS_WC_RECV_END, > }; > > enum ib_wc_flags { > diff --git a/include/uapi/rdma/ib_verbs.h b/include/uapi/rdma/ib_verbs.h > index 3be3152..fd7a393 100644 > --- a/include/uapi/rdma/ib_verbs.h > +++ b/include/uapi/rdma/ib_verbs.h > @@ -29,4 +29,20 @@ enum ib_uverbs_send_flags { > IB_UVERBS_SEND_END = (1 << 5), > }; > > +enum ib_uverbs_wc_opcode { > + IB_UVERBS_WC_SEND = 0, > + IB_UVERBS_WC_RDMA_WRITE = 1, > + IB_UVERBS_WC_RDMA_READ = 2, > + IB_UVERBS_WC_COMP_SWAP = 3, > + IB_UVERBS_WC_FETCH_ADD = 4, > + IB_UVERBS_WC_SEND_END = 5, > + > + /* > + * Set value of IB_WC_RECV so consumers can test if a completion is a > + * receive by testing (opcode & IB_WC_RECV). > + */ > + IB_UVERBS_WC_RECV = 1 << 7, > + IB_UVERBS_WC_RECV_END = (1 << 7) + 1, > +}; > + > #endif /* _UAPI_RDMA_IB_VERBS_H */ > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
>> + IB_WC_SEND = IB_UVERBS_WC_SEND, >> + IB_WC_RDMA_WRITE = IB_UVERBS_WC_RDMA_WRITE, >> + IB_WC_RDMA_READ = IB_UVERBS_WC_RDMA_READ, >> + IB_WC_COMP_SWAP = IB_UVERBS_WC_COMP_SWAP, >> + IB_WC_FETCH_ADD = IB_UVERBS_WC_FETCH_ADD, >> + IB_WC_LSO = IB_UVERBS_WC_SEND_END, >> + IB_WC_LOCAL_INV = IB_UVERBS_WC_SEND_END + 1, >> + IB_WC_REG_MR = IB_UVERBS_WC_SEND_END + 2, >> + IB_WC_MASKED_COMP_SWAP = IB_UVERBS_WC_SEND_END + 3, >> + IB_WC_MASKED_FETCH_ADD = IB_UVERBS_WC_SEND_END + 4, > As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. > Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself. I disagree, I'd say its better to keep the code verbosity level here... -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Dec 29, 2015 at 01:02:54PM +0200, Sagi Grimberg wrote: >> As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. >> Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself. > > I disagree, I'd say its better to keep the code verbosity level here... I really don't like enum auto assignment for constants that are fixe as part of an ABI. There is too much chance of things going wrong. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Dec 30, 2015 at 10:44:29AM +0100, Christoph Hellwig wrote: > On Tue, Dec 29, 2015 at 01:02:54PM +0200, Sagi Grimberg wrote: > >> As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. > >> Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself. > > > > I disagree, I'd say its better to keep the code verbosity level here... > > I really don't like enum auto assignment for constants that are fixe > as part of an ABI. There is too much chance of things going wrong. It is up to you, just be constant in your enums assignments. Thanks. > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 5dccc6a..7dce204 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -819,22 +819,19 @@ enum ib_wc_status { const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status); enum ib_wc_opcode { - IB_WC_SEND, - IB_WC_RDMA_WRITE, - IB_WC_RDMA_READ, - IB_WC_COMP_SWAP, - IB_WC_FETCH_ADD, - IB_WC_LSO, - IB_WC_LOCAL_INV, - IB_WC_REG_MR, - IB_WC_MASKED_COMP_SWAP, - IB_WC_MASKED_FETCH_ADD, -/* - * Set value of IB_WC_RECV so consumers can test if a completion is a - * receive by testing (opcode & IB_WC_RECV). - */ - IB_WC_RECV = 1 << 7, - IB_WC_RECV_RDMA_WITH_IMM + IB_WC_SEND = IB_UVERBS_WC_SEND, + IB_WC_RDMA_WRITE = IB_UVERBS_WC_RDMA_WRITE, + IB_WC_RDMA_READ = IB_UVERBS_WC_RDMA_READ, + IB_WC_COMP_SWAP = IB_UVERBS_WC_COMP_SWAP, + IB_WC_FETCH_ADD = IB_UVERBS_WC_FETCH_ADD, + IB_WC_LSO = IB_UVERBS_WC_SEND_END, + IB_WC_LOCAL_INV = IB_UVERBS_WC_SEND_END + 1, + IB_WC_REG_MR = IB_UVERBS_WC_SEND_END + 2, + IB_WC_MASKED_COMP_SWAP = IB_UVERBS_WC_SEND_END + 3, + IB_WC_MASKED_FETCH_ADD = IB_UVERBS_WC_SEND_END + 4, + + IB_WC_RECV = IB_UVERBS_WC_RECV, + IB_WC_RECV_RDMA_WITH_IMM = IB_UVERBS_WC_RECV_END, }; enum ib_wc_flags { diff --git a/include/uapi/rdma/ib_verbs.h b/include/uapi/rdma/ib_verbs.h index 3be3152..fd7a393 100644 --- a/include/uapi/rdma/ib_verbs.h +++ b/include/uapi/rdma/ib_verbs.h @@ -29,4 +29,20 @@ enum ib_uverbs_send_flags { IB_UVERBS_SEND_END = (1 << 5), }; +enum ib_uverbs_wc_opcode { + IB_UVERBS_WC_SEND = 0, + IB_UVERBS_WC_RDMA_WRITE = 1, + IB_UVERBS_WC_RDMA_READ = 2, + IB_UVERBS_WC_COMP_SWAP = 3, + IB_UVERBS_WC_FETCH_ADD = 4, + IB_UVERBS_WC_SEND_END = 5, + + /* + * Set value of IB_WC_RECV so consumers can test if a completion is a + * receive by testing (opcode & IB_WC_RECV). + */ + IB_UVERBS_WC_RECV = 1 << 7, + IB_UVERBS_WC_RECV_END = (1 << 7) + 1, +}; + #endif /* _UAPI_RDMA_IB_VERBS_H */
This exposes the WC opcodes supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/rdma/ib_verbs.h | 29 +++++++++++++---------------- include/uapi/rdma/ib_verbs.h | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 16 deletions(-)