net/l2util: add eui_short/48/64_get()#12641
net/l2util: add eui_short/48/64_get()#12641benpicco wants to merge 11 commits intoRIOT-OS:masterfrom
Conversation
|
Rebased & renamed the functions to better fit with the other functions in |
API users should only call the wrapper functions.
miri64
left a comment
There was a problem hiding this comment.
I am not happy about the naming and placement of these functions. IMHO they belong more to l2util than the type definitions for euiXX.
sys/include/net/eui48.h
Outdated
| * @param[out] addr The dedicated address for the netdev | ||
| * | ||
| */ | ||
| size_t board_get_eui48(netdev_t *netdev, eui48_t *addr); |
sys/include/net/eui64.h
Outdated
| * @param[out] addr The generated short address | ||
| * | ||
| */ | ||
| static inline void eui_short_get(netdev_t *netdev, uint16_t *addr) |
There was a problem hiding this comment.
Why is this in eui64.h. Neither is the short address of IEEE 802.15.4 an EUI, nor has it anything to do with an EUI-64 (except that they are both used in IEEE 802.15.4 as addresses). This function and board_get_eui_short don't belong here. You've put the implementation for board_get_…() already in l2util (which given that l2util might not be compiled in in any case is somewhat of a bargain IMHO, but let's discuss this elsewhere), so why not put it there as l2util_generate_short_addr()?
There was a problem hiding this comment.
Then it should also be l2util_generate_euiXX() for consistency.
There was a problem hiding this comment.
Yes, i wrote the other comments before I realized, that the other functions are also misplaced.
|
I moved them back to |
|
Let's define what we expect as use cases by likelyhood. I'd say there are three scenarios:
I believe that this is also the order of likelihood. I think that this PR handles case 1. and 3. very well, but case 2. could be handled better: If only a single EUI driver is loaded, this could provide the custom EUI function as weak symbol, which returns the provided EUI on the first call and an error on all subsequent. This would require no board support (except for adding e.g. |
|
As for 2., I could implement in #12746. |
|
I think we should just drop that 'automatic' MAC chip <-> transceiver pairing idea and leave it to the board to implement If at some point we come up with a good solution we can still convert it to that, but let's start with the simple implementation first. |
miri64
left a comment
There was a problem hiding this comment.
Thanks for bringing this back to my attention. I have a question though...
sys/include/net/l2util.h
Outdated
| * | ||
| * @warning Don't call this function directly, use @ref l2util_generate_short_addr() instead. | ||
| * | ||
| * @param[in] driver The driver name of the netdev |
There was a problem hiding this comment.
Please relight my memory: What is the driver name of the netdev?
There was a problem hiding this comment.
The idea was that a EUI would be assigned to a certain device/driver.
E.g. both samr21-xpro and same54-xpro contain a EUI-64 resp. EUI-48.
On samr21-xpro that should only be used for the first device of the at86rf2xx driver…
It's not pretty but so far we haven't come up with a better solution to assign IDs to netdevs.
There was a problem hiding this comment.
It's not pretty but so far we haven't come up with a better solution to assign IDs to netdevs.
Mhhhh its not just not pretty, it can be very costly. Both the string will cost memory, and string operations aren't the most efficient either. :-/
There was a problem hiding this comment.
If the netdev allocations would be in an xfa this would be simpler :-/.
There was a problem hiding this comment.
For this we would have the migration benefit, that this could be done driver by driver.
There was a problem hiding this comment.
Why not provide a board-unique ID with
paramsbtw?
- we have to touch every board
- we waste RAM and ROM for information that is already implicitly available
There was a problem hiding this comment.
* we waste RAM and ROM for information that is already implicitly available
I thought it is not. If it is why use the (more RAM heavy) name?
* we have to touch every board
If we don't use the current approach, I believe we don't have. Also: only every board that provides a netdev params.
There was a problem hiding this comment.
I thought it is not. If it is why use the (more RAM heavy) name?
Well we just have to touch every netdev driver (to do the index -> params mapping inside the driver instead of auto_init). I just want to be sure that's the right way to go before I shave that Yak 😉
There was a problem hiding this comment.
I just want to be sure that's the right way to go before I shave that Yak wink
See #12641 (comment). As far as I understand board.c might not exist anymore in the near future :-/.
|
Apparently, there is some rework to |
…eui_short/48/64()
The board comes with an EU-64 stored inside EDBG. It is also printed on a label on the board.
|
I've converted |
|
@benpicco can you give this a rebase and status update on the WIP state of this PR? |
|
Requires #13746 for a proper solution, but I don't have time to shave that yak now. |
|
superseded by #13746 |
Contribution description
Based on the discussion in #12592 the consensus seemed that there should be an additional layer on top of luid to dispatch L2 addresses.
Maybe it could be as simple as that?
If your board provides a EUI64, with this all you have to do is implement
and then figure out a way to dispatch the address to the right
netdev.However, for the most common case where there is only one interface, you can simple ignore
netdev.Testing procedure
Nothing to test yet.
Issues/PRs references
depends on #12592
addresses #12616