Skip to content

Conversation

artokin
Copy link
Contributor

@artokin artokin commented Nov 20, 2020

Summary of changes

Add method set_mac_address that Application can use to set MAC address to the interface.
Update get_mac_address to return MAC address correctly from EMAC.

This PR is copied from: #13902

Impact of changes

Migration actions required

Documentation


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

@mikter , @mikaleppanen , @juhhei01 , @JarkkoPaso


Arto Kinnunen added 6 commits November 18, 2020 17:17
Add method set_mac_address to set network interface MAC address.
Add support to set and get MAC address from EMAC interface.
Remove unnecessary method: add_ethernet_interface_ns
Remove final keyword to allow inheritance.
Use nsapi_size_t instread os size_t.
@ciarmcom
Copy link
Member

@artokin, thank you for your changes.
@juhhei01 @mikter @JarkkoPaso @mikaleppanen @ARMmbed/mbed-os-test @ARMmbed/mbed-os-mesh @ARMmbed/mbed-os-connectivity @ARMmbed/mbed-os-maintainers please review.

@0xc0170 0xc0170 requested review from a team and removed request for a team November 20, 2020 13:34
* All interfaces are not supporting MAC address set. A call to connect()
* will fail if MAC address is provided but not possible to use.
*
* @param mac_addr Buffer containing the MAC address

Choose a reason for hiding this comment

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

in what format?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added "in hexadecimal format"

* set before calling the interface connect() method. EUI-48 MAC addresses
* are used for Ethernet while Mesh interface is using 8-byte EUI-64 address.
*
* All interfaces are not supporting MAC address set. A call to connect()

Choose a reason for hiding this comment

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

can't the set_mac_address return an error if it's not supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not easily as the interface initialisation happens during the connect()-method call.

Copy link

Choose a reason for hiding this comment

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

If connect fails I think this makes quite inflexible interface as you can't recover from this and can't make a feature to read Mac from Factory tool, but for devices that has HW support for getting MAC it should override the factory tool configuration. So connect should not fail, but trace out an warning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mikter , good point!
Connect() failure is now ignored in the correction commit. Would you please review again?


/** Set the MAC address to the interface.
*
* Provided MAC address is set the the network interface. Address must be

Choose a reason for hiding this comment

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

Suggested change
* Provided MAC address is set the the network interface. Address must be
* Provided MAC address is set on the network interface. Address must be


nsapi_error_t EmacTestNetworkStack::Interface::set_mac_address(uint8_t *buf, nsapi_size_t buflen)
{
return NSAPI_ERROR_OK;

Choose a reason for hiding this comment

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

Shouldn't this be NSAPI_ERROR_UNSUPPORTED?

-Update method set_mac_address description
-Update EMAC test method return value
@artokin
Copy link
Contributor Author

artokin commented Nov 23, 2020

@paul-szczepanek-arm , thanks for your comments.
A correction commit has been added, would you please review again?

@mergify mergify bot added needs: work and removed needs: CI labels Nov 27, 2020
@mbed-ci
Copy link

mbed-ci commented Nov 27, 2020

Jenkins CI Test : ❌ FAILED

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

CLICK for Detailed Summary

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

@artokin artokin force-pushed the mac_address_set_get_mbed_os_master branch from ac517a8 to 0bc2b9e Compare November 30, 2020 11:05
@mergify mergify bot dismissed mikter’s stale review November 30, 2020 11:06

Pull request has been modified.

-Remove Nanostack::add_ethernet_interface API change
-Add get_mac_address to MeshEthernetInterface
-Fix compiler warnings by adding overrides
@artokin artokin force-pushed the mac_address_set_get_mbed_os_master branch from 0bc2b9e to 6a28bce Compare November 30, 2020 11:49
A new method has been added to the NetworkInterface. Therfore WICED
library needs to be rebuild for ARMC6.
@0xc0170
Copy link
Contributor

0xc0170 commented Dec 2, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Dec 2, 2020

Jenkins CI Test : ❌ FAILED

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

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-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_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️
jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 7, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Dec 7, 2020

Jenkins CI Test : ❌ FAILED

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

CLICK for Detailed Summary

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

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

mbed-ci commented Dec 8, 2020

Jenkins CI Test : ✔️ SUCCESS

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

CLICK for Detailed Summary

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

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.