From owner-freebsd-net@FreeBSD.ORG Thu Sep 25 13:14:13 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC396E20 for ; Thu, 25 Sep 2014 13:14:13 +0000 (UTC) Received: from nbfkord-smmo03.seg.att.com (nbfkord-smmo03.seg.att.com [209.65.160.84]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 441DDBC3 for ; Thu, 25 Sep 2014 13:14:13 +0000 (UTC) Received: from unknown [12.187.104.25] (EHLO webmail.solarflare.com) by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.2-0) with ESMTP id 52514245.2b15b39da940.788207.00-2490.2001331.nbfkord-smmo03.seg.att.com (envelope-from ); Thu, 25 Sep 2014 13:14:13 +0000 (UTC) X-MXL-Hash: 54241525753bf69d-6ae4343d6648da81f33d8cb0f745348446e534ea Received: from unknown [12.187.104.25] (EHLO webmail.solarflare.com) by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.2-0) over TLS secured channel with ESMTP id f0514245.0.788166.00-2385.2001206.nbfkord-smmo03.seg.att.com (envelope-from ); Thu, 25 Sep 2014 13:13:56 +0000 (UTC) X-MXL-Hash: 5424151406cdc755-acd2e0d0c1678773b02009735e699851c2ed2565 Received: from [192.168.38.17] (84.52.89.52) by webmail.SolarFlare.com (10.20.40.31) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 25 Sep 2014 06:13:15 -0700 Message-ID: <5424150B.2000606@solarflare.com> Date: Thu, 25 Sep 2014 17:13:47 +0400 From: Andrew Rybchenko User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Subject: [PATCH 3/4] sfxge: Add sysctl to get Tx queue deferred packet get-list counter Content-Type: multipart/mixed; boundary="------------010403060201090708090203" X-Originating-IP: [84.52.89.52] X-TM-AS-Product-Ver: SMEX-10.0.0.1412-7.000.1014-20974.005 X-TM-AS-Result: No--1.093600-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-AnalysisOut: [v=2.0 cv=Lb2LHEji c=1 sm=1 a=MkjXnYnS3dyNWGSWLXxFFQ==:17 a] X-AnalysisOut: [=Ozv50jBIw7UA:10 a=oDRzG1I58OgA:10 a=Ya0UbulxNOQA:10 a=4ox] X-AnalysisOut: [owH2qkH0A:10 a=RB3BGLmKESwA:10 a=BLceEmwcHowA:10 a=zRKbQ67] X-AnalysisOut: [AAAAA:8 a=qg_zykTt5_OaQZwxDF0A:9 a=wPNLvfGTeEIA:10 a=ciaWO] X-AnalysisOut: [uxtwEfcaP39IWEA:9 a=QEXdDO2ut3YA:10 a=s9qa1pk-s7gA:10] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2014051901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.25] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2014 13:14:13 -0000 --------------010403060201090708090203 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: quoted-printable The patch allows to check state of the software Tx queues in run time. The information contained in this message is confidential and is intended f= or the addressee(s) only. If you have received this message in error, pleas= e notify the sender immediately and delete the message. Unless you are an a= ddressee (or authorized to receive for an addressee), you may not use, copy= or disclose to anyone this message or any information contained in this me= ssage. The unauthorized use, disclosure, copying or alteration of this mess= age is strictly prohibited. --------------010403060201090708090203 Content-Type: text/plain; charset="UTF-8"; name="get_count_show" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="get_count_show" Add sysctl to get Tx queue deferred packet get-list counter Submitted by: Andrew Rybchenko Sponsored by: Solarflare Communications, Inc. diff -r 099f556d39e0 sys/dev/sfxge/sfxge.h --- a/sys/dev/sfxge/sfxge.h Thu Sep 25 16:24:14 2014 +0400 +++ b/sys/dev/sfxge/sfxge.h Thu Sep 25 16:30:30 2014 +0400 @@ -202,6 +202,7 @@ struct ifnet *ifnet; unsigned int if_flags; struct sysctl_oid *stats_node; + struct sysctl_oid *txqs_node; struct task task_reset; diff -r 099f556d39e0 sys/dev/sfxge/sfxge_tx.c --- a/sys/dev/sfxge/sfxge_tx.c Thu Sep 25 16:24:14 2014 +0400 +++ b/sys/dev/sfxge/sfxge_tx.c Thu Sep 25 16:30:30 2014 +0400 @@ -176,7 +176,7 @@ KASSERT(*get_tailp == NULL, ("*get_tailp != NULL")); *stdp->std_getp = get_next; stdp->std_getp = get_tailp; - stdp->std_count += count; + stdp->std_get_count += count; } #endif /* SFXGE_HAVE_MQ */ @@ -380,7 +380,7 @@ prefetch_read_many(txq->common); mbuf = stdp->std_get; - count = stdp->std_count; + count = stdp->std_get_count; while (count != 0) { KASSERT(mbuf != NULL, ("mbuf == NULL")); @@ -412,17 +412,17 @@ if (count == 0) { KASSERT(mbuf == NULL, ("mbuf != NULL")); stdp->std_get = NULL; - stdp->std_count = 0; + stdp->std_get_count = 0; stdp->std_getp = &stdp->std_get; } else { stdp->std_get = mbuf; - stdp->std_count = count; + stdp->std_get_count = count; } if (txq->added != pushed) efx_tx_qpush(txq->common, txq->added); - KASSERT(txq->blocked || stdp->std_count == 0, + KASSERT(txq->blocked || stdp->std_get_count == 0, ("queue unblocked but count is non-zero")); } @@ -476,12 +476,12 @@ sfxge_tx_qdpl_swizzle(txq); - if (stdp->std_count >= SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT) + if (stdp->std_get_count >= SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT) return (ENOBUFS); *(stdp->std_getp) = mbuf; stdp->std_getp = &mbuf->m_nextpkt; - stdp->std_count++; + stdp->std_get_count++; } else { volatile uintptr_t *putp; uintptr_t old; @@ -575,7 +575,7 @@ m_freem(mbuf); } stdp->std_get = NULL; - stdp->std_count = 0; + stdp->std_get_count = 0; stdp->std_getp = &stdp->std_get; mtx_unlock(&txq->lock); @@ -1315,6 +1315,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, unsigned int txq_index, enum sfxge_txq_type type, unsigned int evq_index) { + char name[16]; + struct sysctl_oid *txq_node; struct sfxge_txq *txq; struct sfxge_evq *evq; #ifdef SFXGE_HAVE_MQ @@ -1367,6 +1369,16 @@ goto fail2; } + snprintf(name, sizeof(name), "%u", txq_index); + txq_node = SYSCTL_ADD_NODE( + device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(sc->txqs_node), + OID_AUTO, name, CTLFLAG_RD, NULL, ""); + if (txq_node == NULL) { + rc = ENOMEM; + goto fail_txq_node; + } + if (type == SFXGE_TXQ_IP_TCP_UDP_CKSUM && (rc = tso_init(txq)) != 0) goto fail3; @@ -1377,6 +1389,11 @@ stdp->std_getp = &stdp->std_get; mtx_init(&txq->lock, "txq", NULL, MTX_DEF); + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(txq_node), OID_AUTO, + "dpl_get_count", CTLFLAG_RD | CTLFLAG_STATS, + &stdp->std_get_count, 0, ""); #endif txq->type = type; @@ -1387,6 +1404,7 @@ return (0); fail3: +fail_txq_node: free(txq->pend_desc, M_SFXGE); fail2: while (nmaps-- != 0) @@ -1480,6 +1498,15 @@ KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); + sc->txqs_node = SYSCTL_ADD_NODE( + device_get_sysctl_ctx(sc->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), + OID_AUTO, "txq", CTLFLAG_RD, NULL, "Tx queues"); + if (sc->txqs_node == NULL) { + rc = ENOMEM; + goto fail_txq_node; + } + /* Initialize the transmit queues */ if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_NON_CKSUM, SFXGE_TXQ_NON_CKSUM, 0)) != 0) @@ -1509,5 +1536,6 @@ sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM); fail: +fail_txq_node: return (rc); } diff -r 099f556d39e0 sys/dev/sfxge/sfxge_tx.h --- a/sys/dev/sfxge/sfxge_tx.h Thu Sep 25 16:24:14 2014 +0400 +++ b/sys/dev/sfxge/sfxge_tx.h Thu Sep 25 16:30:30 2014 +0400 @@ -82,10 +82,10 @@ * Deferred packet list. */ struct sfxge_tx_dpl { - uintptr_t std_put; /* Head of put list. */ - struct mbuf *std_get; /* Head of get list. */ - struct mbuf **std_getp; /* Tail of get list. */ - unsigned int std_count; /* Count of packets. */ + uintptr_t std_put; /* Head of put list. */ + struct mbuf *std_get; /* Head of get list. */ + struct mbuf **std_getp; /* Tail of get list. */ + unsigned int std_get_count; /* Packets in get list. */ }; --------------010403060201090708090203--