-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Centralize net_mgmt layer code allocation #89083
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
Centralize net_mgmt layer code allocation #89083
Conversation
pdgendt
left a comment
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.
Nice!
c1d9f22 to
0bed9ac
Compare
|
include/zephyr/net/net_mgmt.h
Outdated
|
|
||
| /** @endcond */ | ||
|
|
||
| /** Central place the definition of the layer codes (7 bit 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.
Should the codes be an enum so they are grouped nicely in the docs and the whole group has this header?
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.
We can certainly experiment with enum, the current doc does not look that great atm https://builds.zephyrproject.io/zephyr/pr/89083/docs/doxygen/html/group__net__mgmt.html
I will mark this as DNM and investigate this more.
Instead of littering the source tree with hard to track layer code definitions, have a central place where to register the layer codes. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The _ is a reserved character in front of the symbols so remove it from network management event macros. The remaining string without the _ will identify the network API anyway so having underscore there is not needed. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of hard coding some random value to layer code, use the code that is registered in net_mgmt.h This way it is easier to keep track of used layer codes in the future, and we also allow out-of-tree components a way to avoid allocating same layer code to in-tree-source code. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
0bed9ac to
2e47301
Compare
|
Replaced layer code definitions by enum values to make documentation look better. |
Place
net_mgmtlayer codes in one central place inzephyr/include/net/net_mgmt.hso that we can keep track of their allocation and usage in the code. Note that I specified the layer code as 7 bit value, although currently the existing code uses 4 more bits. We can steal those bits in the future for some other purposes.This PR does not change functionality of the code in any way.