RE: [PATCH 3/3] drivers: always enable the null net driver [RFC]

Morten Brørup
2026-01-22T13:13:12Z

> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Thursday, 22 January 2026 13.24
>
> Having the net_null driver always available can be convenient and
> allows
> use by unit tests, so add this trivial driver to the always-enable
> list.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>
> ---
> I'm not sure if we want this to be always enabled or not, so sending
> this as an RFC. I can see definite advantages to doing so, but I also
> dislike having too many components on the always-enable list.
>
> Since I'm ambivilent myself, including this patch so the community can
> decide.

I don't think real applications use this.
If they do, they can include it manually.

My main objection is:
We are setting the wrong precedence if we make stuff like this mandatory for convenience.

But I agree with the reason you are suggesting it.

Is there some other way it can be enabled for unit tests?
Maybe the null driver can depend on the unit tests being built?

I don't mind that the driver is being built.
I just don't want it included by default when statically linking a monolithic application.

I'm flexible on this RFC, so it's a very soft NAK from me.
If it can be disabled at build time, I'm OK with it. (But still concerned about setting the wrong precedence.)

> ---
> drivers/meson.build | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/meson.build b/drivers/meson.build
> index 3fe3be48fb..9ed0dba786 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -80,6 +80,8 @@ endif
> always_enable = ['bus/pci', 'bus/vdev']
> # we always need a mempool driver, and ring is default, so make it
> mandatory
> always_enable += ['mempool/ring']
> +# unit tests take advantage of net/null driver, so always enable it
> +always_enable += ['net/null']
> enable_drivers += always_enable
>
> default_cflags = machine_args
> --
> 2.51.0