November 16, 2011

Issue with unregister & registering same netdev without doing free netdev

Forums: 

Hi Guys,
I have some requirement in driver in which do below operation but facing some bug_on from kernel
-> Depending on application input i have to unregister & register the same netdev without freeing
I am facing the bug_on from kernel during registration as below
BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);

-> If we forcefully reset the state in our driver, then this works fine but kernel warns already registered device & some thing seriously wrong here

Then i have tried to initialize the device after unregistration by calling ether_setup & then again registering BUT same bug_on appeared.

My requirement is quiet simple,
-> Whenever user application want to "delete the netdev interface" then i have to make the interface disappeared for ifconfig/iwconfig, so that user can't play with that
-> Whenever user application want to "Add the netdev interface" then i have to make the interface appearing for ifconfig/iwconfig, so that user can use those

The problem is i don't want to call Alloc_netdev/free_netdev based on application input (dynamically creating/destroying), i just want to register/unregister statically created interfaces accordingly.

If you guys have any idea on this then please reply. Thanks in advance

Thanks,
Manoj