From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38AB0A0487 for ; Mon, 1 Jul 2019 14:33:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5862D5B3A; Mon, 1 Jul 2019 14:33:28 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 35D195587 for ; Mon, 1 Jul 2019 14:33:27 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id c6so15754998wml.0 for ; Mon, 01 Jul 2019 05:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1W9MBnPD9PEFZZltlclNzgQDq/oiKhps1OX32LBTcDc=; b=b8Bw1D+ZMcdfC4kX7/xObLgZb9n0A0S/QrplpOIBgrTb6v7l58jBpAkbqLfCkYJ/UT P26fIKCOho7PRXdcMYKesPd4WW8W+3J1z6o3Lz6dobEwAQju9tuCabs7xBjVmyQx0Tfy Z3Mvyja9R6A7eEZUe9k2gqi/Hhq8kp3UlLpicQXbNLxaIg+6bQxmrmEJt00A3pqnWsrK RTclRO8DsZYN96b6zXMcBMsSGBSotUgTefE5dWIbHzlo6i5DmlaWo949EuhPDzxWen0h nKAzZxrI1yRIGdLr/kjNutxnDRh3iWRKGtCkWcpSBiqj+szkJTl+TGTRnX/NFPXeR4H7 XC8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=1W9MBnPD9PEFZZltlclNzgQDq/oiKhps1OX32LBTcDc=; b=R4Uhmcw8QnJ1a3m/bT2kEQkUoyvdsVnRBdxYMTVVjRfMW6WAKygVK1qx1NomYwOKHd NsSYlDkILlY+UZvB/bTM34mo/XmtrwBv/AmaIABUJKkEl89Lp5Tja9HBcGGzrvi9VuEt nnNXhVEmwojq03sfv1X2sSIm3/4QcUtuvShRGe5qDLQ5Gk4tEW0g8gYLEVFW5QC4nAdJ OiIxb9x7Bje3ip58WgVP6v7jazshPQnqMI6UORFT8vqwrOBrj26wWXgHHVF5P+1DZCUL 1NChPzqPblUOyhEK1OK9t0/7NPGkAReI7lCMvE0PGX8nyfCNdYWkSsVUlJGXOSx4dMWk 1b8A== X-Gm-Message-State: APjAAAUNspccW8iGiM8zetoDo8lREfjKQ1HABeGNTARlQdg+GaailPD1 MZoupRQDzQUwQW+H+n6pMq+W6w== X-Google-Smtp-Source: APXvYqzbDEXkmdsmjaKpXff4bA90pr1hcD8l04TuFFhIZZjH3QrqdOqrwjuQiFzpFX06GM59EIEfrA== X-Received: by 2002:a1c:345:: with SMTP id 66mr17582031wmd.8.1561984406848; Mon, 01 Jul 2019 05:33:26 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v15sm9641205wrt.25.2019.07.01.05.33.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jul 2019 05:33:25 -0700 (PDT) Date: Mon, 1 Jul 2019 14:33:24 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Stephen Hemminger Cc: dev@dpdk.org, Stephen Hemminger Message-ID: <20190701123324.p7gmaudncgvagadz@bidouze.vm.6wind.com> References: <20190626222135.11368-1-stephen@networkplumber.org> <20190626233346.4719-1-stephen@networkplumber.org> <20190626233346.4719-3-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190626233346.4719-3-stephen@networkplumber.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v2 2/2] failsafe: implement xstats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello Stephen, On Wed, Jun 26, 2019 at 04:33:46PM -0700, Stephen Hemminger wrote: > Add support for extended statistics in failsafe driver. > Reports basic statistics for the failsafe driver, and detailed > statistics for each sub device. > > Signed-off-by: Stephen Hemminger > --- > drivers/net/failsafe/failsafe_ops.c | 130 ++++++++++++++++++++++++++++ > 1 file changed, 130 insertions(+) > > diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c > index 96e05d4dc4b1..a250c0528965 100644 > --- a/drivers/net/failsafe/failsafe_ops.c > +++ b/drivers/net/failsafe/failsafe_ops.c > @@ -789,6 +789,133 @@ fs_stats_reset(struct rte_eth_dev *dev) > fs_unlock(dev, 0); > } > > +static int > +fs_xstats_count(struct rte_eth_dev *dev) > +{ > + struct sub_device *sdev; > + uint8_t i; > + int count; > + > + count = rte_eth_basic_stats_count(dev); > + > + fs_lock(dev, 0); > + FOREACH_SUBDEV(sdev, i, dev) { > + count += rte_eth_xstats_get_names(PORT_ID(sdev), NULL, 0); > + } > + fs_unlock(dev, 0); > + > + return count; > +} > + > +static int > +fs_xstats_get_names(struct rte_eth_dev *dev, > + struct rte_eth_xstat_name *xstats_names, > + unsigned int limit) > +{ > + struct sub_device *sdev; > + unsigned int count; > + char tmp[RTE_ETH_XSTATS_NAME_SIZE]; > + uint8_t i; > + int r; > + > + if (!xstats_names) > + return fs_xstats_count(dev); > + > + r = rte_eth_basic_stats_get_names(dev, xstats_names); > + if (r < 0) > + return r; > + > + count = r; > + > + fs_lock(dev, 0); > + FOREACH_SUBDEV(sdev, i, dev) { > + struct rte_eth_xstat_name *sub_names = xstats_names + count; > + > + if (count >= limit) > + break; > + > + r = rte_eth_xstats_get_names(PORT_ID(sdev), > + xstats_names + count, sub_names here? Or do you want to point our the relationship between + count on the array and - count on the array length? If so that makes sense. > + limit - count); > + if (r < 0) { > + fs_unlock(dev, 0); > + return r; > + } > + > + /* add sub_ prefix to names */ > + for (i = 0; i < r; i++) { > + snprintf(tmp, sizeof(tmp), "sub%u_%s", Prefixing is a good idea, maybe it would be better with an '_' between the sub device name and the stat name? The rest of the implementation seems solid, thanks. You need to update the feature matrix for fail-safe however. Regards, -- Gaëtan Rivet 6WIND