From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH rdma-next 1/5] RDMA/netlink: Remove netlink clients infrastructure
Date: Thu, 8 Jun 2017 20:51:41 +0300 [thread overview]
Message-ID: <20170608175141.GN1127@mtr-leonro.local> (raw)
In-Reply-To: <88fb8d57-cd02-78bc-3045-c09f62c280b9-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2926 bytes --]
On Thu, Jun 08, 2017 at 08:29:25AM -0700, Bart Van Assche wrote:
> On 06/08/17 07:38, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > RDMA netlink has complicated infrastructure to add and remove netlink
> > clients to NETLINK_RDMA family. This complicates the code and not in
> > use because not many clients are available (3 clients) and most of them
> > (2 clients) are statically compiled together with netlink.c.
> >
> > The following patch refactors RDMA netlink and opens door for the future
> > patches which will be able to get rid of a lot of dead iwcm* code.
>
> Hello Leon,
>
> There are multiple changes in this patch:
> - Renaming ibnl_add_client() and ibnl_remove_client() into
> rdma_nl_register() and rdma_nl_unregister().
> - Removal of the module pointers from ibnl_ls_cb_table[].
> - Conversion of client_list from a linked list into an array
> (rdma_nl_types[]).
>
> Could this patch have been split?
I tried, but once I got rid of the client (delete function), i was
required to change the function signature and while I was there, I changed
the name. So if it is possible, I would like to have one patch and not
many patches which changes the same lines of code.
>
> > +static bool is_nl_msg_valid(unsigned int type, unsigned int op)
> > {
> > - [ ... ]
> > + unsigned int max_num_ops;
> > +
> > + switch (type) {
> > + case RDMA_NL_RDMA_CM:
> > + max_num_ops = RDMA_NL_RDMA_CM_NUM_OPS;
> > + break;
> > + case RDMA_NL_IWCM:
> > + max_num_ops = RDMA_NL_IWPM_NUM_OPS;
> > + break;
> > + case RDMA_NL_LS:
> > + max_num_ops = RDMA_NL_LS_NUM_OPS;
> > + break;
> > + case RDMA_NL_RSVD:
> > + case RDMA_NL_I40IW:
> > + default:
> > + return false;
> > }
> > + return (op < max_num_ops) ? true : false;
> > +}
>
> Can this code be made more compact by storing the *_NUM_OPS constants in
> an array?
I thought that it is more easy to read, but have no strong opinion about
it.
>
> > +void rdma_nl_register(unsigned int index,
> > + const struct ibnl_client_cbs cb_table[])
> > {
> > - [ ... ]
> > - return -EINVAL;
> > + rdma_nl_types[index].cb_table = cb_table;
> > + mutex_unlock(&rdma_nl_mutex);
> > +}
> > +EXPORT_SYMBOL(rdma_nl_register);
>
> Shouldn't this function return an error code or print a warning message
> if rdma_nl_types[index].cb_table had already been set?
Agree, warning will be good there. I don't want to return value from
this function, because callers are not really interested in
success/failure once they finished to debug their code.
>
> Otherwise this patch looks like a welcome cleanup and simplification to me.
Thanks for taking time to look on these patches.
>
> Bart.
> --
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-08 17:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 14:38 [PATCH rdma-next 0/5] Refactor RDMA netlink infrastructure Leon Romanovsky
[not found] ` <20170608143852.9072-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-08 14:38 ` [PATCH rdma-next 1/5] RDMA/netlink: Remove netlink clients infrastructure Leon Romanovsky
[not found] ` <20170608143852.9072-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-08 15:29 ` Bart Van Assche
[not found] ` <88fb8d57-cd02-78bc-3045-c09f62c280b9-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-06-08 17:51 ` Leon Romanovsky [this message]
2017-06-08 14:38 ` [PATCH rdma-next 2/5] RDMA/netlink: Remove redundant owner option for netlink callbacks Leon Romanovsky
2017-06-08 14:38 ` [PATCH rdma-next 3/5] RDMA/netlink: Avoid double pass for RDMA netlink messages Leon Romanovsky
2017-06-08 14:38 ` [PATCH rdma-next 4/5] RDMA/iwcm: Remove useless check of nelink client validity Leon Romanovsky
2017-06-08 14:38 ` [PATCH rdma-next 5/5] RDMA/iwcm: Remove extra EXPORT_SYMBOLS Leon Romanovsky
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=20170608175141.GN1127@mtr-leonro.local \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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