On Sun, Nov 22, 2015 at 06:46:49PM +0100, Christoph Hellwig wrote:
> Instead of the confusing IB spec values provide a flags argument that
> describes:
>
> a) the operation we perform the memory registration for, and
> b) if we want to access it for read or write purposes.
>
> This helps to abstract out the IB vs iWarp differences as well.
This is so much better, thanks
> +#define IB_REG_LKEY (ib_reg_scope_t)0x0000
> +#define IB_REG_RKEY (ib_reg_scope_t)0x0001
Wrap in () just for convention?
> +static inline int ib_scope_to_access(ib_reg_scope_t scope)
> +{
> + unsigned int acc = 0;
> +
> + if (scope & IB_REG_RKEY) {
> + WARN_ON(scope & IB_REG_OP_SEND);
> +
> + if (scope & IB_REG_OP_RDMA_READ)
> + acc |= IB_ACCESS_REMOTE_READ;
> + if (scope & IB_REG_OP_RDMA_WRITE)
> + acc |= IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE;
> + } else {
> + if (scope & IB_REG_OP_RDMA_READ)
> + acc |= IB_ACCESS_LOCAL_WRITE;
> + }
> +
> + return acc;
> +}
> +
> +static inline int iwarp_scope_to_access(ib_reg_scope_t scope)
> +{
Maybe
unsigned int acc = ib_scope_to_access(scope);
if ((scope & (IB_REG_RKEY | IB_REG_OP_RDMA_READ)) == (IB_REG_RKEY |
IB_REG_OP_RDMA_READ))
acc |= IB_ACCESS_LOCAL_WRITE;
return acc;
Makes it a bit clearer what the only difference is.
Is this enough to purge the cap test related to this?
Jaason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html