FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

PBUF_RAM allocation allows configuration of MARGIN_LEN · RT-Thread/rt-thread@562db38 · GitHub

Commit 562db38

Browse files
committed
PBUF_RAM allocation allows configuration of MARGIN_LEN
1 parent 9580afd commit 562db38

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • components/net/lwip/lwip-2.1.2/src/core

‎components/net/lwip/lwip-2.1.2/src/core/pbuf.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
271271
break;
272272
}
273273
case PBUF_RAM: {
274-
u16_t payload_len = (u16_t)(LWIP_MEM_ALIGN_SIZE(offset) + LWIP_MEM_ALIGN_SIZE(length));
274+
mem_size_t payload_len = (mem_size_t)(LWIP_MEM_ALIGN_SIZE(offset) + LWIP_MEM_ALIGN_SIZE(length));
275+
#if PBUF_PAYLOAD_MARGIN_LEN > 0
276+
payload_len += LWIP_MEM_ALIGN_SIZE(PBUF_PAYLOAD_MARGIN_LEN);
277+
#endif
275278
mem_size_t alloc_len = (mem_size_t)(LWIP_MEM_ALIGN_SIZE(SIZEOF_STRUCT_PBUF) + payload_len);
276279

277280
/* bug #50040: Check for integer overflow when calculating alloc_len */

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL