-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/esp_netif_ppp_opts' into 'master'
feat(esp_netif): PPP netif extend config/use RAM pbufs Closes IDFGH-10017 See merge request espressif/esp-idf!26057
- Loading branch information
Showing
6 changed files
with
85 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2001-2004 Swedish Institute of Computer Science | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* | ||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD | ||
*/ | ||
#include "pppif.h" | ||
#include "lwip/tcpip.h" | ||
|
||
/* | ||
* Similar to pppos_input_tcpip() from lwip's ppp netif, but instead | ||
* of PBUF_POOL, we use PBUF_RAM type of the pbuf we pass to the stack | ||
*/ | ||
err_t pppos_input_tcpip_as_ram_pbuf(ppp_pcb *ppp, u8_t *s, int l) | ||
{ | ||
struct pbuf *p = pbuf_alloc(PBUF_RAW, l, PBUF_RAM); | ||
if (!p) { | ||
return ERR_MEM; | ||
} | ||
pbuf_take(p, s, l); | ||
|
||
err_t err = tcpip_inpkt(p, ppp_netif(ppp), pppos_input_sys); | ||
if (err != ERR_OK) { | ||
pbuf_free(p); | ||
} | ||
return err; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2001-2004 Swedish Institute of Computer Science | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* | ||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD | ||
*/ | ||
#include "lwip/pbuf.h" | ||
#include "netif/ppp/pppos.h" | ||
|
||
/** Pass received raw characters to PPPoS to be decoded through lwIP TCPIP thread. | ||
* | ||
* This function uses allocated packet buffers of exact size for input to TCP/IP stack | ||
* to consume less memory in download mode, compared to the pppos_input_tcpip() from lwIP. | ||
* (original implementation uses `PBUF_POOL`, which on ESP port uses standard malloc | ||
* to allocate a fixed size pbuf) | ||
* | ||
* @param ppp PPP descriptor index, returned by pppos_create() | ||
* @param s received data | ||
* @param l length of received data | ||
*/ | ||
err_t pppos_input_tcpip_as_ram_pbuf(ppp_pcb *ppp, u8_t *s, int l); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters