-
Notifications
You must be signed in to change notification settings - Fork 3k
Networking update: general refactoring, unifying EMAC, multi-if #4079
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
Conversation
Make the IP stack abstraction LWIP independent, move the stack independent files to generic directory, rename files to better describe their purpose.
This is looking good! Still working through reviewing it. Also ccing @c1728p9 |
@geky btw when you'll have time to work on the EMAC stuff, feel free to push to this branch. |
What do DEVICE_ETH and DEVICE_WIFI actually mean? I want to be clear on that. DEVICE_EMAC was odd, because unlike all the other DEVICE_XXX, it didn't seem mean anything positive, as far as I could tell - the target didn't directly provide "emac" calls - it was only used as library option hint to the LWIP/NSAPI code to tell it not to look for its own built-in target driver. Looking at this, I'm not sure what DEVICE_ETH currently means, but it would seem logical that it could mean "platform provides provide mbed_emac_eth_default"? And hence EthernetInterface default constructor is provided? If DEVICE_ETH isn't defined, you should still be able to have plug-in modules(s). Do you even need a define? How about just a weak mbed_emac_eth_default? It's maybe not the way the rest of the mbed HAL works, but emac already isn't. |
Feeling quite positive on this, from what I've managed to take in so far - seems to be a sensible completion of the emac concept which wasn't fully realised. The diff is going to conflict greatly with the work on the cellular stuff being aimed at 5.5, which had to rework lwip_stack's connect logic. I'm hoping this is aimed at 5.6 or later. But the wider design approaches fit well - we have a similar concept about having an "mbed_ppp_attach" allowing a modem device to attach itself to the PPP driver of whichever stack is present, much like this attaches emacs. We should align our naming with the mbed_ipstack prefix. Given the amount of design effort going on here, I would like to see potential design glitches shaken out by attempting a Nanostack implementation sooner rather than later. |
@kjbracey-arm I'm afraid it's also targeted for 5.5 (it seems that lesson of 5.2 didn't worked) and we still don't know schedules between teams and don't consider clashes like that. As to the flags, |
Work picked up by Kari Haapalehto in ARMmbed#4918, from Bartek Szatkowsi's branch at ARMmbed#4079, commit 8c28917. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Refactor k64f_emac * Remove lwip depencies * Correct doxygen warnings * Add weak definitions for mbed_ipstack.h functions. * Remove emac_interface_t - drivers register with emac_interface_ops_t and void *, and get an mbed_ipstack_interface_t to pass to stack. * Reinstate use of EthInterface abstraction * ipstack_lwip.c renamed as mbed_ipstack_lwip.c * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with mbed_ipstack_lwip.cpp
Initial work by Bartek Szatkowski in ARMmbed#4079, reworked following review of ARMmbed#5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since ARMmbed#4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in ARMmbed#4079, reworked following review of ARMmbed#5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since ARMmbed#4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in #4079, reworked following review of #5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since #4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in #4079, reworked following review of #5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since #4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in #4079, reworked following review of #5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since #4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in ARMmbed#4079, reworked following review of ARMmbed#5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since ARMmbed#4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in ARMmbed#4079, reworked following review of ARMmbed#5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since ARMmbed#4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
Initial work by Bartek Szatkowski in #4079, reworked following review of #5202 to transform the entire system into C++, retaining the basic functionality. Bartek's summary: * Porting ethernet to EMAC * Updating EMAC to enable multiple interfaces * Untangling networking classes, making the abstractions a bit clearer to follow, etc * General refactoring * Removal of DEVICE_EMAC flag and introducing DEVICE_ETH and DEVICE_WIFI Revisions since initial branch: * Remove lwip depencies * Correct doxygen warnings * Remove emac_api.h, replace with C++ EMAC abstract class. * Create OnboardNetworkInterface, and LWIP implementation. * Mappings since #4079 lwip-interface/nsapi_stack_lwip.c -> LWIPStack.cpp lwip-interface/ipstack_lwip.c -> LWIPInterface.cpp netsocket/mbed_ipstack.h -> OnboardNetworkStack.h hal/emac_api.h -> EMAC.h * Reinstate use of EthInterface abstraction * Correct and clarify HW address EMAC ops * Restore MBED_MAC_ADDR implementation * Integrate PPP support with LWIP::Interface. * Convert K64F lwIP driver to K64F_EMAC. To do: * Convert emac_stack_mem.h to follow this pattern. * Figure out DEVICE_ETH/EMAC * Update all drivers to use EMAC
WORK IN PROGRESS
Description
It's still work in progress, most of the changes were done some time ago, but I've decided to create the PR so we can start discussion and other people can start contributing. Probably contains a lot of issues ;)
General networking update, including:
DEVICE_EMAC
flag and introducingDEVICE_ETH
andDEVICE_WIFI
Roughly the mbed OS networking represented below. It's 'sort of' a class (abstraction) diagram, the arrows represent, any kind of, associations, and may not be complete, but represent the most important connections.
DISCLAIMER Connections on the diagram (and the whole diagram really) is just conceptual simplification, they don't represent things like callbacks which may make the connection in both directions. It should be useful to illustrate how the things are put together and interact, rather then provide complete and formal picture. aka pseudo-UML.
Status
IN DEVELOPMENT
Todos
feature_lwip-tests-mbedmicro-net-connectivity
fails on K64FWiFiAccessPoint
class name, it'll be confusing when we add AP modeETH
WIFI
flags (do we need them? in what form? do we needLWIP
at the same time?)Todo but possibly after this PR
NetworkInterface
CC
@geky @kjbracey-arm