mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-16 18:03:44 +08:00
arp/ndp: allow overriding the decision to copy pbufs
lwIP aims to support zero-copy TX, and thus, must internally handle all cases that pbufs are referenced rather than copied upon low-level output. However, in the current situation, the arp/ndp packet queuing routines conservatively copy entire packets, even when unnecessary in cases where lwIP is used in a zero-copy compliant manner. This patch moves the decision whether to copy into a centralized macro, allowing zero-copy compliant applications to override the macro to avoid the unnecessary copies. The macro defaults to the safe behavior, though.
This commit is contained in:
committed by
goldsimon
parent
27c835aa56
commit
d3fc398580
@@ -2034,12 +2034,11 @@ nd6_queue_packet(s8_t neighbor_index, struct pbuf *q)
|
||||
return ERR_ARG;
|
||||
}
|
||||
|
||||
/* IF q includes a PBUF_REF, PBUF_POOL or PBUF_RAM, we have no choice but
|
||||
* to copy the whole queue into a new PBUF_RAM (see bug #11400)
|
||||
* PBUF_ROMs can be left as they are, since ROM must not get changed. */
|
||||
/* IF q includes a pbuf that must be copied, we have to copy the whole chain
|
||||
* into a new PBUF_RAM. See the definition of PBUF_NEEDS_COPY for details. */
|
||||
p = q;
|
||||
while (p) {
|
||||
if (p->type != PBUF_ROM) {
|
||||
if (PBUF_NEEDS_COPY(p)) {
|
||||
copy_needed = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user