On Thu, Dec 28, 2023 at 07:25:18PM +0100, Stefano Brivio wrote:
On Thu, 21 Dec 2023 17:15:46 +1100 David Gibson
wrote: In general, the passt code is a bit haphazard about what's a true global variable and what's in the quasi-global 'context structure'. The flow_count field is one such example: it's in the context structure, although it's really part of the same data structure as flowtab[], which is a genuine global.
Well, the reason is that flow_tab[FLOW_MAX] might be problematically too big to live on the stack, unlike flow_count.
But anyway, as far as thoughts of multithreading are concerned, both should probably be global. And sure, it's more consistent this way.
Move flow_count to be a regular global to match. For now it needs to be public, rather than static, but we expect to be able to change that in future.
If it's not static, it should be initialised, and that's not done here.
Uh... what? "static" here is meaning module-global rather than global-global, which has no bearing on initialisation. AFAIK globals are zero-initialised whether they're static or not.
This becomes 'flow_first_free' in 13/13, but it's not initialised either, and that should also start off as zero.
-- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson