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

New feature: send/recv message implementation added to network stack #15040

Merged
merged 6 commits into from
Sep 9, 2021

Conversation

mat-kalinowski
Copy link
Contributor

Summary of changes

This PR is continuation of another stale PR: #14847. I am opening this one, as I didn't have access to push to the fork created by other developer.

I have added few changes related to unresolved comments:

  • function names were changed from socket_sendmsg/socket_recvmsg to socket_sendto_control/socket_recvfrom_control.
  • default implementation of this functions was provided in the NetworkStack class to not break the existing API. This was the issue that caused tests to fail in the previous PR.
  • MsgHeaderIterator accesses elements on the aligned addresses

.

Impact of changes

Migration actions required

Documentation

Stale PR with this feature:
#14847

Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@pan-

@ciarmcom
Copy link
Member

ciarmcom commented Sep 1, 2021

@mat-kalinowski, thank you for your changes.
@pan- @ARMmbed/mbed-os-connectivity @ARMmbed/mbed-os-mesh @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 1, 2021

If you rebase to the latest master, license check should stop failing with python error. Also review styling check - code needs fixing.

@mat-kalinowski
Copy link
Contributor Author

mat-kalinowski commented Sep 2, 2021

I have added some changes to solve the bugs present in the unit tests:

  • default argument added to the function add_ethernet_interface was not included in the gmock's MOCK_METHOD. I have added wrapper function to solve this and adjusted EXPECT_CALL invocations.
  • recvfrom_control from NetworkStackstub was implemented in a wrong way. Unit test TestUDPSocket.recv_address_filtering was running into timeout because of that.
  • default implementations for recvfrom_control/sendto_control in the NetworkStack were moved to the header file. They were implemented to not break the API for all existing NetworkStack implementors and we don't want to change linking information.

This patch contains improvements mentioned in the unresolved PR
comments:
- function names were changed from socket_sendmsg/socket_recvmsg to
  socket_sendto_control/socket_recvfrom_control.
- default implementation of this functions was provided in the
  NetworkStack class.
- MsgHeaderIterator accesses elements on the aligned addresses.
Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

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

Thanks for adding the test and applying the change requested in the previous PR. I left comments for few improvements that should be made to that PR.

connectivity/lwipstack/include/lwipstack/lwipopts.h Outdated Show resolved Hide resolved
connectivity/netsocket/include/netsocket/nsapi_types.h Outdated Show resolved Hide resolved
Doxygen documentation for MsgHeaderIterator was added. Type used
for alignment of the nsapi_msghdr_t struct was changed.
Minor errors in the documentation were fixed. These caused failure
of the doxygen checks in the PR.
pan-
pan- previously approved these changes Sep 6, 2021
@mergify mergify bot added needs: CI and removed needs: review labels Sep 6, 2021
0xc0170
0xc0170 previously requested changes Sep 6, 2021
Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

As this is a feature pull request, should there be referenced docs update?

nsapi_size_or_error_t TCPSocket::sendto_control(const SocketAddress &address, const void *data, nsapi_size_t size,
nsapi_msghdr_t *control, nsapi_size_t control_size)
{
// FIXME: Implement
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rather create an tracking issue for this and remove the comment (reference the issue in the commit message, it can be easily found then)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, new issue - #15057

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue number should be added in the amended commit message when merging this PR into master

@mergify mergify bot added needs: work and removed needs: CI labels Sep 6, 2021
@pan-
Copy link
Member

pan- commented Sep 7, 2021

@0xc0170 Yes a doc update is required, I'm doing it.

@mergify mergify bot dismissed stale reviews from pan- and 0xc0170 September 7, 2021 13:57

Pull request has been modified.

pan-
pan- previously approved these changes Sep 8, 2021
@mergify mergify bot added the needs: CI label Sep 8, 2021
@mergify mergify bot removed the needs: work label Sep 8, 2021
0xc0170
0xc0170 previously approved these changes Sep 8, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 8, 2021

CI started

@mergify mergify bot added needs: work and removed needs: CI labels Sep 8, 2021
@mbed-ci
Copy link

mbed-ci commented Sep 8, 2021

Jenkins CI Test : ❌ FAILED

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM
jenkins-ci/mbed-os-ci_build-greentea-ARM
jenkins-ci/mbed-os-ci_build-example-GCC_ARM
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM
jenkins-ci/mbed-os-ci_build-example-ARM
jenkins-ci/mbed-os-ci_cmake-example-ARM

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 8, 2021

The build errors are related, please review the logs

Macro MBED_ALIGN expands in C to _Alignas which can't be used in the
type declaration. This patch moves it to the first type definition
which makes this code compile properly in CPP and C.
@mergify mergify bot dismissed stale reviews from pan- and 0xc0170 September 8, 2021 14:30

Pull request has been modified.

@mat-kalinowski
Copy link
Contributor Author

mat-kalinowski commented Sep 8, 2021

The build errors are related, please review the logs

Done, It should work fine now

@mergify mergify bot added needs: CI and removed needs: work labels Sep 8, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 9, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented Sep 9, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

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.

7 participants