Subject: Re: [PATCH rdma-next v3 09/13] RDMA/nldev: Allow optional-counter status configuration through RDMA netlink

From: Jason Gunthorpe <[email-masked]>
Date: Thu, 7 Oct 2021 10:07:48 -0300

On Wed, Oct 06, 2021 at 12:52:12PM +0300, Leon Romanovsky wrote:

> @@ -1986,11 +2030,13 @@ static int nldev_stat_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
>  		goto end;
>  	}
>  
> -	if (!tb[RDMA_NLDEV_ATTR_STAT_MODE]) {
> +	if (tb[RDMA_NLDEV_ATTR_STAT_MODE])
> +		ret = nldev_stat_set_mode_doit(skb, nlh, extack, tb, device,
> +					       port);
> +	else if (tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC])
> +		ret = nldev_stat_set_counter_dynamic_doit(tb, device, port);
> +	else
>  		ret = -EINVAL;
> -		goto end;
> -	}

I missed this before.. Why is this exclusive?

If userspace sends both inputs then both should be set.

And shouldn't this reject NL attributes it doesn't support - eg
shouldn't this have a stat_set policy to check that?

Jason