public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Matan Barak <matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: "Hefty,
	Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Liran Liss <liranl-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Tal Alon <talal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
	"Weiny, Ira" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH for-next 03/13] IB/core: Add new ioctl interface
Date: Thu, 15 Jun 2017 10:57:51 -0600	[thread overview]
Message-ID: <20170615165751.GB23773@obsidianresearch.com> (raw)
In-Reply-To: <CAAKD3BA+Bpwbx+pZivK_+jRLc9kCrvhQkPy4tKcaTqUZhfRiOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Jun 15, 2017 at 02:50:17PM +0300, Matan Barak wrote:

> Following object oriented approach, I can think of the following
> trivial changes:
> type->class
> action->method (actually, these are static methods, but nm)

I don't think they are static methods.. anything that takes an object
id or a fd num is a normal method acting on that object, anything that
returns an object id/fd num is a constructor, anything that destroys
an object id is a destructor.

> The "groups" concept is a bit harder to grasp in OO. In our case, an
> entity is actually divided into a few "groups" and its actual
> content

This is similar to standard OO concept of mixins/multiple inheritance,
but you are applying the idea to function parameter lists, not classes.

> In contrast of the OO multiple inheritance case, we have a specific
> meaning to the order of these groups - the handler actually uses
> them.

That distinction seems conceptually unnecessary.. The access of the
arguments should not depend on where the argument is defined, only on
the argument ID, which is back to what I said before, why do we need
to even have a word for namepace?

static inline void *uverbs_get_attr(const uvbers_attr_bundle *args, uint32_t attr_id)
{
    if (((attr_id & UVERBS_ID_NS_MASK) >> UVERBS_ID_NS_SHIFT) == 0)
        return args.common_attrs[attr_id & XX];
    if (((attr_id & UVERBS_ID_NS_MASK) >> UVERBS_ID_NS_SHIFT) == 1)
        return args.driver_attrs[attr_id & YY];
    return NULL;
}

void some_method(const uvbers_attr_bundle *args)
{
    uverbs_get_attr(args, ATTR_ID_COMMON_A);
    uverbs_get_attr(args, ATTR_ID_MLX5_B);
}

> struct uverbs_attr_spec {
>     enum uverbs_attr_type        type;
>     <...>
> };
> 
> struct uverbs_attr_spec_ns {
>     struct uverbs_attr_spec        *attrs;
>     <...>
> };

I don't think we need _ns versions of any of these at all. Stop
treating ns as special, there is only attribute IDs, and the only time
the specialness of the ID layout comes into play is when you hash the
ID for quick lookup, or 'hash' the ID for attribute storage (eg
uverbs_get_attr)

*NOTHING* else should care if an ID is within the driver, common or
other reserved space.

> >> I used the term "group" to emphasize that these aren't just a random
> >> collection of params in a lit.
> >> Grouping this entities together has a specific meaning.
> >
> > But *what* is that meaning?  That's what I'd like the name to
> > convey.  I thought the grouping was because the attributes were a
> > set of parameters being passed into a single
> > function/operation/action/method.
> 
> Entities were grouped together because they belong to the same
> namespace. If we take the attributes for an example, once we execute
> the method's handler, we get one group of attributes for the common
> namespace and another one for the driver namespace. By using
> namespaces, we could introduce new arguments for either common and
> driver specific without stepping on other attributes in different
> namespaces.  When reaching the handler, each argument has a unique
> meaning. Please see the uverbs_attr_array example above.

Again, don't see why we should care. All of this micro-optimizing
should be hidden from the method author.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-06-15 16:57 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 12:22 [PATCH for-next 00/13] IB/core: SG IOCTL based RDMA ABI Matan Barak
     [not found] ` <1496838172-39671-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-06-07 12:22   ` [PATCH for-next 01/13] IB/core: Add a generic way to execute an operation on a uobject Matan Barak
2017-06-07 12:22   ` [PATCH for-next 02/13] IB/core: Add support to finalize objects in one transaction Matan Barak
     [not found]     ` <1496838172-39671-3-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-06-08 23:51       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AB141A91-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-11  8:16           ` Matan Barak
     [not found]             ` <CAAKD3BCpRwiCejxuKiP07q-jGoRF1W8Ovs5aMt07uO2gAc1Qug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-21 15:33               ` Dennis Dalessandro
     [not found]                 ` <37c8c95b-eec5-af5c-8d72-eea429d84818-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-06-29 16:41                   ` Matan Barak
2017-06-07 12:22   ` [PATCH for-next 03/13] IB/core: Add new ioctl interface Matan Barak
     [not found]     ` <1496838172-39671-4-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-06-13 22:48       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AB143340-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-14  8:39           ` Matan Barak
     [not found]             ` <CAAKD3BArF5U49WQ2PcYjpSbPpQmyubJQ6vKKUer_L05QBQpT0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-14 17:25               ` Hefty, Sean
     [not found]                 ` <1828884A29C6694DAF28B7E6B8A82373AB1436F6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-14 17:39                   ` Jason Gunthorpe
     [not found]                     ` <20170614173940.GA15278-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-14 17:46                       ` Hefty, Sean
2017-06-15 11:51                       ` Matan Barak
2017-06-15 11:50                   ` Matan Barak
     [not found]                     ` <CAAKD3BA+Bpwbx+pZivK_+jRLc9kCrvhQkPy4tKcaTqUZhfRiOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-15 16:57                       ` Jason Gunthorpe [this message]
     [not found]                         ` <20170615165751.GB23773-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-20 12:03                           ` Matan Barak
2017-06-20 15:38                             ` Jason Gunthorpe
     [not found]                               ` <20170620153855.GA29283-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-29 16:38                                 ` Matan Barak
2017-06-07 12:22   ` [PATCH for-next 04/13] IB/core: Declare a type instead of declaring only type attributes Matan Barak
2017-06-07 12:22   ` [PATCH for-next 05/13] IB/core: Add DEVICE type and root types structure Matan Barak
2017-06-07 12:22   ` [PATCH for-next 06/13] IB/core: Initialize uverbs types specification Matan Barak
2017-06-07 12:22   ` [PATCH for-next 07/13] IB/core: Add macros for declaring actions and attributes Matan Barak
2017-06-07 12:22   ` [PATCH for-next 08/13] IB/core: Explicitly destroy an object while keeping uobject Matan Barak
2017-06-07 12:22   ` [PATCH for-next 09/13] IB/core: Export ioctl enum types to user-space Matan Barak
2017-06-07 12:22   ` [PATCH for-next 10/13] IB/core: Add legacy driver's user-data Matan Barak
2017-06-07 12:22   ` [PATCH for-next 11/13] IB/core: Add completion queue (cq) object actions Matan Barak
2017-06-07 12:22   ` [PATCH for-next 12/13] IB/core: Assign root to all drivers Matan Barak
2017-06-07 12:22   ` [PATCH for-next 13/13] IB/core: Expose ioctl interface through experimental Kconfig Matan Barak
2017-06-07 15:53   ` [PATCH for-next 00/13] IB/core: SG IOCTL based RDMA ABI Jason Gunthorpe
     [not found]     ` <20170607155323.GB30124-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-08 14:09       ` Matan Barak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170615165751.GB23773@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=liranl-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=talal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox