mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
Added the option PBUF_LINK_ENCAPSULATION_HLEN to allocate additional header space for TX on netifs requiring additional headers
This commit is contained in:
parent
e3e3200f95
commit
6ef7563f53
@ -6,6 +6,10 @@ HISTORY
|
||||
|
||||
++ New features:
|
||||
|
||||
2015-02-13: Simon Goldschmidt
|
||||
* opt.h, pbuf.h/.c, etharp.c: Added the option PBUF_LINK_ENCAPSULATION_HLEN to
|
||||
allocate additional header space for TX on netifs requiring additional headers
|
||||
|
||||
2015-02-12: chrysn
|
||||
* timers.h/.c: introduce sys_timeouts_sleeptime (returns the time left before
|
||||
the next timeout is due, for NO_SYS==1)
|
||||
|
@ -214,17 +214,22 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
||||
switch (layer) {
|
||||
case PBUF_TRANSPORT:
|
||||
/* add room for transport (often TCP) layer header */
|
||||
offset = PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN;
|
||||
offset = PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN;
|
||||
break;
|
||||
case PBUF_IP:
|
||||
/* add room for IP layer header */
|
||||
offset = PBUF_LINK_HLEN + PBUF_IP_HLEN;
|
||||
offset = PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN;
|
||||
break;
|
||||
case PBUF_LINK:
|
||||
/* add room for link layer header */
|
||||
offset = PBUF_LINK_HLEN;
|
||||
offset = PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN;
|
||||
break;
|
||||
case PBUF_RAW_TX:
|
||||
/* add room for encapsulating link layer headers (e.g. 802.11) */
|
||||
offset = PBUF_LINK_ENCAPSULATION_HLEN;
|
||||
break;
|
||||
case PBUF_RAW:
|
||||
/* no offset (e.g. RX buffers or chain successors) */
|
||||
offset = 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -1189,6 +1189,14 @@
|
||||
#endif /* LWIP_HOOK_VLAN_SET */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated
|
||||
* for an additional encapsulation header before ethernet headers (e.g. 802.11)
|
||||
*/
|
||||
#ifndef PBUF_LINK_ENCAPSULATION_HLEN
|
||||
#define PBUF_LINK_ENCAPSULATION_HLEN 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
|
||||
* designed to accommodate single full size TCP frame in one pbuf, including
|
||||
|
@ -60,6 +60,7 @@ typedef enum {
|
||||
PBUF_TRANSPORT,
|
||||
PBUF_IP,
|
||||
PBUF_LINK,
|
||||
PBUF_RAW_TX,
|
||||
PBUF_RAW
|
||||
} pbuf_layer;
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q)
|
||||
}
|
||||
if(copy_needed) {
|
||||
/* copy the whole packet into new pbufs */
|
||||
p = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
|
||||
p = pbuf_alloc(PBUF_RAW_TX, p->tot_len, PBUF_RAM);
|
||||
if(p != NULL) {
|
||||
if (pbuf_copy(p, q) != ERR_OK) {
|
||||
pbuf_free(p);
|
||||
@ -1240,7 +1240,7 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
||||
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||
|
||||
/* allocate a pbuf for the outgoing ARP request packet */
|
||||
p = pbuf_alloc(PBUF_RAW, SIZEOF_ETHARP_PACKET_TX, PBUF_RAM);
|
||||
p = pbuf_alloc(PBUF_RAW_TX, SIZEOF_ETHARP_PACKET_TX, PBUF_RAM);
|
||||
/* could allocate a pbuf for an ARP request? */
|
||||
if (p == NULL) {
|
||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS,
|
||||
|
Loading…
Reference in New Issue
Block a user