On Fri, Jan 14, 2022 at 09:11:08AM -0800, Paul Goyette wrote: > #ifdef ALTQ > altq-code-part-A > #endif > (common code) > #ifdef ALTQ > altq-code-part-B > #endif > ... > > The existing module_hook mechanism doesn't help us here. We can > make the two pieces of altq code into module hooks, but that > doesn't handle the case where the module gets loaded or unloaded > between the two parts of the altq code.
I guess the same thing will happen when we make more networking things loadable: each interface needs to "attach to altq", and if altq is loaded later, it needs a way to iterate all interfaces "at some convenient time" and do the necessary fixup. Same for unloading altq. That way the interface driver can set a "altq present" flag at attach time and only do the part A and part B calls if that flag is set. Martin