-
Notifications
You must be signed in to change notification settings - Fork 11
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
coap: zephyr: implement server-negotiated block size during block upload #570
Open
szczys
wants to merge
5
commits into
main
Choose a base branch
from
szczys/blocksize-server-suggests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Visit the preview URL for this PR (updated for commit 86adf2d): https://golioth-firmware-sdk-doxygen-dev--pr570-szczys-blocksi-ie16jg7s.web.app (expires Mon, 23 Sep 2024 15:21:13 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: a9993e61697a3983f3479e468bcb0b616f9a0578 |
szczys
force-pushed
the
szczys/blocksize-server-suggests
branch
from
September 3, 2024 19:51
858afc7
to
b8f8694
Compare
szczys
changed the title
Szczys/blocksize server suggests
coap: zephyr: implement server-negotiated block size during block upload
Sep 3, 2024
szczys
force-pushed
the
szczys/blocksize-server-suggests
branch
2 times, most recently
from
September 3, 2024 21:49
91e1a29
to
20ed573
Compare
Code Coverage
|
szczys
force-pushed
the
szczys/blocksize-server-suggests
branch
2 times, most recently
from
September 4, 2024 02:39
d350687
to
fc504e7
Compare
szczys
force-pushed
the
szczys/blocksize-server-suggests
branch
from
September 4, 2024 18:52
fc504e7
to
05afcb7
Compare
szczys
force-pushed
the
szczys/add-blocksize-negotiation
branch
4 times, most recently
from
September 14, 2024 00:32
4b38e9d
to
7ed09a6
Compare
Add SZX_TO_BLOCKSIZE macro to convert from coap enum value to bytes Signed-off-by: Mike Szczys <mike@golioth.io>
Remove macro that is more broadly available from coap_client.h Signed-off-by: Mike Szczys <mike@golioth.io>
When performing blockwise upload, the server may negotiate a smaller block size than the device begins with. - Add a struct member to track this using post_block_ctx which is accessible both in the block upload functions as well as the coap thread functions. Use the _szx suffice to indicate coap block size enum value (as opposed to bytes). - When the server requests a smaller size, update the blockwise_transfer context so the value is used on subsequent blocks. - When the block_size is updated to a smaller value, the number of the next block needs to be recalculated because the previous transfer actually included more than one block of the newly negotiated size. Signed-off-by: Mike Szczys <mike@golioth.io>
When the server responds to a block upload request with a smaller block size, store the value to inform the negotiated block size. Signed-off-by: Mike Szczys <mike@golioth.io>
Use the negotiated block size when initializing the block1 option of the coap packet. This moves the use of the compiled-in CONFIG_GOLIOTH_BLOCKWISE_UPLOAD_MAX_BLOCK_SIZE value to the initialization step of the negotiated value, and allows for the negotiated value to be updated based on the server preference, then used for all subsequent coap requests in the block upload process. The Kconfig value was previously masked by a bitwise operation. This should not be necessary as that symbol was updated to a 'choice' in Kconfig so we can be confident that the value is valid coap size or it would have triggered a static assert. Signed-off-by: Mike Szczys <mike@golioth.io>
szczys
force-pushed
the
szczys/blocksize-server-suggests
branch
from
September 16, 2024 15:20
05afcb7
to
86adf2d
Compare
Code Coverage (Linux)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
negotiated_blocksize
context member to store desired block size from servernegotiated_blocksize
and updateblockwise_context
accordinglynegotiated_blocksize
when appending theblock1
szx (block size) on future coap packets.blockwise_context
so this is the next best option. This is a bit convoluted and could be cleaned up in future work.resolves https://github.com/golioth/firmware-issue-tracker/issues/628