-
Notifications
You must be signed in to change notification settings - Fork 3k
Wi-SUN interface implementation. #8600
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
Wi-SUN interface implementation. #8600
Conversation
@KariHaapalehto Can you run astyle on the changes (features are currently being updated so would like avoiding new styling issues) ? |
To get Wi-Sun mesh network working, also nanostack with Wi-Sun support is needed. ws_empty_functions.c and ws_management_api.h are temporary included here, so that wisun_tasklet will compiled without problems. They will replaced with the official versions with next nanostack release.
6ce4262
to
4440612
Compare
AStyle fixes done |
@artokin @juhhei01 @mikter @JarkkoPaso for your information |
"value": 0 | ||
}, | ||
"wisun-device-type": { | ||
"help": "Device mode (NET_6LOWPAN_ROUTER or NET_6LOWPAN_HOST). Router is routing packets from other device, creating a mesh network.", |
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.
currently supported modes are border router and router. but through mesh API I don't know if border router is wanted at all
@JarkkoPaso please check |
"help": "Device mode (NET_6LOWPAN_ROUTER or NET_6LOWPAN_HOST). Router is routing packets from other device, creating a mesh network.", | ||
"value": "NET_6LOWPAN_ROUTER" | ||
}, | ||
"wisun-nd-channel-mask": { |
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.
channel mask in wish goes from 0 to maximum amount of channels defined by regulatory domain and class. the maximum amount possible is 8* uint32
"help": "Channel mask, bit-mask of channels to use. [0-0x07fff800]", | ||
"value": "0x7fff800" | ||
}, | ||
"wisun-nd-channel-page": { |
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.
channel page is not needed in wi-SUN
"value": 0 | ||
}, | ||
"wisun-nd-channel": { | ||
"help": "RF channel to use when `channel_mask` is not defined. [0-26].", |
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.
not needed in wi-SUN
"value": 0 | ||
}, | ||
"wisun-nd-panid-filter": { | ||
"help": "Beacon PAN ID filter, 0xffff means no filtering. [0-0xffff]", |
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.
Not needed in Wi-SUN
wisun_tasklet_data_ptr->channel_list.channel_page = (channel_page_e)MBED_CONF_MBED_MESH_API_WISUN_ND_CHANNEL_PAGE; | ||
wisun_tasklet_data_ptr->channel_list.channel_mask[0] = MBED_CONF_MBED_MESH_API_WISUN_ND_CHANNEL_MASK; | ||
|
||
if (channel > 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.
Channel mask and channel selection is not needed to Wi-SUN
arm_nwk_6lowpan_link_nwk_id_filter_for_nwk_scan(wisun_tasklet_data_ptr->network_interface_id, NULL); | ||
|
||
arm_nwk_6lowpan_link_panid_filter_for_nwk_scan( | ||
wisun_tasklet_data_ptr->network_interface_id, |
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.
Not needed for Wi-SUN
|
||
// Enable MPL by default | ||
const uint8_t all_mpl_forwarders[16] = {0xff, 0x03, [15] = 0xfc}; | ||
multicast_mpl_domain_subscribe(wisun_tasklet_data_ptr->network_interface_id, |
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.
Not Needed for Wi-SUN
tr_error("MAC Address read fail\n"); | ||
} else { | ||
uint8_t temp[2]; | ||
common_write_16_bit(app_link_address_info.mac_short, temp); |
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.
mac16 not used in wi-SUN
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.
this is true
tr_debug("IID (Based on MAC 64-bit address): %s", trace_array(app_link_address_info.iid_eui64, 8)); | ||
} | ||
|
||
tr_debug("Channel: %d", arm_net_get_current_channel(wisun_tasklet_data_ptr->network_interface_id)); |
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.
Channel is meaningless in channel hopping network do you really need this?
network_layer_address_s app_nd_address_info; | ||
link_layer_address_s app_link_address_info; | ||
uint8_t temp_ipv6[16]; | ||
if (arm_nwk_nd_address_read(wisun_tasklet_data_ptr->network_interface_id, &app_nd_address_info) != 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.
I don't know do these give meaningless information ?
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.
Will remove these
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.
Looks good for me.
"value": 0 | ||
}, | ||
"wisun-bc-dwell-interval": { | ||
"help": "Broadcast dwell interval. Range: 15-250 milliseconds", |
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.
They have changed the dwell time range to 15-255ms in new spec. I know, it is still wrong in nanostack api also. Same thing in wisun-uc-dwell-interval.
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.
Fix the typo now to prevent issues later
"help": "default network name for wisun network", | ||
"value": "\"NETWORK_NAME\"" | ||
}, | ||
"wisun-regulator-domain": { |
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.
Fix typo: regulatory domain, also need to change to the tasklet code.
wisun_tasklet_data_ptr->operating_mode_extension); | ||
|
||
ws_management_node_init(wisun_tasklet_data_ptr->network_interface_id, | ||
MBED_CONF_MBED_MESH_API_WISUN_REGULATOR_DOMAIN, |
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.
Regulatory
fhss_timer_ptr); | ||
|
||
tr_debug("Domain: %d, mode: %d, class: %d, network name: %s", | ||
MBED_CONF_MBED_MESH_API_WISUN_REGULATOR_DOMAIN, |
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.
Regulatory
92c9223
to
4c3015d
Compare
|
||
tr_debug("Domain: %d, mode: %d, class: %d, network name: %s", | ||
MBED_CONF_MBED_MESH_API_WISUN_REGULATORY_DOMAIN, | ||
MBED_CONF_MBED_MESH_API_WISUN_OPERATING_MODE, |
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.
tracing mode and class is incorrect as those are not set really.
if those values are different from default use for example following way to configure
if (ws_conf.operating_mode != 255 ||
ws_conf.operating_class != 255 ) {
ret = ws_management_regulatory_domain_set(mesh->net_rf_id, ws_conf.regulatory_domain, ws_conf.operating_class, ws_conf.operating_mode);
if (ret != 0) {
cmd_printf("Regulatory domain configuration failed %"PRIi32"\r\n", ret);
return CMDLINE_RETCODE_FAIL;
}
}
@@ -0,0 +1,233 @@ | |||
/* |
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.
This file is public API and is now on wrong place. is this intentional?
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.
I'll move it to mbed-os\features\nanostack\sal-stack-nanostack\nanostack
4c3015d
to
d6c402d
Compare
char *Nanostack::WisunInterface::get_gateway(char *buf, nsapi_size_t buflen) | ||
{ | ||
NanostackLockGuard lock; | ||
if (wisun_tasklet_get_router_ip_address(buf, buflen) == 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.
get_gateway is calling wisun_tasklet_get_router_ip_address and getRouterIpAddress is calling get_gateway?
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.
This is implemented just like LOWPANNDInterface.
and WisunInterface::getRouterIpAddress is a api for wisun
|
||
// For tracing we need to define flag, have include and define group | ||
//#define HAVE_DEBUG | ||
#define TRACE_GROUP "wisuND" |
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.
Not sure if we want to keep trace group max 4 characters long?
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.
Will change it for 4 char
d6c402d
to
3161cb5
Compare
@mikter Any other comments/change request? |
// TODO, read interface name from configuration | ||
mac_description_storage_size_t storage_sizes; | ||
storage_sizes.device_decription_table_size = 32; | ||
storage_sizes.key_description_table_size = 6; |
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.
This should be 4
3161cb5
to
6163e6f
Compare
@jarlamsa Can you rereview?
@KariHaapalehto When is this happening? for 5.11 or later? |
if (wisun_tasklet_data_ptr->tasklet_state != TASKLET_STATE_BOOTSTRAP_READY) { | ||
tr_info("Wi-SUN bootstrap ready"); | ||
wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_READY; | ||
wisun_tasklet_network_state_changed(MESH_CONNECTED); |
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.
The local ula prefix needs probably to be checked similar to thread_tasklet.c to prevent reporting NSAPI_GLOBAL_UP with only ula prefix.
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.
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.
Any comments about this? 6lowpan isn't doing it....
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.
@kjbracey-arm can you comment on this?
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.
I don't believe Wi-SUN has any inherent concept analogous to the "mesh-local" address. Thread only says "local" if it has specifically only the Thread mesh-local address, not any ULA.
I believe the logic was that a standard ULA could equally represent a connection tunnel to a cloud server as well as a site-specific ULA, so we treat ULAs as "global" - we've no idea how many networks we can get with them. There could even be NAT going on, so we have a ULA but NATted global connectivity.
Apps can check to see if "get_ip_address" returns a ULA themselves if they want to distinguish between a ULA or need a real global address.
However, all the IPv6 things should be saying "local" if they only have a link-local address. The Thread stuff is just stretching that to also cover the thread mesh-local link.
Maybe if there was some other was to detect definitely local connectivity? Both 6LoWPAN-ND and Wi-SUN could maybe look at the "grounded" flag of the DODAG. If that was exposed via API, you would be local if clear. But then you'd need an event mechanism for it changing. Would be an extension.
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.
In IPv4, the global is actualy "We have a router and DHCP somewhere" so I think equal state should be indicated here.
I don't know how...
Do we have any API to ask that "is border router alive and does it have a backbone"
Because, the whole distinction between GLOBAL and LOCAL should not be about IP address scope. It should be answer to the question whether there is a route to "somewhere"
yes -> global
no -> local
And that information can be used in Mbed Client: "Should I try the TLS handshake again?" and the answer is the same.
GLOBAL -> yes
other states -> no
So there will most probably be cases where ULA prefix satisfies the requirement.
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.
Not sure we have any existing logic about route existence, or at least don't recall seeing it.
I think maybe it's just convenient that having an IPv4 address implies a DHCPv4 server, and one assumes that a DHCPv4 server is a router. We assume we don't auto-assign ourselves a "link-local" 169.254.x.x address.
So, IPv6 for LwIP checks for non-link-local IPv6 addresses. As does MeshInterfaceNanostack. "MESH_CONNECTED" is turned into either LOCAL_UP or GLOBAL_UP depending on if we only have a link-local address.
The Thread special case is stopping the mesh-local ULA from being reported as global, as any other ULA is.
So I think this is correct for now - it's plausible to assume if you have a ULA you at least have a router giving out SLAAC prefixes, even if it's not connected to anywhere, just like you assume the same for DHCPv4.
Do we have any API to ask that "is border router alive and does it have a backbone"
Not sure whether it's easily or at all findable via public APIs, but RPL Grounded flag would be it, if the border router is maintaining it correctly. I think that's a general extension for 6LoWPAN-ND and Wi-SUN though - not something for this PR.
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.
Approve - main reservation is on the name capitalisation, but I can live with this is others prefer it this way.
Not inspected the bulk of the code in detail, but I'm assuming it's faithfully cloned from the 6LoWPAN-ND stuff. At some point we should try to reduce the duplication, but this will do for starters.
* | ||
* Configure Nanostack to use Wi-SUN protocol. | ||
*/ | ||
class WisunInterface : public MeshInterfaceNanostack { |
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.
Not WiSUNInterface
? We have LoWPANNDInterface
with full silly capitalisation for 6LoWPAN-ND. Seems inconsistent, but maybe there's another factor.
if (wisun_tasklet_data_ptr->tasklet_state != TASKLET_STATE_BOOTSTRAP_READY) { | ||
tr_info("Wi-SUN bootstrap ready"); | ||
wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_READY; | ||
wisun_tasklet_network_state_changed(MESH_CONNECTED); |
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.
I don't believe Wi-SUN has any inherent concept analogous to the "mesh-local" address. Thread only says "local" if it has specifically only the Thread mesh-local address, not any ULA.
I believe the logic was that a standard ULA could equally represent a connection tunnel to a cloud server as well as a site-specific ULA, so we treat ULAs as "global" - we've no idea how many networks we can get with them. There could even be NAT going on, so we have a ULA but NATted global connectivity.
Apps can check to see if "get_ip_address" returns a ULA themselves if they want to distinguish between a ULA or need a real global address.
However, all the IPv6 things should be saying "local" if they only have a link-local address. The Thread stuff is just stretching that to also cover the thread mesh-local link.
Maybe if there was some other was to detect definitely local connectivity? Both 6LoWPAN-ND and Wi-SUN could maybe look at the "grounded" flag of the DODAG. If that was exposed via API, you would be local if clear. But then you'd need an event mechanism for it changing. Would be an extension.
#endif | ||
|
||
/* Regulatory domain values*/ | ||
#define REG_DOMAIN_WW 0x00 // World wide |
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.
This is obviously for Nanostack, but really all these defines should have WS_
prefixes.
@KariHaapalehto Can you review latest comments ? Is this targeting 5.11 ? (not yet labeled!) |
Yes, this can be targeted to 5.11. |
@KariHaapalehto @jarlamsa All review comments addressed ? @jarlamsa CAn you update your review feedback here? |
/morph build |
Build : SUCCESSBuild number : 3689 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 3290 |
Test : FAILUREBuild number : 3463 |
/morph export-build |
Exporter Build : FAILUREBuild number : 3296 |
Exporters failure ^^ pipeline closed, will restart or goes to rollup (most probably rollup ) |
CI started. |
Test run: SUCCESSSummary: 4 of 4 test jobs passed |
This is a initial version of Wi-SUN interface implementation.
To get Wi-SUN mesh network working, also nanostack with Wi-Sun support is needed. ws_empty_functions.c and ws_management_api.h are temporary included here,
so that wisun_tasklet will compiled without problems.
They will replaced with the official versions with next nanostack release.
Description
Tested locally with Nucleo_F429ZI
Pull request type