-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Modem cmux DCE #65955
Modem cmux DCE #65955
Conversation
Initial review is really promising, I will find time to review it in detail :) |
c20857f
to
d34d2cf
Compare
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.
Really like it, I want to discuss the flow control API, see my comment :)
include/zephyr/modem/cmux.h
Outdated
* @return -EPIPE CMUX control channel is not open. | ||
* @return -EALREADY Ongoing flow control request. | ||
*/ | ||
int modem_cmux_flow_ctrl_set_asynch(struct modem_cmux *cmux, bool state); |
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.
Could you describe the usecase for this API? The CMUX instance has an RX buffer, if the RX buffer nears full, the CMUX instance should automatically disable flow IMO :)
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.
Main reason for this new API was that I try to test similar functionality than your unit test with stubbed. I was also wondering that 3GGP CMUX define flow control for / DLCI channel now all channels are active or disabled. Now both end could call it. It will disable or enable flow control at caller side and remote side.
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'm really not sold on the manual API...
The CMUX instance knows the state of all buffers, its TX buffer, the CMUX RX buffer, and every DLCI RX buffer. CMUX defines two types of flow control, the flow control messages FCOFF
and FCON
, and individual channel flow control through MSC
. We know we need to disable flow control for all channels if the CMUX RX buffer nears full, and we know the same for each DLCI RX buffer, so we really should be handling it automatically from within the CMUX instance.
Flow control should probably be its own PR, or at least its own commit, and should be handled internally. Its the simplest and most scalable solution.
dc52acf
to
b77808f
Compare
I update test with your comment's and added some extra verfify for test_modem_cmux_disconnect_connect_sync() and test_modem_cmux_dlci_close_open_sync() test cases for DCE. |
e21f323
to
1b54fc7
Compare
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 suggest you move flow control out into its own PR, it should be handled internally by CMUX. The DCE additions and test case look excellent :)
include/zephyr/modem/cmux.h
Outdated
* @return -EPIPE CMUX control channel is not open. | ||
* @return -EALREADY Ongoing flow control request. | ||
*/ | ||
int modem_cmux_flow_ctrl_set_asynch(struct modem_cmux *cmux, bool state); |
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'm really not sold on the manual API...
The CMUX instance knows the state of all buffers, its TX buffer, the CMUX RX buffer, and every DLCI RX buffer. CMUX defines two types of flow control, the flow control messages FCOFF
and FCON
, and individual channel flow control through MSC
. We know we need to disable flow control for all channels if the CMUX RX buffer nears full, and we know the same for each DLCI RX buffer, so we really should be handling it automatically from within the CMUX instance.
Flow control should probably be its own PR, or at least its own commit, and should be handled internally. Its the simplest and most scalable solution.
1b54fc7
to
b7ba18f
Compare
@bjarki-trackunit Thanks for review. I remove Flow Control API and functionality. I have updated PR. |
Nice, I will re-review later today |
I will spend some time tomorrow as well, I'm fairly certain the changes to fcon and fcoff are not necessary, I will need to look more into it locally :) |
b7ba18f
to
b828d0e
Compare
@bjarki-trackunit Please review. I have put flow control to original format back. |
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.
Tested the changes locally and it behaves as expected :) There is one spelling mistake, when that is fixed we are good to go :)
subsys/modem/modem_cmux.c
Outdated
@@ -435,6 +446,40 @@ static void modem_cmux_on_control_frame_uih(struct modem_cmux *cmux) | |||
} | |||
} | |||
|
|||
static void modem_cmux_conect_response_transmit(struct modem_cmux *cmux) |
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.
Should be _connect_
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 will be fix this after my bicycle ride. Thanks
Added missing command and message handling for use existing modem cmux for DCE role. DCE CMUX connection can be now initialized from DTE side. Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Added possibility for link 2 modem mock instance for validating P2P communication without any data stubbing. Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
Added unite test for for validate modem CMUX DTE & DCE role communication together. Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
b828d0e
to
f4c5944
Compare
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.
Nice work :)
Modem cmux update
Modem test update