Subject: Re: [PATCH rdma-next 10/10] RDMA/nldev: Add support to get current enabled optional counters

From: Jason Gunthorpe <[email-masked]>
Date: Tue, 24 Aug 2021 10:13:28 -0300

On Tue, Aug 24, 2021 at 10:13:34AM +0800, Mark Zhang wrote:
> On 8/24/2021 3:44 AM, Jason Gunthorpe wrote:
> > On Wed, Aug 18, 2021 at 02:24:28PM +0300, Mark Zhang wrote:
> > 
> > > diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
> > > index 79e6ca87d2e0..57f39d8fe434 100644
> > > +++ b/include/uapi/rdma/rdma_netlink.h
> > > @@ -557,6 +557,8 @@ enum rdma_nldev_attr {
> > >   	RDMA_NLDEV_ATTR_STAT_OPCOUNTER_ENTRY,	/* nested table */
> > >   	RDMA_NLDEV_ATTR_STAT_OPCOUNTER_ENTRY_NAME,	/* string */
> > >   	RDMA_NLDEV_ATTR_STAT_OPCOUNTER_ENTRY_VALUE,	/* u64 */
> > > +	RDMA_NLDEV_ATTR_STAT_OP_MODE_LIST,		/* u8 */
> > > +	RDMA_NLDEV_ATTR_STAT_OP_MODE_LIST_SUPPORTED,	/* u8 */
> > 
> > See, here - shouldn't manipulation of MODE_LIST be done by a normal
> > RDMA_NLDEV_CMD_STAT_SET with the new MODE_LIST array? This doesn't seem
> > netlinky at all..
> 
> Both of them are flags and this is a "get" operation; "MODE_LIST" asks
> kernel to return currently enabled op-counters, "MODE_LIST_SUPPORTED" asks
> kernel to return supported op-counters. Maybe the macro name are not good?

The marcors are fine, the protocol is just a bit wonky. The ADD/REMOVE
idea should only be used on top level objects, but this is a nested
sub so you should be using SET to manipulate it and it should provide
the entire current list, not a add/remove type operation.

Jason