From owner-svn-src-all@FreeBSD.ORG Tue Sep 23 18:26:00 2014 Return-Path: Delivered-To: svn-src-all@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 36264881; Tue, 23 Sep 2014 18:26:00 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F4415FB; Tue, 23 Sep 2014 18:25:58 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id s8NIPnsg030004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Sep 2014 22:25:49 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id s8NIPnD3030003; Tue, 23 Sep 2014 22:25:49 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 23 Sep 2014 22:25:49 +0400 From: Gleb Smirnoff To: Hans Petter Selasky Subject: Re: svn commit: r272027 - in head: contrib/ofed/libibverbs/examples contrib/ofed/libmlx4/src sys/conf sys/modules/mlx4 sys/modules/mlxen sys/ofed/drivers/infiniband/hw/mlx4 sys/ofed/drivers/infiniband/... Message-ID: <20140923182549.GG884@FreeBSD.org> References: <201409231237.s8NCb27N061223@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201409231237.s8NCb27N061223@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Tue, 23 Sep 2014 18:26:00 -0000 Hans, On Tue, Sep 23, 2014 at 12:37:02PM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Tue Sep 23 12:37:01 2014 H> New Revision: 272027 H> URL: http://svnweb.freebsd.org/changeset/base/272027 H> H> Log: H> Hardware driver update from Mellanox Technologies, including: H> - improved performance H> - better stability H> - new features H> - bugfixes ... H> @@ -240,7 +240,7 @@ ipoib_ib_handle_rx_wc(struct ipoib_dev_p H> */ H> if (unlikely(!ipoib_alloc_rx_mb(priv, wr_id))) { H> memcpy(&priv->rx_ring[wr_id], &saverx, sizeof(saverx)); H> - dev->if_iqdrops++; H> + if_inc_counter(dev, IFCOUNTER_IQDROPS, 1); H> goto repost; H> } Thanks a lot for these changes :) However, to fully convert driver to new stats we need to 1) stop writing to ifnet if_foo fields, 2) provide if_get_counter() method, that will return current counter values. This can be achieved in two ways: 1) Dumb solution. Remove assignments for if_foo counters from mlx4_en_DUMP_ETH_STATS(). Provide if_get_counter() method, that will return the values using the same code we deleted. The cons of the solution is that we still run a useless callout to gather statistics, and that statistics are updated only on callout. If we query the interface faster than 1 time per second, we will get same results in two queries. Example of dumb solution can be found in igb(4). Since the code is shared between OSes, it could be that dumb solution is the best, since it is less disruptive. 2) Smarter solution. Remove assignments for if_foo counters from mlx4_en_DUMP_ETH_STATS(). Do not run mlx4_en_DUMP_ETH_STATS() periodically. Provide if_get_counter() method, that will first run mlx4_en_DUMP_ETH_STATS(), and then do a switch on counter type and return it. Example of smarter solution is vtnet(4). 3) Smart solution. Remove assignments for if_foo counters from mlx4_en_DUMP_ETH_STATS(). Do not run mlx4_en_DUMP_ETH_STATS() periodically. Provide if_get_counter() method, that will switch on the counter type and query the proper hardware register to fetch the value and return it. No examples available, yet :) Can you help me with this, please? I can code the dumb one quickly, but probably committing it w/o hardware test is a risky plan. -- Totus tuus, Glebius.