Skip to content
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

modified Wi-SUN tasklet to return success when calling connect twice #11556

Merged
merged 1 commit into from
Oct 18, 2019

Conversation

mikter
Copy link

@mikter mikter commented Sep 24, 2019

Description

If connect to be called multiple times it will return NSAPI_ERROR_IS_CONNECTED status.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[X] Breaking change

Reviewers

@JarkkoPaso @artokin @SeppoTakalo @AnttiKauppila @teetak01

Release Notes

Summary of changes

As stated in Mesh API documentation, we should return the status NSAPI_ERROR_IS_CONNECTED if connect is called twice. This PR (11556) fixes it.

Impact of changes

If connect method is called twice then different status code is returned.

Migration actions required

Implementations that rely on NSAPI_ERROR_DEVICE_ERROR status code when calling connect twice as their recovery method needs to change the handling to the correct status NSAPI_ERROR_IS_CONNECTED.

@ciarmcom
Copy link
Member

@mikter, thank you for your changes.
@JarkkoPaso @teetak01 @AnttiKauppila @SeppoTakalo @artokin @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

@mikter mikter changed the title modified Wi-SUN tasklet to return success when calling connet twice modified Wi-SUN tasklet to return success when calling connect twice Sep 24, 2019
@@ -171,7 +171,7 @@ bool LoWPANNDInterface::getRouterIpAddress(char *address, int8_t len)
}

#define LOWPAN 0x2345
#if MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == LOWPAN && DEVICE_802_15_4_PHY
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 802_15_4_PHY is not requires for mesh anymore?

@@ -133,6 +133,7 @@ static void wisun_tasklet_main(arm_event_s *event)
* The event is delivered when the NanoStack OS is running fine.
* This event should be delivered ONLY ONCE.
*/
tr_debug("event_Init");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too detailed trace

