Hook up TCP cachehit stat

This commit hooks up the TCP cachehit stat to the PCB locality feature
so that when a PCB is moved to the head of the list and a segment comes
in, we consider this a cache hit

This also matches the usage of the cachehit stat in UDP
This commit is contained in:
Joel Cunningham 2015-09-17 09:07:52 -05:00 committed by goldsimon
parent f62022cdf3
commit 72b3f3f612

View File

@ -226,6 +226,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
prev->next = pcb->next; prev->next = pcb->next;
pcb->next = tcp_active_pcbs; pcb->next = tcp_active_pcbs;
tcp_active_pcbs = pcb; tcp_active_pcbs = pcb;
} else {
TCP_STATS_INC(tcp.cachehit);
} }
LWIP_ASSERT("tcp_input: pcb->next != pcb (after cache)", pcb->next != pcb); LWIP_ASSERT("tcp_input: pcb->next != pcb (after cache)", pcb->next != pcb);
break; break;
@ -303,6 +305,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
lpcb->next = tcp_listen_pcbs.listen_pcbs; lpcb->next = tcp_listen_pcbs.listen_pcbs;
/* put this listening pcb at the head of the listening list */ /* put this listening pcb at the head of the listening list */
tcp_listen_pcbs.listen_pcbs = lpcb; tcp_listen_pcbs.listen_pcbs = lpcb;
} else {
TCP_STATS_INC(tcp.cachehit);
} }
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n")); LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n"));