Re: [PATCH 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

Jason Gunthorpe
2022-05-19T12:49:08Z

On Thu, May 19, 2022 at 05:57:01AM +0000, Long Li wrote:

> > > +
> > > + err = ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd),
> > > +udata->inlen));
> >
> > Skeptical this min is correct, many other drivers get this wrong.
>
> I think this is correct. This is to prevent user-mode passing more data that may overrun the kernel buffer.

And what happens when udata->inlen is, say, 0?

> > > + // map to the page indexed by ucontext->doorbell
> >
> > Not kernel style, be sure to run checkpatch and fix the egregious things.
> >
> > > +static void mana_ib_disassociate_ucontext(struct ib_ucontext
> > > +*ibcontext) { }
> >
> > Does this driver actually support disassociate? Don't define this function if it
> > doesn't.
> >
> > I didn't see any mmap zapping so I guess it doesn't.
>
> The user-mode deals with zapping.
> I see the following comments on rdma_umap_priv_init():
>
> /* RDMA drivers supporting disassociation must have their user space designed
> * to cope in some way with their IO pages going to the zero page. */
>
> Is there any other additional work for the kernel driver to support
> disassociate? It seems uverbs_user_mmap_disassociate() has done all
> the zapping when destroying a ucontext.

Nope, that looks OK then

> I will open PR to rdma-core. The current version of the driver
> supports queue pair type IB_QPT_RAW_PACKET. The test case will be
> limited to querying device and load/unload. Running traffic tests
> will require DPDK (or other user-mode program making use of
> IB_QPT_RAW_PACKET).
>
> Is it acceptable to develop test cases for this driver without
> traffic/data tests?

I'm not keen on that, even EFA was able to do simple traffic.

Even with RAW_PACKET I would expect the driver to be able to send/recv
using standard verbs as RAW_PACKET is a common feature.

Jason