PPP: remove ppp_singlebuf

We don't have to keep a helper function just for the sake of a PBUF_RAW
constant. Inline ppp_singlebuf function.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
This commit is contained in:
Sylvain Rochet 2017-05-05 15:42:06 +02:00
parent 3e909bafa8
commit 4171f39a72
4 changed files with 3 additions and 11 deletions

View File

@ -406,9 +406,6 @@ void ppp_link_end(ppp_pcb *pcb);
/* function called to process input packet */ /* function called to process input packet */
void ppp_input(ppp_pcb *pcb, struct pbuf *pb); void ppp_input(ppp_pcb *pcb, struct pbuf *pb);
/* helper function, merge a pbuf chain into one pbuf */
struct pbuf *ppp_singlebuf(struct pbuf *p);
/* /*
* Functions called by PPP protocols. * Functions called by PPP protocols.

View File

@ -923,7 +923,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
*/ */
for (i = 0; (protp = protocols[i]) != NULL; ++i) { for (i = 0; (protp = protocols[i]) != NULL; ++i) {
if (protp->protocol == protocol) { if (protp->protocol == protocol) {
pb = ppp_singlebuf(pb); pb = pbuf_coalesce(pb, PBUF_RAW);
(*protp->input)(pcb, (u8_t*)pb->payload, pb->len); (*protp->input)(pcb, (u8_t*)pb->payload, pb->len);
goto out; goto out;
} }
@ -971,11 +971,6 @@ out:
pbuf_free(pb); pbuf_free(pb);
} }
/* merge a pbuf chain into one pbuf */
struct pbuf *ppp_singlebuf(struct pbuf *p) {
return pbuf_coalesce(p, PBUF_RAW);
}
/* /*
* Write a pbuf to a ppp link, only used from PPP functions * Write a pbuf to a ppp link, only used from PPP functions
* to send PPP packets. * to send PPP packets.

View File

@ -394,7 +394,7 @@ pppoe_disc_input(struct netif *netif, struct pbuf *pb)
return; return;
} }
pb = ppp_singlebuf(pb); pb = pbuf_coalesce(pb, PBUF_RAW);
if (pb->len < sizeof(*ethhdr)) { if (pb->len < sizeof(*ethhdr)) {
goto done; goto done;

View File

@ -507,7 +507,7 @@ static void pppol2tp_dispatch_control_packet(pppol2tp_pcb *l2tp, u16_t port, str
return; return;
} }
p = ppp_singlebuf(p); p = pbuf_coalesce(p, PBUF_RAW);
inp = (u8_t*)p->payload; inp = (u8_t*)p->payload;
/* Decode AVPs */ /* Decode AVPs */
while (p->len > 0) { while (p->len > 0) {