Re: [PATCH net-next v2 3/8] ynl: support directional specs in ynl-gen-c.py

From: Jakub Kicinski
Date: Fri Nov 15 2024 - 17:10:36 EST


On Fri, 15 Nov 2024 11:36:41 -0800 Stanislav Fomichev wrote:
> The intent is to generate ethtool uapi headers. For now, some of the
> things are hard-coded:
> - <FAMILY>_MSG_{USER,KERNEL}_MAX
> - the split between USER and KERNEL messages

Maybe toss in a TODO: comment or some such on top of
render_uapi_directional(), to make it clear that the code needs
more love before it can be reasonably reused.

nit: possibly split into two commits for ease of review

> + if family.msg_id_model == 'unified':
> + render_uapi_unified(family, cw, max_by_define, separate_ntf)
> + elif family.msg_id_model == 'directional':
> + render_uapi_directional(family, cw, max_by_define)
> + else:
> + raise Exception(f'Unsupported enum-model {family.msg_id_model}')

You gotta say "Message enum-model", enum-mode alone sounds like we're
doing something with how enums are processed, rather than message IDs.