From c2a5480ac7c55674928c4391a3f3d24e84ec321c Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Thu, 4 Aug 2016 23:52:54 +0200 Subject: [PATCH] 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. --- src/include/netif/ppp/ppp_impl.h | 3 --- src/netif/ppp/ppp.c | 10 +++------- src/netif/ppp/pppoe.c | 2 -- src/netif/ppp/pppol2tp.c | 2 -- src/netif/ppp/pppos.c | 2 -- 5 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h index 1b27415f..8c60fef9 100644 --- a/src/include/netif/ppp/ppp_impl.h +++ b/src/include/netif/ppp/ppp_impl.h @@ -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); diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 96bcd8b1..02b90f25 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -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)); diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index 26220ffe..d3b6c9cf 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -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; diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index 877f84dc..3a681254 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -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; diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 006971d9..69ed80e9 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -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));