From 72b3f3f612ca76a10f5c1d5eb746ef2fbeade60b Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Thu, 17 Sep 2015 09:07:52 -0500 Subject: [PATCH] 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 --- src/core/tcp_in.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 3faad155..5e7c8a4d 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -226,6 +226,8 @@ tcp_input(struct pbuf *p, struct netif *inp) prev->next = pcb->next; pcb->next = tcp_active_pcbs; tcp_active_pcbs = pcb; + } else { + TCP_STATS_INC(tcp.cachehit); } LWIP_ASSERT("tcp_input: pcb->next != pcb (after cache)", pcb->next != pcb); break; @@ -303,6 +305,8 @@ tcp_input(struct pbuf *p, struct netif *inp) lpcb->next = tcp_listen_pcbs.listen_pcbs; /* put this listening pcb at the head of the listening list */ tcp_listen_pcbs.listen_pcbs = lpcb; + } else { + TCP_STATS_INC(tcp.cachehit); } LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n"));