Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1047776lqo; Thu, 9 May 2024 03:16:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUDOIKgPkeFX3xjanLtNF6B2tgo7sdvYZk4trXQEdKEay8TP7NPb741HSrGsAnaH9ASN8Q4L/d4belClQUNAvfLkdRx8PsEtXeXFNQQvQ== X-Google-Smtp-Source: AGHT+IHU9NcfZKFkK97LI5psuW7Mg3IB8KqC3MRHMkVOc+pnBbc/jrOAx1TtCaYbmSEBPP9mqQHM X-Received: by 2002:a17:90a:f014:b0:2ae:6e16:da91 with SMTP id 98e67ed59e1d1-2b6165c1513mr5041553a91.29.1715249792990; Thu, 09 May 2024 03:16:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715249792; cv=pass; d=google.com; s=arc-20160816; b=lewGF1B4Wo4CFob2adQlRSvZ4zEQmcJgzMKEubUoqcOqo4nDsxP0B63CTgtRT/LFTh ZjVrFevIhzfCSGlbHA3qsr87PSIt49hKblO70W9E0QMJObHB4QaOPHyNVYIUqYGaQDdG Q6FTeBju5TmdDneBnn1107ASX58opszii56SJVA0plSv/JFyiGvlfCztomikgpMLIilh XOeEwBd2Rep/rnfsFHYBwHDP44QRpIudFdBQRozHp1xTt2hxnDtL1H29Q+tGfMMvyFuS L1ddnZzCi2eSs6FPHxWPxKJB/BVUkRfzn80oExEt13Gcw0F71hcmV5v9GGVKiZEC7iVt s8TA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=5I6sdfeuhGDQZEJYpwbwlRvLcoIJyVZFCXAeHmKIg6Q=; fh=Qh+ossU+LufZ6CTCfS5hqcSHHoVWrLSPrJ0uTBrUztE=; b=UL4BRg8lXQiZUsYgHCIhkTUcYQ/o7KqDOTwfzQLKv+oZjAfDlzUmITZNDL/bTZW6uk wFLdUuX4IySNipOEwZHCHJk0cfuQ8+MH3trVhhiYhRNdRHSeIW0IGO6X49l1RZBvlfQz dEws07KFv08a2SS36nFCXw7PbWMABezSVFFicXt4eRPgk4R95OT2OP5j/TQBtyqxJHfn MKzjjuoLPNCXSaa6YV9FSFst0ymNN0Ya6ihKXjrL+vTBoeXZyKJgbzqnwMjFBeuv/t53 IHlDEShkgsGshdD56LgksG3PkFYa+h56UKVxF0Gr4Fg957p20hn3oxBHiFMWTfv2igGM Oygg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RxmUVVIu; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-174396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628fb9b77si3260115a91.133.2024.05.09.03.16.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 03:16:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RxmUVVIu; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-174396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 644DB283041 for ; Thu, 9 May 2024 10:16:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B506714B09F; Thu, 9 May 2024 10:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RxmUVVIu" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42818D528; Thu, 9 May 2024 10:16:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715249780; cv=none; b=sO+R/vu5cKbSivdboQifYV4BBMLj+38bdsFJS7ba5CslO2oXhNj9UDziUiYKqFBPGW7bd06Urui1e0tB8qmwWlKywCApuLFDIPDEyv4o0kMsoQl/snbpnpUkArGmTmSMSYqU7mmZtEloZOHKgee+Fs4DFxUE2lNcDrgUsrkPgCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715249780; c=relaxed/simple; bh=881zudWU6qfyucZG14Pc4Iu4wKaVIbgiMZki3Pu9CRM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=T1jQmk+HMsAFO93ZUwGsSQtYIcoUDvsiQ6wiCByHrYeOOP5lHhXGLf6+f/lGN2U3FPf0S4MaxVI2xrJamUJXvopjdOcV+eK+tpouJT2O2OF5OzSo8AmBIlkhky1/PikGWrG0O2RThKw6dke8YbhK4HorufZ9Erb++y5Y/tnVfuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RxmUVVIu; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a5a1054cf61so161414266b.1; Thu, 09 May 2024 03:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715249777; x=1715854577; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5I6sdfeuhGDQZEJYpwbwlRvLcoIJyVZFCXAeHmKIg6Q=; b=RxmUVVIuw8gB2wvTb3DD7gEcMwpzhLX7cpI6vBeP+GPp+yuboH2udiL1Ah5eWtADDm O9BS1TxqoZWxU3SlqTVy/b4w/ftsbrjvprB5c+eem4bgdqQtM6tmrPcUHWiPrWxdfpeI gWSA3ywx4PNJo1o3o6UXyajQK5LC9fxDAzAWEqteJw35o97SDRvKTGnZfWeflSoy6exq X9V3ZA1gxHMqpfE8ur6SJz/u9zAB/oHuLIBzqD4fySw0z8YQOlQxZVplTeKUmq+/8hb3 TZmY7abJYNsTfEusTr9gibifJM6TlApTwdjRYwkkrnEaRxmWhuMRlNbNwZg7bSpbckHZ VYpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715249777; x=1715854577; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5I6sdfeuhGDQZEJYpwbwlRvLcoIJyVZFCXAeHmKIg6Q=; b=t9xfnpW5xSvor6OhbPLQvsqm0BrVG/urVttWKJkEM+iI6i4wtMCao3zNFRkeD7CiRi iX4LXAaxCZ5xwaWNOO7XXeVai8jWWgLbI0OZqR7x6HGNdQUvL3TM9cchvxPd+0puhKtH un6qgxH/FC+lmHXgW6w+I3M89BqbNSx4PPhpHniC6Ig9izHa3m87Y5JW95lTGCDAvaTQ 3Adoz2IYQLTR3YrgkdYRGU6rS60oedtLIVFN9uYQ35I+hF+xHOk8ykfr0c8axyqYW0F/ 9UtF5nLbM4+l1tkscr5yHABFxBf6oac7Ohz23Tuul3az5+tzIcdKLPqDfIedV9KkJ3M/ 24hw== X-Forwarded-Encrypted: i=1; AJvYcCUr3NOs21By4VhoNADb+6X/GYHdiAHfFI6GIaNGkBEF+LQZPzmui2agj22YGqhXc34EzYDqbbqLPWjALMw0idfcqERPiVYA5eVEZyN7BGXNAMa2QJQ8kh7rnfmh/eNh41U3Wav13BH+sWP4Em7y1IPSxFgsfLlMedlM66ezTwX9LA== X-Gm-Message-State: AOJu0YwQSaef48JVuutKv06rqVXlvxftonviyuThMkBrQIP/BLsQ+n1u QjUEbBq0XG8ges/xn3g+w+BxmVi+YKqYmQq7lBPnxfefOoyfPryil5vdHg== X-Received: by 2002:a50:8d17:0:b0:571:bed1:3a36 with SMTP id 4fb4d7f45d1cf-5731da9adbdmr4789496a12.38.1715249777220; Thu, 09 May 2024 03:16:17 -0700 (PDT) Received: from [172.27.51.192] ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733bed2059sm543028a12.56.2024.05.09.03.16.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 May 2024 03:16:16 -0700 (PDT) Message-ID: <32495a72-4d41-4b72-84e7-0d86badfd316@gmail.com> Date: Thu, 9 May 2024 13:16:15 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next 0/1] mlx5: Add netdev-genl queue stats To: Joe Damato , Jakub Kicinski Cc: Tariq Toukan , Zhu Yanjun , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, saeedm@nvidia.com, gal@nvidia.com, nalramli@fastly.com, "David S. Miller" , Eric Dumazet , Leon Romanovsky , "open list:MELLANOX MLX5 core VPI driver" , Paolo Abeni , Tariq Toukan References: <20240503145808.4872fbb2@kernel.org> <20240503173429.10402325@kernel.org> <8678e62c-f33b-469c-ac6c-68a060273754@gmail.com> <20240508175638.7b391b7b@kernel.org> <20240508190839.16ec4003@kernel.org> Content-Language: en-US From: Tariq Toukan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 09/05/2024 9:30, Joe Damato wrote: > On Wed, May 08, 2024 at 07:08:39PM -0700, Jakub Kicinski wrote: >> On Thu, 9 May 2024 01:57:52 +0000 Joe Damato wrote: >>> If I'm following that right and understanding mlx5 (two things I am >>> unlikely to do simultaneously), that sounds to me like: >>> >>> - mlx5e_get_queue_stats_rx and mlx5e_get_queue_stats_tx check if i < >>> priv->channels.params.num_channels (instead of priv->stats_nch), >> >> Yes, tho, not sure whether the "if i < ...num_channels" is even >> necessary, as core already checks against real_num_rx_queues. >> >>> and when >>> summing mlx5e_sq_stats in the latter function, it's up to >>> priv->channels.params.mqprio.num_tc instead of priv->max_opened_tc. >>> >>> - mlx5e_get_base_stats accumulates and outputs stats for everything from >>> priv->channels.params.num_channels to priv->stats_nch, and >> >> I'm not sure num_channels gets set to 0 when device is down so possibly >> from "0 if down else ...num_channels" to stats_nch. > > Yea, you were right: > > if (priv->channels.num == 0) > i = 0; > else > i = priv->channels.params.num_channels; > > for (; i < priv->stats_nch; i++) { > > Seems to be working now when I adjust the queue count and the test is > passing as I adjust the queue count up or down. Cool. > I agree that get_base should include all inactive queues stats. But it's not straight forward to implement. A few guiding points: Use mlx5e_get_dcb_num_tc(params) for current num_tc. txq_ix (within the real_num_tx_queues) is calculated by c->ix + tc * params->num_channels. The txqsq stats struct is chosen by channel_stats[c->ix]->sq[tc]. It means, in the base stats you should include SQ stats for: 1. all SQs of non-active channels, i.e. ch in [params.num_channels, priv->stats_nch), tc in [0, priv->max_opened_tc). 2. all SQs of non-active TCs in active channels [0, params.num_channels), tc in [mlx5e_get_dcb_num_tc(params), priv->max_opened_tc). Now I actually see that the patch has issues in mlx5e_get_queue_stats_tx. You should not loop over all TCs of channel index i. You must do a reverse mapping from "i" to the pair/tuple [ch_ix, tc], and then access a single TXQ stats by priv->channel_stats[ch_ix].sq[tc]. > Adding TCs to the NIC triggers the test to fail, so there's still some bug > in how I'm accumulating stats from the hw TCs.