-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement customized naming for wiphy #57
Conversation
I just figured out why does the value of variable |
vwifi.c
Outdated
@@ -71,6 +74,10 @@ static DEFINE_SPINLOCK(vif_list_lock); | |||
/* SME stands for "station management entity" */ | |||
enum sme_state { SME_DISCONNECTED, SME_CONNECTING, SME_CONNECTED }; | |||
|
|||
/* Each virtual interface contains a wiphy, wvifi_wiphy_counter is responsible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tweak the comment style. i.e.,
/* Each virtual interface contains a wiphy, wvifi_wiphy_counter is responsible
* for recording the number of wiphy in vwifi.
*/
Be aware of the position of the ending mark.
|
||
/* Reference: | ||
* Linux Kernel Tag : v6.7.1 | ||
* The default phy%d naming for wiphy in linux kernel depends on the value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to mention Linux kernel since this module is intended to be specific to it.
vwifi.c
Outdated
wiphy = wiphy_new_nm(&vwifi_cfg_ops, 0, NULL); | ||
|
||
/* Reference: | ||
* https://elixir.bootlin.com/linux/latest/source/net/wireless/core.c#L450 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of "latest," specify the kernel version. That is, https://elixir.bootlin.com/linux/v6.7/source/net/wireless/core.c#L447
The default phy%d naming for wiphy in linux kernel depends on the value of a static variable wiphy_counter. Since they never attempts to decrease the value of wiphy_counter even a wiphy is unregistered or freed, this behavior ensures the naming and indexing for wiphy will be absolutely unique. However, the kernel might have other projects also utilize wiphy structure, which will cause some confusion of wiphy's index and naming when using `struct wiphy`. We implement a custom-made name "vw_phy%d" for wiphy in our project, in order to seperate the naming and indexing for `struct wiphy` in our project. As for the troublesome behavior causing by the never-decreasing index of wiphy structure as decribed in sysprog21#54, we suggest to make some changes when doing manual testing by finding the wiphy index of the interface first, and use the index to query the actual wiphy's name for the interface as describe in the changes of README.md. Close sysprog21#54
Thank @vax-r for contributing! |
Summary
The default phy%d naming for wiphy in linux kernel depends on the value of a static variable
wiphy_counter
. Since they never attempts to decrease the value ofwiphy_counter
even a wiphy is unregistered or freed, this behavior ensures the naming and indexing for wiphy will be absolutely unique.However, the kernel might have other projects also utilize wiphy structure, which will cause some confusion of wiphy's index and naming when using
struct wiphy
. We implement a custom-made name "vw_phy%d" for wiphy in our project, in order to seperate the naming and indexing forstruct wiphy
in our project.As for the troublesome behavior causing by the never-decreasing index of wiphy structure as decribed in #54 , we suggest to make some changes when doing manual testing by finding the wiphy index of the interface first, and use the index to query the actual wiphy's name for the interface as describe in the changes of README.md.
Reference
Related issue
Fix #54