@@ -434,7 +436,7 @@ int8_t wisun_tasklet_connect(mesh_interface_cb callback, int8_t nwk_interface_id
int8_t tasklet_id = wisun_tasklet_data_ptr->tasklet;

if (wisun_tasklet_data_ptr->network_interface_id != INVALID_INTERFACE_ID) {
return -3; // already connected to network
return wisun_tasklet_data_ptr->tasklet; // already connected to network
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed also to other mesh tasklets?

@SeppoTakalo
Copy link
Contributor

If usage of DEVICE_802_15_4_PHY flag is now removed, should you remove that from all targets as well? There are still few boards defining it in targets.json

@mikter
Copy link
Author

mikter commented Sep 24, 2019

If usage of DEVICE_802_15_4_PHY flag is now removed, should you remove that from all targets as well? There are still few boards defining it in targets.json

My understanding was that this flag is only set if the board has 802 radio included. but mesh apis needs to be available if it is used with radio shield. So the && configuration was wrong

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 24, 2019

started CI meanwhile

@SeppoTakalo
Copy link
Contributor

If usage of DEVICE_802_15_4_PHY flag is now removed, should you remove that from all targets as well? There are still few boards defining it in targets.json

My understanding was that this flag is only set if the board has 802 radio included. but mesh apis needs to be available if it is used with radio shield. So the && configuration was wrong

True, but is there any use of the DEVICE_802_15_4 flag anymore? Only reference is in TEST_APPS/device/nanostack_mac_tester/main.cpp, but it is already flagged out with ICETEA_MAC_TESTER_ENABLED.

@mbed-ci
Copy link

mbed-ci commented Sep 24, 2019

Test run: FAILED

Summary: 2 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_mbed2-build-IAR
  • jenkins-ci/mbed-os-ci_cloud-client-test

@SeppoTakalo
Copy link
Contributor

-11 again from Python.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 24, 2019

I restarted both, all good now!

@@ -40,7 +40,7 @@
},
"default-mesh-type": {
"help": "Configuration type for MeshInterface::get_default_instance(). [LOWPAN/THREAD/WISUN]",
"value": "THREAD"
"value": null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question before integrating this: isn't this breaking change for apps - as the config value changes for default mesh type ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, these changes are potentially breaking, adding proper labels

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questionable..
Is it a breaking change to return no default, instead of non-configured non-working default?

Or @mikter did the non-configured Thread work? My assumption is that it is a demo, with no real use cases.. should we optimise for testing and demo, or for real use cases.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anyone should have Thread configured without any configuration in application

It would however work as a non-commissioned Thread device, but that should still be application configuration not a default.

I can remove this change if you like from this commit as it is not really related. although the Breaking change is not only because of this configuration, but it is because we are changing status code on public API.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 30, 2019

CI restarted

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 30, 2019

@AnttiKauppila Happy with changes and Release notes?

@mbed-ci
Copy link

mbed-ci commented Sep 30, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 2
Build artifacts

@bulislaw
Copy link
Member

bulislaw commented Oct 2, 2019

Hold on here please, I'll start an email thread to confirm it.

@juhhei01
Copy link
Contributor

juhhei01 commented Oct 2, 2019

@mikter Are you sure that next sequence will work:

  1. Connect and wait success status
  2. Disconnect connection
  3. reconnect by connect call. I think This is not working anymore because of removing stuff from original changes.

You demonstrate this and I see it was working earlier.

I think double connect is now supported but not mine sequence.

@juhhei01
Copy link
Contributor

juhhei01 commented Oct 2, 2019

@bulislaw , @adbridge and @0xc0170 I have not following this in early but we now loosing a bug fix for sequence that I was telling to Mika. That was working but not anymore.

@adbridge
Copy link
Contributor

adbridge commented Oct 2, 2019

@juhhei01 Mika was supposed to just split the original PR into 2 separate ones, so presumably there should be another PR he has raised to cover your bug fix ?

@juhhei01
Copy link
Contributor

juhhei01 commented Oct 2, 2019

@adbridge I did not buy idea why you was blocking that fix which was reviewed and aproved by mesh stakeholders. I see that those blocked issues was even critical than current one.

@@ -116,7 +116,7 @@ nsapi_error_t map_mesh_error(mesh_error_t err)
case MESH_ERROR_PARAM:
return NSAPI_ERROR_PARAMETER;
case MESH_ERROR_STATE:
return NSAPI_ERROR_DEVICE_ERROR;
Copy link
Contributor

@juhhei01 juhhei01 Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that now we are hiding something bigger issue? If we can return connected state at mesh error state.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current return value make more sense if we are already connected

@bulislaw
Copy link
Member

bulislaw commented Oct 2, 2019

Ok the 5.15 is confirmed, I don't have further comments.

@adbridge
Copy link
Contributor

adbridge commented Oct 3, 2019

@adbridge I did not buy idea why you was blocking that fix which was reviewed and aproved by mesh stakeholders. I see that those blocked issues was even critical than current one.

@juhhei01 because it broke the PR guidelines. PRs should contain self-contained fixes not a mixture of things.

@SeppoTakalo
Copy link
Contributor

@adbridge You are mixing commits and PRs.

https://os.mbed.com/docs/mbed-os/v5.14/contributing/workflow.html#guidelines-for-github-pull-requests

Each commit should be the minimum self-contained commit for a change. A commit should always result in a new state that is again in a compilable state. You should (if possible) split large changes into logical smaller commits that help reviewers follow the reasoning behind the full change.

One PR may contain more that one fix. Nothing wrong with that.

You seem to enforse the last rule in the list:

Smaller pull requests are easier to review and faster to integrate. Use dependencies – split your work by pull request type or functional changes. To add a third-party driver, send it in a separate pull request, and add it as a dependency to your pull request.

However, pay attention to easier to review as this PR was already reviewed. So I fail to see the reason for the split. After clicking the merge button, it does not much matter how many PR was the content split. Its all in the master then.

Having more merge commits just make history harder to read.

@adbridge
Copy link
Contributor

adbridge commented Oct 4, 2019

@adbridge You are mixing commits and PRs.
https://os.mbed.com/docs/mbed-os/v5.14/contributing/workflow.html#guidelines-for-github-pull-requests

Each commit should be the minimum self-contained commit for a change. A commit should always result in a new state that is again in a compilable state. You should (if possible) split large changes into logical smaller commits that help reviewers follow the reasoning behind the full change.

One PR may contain more that one fix. Nothing wrong with that.
You seem to enforse the last rule in the list:

Smaller pull requests are easier to review and faster to integrate. Use dependencies – split your work by pull request type or functional changes. To add a third-party driver, send it in a separate pull request, and add it as a dependency to your pull request.
Having more merge commits just make history harder to read.

@SeppoTakalo multiple commits for the same fix are acceptable. This PR had two very different changes and in that case it should go to two separate PRs. We are getting more strict on this because too many people are just dumping PRs with multiple unconnected fixes in them.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2019

Will start CI soon here, just to confirm @mikter @@juhhei01 all ready for us to proceed with this fix?

@mikter
Copy link
Author

mikter commented Oct 18, 2019

yes

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Oct 18, 2019

Test run: SUCCESS

Summary: 12 of 12 test jobs passed
Build number : 3
Build artifacts

@0xc0170 0xc0170 merged commit 9e87200 into ARMmbed:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.