Re: [PATCH v2] [RFC] rdma/cm: support option to allow manually setting IB path

Jason Gunthorpe
2009-10-22T16:54:14Z

On Thu, Oct 22, 2009 at 01:10:09AM -0700, Sean Hefty wrote:

> +static int ucma_set_ib_path(struct ucma_context *ctx,
> + struct ib_path_rec_data *path_data, size_t optlen)
> +{
> + struct ib_sa_path_rec sa_path;
> + struct rdma_cm_event event;
> + int ret;
> +
> + if (optlen != sizeof(*path_data))
> + return -EINVAL;
> +
> + if (path_data->flags != IB_PATH_GMP | IB_PATH_PRIMARY |
> + IB_PATH_OUTBOUND | IB_PATH_INBOUND)
> + return -EINVAL;

This should accept an array here, to aid easing in APM support:

if ((optlen % sizeof(*path_data)) != 0) return -EINVAL;

for (; optlen != 0; optlen -= sizeof(*path_data), path_data++)
if (path_data->flags == (IB_PATH_GMP | IB_PATH_PRIMARY |
IB_PATH_OUTBOUND | IB_PATH_INBOUND))
break;

if (optlen == 0) return -EINVAL;

Could you do basic APM support right now, exactly with the same
capability as ucm has?

> +enum {
> + IB_PATH_GMP = 1,
> + IB_PATH_PRIMARY = (1<<1),
> + IB_PATH_ALTERNATE = (1<<2),
> + IB_PATH_OUTBOUND = (1<<3),
> + IB_PATH_INBOUND = (1<<4)
> +};

I like the PATH_PRIMARY/PATH_ALTERNATE idea,

But I think IB_PATH_OUTBOUND_REV is still required.

Jason