Skip to content

LoRaWAN: FRMPayload size validity #7459

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

Merged
merged 2 commits into from
Jul 13, 2018
Merged

Conversation

hasnainvirk
Copy link
Contributor

Description

It was pointed out in #7432 and #7232 that the stack was comparing frame payload size
with the allowed payload size in a wrong manner in shcedule_tx().
We must strip the overhead from the frame before comparison.

We did have a similar check in prepare_ongoing_tx() API which would correctly analyse
the situation but a check was needed in schedule_tx() as well. The reason is that the
schedule_tx() API can be called automatically by the stack if the user intiated requested
was not promptly entertained because of duty cycle restriction. Now, the datarate can change
here (for CONFIRMED messages if the ack was not received after retries max out). That's why
a test for validity was needed.

We strip off the frame overhead from the payload length to get correct FRMPayload size and
hence do a successful comparison.

In order to have consistent frame overhead, we have opted to always include Port field in the
frame.

Pull request type

[X] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

@hasnainvirk
Copy link
Contributor Author

@kivaisan @kjbracey-arm @0xc0170 @cmonr Please review.

@0xc0170 0xc0170 requested a review from a team July 10, 2018 10:59
@hasnainvirk
Copy link
Contributor Author

@0xc0170 The build failed for some reason. Could you restart ?

@cmonr cmonr requested review from 0xc0170 and kjbracey July 10, 2018 16:25
if (_ongoing_tx_msg.type == MCPS_PROPRIETARY) {
frm_payload_size = _params.tx_buffer_len;
} else {
frm_payload_size = _params.tx_buffer_len - LORA_MAC_FRMPAYLOAD_OVERHEAD;
Copy link
Contributor

Choose a reason for hiding this comment

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

overhead is a fudge factor for the get_max_payload having it pre-subtracted, so always needs to be applied, even for proprietary.

@hasnainvirk
Copy link
Contributor Author

@kjbracey-arm Please review again.

@hasnainvirk hasnainvirk changed the title FRMPayload size validity LoRaWAN: FRMPayload size validity Jul 12, 2018
@hasnainvirk hasnainvirk force-pushed the issue_7232_7432 branch 2 times, most recently from e87e73c to b2bdf76 Compare July 12, 2018 10:21
Hasnain Virk added 2 commits July 12, 2018 13:28
It was pointed out in ARMmbed#7432 and ARMmbed#7232 that the stack was comparing frame payload size
with the allowed payload size in a wrong manner in shcedule_tx().
We must strip the overhead from the frame before comparison.

We did have a similar check in prepare_ongoing_tx() API which would correctly analyse
the situation but a check was needed in schedule_tx() as well. The reason is that the
schedule_tx() API can be called automatically by the stack if the user intiated requested
was not promptly entertained because of duty cycle restriction. Now, the datarate can change
here (for CONFIRMED messages if the ack was not received after retries max out). That's why
a test for validity was needed.

We now perform a comparison using _ongoing_tx_message structure which contains the actual
FRMPayload size.

For proprietary type of messages only MHDR and Port field is used so we shouldn't add MAC commands
and other overhead into them.

In order to have consistent frame overhead, we have opted to always include Port field in the
frame.
timeout unit should be ms not micro second.
@hasnainvirk
Copy link
Contributor Author

@0xc0170 Need CI here.

@cmonr
Copy link
Contributor

cmonr commented Jul 12, 2018

@hasnainvirk Will start shortly. We're looking into a test issue.

@cmonr
Copy link
Contributor

cmonr commented Jul 12, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Jul 12, 2018

Build : SUCCESS

Build number : 2590
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7459/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Jul 12, 2018

@mbed-ci
Copy link

mbed-ci commented Jul 13, 2018

@cmonr cmonr merged commit 4c1a89c into ARMmbed:master Jul 13, 2018
@cmonr
Copy link
Contributor

cmonr commented Jul 16, 2018

Pushing this out for 5.10.

This PR's changeset is based off of this: #7430

pan- pushed a commit to pan-/mbed that referenced this pull request Aug 22, 2018
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.

6 participants