diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 3c528a09..13a961d2 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1917,11 +1917,21 @@ /** * PPP_INPROC_MULTITHREADED==1 call ppp_input() using tcpip_callback(). - * Set this to 0 if pppos_input() is called inside tcpip_thread or with NO_SYS==1. - * Default is 1 for NO_SYS==0 (multithreaded) and 0 for NO_SYS==1 (single-threaded). + * + * Set this to 0 in the following cases: + * - pppos_input() is called from the main loop and NO_SYS==1 + * - you are using tcpip_input() (NO_SYS==0) on PPP data input + * + * Otherwise, if pppos_input() is called outside lwIP context (IRQ) + * set this to 1. + * + * CAUTION: if set to 1, you should NEVER call pppos_connect(), pppos_listen() + * and ppp_free() if pppos_input() can still be running, doing this is not + * thread safe. You should also avoid calling pppos_input() if PPPoS session + * is not started yet. */ #ifndef PPP_INPROC_MULTITHREADED -#define PPP_INPROC_MULTITHREADED (NO_SYS==0) +#define PPP_INPROC_MULTITHREADED 0 #endif /** diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 2dce3403..bb4badb3 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -556,8 +556,14 @@ PACK_STRUCT_END #endif #endif /* PPP_INPROC_MULTITHREADED */ -/** Pass received raw characters to PPPoS to be decoded. This function is - * thread-safe and can be called from a dedicated RX-thread or from a main-loop. +/** Pass received raw characters to PPPoS to be decoded. + * + * This function is thread-safe if PPP_INPROC_MULTITHREADED is set to 1 + * and can be called from a dedicated RX-thread or from interrupt context + * BUT you should NEVER call pppos_connect(), pppos_listen() + * and ppp_free() if pppos_input() can still be running, doing this is not + * thread safe. You should also avoid calling pppos_input() if PPPoS session + * is not started yet. * * @param pcb PPP descriptor index, returned by ppp_new() * @param data received data