Re: [PATCH rdma-next V3 1/5] RDMA/netlink: Remove netlink clients infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 17, 2017 at 10:02:07AM -0400, Dennis Dalessandro wrote:
> On 6/27/2017 1:00 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >
> > 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.
>
> So here you say there are three clients.
>
> > -	struct ibnl_client *cur;
> > -	struct ibnl_client *nl_client;
> > +	static const unsigned int max_num_ops[RDMA_NL_NUM_CLIENTS - 1] = {
> > +				  RDMA_NL_RDMA_CM_NUM_OPS,
> > +				  RDMA_NL_IWPM_NUM_OPS,
> > +				  0,
> > +				  RDMA_NL_LS_NUM_OPS,
> > +				  0 };
> >
> > -	nl_client = kmalloc(sizeof *nl_client, GFP_KERNEL);
> > -	if (!nl_client)
> > -		return -ENOMEM;
> > +	/*
> > +	 * This BUILD_BUG_ON is intended to catch addition of new
> > +	 * RDMA netlink protocol without updating the array above.
> > +	 */
> > +	BUILD_BUG_ON(RDMA_NL_NUM_CLIENTS != 6);
>
> Yet we are checking for 6? Can you elaborate here.

This check is needed to ensure that the array is properly initialized.

The clients were exposed in include/uapi/rdma/rdma_netlink.h, in the
following enum:

  6 enum {
  7         RDMA_NL_RDMA_CM = 1,
  8         RDMA_NL_IWCM,
  9         RDMA_NL_RSVD,
 10         RDMA_NL_LS,     /* RDMA Local Services */
 11         RDMA_NL_I40IW,
 12         RDMA_NL_NUM_CLIENTS
 13 };

First of all it starts from 1, second we have RDMA_NL_RSVD and
RDMA_NL_NUM_CLIENTS which exposed, but are not real clients, because
nothing is handled them

It leads for RDMA_NL_NUM_CLIENTS == 6 and this is why I'm checking for 6.

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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux