-
Notifications
You must be signed in to change notification settings - Fork 2k
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
net/gnrc_netif: opt of _ipv6_get_iid() #10455
Conversation
The idea behind |
I mean, why do device drivers need to implement an IPv6-interface-specific function? |
hm, I do disagree! Of course one can argue if it belongs into the link layer code / device driver or better somewhere higher as in netif. But I see some good reasons to leave it in the netdev implementations:
|
Academically speaking this might be true, but in practical software design, especially looking at our architecture, it makes much sense to put it somewhere inside the netdev implementations. |
I've thought about it and I think you are right in the long term :-/. |
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.
ACK. Tested if auto address configuration for samr21-xpro
and native
still works.
@@ -887,7 +895,8 @@ int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64) | |||
break; | |||
} | |||
} | |||
#endif | |||
#endif /* GNRC_NETIF_L2ADDR_MAXLEN > 0 */ | |||
|
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.
Unrelated change, but ok.
Note: I think I'm going to revert this change after all, once #10524 is merged for two reasons:
|
Contribution description
While integrating NimBLE into GNRC, I am working my way through
gnrc_netif
, trying to implement it for NimBLE. Looking at thegnrc_netif
code, there is quite some room for optimization...I could not find anything about this on a quick search - so if I am addressing something that is already addressed somewhere else, simply ignore my renting and close this PR :-)
This PR focuses on the
gnrc_netif_ipv6_get_iid()
function: why are we duplicating all the generating code here, even on multiple layers? Event inside this one function there is a whole code block of 8 lines duplicated...So to row back: as far as I can see, almost all(?) netdev implementations are actually allowing to get the IID through the
NETOPT_IPV6_IID
option. So why don't we just use that here?This PR takes a first step, by using the
NETOPT_IPV6_IID
option to get the IID from the netdev device. If successful, we are done. If not, we proceed with the existing code.As a follow up I would imagine, we should be able to get rid of the whole
else
part by only depending on gettingNETOPT_IPV6_IID
, right?! This would save quite some unnecessary link layer dependencies into netif. And not to mention some saved ROM :-)Testing procedure
Run some tests using the
gnrc_networking
example for different link layer devices, checking the generated link local addresses carefully.Issues/PRs references
none