mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 03:32:50 +00:00
PPP: remove PPP_USE_PBUF_RAM configuration option
Having it configurable does not really make sense anymore, we already need PBUF_RAM in all transmit paths. There are no real reason to keep allocating PPP response buffers from the PBUF_POOL which should be now reserved for receive paths only.
This commit is contained in:
parent
012fadd77f
commit
39cb84466d
@ -60,16 +60,10 @@ extern "C" {
|
||||
/*
|
||||
* Memory used for control packets.
|
||||
*
|
||||
* PPP_CTRL_PBUF_MAX_SIZE is the amount of memory we allocate when we
|
||||
* PPP_CTRL_PBUF_UNKNOWN_SIZE is the amount of memory we allocate when we
|
||||
* cannot figure out how much we are going to use before filling the buffer.
|
||||
*/
|
||||
#if PPP_USE_PBUF_RAM
|
||||
#define PPP_CTRL_PBUF_TYPE PBUF_RAM
|
||||
#define PPP_CTRL_PBUF_MAX_SIZE 512
|
||||
#else /* PPP_USE_PBUF_RAM */
|
||||
#define PPP_CTRL_PBUF_TYPE PBUF_POOL
|
||||
#define PPP_CTRL_PBUF_MAX_SIZE PBUF_POOL_BUFSIZE
|
||||
#endif /* PPP_USE_PBUF_RAM */
|
||||
#define PPP_CTRL_PBUF_UNKNOWN_SIZE 512
|
||||
|
||||
/*
|
||||
* The basic PPP frame.
|
||||
|
@ -184,20 +184,6 @@
|
||||
#define PPP_NOTIFY_PHASE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* pbuf_type PPP is using for LCP, PAP, CHAP, EAP, CCP, IPCP and IP6CP packets.
|
||||
*
|
||||
* Memory allocated must be single buffered for PPP to works, it requires pbuf
|
||||
* that are not going to be chained when allocated. This requires setting
|
||||
* PBUF_POOL_BUFSIZE to at least 512 bytes, which is quite huge for small systems.
|
||||
*
|
||||
* Setting PPP_USE_PBUF_RAM to 1 makes PPP use memory from heap where buffers are
|
||||
* continuous by design, allowing you to use a smaller PBUF_POOL_BUFSIZE.
|
||||
*/
|
||||
#ifndef PPP_USE_PBUF_RAM
|
||||
#define PPP_USE_PBUF_RAM 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* PPP_FCS_TABLE: Keep a 256*2 byte table to speed up FCS calculation for PPPoS
|
||||
*/
|
||||
|
@ -236,7 +236,7 @@ static void chap_timeout(void *arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(pcb->chap_server.challenge_pktlen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(pcb->chap_server.challenge_pktlen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -345,7 +345,7 @@ static void chap_handle_response(ppp_pcb *pcb, int id,
|
||||
/* send the response */
|
||||
mlen = strlen(message);
|
||||
len = CHAP_HDRLEN + mlen;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +len), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +len), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -441,7 +441,7 @@ static void chap_respond(ppp_pcb *pcb, int id,
|
||||
char rname[MAXNAMELEN+1];
|
||||
char secret[MAXSECRETLEN+1];
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(RESP_MAX_PKTLEN), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(RESP_MAX_PKTLEN), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
|
@ -251,7 +251,7 @@ static void eap_send_failure(ppp_pcb *pcb) {
|
||||
struct pbuf *p;
|
||||
u_char *outp;
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -282,7 +282,7 @@ static void eap_send_success(ppp_pcb *pcb) {
|
||||
struct pbuf *p;
|
||||
u_char *outp;
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -683,7 +683,7 @@ static void eap_send_request(ppp_pcb *pcb) {
|
||||
return;
|
||||
}
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_CTRL_PBUF_MAX_SIZE), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_CTRL_PBUF_UNKNOWN_SIZE), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -1018,7 +1018,7 @@ static void eap_send_response(ppp_pcb *pcb, u_char id, u_char typenum, const u_c
|
||||
int msglen;
|
||||
|
||||
msglen = EAP_HEADERLEN + sizeof (u_char) + lenstr;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -1052,7 +1052,7 @@ static void eap_chap_response(ppp_pcb *pcb, u_char id, u_char *hash, const char
|
||||
|
||||
msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + MD5_SIGNATURE_SIZE +
|
||||
namelen;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -1097,7 +1097,7 @@ int lenstr;
|
||||
int msglen;
|
||||
|
||||
msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + lenstr;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -1139,7 +1139,7 @@ u_char *str;
|
||||
|
||||
msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + sizeof (u32_t) +
|
||||
SHA_DIGESTSIZE;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -1170,7 +1170,7 @@ static void eap_send_nak(ppp_pcb *pcb, u_char id, u_char type) {
|
||||
int msglen;
|
||||
|
||||
msglen = EAP_HEADERLEN + 2 * sizeof (u_char);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
|
@ -735,7 +735,7 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
|
||||
} else
|
||||
cilen = 0;
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(cilen + HEADERLEN + PPP_HDRLEN), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(cilen + HEADERLEN + PPP_HDRLEN), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -778,7 +778,7 @@ void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen)
|
||||
datalen = pcb->peer_mru - HEADERLEN;
|
||||
outlen = datalen + HEADERLEN;
|
||||
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(outlen + PPP_HDRLEN), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(outlen + PPP_HDRLEN), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
|
@ -1843,7 +1843,7 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) {
|
||||
* Process all his options.
|
||||
*/
|
||||
next = inp;
|
||||
nakp = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_CTRL_PBUF_MAX_SIZE), PPP_CTRL_PBUF_TYPE);
|
||||
nakp = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_CTRL_PBUF_UNKNOWN_SIZE), PBUF_RAM);
|
||||
if(NULL == nakp)
|
||||
return 0;
|
||||
if(nakp->tot_len != nakp->len) {
|
||||
|
@ -533,7 +533,7 @@ static void upap_sauthreq(ppp_pcb *pcb) {
|
||||
|
||||
outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) +
|
||||
pcb->upap.us_userlen + pcb->upap.us_passwdlen;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
@ -570,7 +570,7 @@ static void upap_sresp(ppp_pcb *pcb, u_char code, u_char id, const char *msg, in
|
||||
int outlen;
|
||||
|
||||
outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen;
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PPP_CTRL_PBUF_TYPE);
|
||||
p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PBUF_RAM);
|
||||
if(NULL == p)
|
||||
return;
|
||||
if(p->tot_len != p->len) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user