-
Notifications
You must be signed in to change notification settings - Fork 178
Porting Guide for L3 API #940
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
Porting Guide for L3 API #940
Conversation
@SeppoTakalo please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes requested. Otherwise looks OK.
|
||
The scope of this document is limited to advanced cellular modems, where the device presents an additional IP Layer3 interface to send and receive frames, and one of the onboard network stacks that runs on Mbed OS on the host processor uses this. | ||
|
||
(If the device has an off-board network stack, a driver needs to implement `NetworkStack` directly instead to pass network calls to the offboard stack). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ()
and add link to NetworkStack porting guide.
See [NetworkStack porting guide](networkstack.html)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
The first step in the port is to create a driver class for cellular device that you can instantiate to control your device. You must derive this class from the `L3IP` class. A network stack (or test framework) uses this API to control your driver. | ||
|
||
The L3IP-derived driver would normally be installed in features/cellular/framework/targets, often in a `TARGET_XXX` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line, as the porting guide does not need to specify where to place the driver. We allow some flexibility there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
|
||
### Being the default Interface | ||
Currently EMAC based interfaces are created by automated factories and can be default for applications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not specific to EMAC.
Any interface type can be supplied as a default interface.
See https://os.mbed.com/docs/mbed-os/v5.11/apis/network-interfaces.html and scroll down for "Default network interface"
So re-phare this to something like: "In Mbed OS targets may provide default network interfaces through automated factory method"...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
### OnboardNetworkStack | ||
|
||
The precise details of the `OnboardNetworkStack` API should not concern an L3IP driver writer - it provides the mechanism to bind a driver to a stack, and the APIs needed to implement a `NetworkInterface`, but this is handled by `L3IPInterface`, either as a base class of your own `XXXInterface`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this sentence:
but this is handled by
L3IPInterface
, either as a base class of your ownXXXInterface
.
Either ... or...
Is there an option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected.
|
||
Greentea L3IP tests are in the Mbed OS tree under the `TESTS/network/L3IP` directory. | ||
|
||
The driver should also be exercised with real-world examples, such as the [Arm Mbed Client example](https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-client/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to leave this out, and just refer to our Socket test plan.
I have seen it too many times that people skip the socket tests and go directly to test with client. This approach might hide lots of bugs in the socket level, as we have seen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
The scope of this document is limited to advanced cellular modems, where the device presents an additional IP Layer3 interface to send and receive frames, and one of the onboard network stacks that runs on Mbed OS on the host processor uses this. | ||
|
||
If the device has an off-board network stack, a driver needs to implement | ||
[NetworkStack](https://github.com/ARMmbed//mbed-os-5-docs/blob/development/docs/porting/connectivity/NetworkStack.md) directly instead to pass network calls to the offboard stack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link needs to be fixed.
I think the correct target is https://os.mbed.com/docs/mbed-os/v5.11/porting/networkstack.html
Which is (networkstack.html), or sometimes ../porting/networkstack.html
have been used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, but the networkstack porting link needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Images looks OK now
Note to self: 5.12 delivery |
@tymoteuszblochmobica Thanks for the PR. In the future, if a PR is only applicable for the next release, please let us know in the PR description. Thanks in advance :) [Also, I hope you don't mind I updated your PR description with an obnoxiously bold note to myself.] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR 👍 This is great content. Please review my changes to make sure I didn't accidentally change the meaning of anything, and please answer the two questions I've left in comments.
|
||
### IP Layer3 memory manager | ||
|
||
The IP Layer3 memory manager class provides an abstracted memory interface toward memory modules used in different network stacks. For the send and receive paths, data is transferred in memory buffers controlled through an `NetStackMemoryManager` object. The network stack, using an L3IP driver, provides it with a reference to the memory manager in use before powering up - this is constant as long as the L3IP is powered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This last sentence confuses me. Could you please clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's based on EMAC which has the same memory management arch and behavior.
https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/porting/connectivity/ethernet.md
However to keep it more easy to understand than original i replaced description to:
"The network stack provides L3IP driver with reference to the memory manager before L3IP device powers up."
|
||
To do this, create a C++ class that inherits from both `L3IPInterface` and a base class for the new IP Layer3 cellular interface solution. The `L3IPInterface` is a helper class that implements all the core `NetworkInterface` functionality for you. You then need to implement the extra configuration methods. | ||
|
||
You don't usually directly expose the `L3IP` driver class of a cellular driver - it is not usually declared as `L3IP::get_default_instance`. However, passing it to the constructor of your base `L3IPInterface` makes it visible using the `getl3ip` method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the first time we mention the getl3ip
method? If so, could you please provide some context or a link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also based on EMAC which has the same way of getting driver instance.
https://github.com/ARMmbed/mbed-os-5-docs/blob/development/docs/porting/connectivity/ethernet.md
Both EMACInterface and L3IPInterface are helper classes provides glue logic between network drivers and network stack.
Methods getl3ip() is similar to wifi/ethernet get_emac() and both are getting driver instance
getl3ip/get_emac is a member of L3IPInterface /EMACInterface
Text replaced to:
" This then makes it visible using the getl3ip
method which provides access to L3IP device driver instance. Method getl3ip
is a member of L3IPInterface
class."
@@ -0,0 +1,131 @@ | |||
<h2 id="ethernet-port">IP Layer3 (L3IP) drivers</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please choose another unique heading ID because "ethernet-port" is already used here: https://os.mbed.com/docs/mbed-os/v5.11/porting/ethernet-port.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tymoteuszblochmobica use id="l3-porting"
here.
The id
field is used by the documentation engine to generate the .html file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
It looks like my edits got overwritten. Could you please add them back? |
Edits restored |
Edit updated file.
Added Layer 3 IP porting connectivity guide
NOTE FOR TECH WRITERS: THIS IS FOR 5.12 ONLY. DO NOT MERGE INTO 5.11.