|
|
|
|
@ -177,7 +177,7 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno,
|
|
|
|
|
u8_t optlen = LWIP_TCP_OPT_LENGTH(optflags); |
|
|
|
|
|
|
|
|
|
if ((seg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG)) == NULL) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_create_segment: no memory.\n")); |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_create_segment: no memory.\n")); |
|
|
|
|
pbuf_free(p); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
@ -199,7 +199,7 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno,
|
|
|
|
|
|
|
|
|
|
/* build TCP header */ |
|
|
|
|
if (pbuf_header(p, TCP_HLEN)) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_create_segment: no room for TCP header in pbuf.\n")); |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_create_segment: no room for TCP header in pbuf.\n")); |
|
|
|
|
TCP_STATS_INC(tcp.err); |
|
|
|
|
tcp_seg_free(seg); |
|
|
|
|
return NULL; |
|
|
|
|
@ -495,7 +495,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
|
|
|
|
if (apiflags & TCP_WRITE_FLAG_COPY) { |
|
|
|
|
/* Data is copied */ |
|
|
|
|
if ((concat_p = tcp_pbuf_prealloc(PBUF_RAW, seglen, space, &oversize, pcb, apiflags, 1)) == NULL) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, |
|
|
|
|
("tcp_write : could not allocate memory for pbuf copy size %"U16_F"\n", |
|
|
|
|
seglen)); |
|
|
|
|
goto memerr; |
|
|
|
|
@ -510,7 +510,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
|
|
|
|
} else { |
|
|
|
|
/* Data is not copied */ |
|
|
|
|
if ((concat_p = pbuf_alloc(PBUF_RAW, seglen, PBUF_ROM)) == NULL) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, |
|
|
|
|
("tcp_write: could not allocate memory for zero-copy pbuf\n")); |
|
|
|
|
goto memerr; |
|
|
|
|
} |
|
|
|
|
@ -554,7 +554,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
|
|
|
|
/* If copy is set, memory should be allocated and data copied
|
|
|
|
|
* into pbuf */ |
|
|
|
|
if ((p = tcp_pbuf_prealloc(PBUF_TRANSPORT, seglen + optlen, mss_local, &oversize, pcb, apiflags, queue == NULL)) == NULL) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write : could not allocate memory for pbuf copy size %"U16_F"\n", seglen)); |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write : could not allocate memory for pbuf copy size %"U16_F"\n", seglen)); |
|
|
|
|
goto memerr; |
|
|
|
|
} |
|
|
|
|
LWIP_ASSERT("tcp_write: check that first pbuf can hold the complete seglen", |
|
|
|
|
@ -571,7 +571,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
|
|
|
|
LWIP_ASSERT("oversize == 0", oversize == 0); |
|
|
|
|
#endif /* TCP_OVERSIZE */ |
|
|
|
|
if ((p2 = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write: could not allocate memory for zero-copy pbuf\n")); |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: could not allocate memory for zero-copy pbuf\n")); |
|
|
|
|
goto memerr; |
|
|
|
|
} |
|
|
|
|
#if TCP_CHECKSUM_ON_COPY |
|
|
|
|
@ -590,7 +590,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
|
|
|
|
/* If allocation fails, we have to deallocate the data pbuf as
|
|
|
|
|
* well. */ |
|
|
|
|
pbuf_free(p2); |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write: could not allocate memory for header pbuf\n")); |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: could not allocate memory for header pbuf\n")); |
|
|
|
|
goto memerr; |
|
|
|
|
} |
|
|
|
|
/* Concatenate the headers and data pbufs together. */ |
|
|
|
|
@ -603,7 +603,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
|
|
|
|
|
* length of the queue exceeds the configured maximum or |
|
|
|
|
* overflows. */ |
|
|
|
|
if ((queuelen > TCP_SND_QUEUELEN) || (queuelen > TCP_SNDQUEUELEN_OVERFLOW)) { |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write: queue too long %"U16_F" (%d)\n", |
|
|
|
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: queue too long %"U16_F" (%d)\n", |
|
|
|
|
queuelen, (int)TCP_SND_QUEUELEN)); |
|
|
|
|
pbuf_free(p); |
|
|
|
|
goto memerr; |
|
|
|
|
|