From owner-svn-src-all@freebsd.org Wed Jan 27 03:51:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40122A6E788; Wed, 27 Jan 2016 03:51:04 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A28D359; Wed, 27 Jan 2016 03:51:04 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-io0-x22d.google.com with SMTP id f81so6328912iof.0; Tue, 26 Jan 2016 19:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=bR557wykYVAMjgki9IttzTY08PcKLtkYBSdKg+nhSV8=; b=NAaIH8h6voQiA1CDDZAu7v0K4ldCq6Cx4wB+7tVWa5EKVtf1sAZ+oW7uEWsjqjdibe Phg15b4LV7h8BhhOMIP06A3MZZXPqCkIqzKoh00Aw++fImLHqGl2xz4rSdYLBKXe3tsi +Lvz64SjlENfTcllFqoI1bZTeTK5THCawZJSCOtxmM1rQckH59AdJVjtBkRCufsLIKTp mITfTrmYZGkCPJDjtnmlo13/b7JXDp/hm8v+V0dJKV186q5bOYTOHucIeoGEDKWsuSWZ FaEKgLrBdOOlyUhaPnFQd+JMDWRbeknlk9WJt/apl2ka3ADipx8otSxK7X2shHhH8Fgb 7Gpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=bR557wykYVAMjgki9IttzTY08PcKLtkYBSdKg+nhSV8=; b=bxA7+bDUn81PtOTDo3iqB29G9a+A0arAMqIyXfS4+JK/AN9uTpbxz9gK9Hin9UOlsT IfDpVX7K2s6SGp78BMY8fXKeHRaRiNI0fEvqsdBGJpW3CCV093htJoa9eHU45vybs2Hr uti1gdyCEwaKm/yVVRYAXVjM28Y2NGSPACOxT+zk0kwY+LtWJeC7Bl43vgcskDF1BmQV VVPKHCsaY/8IQazRrNvOj05bPj7RZplHCfsrAFazSMw3+0zNHpO0o3Cd3QehAwluocKL IXlw7sq2pR66+jbLiD4F3f49JDis8ZuAsR7TEieddgrCOzZ9cGwalTHLvRqrR72Bbwen sMWw== X-Gm-Message-State: AG10YOS1ytFivRCNhjkW73gYrER/eQda1XpKA85ZaVND99Rdgkiq8d4PfBVO7N/mxt4iqLcF4bAmMo1tKchS8A== MIME-Version: 1.0 X-Received: by 10.107.7.37 with SMTP id 37mr859443ioh.17.1453866663340; Tue, 26 Jan 2016 19:51:03 -0800 (PST) Received: by 10.107.166.3 with HTTP; Tue, 26 Jan 2016 19:51:03 -0800 (PST) In-Reply-To: References: <201601270045.u0R0jkfl032745@repo.freebsd.org> Date: Wed, 27 Jan 2016 11:51:03 +0800 Message-ID: Subject: Re: svn commit: r294869 - in head: sys/dev/cxgbe/tom sys/netinet usr.bin/systat From: Sepherosa Ziehau To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2016 03:51:04 -0000 BTW, amd64 LINT builds fine. On Wed, Jan 27, 2016 at 11:50 AM, Sepherosa Ziehau wrote: > This seems to break i386 LINT: > > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1021:20: > error: use of undeclared identifier 'tcpstates'; did you mean > 'tcpstat'? > toep->tp_tid, tcpstates[tp->t_state], toep, inp); > ^~~~~~~~~ > tcpstat > /usr/freebsd-svn/head/sys/sys/ktr.h:89:69: note: expanded from macro 'CTR5' > #define CTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, > p2, p3, p4, p5, 0) > ^ > /usr/freebsd-svn/head/sys/sys/ktr.h:81:44: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/netinet/tcp_var.h:604:39: note: 'tcpstat' > declared here > VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ > ^ > --- all_subdir_ctl --- > --- ctl_error.o --- > cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE > -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include > /usr/obj/i386.i386/usr/freebsd-svn/head/sys/LINT/opt_global.h -I. > -I/usr/freebsd-svn/head/sys -fno-common > -I/usr/obj/i386.i386/usr/freebsd-svn/head/sys/LINT -fno-builtin > -mno-mmx -mno-sse -msoft-float -ffreestanding -fwrapv > -fstack-protector -Wall -Wredundant-decls -Wnested-externs > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline > -Wcast-qual -Wundef -Wno-pointer-sign > -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs > -fdiagnostics-show-option -Wno-unknown-pragmas > -Wno-error-tautological-compare -Wno-error-empty-body > -Wno-error-parentheses-equality -Wno-error-unused-function > -Wno-error-pointer-sign -Wno-error-shift-negative-value -mno-aes > -mno-avx -std=iso9899:1999 -c > /usr/freebsd-svn/head/sys/modules/ctl/../../cam/ctl/ctl_error.c -o > ctl_error.o > --- all_subdir_cxgb --- > /usr/freebsd-svn/head/sys/net/vnet.h:89:33: note: expanded from macro > 'VNET_PCPUSTAT_DECLARE' > VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)]) > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:399:37: note: expanded from macro > 'VNET_DECLARE' > #define VNET_DECLARE(t, n) extern t n > ^ > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1230:16: > error: use of undeclared identifier 'tcpstates'; did you mean > 'tcpstat'? > tid, tp ? tcpstates[tp->t_state] : "no tp" , toep->tp_flags, inp); > ^~~~~~~~~ > tcpstat > /usr/freebsd-svn/head/sys/sys/ktr.h:89:69: note: expanded from macro 'CTR5' > #define CTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, > p2, p3, p4, p5, 0) > ^ > /usr/freebsd-svn/head/sys/sys/ktr.h:81:44: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/netinet/tcp_var.h:604:39: note: 'tcpstat' > declared here > VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:89:33: note: expanded from macro > 'VNET_PCPUSTAT_DECLARE' > VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)]) > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:399:37: note: expanded from macro > 'VNET_DECLARE' > #define VNET_DECLARE(t, n) extern t n > ^ > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1230:14: > error: pointer type mismatch ('counter_u64_t' (aka 'unsigned long long > *') and 'char *') [-Werror,-Wpointer-type-mismatch] > tid, tp ? tcpstates[tp->t_state] : "no tp" , toep->tp_flags, inp); > ^ ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ > /usr/freebsd-svn/head/sys/sys/ktr.h:89:69: note: expanded from macro 'CTR5' > #define CTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, > p2, p3, p4, p5, 0) > ^ > /usr/freebsd-svn/head/sys/sys/ktr.h:81:44: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1293:11: > error: use of undeclared identifier 'tcpstates'; did you mean > 'tcpstat'? > tp ? tcpstates[tp->t_state] : "no tp", toep->tp_flags); > ^~~~~~~~~ > tcpstat > /usr/freebsd-svn/head/sys/sys/ktr.h:88:65: note: expanded from macro 'CTR4' > #define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0) > ^ > /usr/freebsd-svn/head/sys/sys/ktr.h:81:44: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/netinet/tcp_var.h:604:39: note: 'tcpstat' > declared here > VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:89:33: note: expanded from macro > 'VNET_PCPUSTAT_DECLARE' > VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)]) > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:399:37: note: expanded from macro > 'VNET_DECLARE' > #define VNET_DECLARE(t, n) extern t n > ^ > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1293:9: > error: pointer type mismatch ('counter_u64_t' (aka 'unsigned long long > *') and 'char *') [-Werror,-Wpointer-type-mismatch] > tp ? tcpstates[tp->t_state] : "no tp", toep->tp_flags); > ^ ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ > /usr/freebsd-svn/head/sys/sys/ktr.h:88:65: note: expanded from macro 'CTR4' > #define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0) > ^ > /usr/freebsd-svn/head/sys/sys/ktr.h:81:44: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1499:21: > error: use of undeclared identifier 'tcpstates'; did you mean > 'tcpstat'? > __func__, tid, tcpstates[tp->t_state], toep, toep->tp_flags, > ^~~~~~~~~ > tcpstat > /usr/freebsd-svn/head/sys/sys/ktr.h:81:44: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/netinet/tcp_var.h:604:39: note: 'tcpstat' > declared here > VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:89:33: note: expanded from macro > 'VNET_PCPUSTAT_DECLARE' > VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)]) > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:399:37: note: expanded from macro > 'VNET_DECLARE' > #define VNET_DECLARE(t, n) extern t n > ^ > /usr/freebsd-svn/head/sys/modules/cxgb/tom/../../../dev/cxgb/ulp/tom/cxgb_cpl_io.c:1585:47: > error: use of undeclared identifier 'tcpstates'; did you mean > 'tcpstat'? > CTR4(KTR_CXGB, "%s tid %u, toep %p, inp %p", tcpstates[tp->t_state], > ^~~~~~~~~ > tcpstat > /usr/freebsd-svn/head/sys/sys/ktr.h:88:57: note: expanded from macro 'CTR4' > #define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0) > ^ > /usr/freebsd-svn/head/sys/sys/ktr.h:81:16: note: expanded from macro 'CTR6' > (u_long)(p1), (u_long)(p2), (u_long)(p3), \ > ^ > /usr/freebsd-svn/head/sys/netinet/tcp_var.h:604:39: note: 'tcpstat' > declared here > VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat); /* tcp statistics */ > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:89:33: note: expanded from macro > 'VNET_PCPUSTAT_DECLARE' > VNET_DECLARE(counter_u64_t, name[sizeof(type) / sizeof(uint64_t)]) > ^ > /usr/freebsd-svn/head/sys/net/vnet.h:399:37: note: expanded from macro > 'VNET_DECLARE' > #define VNET_DECLARE(t, n) extern t n > > On Wed, Jan 27, 2016 at 8:45 AM, Gleb Smirnoff wrote: >> Author: glebius >> Date: Wed Jan 27 00:45:46 2016 >> New Revision: 294869 >> URL: https://svnweb.freebsd.org/changeset/base/294869 >> >> Log: >> Augment struct tcpstat with tcps_states[], which is used for book-keeping >> the amount of TCP connections by state. Provides a cheap way to get >> connection count without traversing the whole pcb list. >> >> Sponsored by: Netflix >> >> Modified: >> head/sys/dev/cxgbe/tom/t4_cpl_io.c >> head/sys/netinet/tcp_offload.c >> head/sys/netinet/tcp_subr.c >> head/sys/netinet/tcp_syncache.c >> head/sys/netinet/tcp_timewait.c >> head/sys/netinet/tcp_usrreq.c >> head/sys/netinet/tcp_var.h >> head/usr.bin/systat/netstat.c >> >> Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c >> ============================================================================== >> --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> -#include >> #define TCPSTATES >> #include >> #include >> +#include >> #include >> >> #include "common/common.h" >> >> Modified: head/sys/netinet/tcp_offload.c >> ============================================================================== >> --- head/sys/netinet/tcp_offload.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/netinet/tcp_offload.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -42,10 +42,10 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> -#include >> #include >> #define TCPOUTFLAGS >> #include >> +#include >> #include >> >> int registered_toedevs; >> >> Modified: head/sys/netinet/tcp_subr.c >> ============================================================================== >> --- head/sys/netinet/tcp_subr.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/netinet/tcp_subr.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -1468,6 +1468,7 @@ tcp_close(struct tcpcb *tp) >> #endif >> in_pcbdrop(inp); >> TCPSTAT_INC(tcps_closed); >> + TCPSTAT_DEC(tcps_states[tp->t_state]); >> KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL")); >> so = inp->inp_socket; >> soisdisconnected(so); >> @@ -2910,6 +2911,8 @@ tcp_state_change(struct tcpcb *tp, int n >> int pstate = tp->t_state; >> #endif >> >> + TCPSTAT_DEC(tcps_states[tp->t_state]); >> + TCPSTAT_INC(tcps_states[newstate]); >> tp->t_state = newstate; >> TCP_PROBE6(state__change, NULL, tp, NULL, tp, NULL, pstate); >> } >> >> Modified: head/sys/netinet/tcp_syncache.c >> ============================================================================== >> --- head/sys/netinet/tcp_syncache.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/netinet/tcp_syncache.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -351,6 +351,7 @@ syncache_insert(struct syncache *sc, str >> >> SCH_UNLOCK(sch); >> >> + TCPSTAT_INC(tcps_states[TCPS_SYN_RECEIVED]); >> TCPSTAT_INC(tcps_sc_added); >> } >> >> @@ -364,6 +365,7 @@ syncache_drop(struct syncache *sc, struc >> >> SCH_LOCK_ASSERT(sch); >> >> + TCPSTAT_DEC(tcps_states[TCPS_SYN_RECEIVED]); >> TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); >> sch->sch_length--; >> >> @@ -992,7 +994,16 @@ syncache_expand(struct in_conninfo *inc, >> goto failed; >> } >> } else { >> - /* Pull out the entry to unlock the bucket row. */ >> + /* >> + * Pull out the entry to unlock the bucket row. >> + * >> + * NOTE: We must decrease TCPS_SYN_RECEIVED count here, not >> + * tcp_state_change(). The tcpcb is not existent at this >> + * moment. A new one will be allocated via syncache_socket-> >> + * sonewconn->tcp_usr_attach in TCPS_CLOSED state, then >> + * syncache_socket() will change it to TCPS_SYN_RECEIVED. >> + */ >> + TCPSTAT_DEC(tcps_states[TCPS_SYN_RECEIVED]); >> TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash); >> sch->sch_length--; >> #ifdef TCP_OFFLOAD >> >> Modified: head/sys/netinet/tcp_timewait.c >> ============================================================================== >> --- head/sys/netinet/tcp_timewait.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/netinet/tcp_timewait.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -660,6 +660,7 @@ tcp_tw_2msl_stop(struct tcptw *tw, int r >> >> if (!reuse) >> uma_zfree(V_tcptw_zone, tw); >> + TCPSTAT_DEC(tcps_states[TCPS_TIME_WAIT]); >> } >> >> struct tcptw * >> >> Modified: head/sys/netinet/tcp_usrreq.c >> ============================================================================== >> --- head/sys/netinet/tcp_usrreq.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/netinet/tcp_usrreq.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -1883,6 +1883,7 @@ tcp_attach(struct socket *so) >> tp->t_state = TCPS_CLOSED; >> INP_WUNLOCK(inp); >> INP_INFO_RUNLOCK(&V_tcbinfo); >> + TCPSTAT_INC(tcps_states[TCPS_CLOSED]); >> return (0); >> } >> >> >> Modified: head/sys/netinet/tcp_var.h >> ============================================================================== >> --- head/sys/netinet/tcp_var.h Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/sys/netinet/tcp_var.h Wed Jan 27 00:45:46 2016 (r294869) >> @@ -34,6 +34,7 @@ >> #define _NETINET_TCP_VAR_H_ >> >> #include >> +#include >> >> #ifdef _KERNEL >> #include >> @@ -587,6 +588,9 @@ struct tcpstat { >> uint64_t tcps_sig_err_sigopt; /* No signature expected by socket */ >> uint64_t tcps_sig_err_nosigopt; /* No signature provided by segment */ >> >> + /* Running connection count. */ >> + uint64_t tcps_states[TCP_NSTATES]; >> + >> uint64_t _pad[12]; /* 6 UTO, 6 TBD */ >> }; >> >> >> Modified: head/usr.bin/systat/netstat.c >> ============================================================================== >> --- head/usr.bin/systat/netstat.c Wed Jan 27 00:24:24 2016 (r294868) >> +++ head/usr.bin/systat/netstat.c Wed Jan 27 00:45:46 2016 (r294869) >> @@ -59,10 +59,10 @@ static const char sccsid[] = "@(#)netsta >> #include >> #include >> #include >> -#include >> #define TCPSTATES >> #include >> #include >> +#include >> #include >> #include >> #include >> > > > > -- > Tomorrow Will Never Die -- Tomorrow Will Never Die