Re: [RFC net-next v4 6/9] netdev-genl: Support setting per-NAPI config values

From: Jakub Kicinski
Date: Tue Oct 08 2024 - 19:20:02 EST


On Tue, 8 Oct 2024 16:00:41 -0700 Joe Damato wrote:
> > Make sure you edit the spec, not the output. Looks like there may be
> > a problem here (napi-id vs id in the attributes).
>
> I'm not sure I follow this part, sorry if I'm just missing something
> here.
>
> I was referring to NETDEV_A_NAPI_DEFER_HARD_IRQS which in RFCv4 is
> listed as NLA_S32 (in this patch):
>
> static const struct nla_policy netdev_napi_set_nl_policy[NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT + 1] = {
> [NETDEV_A_NAPI_ID] = { .type = NLA_U32, },
> [NETDEV_A_NAPI_DEFER_HARD_IRQS] = { .type = NLA_S32 },
>
> However, in the yaml spec (patch 2/9):
>
> + -
> + name: defer-hard-irqs
> + doc: The number of consecutive empty polls before IRQ deferral ends
> + and hardware IRQs are re-enabled.
> + type: u32
> + checks:
> + max: s32-max
>
> So the type is u32 but with a "checks" to match what happens now in
> sysfs.
>
> That's why I mentioned changing NLA_S32 to NLA_U32.
>
> Am I missing something?

YNL will generate the correct code for your - the right type
and the right range validation. Run the command below to see.

> Not sure what you meant by "napi-id vs id" ?

I can't apply the series now, but when it was posted the YNL code
generation failed here complaining about napi-id not existing in
the attribute set in which it is used. In the napi attribute set
the NAPI ID is called just "id", not "napi-id".

> > Make sure you run: ./tools/net/ynl/ynl-regen.sh -f
> > and the tree is clean afterwards
>
> OK, will do.