-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
ports/rp2: Enable ipv6 per default for rp2. #15422
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
Conversation
Code size report:
|
Thanks for this. We can see from the CI how much flash and RAM it takes:
So that's 25016 bytes of flash and 3476 bytes of RAM. That's quite a lot more than I expected. The flash increase is acceptable, but the RAM usage... that will decrease the amount of MicroPython heap and may impact existing applications. Are there any settings to tune down the amount of RAM needed by IPv6? |
I think I've identified the 2 main chunks of that increase:
They total 1096 bytes, and their sizes (in entries) match the sizes of corresponding IPv4/ARP tables.
This increase can be split in two parts:
For the remaining 858 bytes I wasn't able to pinpoint a particular source. But they seem to stem from more individual pointers, realignment, and probably more increasing of the So I don't think there is much to tune here. We could tune down (half?) |
Thanks for looking into the RAM size increase.
This looks like the biggest culprit, and there's not much we can do about it. You simply need more bytes to store larger addresses.
That seems kind of reasonable. I don't really know enough about IPv6 to understand if 10 neighbours/destinations is large or not. Is it really going to impact things reducing that? Will reducing it just lead to less performance, or will it mean some packets can no longer be routed? Note that the GC heap size on Pico W will decrease by the amount of extra RAM used by lwIP, so this will be noticed by users. |
This table is essentially the same as the ARP table for ipv4 (also currently at 10 entries). It should above/around the number of local network devices you expect to communicate with. So the bare minimum is maybe around 3. And reducing to 5 might be sensible, but, of course, this depends on the needs of the network and application. Basically, if you want to send an IP packet to a local address, you need the mac address so you know how to address the ethernet packet around it. For IPv4 you'll do an ARP request, for IPv6 you'll do a neighbor solicitation. If you're constantly connected with more than (currently) 10 clients in the local network, the cache will get evicted and you'll need to re-request their address (sending packets, causing delays). I'd argue that if we tune down down Tuning down
|
OK, how about we turn that down to 4? I also looked at the following:
|
Sounds good to me.
Given that the corresponding v4 feature ( |
OK, can you please make the above two config tweaks to this PR? |
Having IPv6 support is important, especially for IoT-Devices which might be many, requiring individual IP-addresses. In particular direct access via link-local addresses and having deterministic SLAAC-addresses can be quite convenient. Also in IPv6-only networks or for connecting to IPv6-only services, this is very useful. For the Pico W, there is enough flash and RAM that enabling IPv6 by default is the right choice. Should IPv6 support in a network exist (i.e. there are Router Advertisements), but not provide connectivity, connecting by domain name should not be a problem as DNS will default to return the IPv4-address (if that exists), unless reconfigured at runtime to prefer IPv6. In any case a user can disable obtaining SLAAC-addresses with: <nic>.ipconfig(autoconf6=False) Signed-off-by: Felix Dörre <felix@dogcraft.de>
Summary
Having IPv6 support is important, especially for IoT-Devices which might be many, requiring individual IP-addresses. In particular direct access via link-local addresses and having deterministic SLAAC-addresses can be quite convenient. Also in IPv6-only networks or for connecting to IPv6-only services, this is very useful.
I believe that for the Raspberry Pico W, there is enough flash and RAM that enabling IPv6 by default is the right choice.
Testing
I'm using this change on a Raspberry Pico W for nearly 2 years now and haven't experienced any problems.
Trade-offs and Alternatives
Should IPv6 support in a network exist (i.e. there are Router Advertisements), but not provide connectivity, connecting by domain name should not be a problem, as DNS will default to return the IPv4-address, if existent, unless reconfigured at runtime to prefer IPv6.
In any case a user can disable obtaining SLAAC-addresses with
<nic>.ipconfig(autoconf6=False)
.