Re: [PATCH rdma-core 1/8] verbs: Annoate ibv_wc helpers with endian

Jason Gunthorpe
2017-07-13T17:48:31Z

On Thu, Jul 13, 2017 at 09:50:57AM +0300, Leon Romanovsky wrote:

> The functions which use this function call are still uint32_t:
> ➜ rdma-core git:(master) ✗ grep mlx4_cq_read_wc_imm_data * -rI
> providers/mlx4/cq.c:static uint32_t mlx4_cq_read_wc_imm_data(struct ibv_cq_ex *ibcq)
> providers/mlx4/cq.c: cq->ibv_cq.read_imm_data = mlx4_cq_read_wc_imm_data;
> ➜ rdma-core git:(master) ✗ grep mlx5_cq_read_wc_imm_data * -rI
> providers/mlx5/cq.c:static inline uint32_t mlx5_cq_read_wc_imm_data(struct ibv_cq_ex *ibcq)
> providers/mlx5/cq.c: cq->ibv_cq.read_imm_data = mlx5_cq_read_wc_imm_data;

Yes, at this point in the series that is fine, they are converted with
each driver's patch. Without sparse be32 and utin32_t are identical.

> > -static inline uint32_t ibv_wc_read_imm_data(struct ibv_cq_ex *cq)
> > +static inline __be32 ibv_wc_read_imm_data(struct ibv_cq_ex *cq)
>
> Doesn't this change break user applications?

No, they are identical types.

> > +static inline uint32_t ibv_wc_read_invalidated_rkey(struct ibv_cq_ex *cq)
> > +{
> > +#ifdef __CHECKER__
> > + return (__attribute__((force)) uint32_t)cq->read_imm_data(cq);
> > +#else
> > + return cq->read_imm_data(cq);
> > +#endif
> > +}
>
> I don't think that those __CHECKER__ ifdefs should be part of the code.
> They are part of infrastructure to support development of library, but
> are not required for the user of that library.

I do not see a viable alternative.

Jason