Re: [PATCH v2 06/17] IB/core: Add support for extended query device caps

Yann Droneaud
2014-12-10T12:59:27Z

Hi Roland,

Le mardi 09 décembre 2014 à 13:43 -0800, Roland Dreier a écrit :
> I was getting ready to apply the ODP series, but then I noticed:
>
> On Tue, Nov 11, 2014 at 8:36 AM, Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> > diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
> > index 71ab83fde472..974025028790 100644
> > --- a/drivers/infiniband/core/uverbs_main.c
> > +++ b/drivers/infiniband/core/uverbs_main.c
> > @@ -122,7 +122,8 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file,
> > struct ib_udata *ucore,
> > struct ib_udata *uhw) = {
> > [IB_USER_VERBS_EX_CMD_CREATE_FLOW] = ib_uverbs_ex_create_flow,
> > - [IB_USER_VERBS_EX_CMD_DESTROY_FLOW] = ib_uverbs_ex_destroy_flow
> > + [IB_USER_VERBS_EX_CMD_DESTROY_FLOW] = ib_uverbs_ex_destroy_flow,
> > + [IB_USER_VERBS_EX_CMD_QUERY_DEVICE] = ib_uverbs_ex_query_device
> > };
> >
> > static void ib_uverbs_add_one(struct ib_device *device);
>
> > diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
> > index 26daf55ff76e..ed8c3d9da42c 100644
> > --- a/include/uapi/rdma/ib_user_verbs.h
> > +++ b/include/uapi/rdma/ib_user_verbs.h
> > @@ -90,8 +90,9 @@ enum {
> > };
> >
> > enum {
> > + IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
> > IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
> > - IB_USER_VERBS_EX_CMD_DESTROY_FLOW
> > + IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
> > };
>
> And this makes no sense to me. I thought the whole point of "EX"
> commands was to add then after IB_USER_VERBS_CMD_THRESHOLD.
>
> In this case, if you make IB_USER_VERBS_EX_CMD_QUERY_DEVICE =
> IB_USER_VERBS_CMD_QUERY_DEVICE then doesn't the entry in
> uverbs_cmd_table[] for normal query device get overwritten with
> ib_uverbs_ex_query_device()??
>

IB_USER_VERBS_CMD_THRESHOLD was introduced as part of commit
400dbc96583f ('IB/core: Infrastructure for extensible uverbs commands').

When I've 'upgraded' it to more extensible scheme, in commit
f21519b23c1b ('IB/core: extended command: an improved infrastructure
for uverbs commands'), I've put the extended commands in a different
namespace, with the idea we could later convert non-extended commands
to extended ones and phase out the older ABI in the future.

I seems that what I've envisioned is starting to happen.

Regards.

--
Yann Droneaud
OPTEYA