From owner-freebsd-net@FreeBSD.ORG Fri Aug 21 00:21:36 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1638D1065672 for ; Fri, 21 Aug 2009 00:21:36 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id BDA398FC16 for ; Fri, 21 Aug 2009 00:21:35 +0000 (UTC) Received: by an-out-0708.google.com with SMTP id d14so111825and.13 for ; Thu, 20 Aug 2009 17:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=seNcSCXRLAGnsuQAGzQPfsX9AKkmCkHwOTOYP0f1R+U=; b=ei2aZhUVnP5N6OhchcUSQvXAH/tXOPYH0nSkP38k3NI3gOowcjyAoRQ+dj6M9nD4VQ 1qQ8ERbB7BPicMdgHwqXbpLXtcS1uztkqOuPQ8moBSGMq+2hCRYWhaBat8dSmZ2NBhgv tIOnWLeg5xubuFFFstJyQPWLNTGa1fRVavn3U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=dSsiZ6PAD+6hx1WFL4ir0lXSrHTJSNLQ10S0wYSp2dTkz/gWguFyHRevgJvQDCn8Ro e0sDjgXWmLy14in1s69QAX4WHDzaIFOgQh+Xp0i+E48NEY4RZQnKvmUWG23X9WZRZY1P DAvAC7b38YFrbMF7cdLBinZwTlD10/Za2ODyw= MIME-Version: 1.0 Received: by 10.100.233.19 with SMTP id f19mr541233anh.72.1250814095148; Thu, 20 Aug 2009 17:21:35 -0700 (PDT) In-Reply-To: <5bc218350908201039q574f92e3mabe73d01c35f662c@mail.gmail.com> References: <5bc218350908191146j2a22f8dcrdecb0b67eedce5c2@mail.gmail.com> <435336.24858.qm@web63908.mail.re1.yahoo.com> <5bc218350908200953p630d99c6u1538999b308c55f9@mail.gmail.com> <2a41acea0908201008y6e8f160dx27b406db7d3081b7@mail.gmail.com> <5bc218350908201023q14c51cer6effadd49cc4c604@mail.gmail.com> <5bc218350908201032l44859117obc3203ad91fc5706@mail.gmail.com> <5bc218350908201034u553df7feiaead037432279360@mail.gmail.com> <2a41acea0908201037n10505b04le924f29efd5398a7@mail.gmail.com> <5bc218350908201039q574f92e3mabe73d01c35f662c@mail.gmail.com> Date: Thu, 20 Aug 2009 17:21:35 -0700 Message-ID: <2a41acea0908201721o33372c89q25e33b8cde8edf06@mail.gmail.com> From: Jack Vogel To: Manish Vachharajani Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Barney Cordoba , freebsd-net@freebsd.org Subject: Re: Dropped vs. missed packets in the ixgbe driver X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2009 00:21:36 -0000 Manish, This is a diff on my changes, note some differences: first, I don't know what vintage your code was, but you do NOT want to read RNBC(i) into stats.mpc. also that is an 82598-only thing. This means that missed_rx is going to accumulate just as it should, except it should be 64 bit. This diff also contains a fix to the flow control stats on 82598, there were differences between that and 82599 that somehow got stripped from my code along the way, this corrects that. Try these changes and let me know if it works for you. Jack Index: ixgbe.c =================================================================== --- ixgbe.c (revision 195857) +++ ixgbe.c (working copy) @@ -4456,7 +4456,8 @@ { struct ifnet *ifp = adapter->ifp;; struct ixgbe_hw *hw = &adapter->hw; - u32 missed_rx = 0, bprc, lxon, lxoff, total; + u32 bprc, lxon, lxoff, total; + u64 missed_rx = 0; adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); @@ -4465,16 +4466,31 @@ mp = IXGBE_READ_REG(hw, IXGBE_MPC(i)); missed_rx += mp; adapter->stats.mpc[i] += mp; - adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); + if (hw->mac.type == ixgbe_mac_82598EB) + adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); } /* Hardware workaround, gprc counts missed packets */ adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); adapter->stats.gprc -= missed_rx; - adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); - adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); - adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); + if (hw->mac.type == ixgbe_mac_82599EB) { + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); + IXGBE_READ_REG(hw, IXGBE_GORCH); /* clears register */ + adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); + IXGBE_READ_REG(hw, IXGBE_GOTCH); /* clears register */ + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); + IXGBE_READ_REG(hw, IXGBE_TORH); /* clears register */ + adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); + adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); + } else { + adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); + adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); + /* 82598 only has a counter in the high register */ + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GOTCH); + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); + } /* * Workaround: mprc hardware is incorrectly counting @@ -4494,9 +4510,6 @@ adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); - adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); - adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); - lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); adapter->stats.lxontxc += lxon; lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);