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

From: Jason Gunthorpe
Date: Thu Oct 07 2021 - 09:07:55 EST


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