mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
PPP, PPPoS: use PBUF_RAM in transmit pathway
Allocate Tx chunk in PBUF_RAM, using PBUF_POOL_BUFSIZE as a great chosen value for chunk size.
This commit is contained in:
parent
3779cf7856
commit
7c0c3879b2
@ -207,10 +207,9 @@ pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p)
|
|||||||
err_t err;
|
err_t err;
|
||||||
LWIP_UNUSED_ARG(ppp);
|
LWIP_UNUSED_ARG(ppp);
|
||||||
|
|
||||||
/* Grab an output buffer. Using PBUF_POOL here for tx is ok since the pbuf
|
/* Grab an output buffer. Assume PBUF_POOL_BUFSIZE is an acceptable
|
||||||
gets freed by 'pppos_output_last' before this function returns and thus
|
* chunk size for Tx as well. */
|
||||||
cannot starve rx. */
|
nb = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, PBUF_RAM);
|
||||||
nb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
|
|
||||||
if (nb == NULL) {
|
if (nb == NULL) {
|
||||||
PPPDEBUG(LOG_WARNING, ("pppos_write[%d]: alloc fail\n", ppp->netif->num));
|
PPPDEBUG(LOG_WARNING, ("pppos_write[%d]: alloc fail\n", ppp->netif->num));
|
||||||
LINK_STATS_INC(link.memerr);
|
LINK_STATS_INC(link.memerr);
|
||||||
@ -220,6 +219,8 @@ pppos_write(ppp_pcb *ppp, void *ctx, struct pbuf *p)
|
|||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Empty the buffer */
|
||||||
|
nb->len = 0;
|
||||||
/* Set nb->tot_len to actual payload length */
|
/* Set nb->tot_len to actual payload length */
|
||||||
nb->tot_len = p->len;
|
nb->tot_len = p->len;
|
||||||
|
|
||||||
@ -258,10 +259,9 @@ pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u16_t protocol)
|
|||||||
err_t err;
|
err_t err;
|
||||||
LWIP_UNUSED_ARG(ppp);
|
LWIP_UNUSED_ARG(ppp);
|
||||||
|
|
||||||
/* Grab an output buffer. Using PBUF_POOL here for tx is ok since the pbuf
|
/* Grab an output buffer. Assume PBUF_POOL_BUFSIZE is an acceptable
|
||||||
gets freed by 'pppos_output_last' before this function returns and thus
|
* chunk size for Tx as well. */
|
||||||
cannot starve rx. */
|
nb = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, PBUF_RAM);
|
||||||
nb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
|
|
||||||
if (nb == NULL) {
|
if (nb == NULL) {
|
||||||
PPPDEBUG(LOG_WARNING, ("pppos_netif_output[%d]: alloc fail\n", ppp->netif->num));
|
PPPDEBUG(LOG_WARNING, ("pppos_netif_output[%d]: alloc fail\n", ppp->netif->num));
|
||||||
LINK_STATS_INC(link.memerr);
|
LINK_STATS_INC(link.memerr);
|
||||||
@ -270,6 +270,8 @@ pppos_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *pb, u16_t protocol)
|
|||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Empty the buffer */
|
||||||
|
nb->len = 0;
|
||||||
/* Set nb->tot_len to actual payload length */
|
/* Set nb->tot_len to actual payload length */
|
||||||
nb->tot_len = pb->tot_len;
|
nb->tot_len = pb->tot_len;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user