esp_modem: Fixed race condition on exiting PPP mode
esp_modem_stop_ppp() stops both ppp netif and switches the modem back to command mode. IF these two actions are not synchronised, we might experience issues of * active PPP session trying to send/receive uart-data * command mode already active before modem switched to it both resulting in crashes. Fixed by introducing the transition mode and running these actions in sequence * set esp-modem to transition mode * enter command mode, wait for the reply or re-sync * close the PPP netif * wait until the netif closes Other fixes include ignoring certain events if modem component not ready or not in appropriate mode: * ignoring all UART events comming from DTE with no DCE attached * ignore pattern detection in PPP mode Closes https://github.com/espressif/esp-idf/issues/6013 Closes https://github.com/espressif/esp-idf/issues/5737 Closes https://github.com/espressif/esp-idf/issues/6024 Closes https://github.com/espressif/esp-idf/issues/6058 Closes https://github.com/espressif/esp-idf/issues/5563 Closes https://github.com/espressif/esp-idf/issues/5695 Closes https://github.com/espressif/esp-idf/issues/5633 Closes https://github.com/espressif/esp-idf/issues/4482 Related https://github.com/espressif/esp-idf/pull/4849 Related https://github.com/espressif/esp-idf/pull/4653
This commit is contained in:
@@ -158,6 +158,17 @@ esp_err_t esp_modem_stop_ppp(modem_dte_t *dte);
|
||||
*/
|
||||
esp_err_t esp_modem_set_rx_cb(modem_dte_t *dte, esp_modem_on_receive receive_cb, void *receive_cb_ctx);
|
||||
|
||||
/**
|
||||
* @brief Notify the modem, that ppp netif has closed
|
||||
*
|
||||
* @note This API should only be used internally by the modem-netif layer
|
||||
*
|
||||
* @param dte ESP Modem DTE object
|
||||
*
|
||||
* @return ESP_OK on success
|
||||
*/
|
||||
esp_err_t esp_modem_notify_ppp_netif_closed(modem_dte_t *dte);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,9 @@ typedef struct modem_dce modem_dce_t;
|
||||
*/
|
||||
typedef enum {
|
||||
MODEM_COMMAND_MODE = 0, /*!< Command Mode */
|
||||
MODEM_PPP_MODE /*!< PPP Mode */
|
||||
MODEM_PPP_MODE, /*!< PPP Mode */
|
||||
MODEM_TRANSITION_MODE /*!< Transition Mode between data and command mode indicating that
|
||||
the modem is not yet ready for sending commands nor data */
|
||||
} modem_mode_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user