[openib-general] Re: [PATCH 14/16] IB uverbs: add mthca user CQ support

Roland Dreier rolandd at cisco.com
Wed Jun 29 09:06:25 PDT 2005


    >> + int is_kernel;

    Andrew> I assume we have one body of code which is capable of
    Andrew> handling data structures in either kenrel memory of user
    Andrew> memory?  (guess).

    Andrew> If so, that's a fairly sensitive thing to be doing.  Tell
    Andrew> us more, please.

It's actually not that bad.  A completion queue (CQ) is a basically a
chunk of memory where completion information is written when a work
request completes.  The hardware can handle many CQs (64K is not an
unreasonable number), and we always do things like allocation of CQ
numbers, programming HW for CQ context, etc. in the kernel.

Both the kernel and userspace can do data path operations like looking
for a new CQ entry.  This means that for userspace CQs, the actual
memory where entries are written should be in userspace.  However the
struct mthca_cq will always be in the kernel.

If you look at how the is_kernel flag is used, you can see that all it
does is control whether we allocate/free the actual buffer and a few
other things in the kernel, or just use the stuff that userspace has
already allocated.

 - R.



More information about the general mailing list