PPP: remove useless ppp_link_start function

This function only set PPP to initialize phase, and it is only called at
the very beginning of functions where it is called. It means we could
as well set the initialize phase before calling those functions in the
PPP core.
This commit is contained in:
Sylvain Rochet 2016-08-04 23:52:54 +02:00
parent 01561b26ef
commit c2a5480ac7
5 changed files with 3 additions and 16 deletions

View File

@ -394,9 +394,6 @@ int ppp_init(void);
ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, void *link_ctx_cb,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
/* Called when link is starting */
void ppp_link_start(ppp_pcb *pcb);
/* Initiate LCP open request */
void ppp_start(ppp_pcb *pcb);

View File

@ -276,6 +276,7 @@ err_t ppp_connect(ppp_pcb *pcb, u16_t holdoff) {
PPPDEBUG(LOG_DEBUG, ("ppp_connect[%d]: holdoff=%d\n", pcb->netif->num, holdoff));
if (holdoff == 0) {
new_phase(pcb, PPP_PHASE_INITIALIZE);
return pcb->link_cb->connect(pcb, pcb->link_ctx_cb);
}
@ -301,6 +302,7 @@ err_t ppp_listen(ppp_pcb *pcb) {
PPPDEBUG(LOG_DEBUG, ("ppp_listen[%d]\n", pcb->netif->num));
if (pcb->link_cb->listen) {
new_phase(pcb, PPP_PHASE_INITIALIZE);
return pcb->link_cb->listen(pcb, pcb->link_ctx_cb);
}
return ERR_IF;
@ -432,6 +434,7 @@ static void ppp_do_connect(void *arg) {
LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF", pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF);
new_phase(pcb, PPP_PHASE_INITIALIZE);
pcb->link_cb->connect(pcb, pcb->link_ctx_cb);
}
@ -705,13 +708,6 @@ ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, vo
return pcb;
}
/** Called when link is starting */
void ppp_link_start(ppp_pcb *pcb) {
LWIP_ASSERT("pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF", pcb->phase == PPP_PHASE_DEAD || pcb->phase == PPP_PHASE_HOLDOFF);
PPPDEBUG(LOG_DEBUG, ("ppp_link_start[%d]\n", pcb->netif->num));
new_phase(pcb, PPP_PHASE_INITIALIZE);
}
/** Initiate LCP open request */
void ppp_start(ppp_pcb *pcb) {
PPPDEBUG(LOG_DEBUG, ("ppp_start[%d]\n", pcb->netif->num));

View File

@ -912,8 +912,6 @@ pppoe_connect(ppp_pcb *ppp, void *ctx)
}
#endif
ppp_link_start(ppp);
lcp_wo = &ppp->lcp_wantoptions;
lcp_wo->mru = sc->sc_ethif->mtu-PPPOE_HEADERLEN-2; /* two byte PPP protocol discriminator, then IP data */
lcp_wo->neg_asyncmap = 0;

View File

@ -264,8 +264,6 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
pppol2tp_clear(l2tp);
ppp_link_start(ppp);
lcp_wo = &ppp->lcp_wantoptions;
lcp_wo->mru = PPPOL2TP_DEFMRU;
lcp_wo->neg_asyncmap = 0;

View File

@ -309,7 +309,6 @@ pppos_connect(ppp_pcb *ppp, void *ctx)
pppos_input_free_current_packet(pppos);
#endif /* PPP_INPROC_IRQ_SAFE */
ppp_link_start(ppp);
/* reset PPPoS control block to its initial state */
memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - offsetof(pppos_pcb, last_xmit));
@ -343,7 +342,6 @@ pppos_listen(ppp_pcb *ppp, void *ctx)
pppos_input_free_current_packet(pppos);
#endif /* PPP_INPROC_IRQ_SAFE */
ppp_link_start(ppp);
/* reset PPPoS control block to its initial state */
memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - offsetof(pppos_pcb, last_xmit));