@@ -286,7 +286,7 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno,
286286 */
287287static struct pbuf *
288288tcp_pbuf_prealloc (u16_t length , u16_t max_length ,
289- u16_t * oversize , struct tcp_pcb * pcb , u8_t tcp_write_flag_more ,
289+ u16_t * oversize , struct tcp_pcb * pcb , pbuf_type type , u8_t tcp_write_flag_more ,
290290 u8_t first_seg )
291291{
292292 struct pbuf * p ;
@@ -310,7 +310,7 @@ tcp_pbuf_prealloc(u16_t length, u16_t max_length,
310310 alloc = LWIP_MIN (max_length , LWIP_MEM_ALIGN_SIZE (length + pcb -> tcp_oversize_val ));
311311 }
312312 }
313- p = tcp_tx_pbuf_alloc (pcb , alloc , PBUF_RAM );
313+ p = tcp_tx_pbuf_alloc (pcb , alloc , type );
314314 if (p == NULL ) {
315315 return NULL ;
316316 }
@@ -440,6 +440,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u32_t len, u8_t apiflags)
440440 struct iovec piov [piov_max_size ];
441441 int piov_cur_index = 0 ;
442442 int piov_cur_len = 0 ;
443+ pbuf_type type = PBUF_RAM ;
443444
444445 int byte_queued = pcb -> snd_nxt - pcb -> lastack ;
445446 if ( len < pcb -> mss && !(apiflags & TCP_WRITE_DUMMY ))
@@ -567,7 +568,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u32_t len, u8_t apiflags)
567568 * can use PBUF_RAW here since the data appears in the middle of
568569 * a segment. A header will never be prepended. */
569570 /* Data is copied */
570- if ((concat_p = tcp_pbuf_prealloc (seglen , space , & oversize , pcb , TCP_WRITE_FLAG_MORE , 1 )) == NULL ) {
571+ if ((concat_p = tcp_pbuf_prealloc (seglen , space , & oversize , pcb , type , TCP_WRITE_FLAG_MORE , 1 )) == NULL ) {
571572 LWIP_DEBUGF (TCP_OUTPUT_DEBUG | 2 ,
572573 ("tcp_write : could not allocate memory for pbuf copy size %" U16_F "\n" ,
573574 seglen ));
@@ -606,7 +607,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u32_t len, u8_t apiflags)
606607
607608 /* If copy is set, memory should be allocated and data copied
608609 * into pbuf */
609- if ((p = tcp_pbuf_prealloc (seglen + optlen , max_len , & oversize , pcb , TCP_WRITE_FLAG_MORE , queue == NULL )) == NULL ) {
610+ if ((p = tcp_pbuf_prealloc (seglen + optlen , max_len , & oversize , pcb , type , TCP_WRITE_FLAG_MORE , queue == NULL )) == NULL ) {
610611 LWIP_DEBUGF (TCP_OUTPUT_DEBUG | 2 , ("tcp_write : could not allocate memory for pbuf copy size %" U16_F "\n" , seglen ));
611612 goto memerr ;
612613 }
@@ -1058,6 +1059,7 @@ tcp_split_one_segment(struct tcp_pcb *pcb, struct tcp_seg *seg, u32_t lentosend,
10581059 struct pbuf * cur_p = NULL ;
10591060 u16_t max_length = 0 ;
10601061 u16_t oversize = 0 ;
1062+ pbuf_type type = PBUF_RAM ;
10611063
10621064 cur_seg = seg ;
10631065 max_length = cur_seg -> p -> len ;
@@ -1066,7 +1068,7 @@ tcp_split_one_segment(struct tcp_pcb *pcb, struct tcp_seg *seg, u32_t lentosend,
10661068 u32_t lentoqueue = cur_seg -> len - lentosend ;
10671069
10681070 /* Allocate memory for p_buf and fill in fields. */
1069- if (NULL == (cur_p = tcp_pbuf_prealloc (lentoqueue + optlen , max_length , & oversize , pcb , 0 , 0 ))) {
1071+ if (NULL == (cur_p = tcp_pbuf_prealloc (lentoqueue + optlen , max_length , & oversize , pcb , type , 0 , 0 ))) {
10701072 LWIP_DEBUGF (TCP_OUTPUT_DEBUG | 2 , ("tcp_split_one_segment: could not allocate memory for pbuf copy size %" U16_F "\n" , (lentoqueue + optlen )));
10711073 goto out ;
10721074 }
@@ -1264,6 +1266,7 @@ tcp_split_segment(struct tcp_pcb *pcb, struct tcp_seg *seg, u32_t wnd)
12641266 u16_t oversize = 0 ;
12651267 u8_t optlen = 0 , optflags = 0 ;
12661268 u16_t mss_local = 0 ;
1269+ pbuf_type type = PBUF_RAM ;
12671270
12681271 LWIP_ASSERT ("tcp_split_segment: sanity check" , (seg && seg -> p ));
12691272
@@ -1294,7 +1297,7 @@ tcp_split_segment(struct tcp_pcb *pcb, struct tcp_seg *seg, u32_t wnd)
12941297 if (seg -> p -> len > ((TCP_HLEN + optlen ) + lentosend )) {/* First buffer is too big, split it */
12951298 u32_t lentoqueue = seg -> p -> len - (TCP_HLEN + optlen ) - lentosend ;
12961299
1297- if (NULL == (p = tcp_pbuf_prealloc (lentoqueue + optlen , mss_local , & oversize , pcb , 0 , 0 ))) {
1300+ if (NULL == (p = tcp_pbuf_prealloc (lentoqueue + optlen , mss_local , & oversize , pcb , type , 0 , 0 ))) {
12981301 LWIP_DEBUGF (TCP_OUTPUT_DEBUG | 2 , ("tcp_split_segment: could not allocate memory for pbuf copy size %" U16_F "\n" , (lentoqueue + optlen )));
12991302 return ;
13001303 }
0 commit comments