-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Inet: Split InetLayer class #12291
Inet: Split InetLayer class #12291
Conversation
#### Problem This is a step toward project-chip#7715 _Virtualize System and Inet interfaces_ for mockability, building on recent virtualization of Inet endpoints and changes to object allocation pools. The `InetLayer` class acts as a factory for `UDPEndPoint` and `TCPEndPoint`. Merely making its methods virtual would result in an unacceptable code size increase for applications that do not use TCP on platforms that offer it, since the vtable would introduce a dependency that normal linking doesn't remove. #### Change overview - Split the `EndPoint` factory/iteration code into its own class, `EndPointManager`. `InetLayer` remains as a stub wrapper for the pair of Managers. - Move the code for TCP idle timeout from `InetLayer` to `TCPEndPoint`. - Move `IPPacketInfo` from `InetLayer.h` to its own files. **NOTE** that applications that use CHIP TCP must now explicitly initialize it via `InetLayer::InitTCP()`. #### Testing CI; no changes to external functionality. Tests revised where necessary to initialize TCP.
Use the Impl's underlying ObjectPool statisticsconnectedhomeip/src/inet/InetLayer.h Lines 79 to 89 in 5dd2f93
This comment was generated by todo based on a
|
Potential followups:
|
PR #12291: Size comparison from 514cf19 to 5dd2f93 Increases above 0.2%:
Increases (36 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Decreases (26 builds for efr32, esp32, k32w, linux, mbed, p6, qpg)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
This has merely moved from
|
Fast track: this PR has been up for a while. It is very heavily exercised by our E2E CI (all tests will use the inet layer). |
#### Problem After PR project-chip#12291, `InetLayer` merely holds pointers to TCP and UDP `EndPointManager`. Almost all uses are of `UDPEndPointManager` only, so `InetLayer` is an unnecessary indirection. Part of project-chip#7715 _Virtualize System and Inet interfaces_ #### Change overview Remove the `InetLayer` class and pass or store `UDPEndPointManager` and/or `TCPEndPointManager` directly. (This was not included in project-chip#12291 because it touches a large number of files with trivial changes.) #### Testing CI; no change to external functionality.
#### Problem After PR project-chip#12291, `InetLayer` merely holds pointers to TCP and UDP `EndPointManager`. Almost all uses are of `UDPEndPointManager` only, so `InetLayer` is an unnecessary indirection. Part of project-chip#7715 _Virtualize System and Inet interfaces_ #### Change overview Remove the `InetLayer` class and pass or store `UDPEndPointManager` and/or `TCPEndPointManager` directly. (This was not included in project-chip#12291 because it touches a large number of files with trivial changes.) #### Testing CI; no change to external functionality.
#### Problem After PR project-chip#12291, `InetLayer` merely holds pointers to TCP and UDP `EndPointManager`. Almost all uses are of `UDPEndPointManager` only, so `InetLayer` is an unnecessary indirection. Part of project-chip#7715 _Virtualize System and Inet interfaces_ #### Change overview Remove the `InetLayer` class and pass or store `UDPEndPointManager` and/or `TCPEndPointManager` directly. (This was not included in project-chip#12291 because it touches a large number of files with trivial changes.) #### Testing CI; no change to external functionality.
* [Inet] Remove InetLayer class #### Problem After PR #12291, `InetLayer` merely holds pointers to TCP and UDP `EndPointManager`. Almost all uses are of `UDPEndPointManager` only, so `InetLayer` is an unnecessary indirection. Part of #7715 _Virtualize System and Inet interfaces_ #### Change overview Remove the `InetLayer` class and pass or store `UDPEndPointManager` and/or `TCPEndPointManager` directly. (This was not included in #12291 because it touches a large number of files with trivial changes.) #### Testing CI; no change to external functionality. * restyle * remove src/inet/InetLayer.cpp * fix merge
Problem
This is a step toward #7715 Virtualize System and Inet interfaces
for mockability, building on recent virtualization of Inet endpoints
and changes to object allocation pools.
The
InetLayer
class acts as a factory forUDPEndPoint
andTCPEndPoint
.Merely making its methods virtual would result in an unacceptable code
size increase for applications that do not use TCP on platforms that
offer it, since the vtable would introduce a dependency that normal
linking doesn't remove.
Change overview
EndPoint
factory/iteration code into its own class,EndPointManager
.InetLayer
remains as a stub wrapper for the pairof Managers.
EndPointBasis
now templated on EndPoint type to reduce code duplication.InetLayer
toTCPEndPoint
.IPPacketInfo
fromInetLayer.h
to its own files.NOTE that applications that use CHIP TCP must now explicitly initialize
it via
InetLayer::InitTCP()
.Testing
CI; no changes to external functionality. Tests revised where necessary