Re: [PATCH] mac802154_hwsim: allow users to specify the number of simulated radios dynamically instead of the previously hardcoded value of 2
Alexander Aring <[email protected]> Mon, 9 Jun 2025 19:04:08 -0400
| Newsgroups | org.kernel.vger.linux-wpan,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CAK-6q+g3ns4BvZhgtzH6a6gDrEGpPmpugQki86fmbKxgHi51Aw@mail.gmail.com> |
Hi, On Mon, Jun 9, 2025 at 5:47 AM Ramon Fontes <[email protected]> wrote: > > Add a module parameter radios to allow users to configure the number > of virtual radios created by mac802154_hwsim at module load time. > This replaces the previously hardcoded value of 2. > > * Added a new module parameter radios > * Modified the loop in hwsim_probe() > * Updated log message in hwsim_probe() > > Signed-off-by: Ramon Fontes <[email protected]> > --- > drivers/net/ieee802154/mac802154_hwsim.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c > index 1cab20b5a..1740abe1a 100644 > --- a/drivers/net/ieee802154/mac802154_hwsim.c > +++ b/drivers/net/ieee802154/mac802154_hwsim.c > @@ -27,6 +27,10 @@ > MODULE_DESCRIPTION("Software simulator of IEEE 802.15.4 radio(s) for mac802154"); > MODULE_LICENSE("GPL"); > > +static unsigned int radios = 2; > +module_param(radios, int, 0444); uint? I can swear I saw that in an earlier patch. > +MODULE_PARM_DESC(radios, "Number of simulated radios"); > + > static LIST_HEAD(hwsim_phys); > static DEFINE_MUTEX(hwsim_phys_lock); > > @@ -1018,13 +1022,13 @@ static int hwsim_probe(struct platform_device *pdev) > struct hwsim_phy *phy, *tmp; > int err, i; > > - for (i = 0; i < 2; i++) { > + for (i = 0; i < radios; i++) { The iterator needs to be unsigned now? - Alex