-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Group] Implement UDPEndPoint for OpenThread (to enable multicast) #13127
[Group] Implement UDPEndPoint for OpenThread (to enable multicast) #13127
Conversation
ca253e7
to
b21a465
Compare
PR #13127: Size comparison from 462dd77 to b21a465 Increases (25 builds for esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (28 builds for esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
b21a465
to
ae78315
Compare
PR #13127: Size comparison from 440c0b1 to 675ae5b Increases (26 builds for efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (2 builds for efr32)
Full report (29 builds for efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
bd52815
to
5802d32
Compare
PR #13127: Size comparison from 939ca0b to 5802d32 Increases (26 builds for efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (2 builds for efr32)
Full report (29 builds for efr32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
PR #13127: Size comparison from 939ca0b to c4c8749 Increases (14 builds for efr32, k32w, mbed, p6, qpg)
Full report (16 builds for efr32, k32w, mbed, p6, qpg)
|
I still suggest to modify the lwIP netif driver like this: static err_t openthread_netif_multicast_handler(struct netif *netif,
const ip6_addr_t *group, enum netif_mac_filter_action action)
{
otError error = OT_ERROR_NONE;
otIp6Address multicast_addr;
memcpy(multicast_addr.mFields.m8, group->addr, sizeof(group->addr));
esp_openthread_lock_acquire(portMAX_DELAY);
if (action == NETIF_ADD_MAC_FILTER) {
error = otIp6SubscribeMulticastAddress(esp_openthread_get_instance(), &multicast_addr);
} else {
error = otIp6UnsubscribeMulticastAddress(esp_openthread_get_instance(), &multicast_addr);
}
esp_openthread_lock_release();
switch (error) {
case OT_ERROR_NONE:
case OT_ERROR_ALREADY:
return ERR_OK;
case OT_ERROR_NO_BUFS:
return ERR_MEM;
case OT_ERROR_INVALID_ARGS:
return ERR_ARG;
default:
return ERR_IF;
}
}
// In lwIP netif initialization:
netif->mld_mac_filter = openthread_netif_multicast_handler; The code snippet will sychornize all the lwIP multicast groups to OpenThread. Then we just need to use socket interface |
@gjc13 This code seems to defeat the purpose of this PR since it still use LwIP on top of Openthread. Feel free to implement it in another PR, but the main goal here was to de-couple LwIP from OpenThread. Not only for Multicast but in general. Your suggestion is relevant since I don't believe that all platform will use this implementation of UDPEndpoint for OpenThread. But it should be in a different PR, just like the modification required for Multicast using the UDPEndpoint socket implementation. |
ee2d590
to
268aaf4
Compare
src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread_LwIP.cpp
Show resolved
Hide resolved
PR #13127: Size comparison from 5053f20 to 268aaf4 Increases (28 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (31 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
…roject-chip#13127) * Add OT UDPEnPointImpl to enable multicast listening
Problem
Partial Fix of #12200
Fix #13126
Partial Fix of #13085
Change overview
Ipv6 subscription for group multicast address wasn't available for OpenThread platform.
Implementing it with the current setup wasn't possible since it would have duplicated the whole IPV6 multicast logic. On top of duplicating the logic, it also caused a lot of error and incompatibility between OpenThread and LwIP.
The solution for now is to use an OpenThread implementation of
UDPEndpoint
which can then use directly the OT multicast api as discussed with @kpschoedel.However, since TCP is not yet supported in OT, we still need to have LWIP on top of OT. This results in a weird buffer situation as can be seen inside the
handleUdpReceive
function in UDPEndPointImplOt.cppTesting
This feature was tested with the EFR32 platform. It was able to do all previous functionality on top of receiving Multicast payload generated with the
TestGroupMessaging
yaml test case.