Removed 'dataptr' from 'struct tcp_seg' and calculate it in tcp_zero_window_probe (the only place where it was used).

This commit is contained in:
goldsimon 2011-03-27 12:56:16 +00:00
parent 3f849848a4
commit 4495516497
4 changed files with 7 additions and 11 deletions

View File

@ -13,6 +13,10 @@ HISTORY
++ New features: ++ New features:
2011-03-22: Simon Goldschmidt
* tcp_impl.h, tcp_in.c, tcp_out.c: Removed 'dataptr' from 'struct tcp_seg' and
calculate it in tcp_zero_window_probe (the only place where it was used).
2010-11-21: Simon Goldschmidt 2010-11-21: Simon Goldschmidt
* dhcp.c/.h: Added a function to deallocate the struct dhcp from a netif * dhcp.c/.h: Added a function to deallocate the struct dhcp from a netif
(fixes bug #31525). (fixes bug #31525).

View File

@ -291,7 +291,6 @@ tcp_input(struct pbuf *p, struct netif *inp)
/* Set up a tcp_seg structure. */ /* Set up a tcp_seg structure. */
inseg.next = NULL; inseg.next = NULL;
inseg.len = p->tot_len; inseg.len = p->tot_len;
inseg.dataptr = p->payload;
inseg.p = p; inseg.p = p;
inseg.tcphdr = tcphdr; inseg.tcphdr = tcphdr;
@ -1167,9 +1166,6 @@ tcp_receive(struct tcp_pcb *pcb)
LWIP_ASSERT("pbuf_header failed", 0); LWIP_ASSERT("pbuf_header failed", 0);
} }
} }
/* KJM following line changed to use p->payload rather than inseg->p->payload
to fix bug #9076 */
inseg.dataptr = p->payload;
inseg.len -= (u16_t)(pcb->rcv_nxt - seqno); inseg.len -= (u16_t)(pcb->rcv_nxt - seqno);
inseg.tcphdr->seqno = seqno = pcb->rcv_nxt; inseg.tcphdr->seqno = seqno = pcb->rcv_nxt;
} }

View File

@ -166,7 +166,6 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno,
seg->flags = optflags; seg->flags = optflags;
seg->next = NULL; seg->next = NULL;
seg->p = p; seg->p = p;
seg->dataptr = p->payload;
seg->len = p->tot_len - optlen; seg->len = p->tot_len - optlen;
#if TCP_OVERSIZE_DBGCHECK #if TCP_OVERSIZE_DBGCHECK
seg->oversize_left = 0; seg->oversize_left = 0;
@ -590,10 +589,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
seg->chksum_swapped = chksum_swapped; seg->chksum_swapped = chksum_swapped;
seg->flags |= TF_SEG_DATA_CHECKSUMMED; seg->flags |= TF_SEG_DATA_CHECKSUMMED;
#endif /* TCP_CHECKSUM_ON_COPY */ #endif /* TCP_CHECKSUM_ON_COPY */
/* Fix dataptr for the nocopy case */
if ((apiflags & TCP_WRITE_FLAG_COPY) == 0) {
seg->dataptr = (u8_t*)arg + pos;
}
/* first segment of to-be-queued data? */ /* first segment of to-be-queued data? */
if (queue == NULL) { if (queue == NULL) {
@ -1444,7 +1439,9 @@ tcp_zero_window_probe(struct tcp_pcb *pcb)
TCPH_FLAGS_SET(tcphdr, TCP_ACK | TCP_FIN); TCPH_FLAGS_SET(tcphdr, TCP_ACK | TCP_FIN);
} else { } else {
/* Data segment, copy in one byte from the head of the unacked queue */ /* Data segment, copy in one byte from the head of the unacked queue */
*((char *)p->payload + TCP_HLEN) = *(char *)seg->dataptr; struct tcp_hdr *thdr = (struct tcp_hdr *)seg->p->payload;
char *d = ((char *)p->payload + TCP_HLEN);
pbuf_copy_partial(seg->p, d, 1, TCPH_HDRLEN(thdr) * 4);
} }
#if CHECKSUM_GEN_TCP #if CHECKSUM_GEN_TCP

View File

@ -278,7 +278,6 @@ PACK_STRUCT_END
struct tcp_seg { struct tcp_seg {
struct tcp_seg *next; /* used when putting segements on a queue */ struct tcp_seg *next; /* used when putting segements on a queue */
struct pbuf *p; /* buffer containing data + TCP header */ struct pbuf *p; /* buffer containing data + TCP header */
void *dataptr; /* pointer to the TCP data in the pbuf */
u16_t len; /* the TCP length of this segment */ u16_t len; /* the TCP length of this segment */
#if TCP_OVERSIZE_DBGCHECK #if TCP_OVERSIZE_DBGCHECK
u16_t oversize_left; /* Extra bytes available at the end of the last u16_t oversize_left; /* Extra bytes available at the end of the last