Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp158706lqo; Thu, 9 May 2024 16:14:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXo8/FtzS6EPg3NvaRPp3aYGaUFJwb9a7x0rpoHEK15ErXjsXq/9pi59236/i5dXxNRWctQOoO1oAy7hQ7t8AdcR8Fux1hIvMVYVdjpnA== X-Google-Smtp-Source: AGHT+IGCoe1Q6MNfUnfMT9XXBzKT4AiaMDgbQ70T8lC5iodbUBAWarXJ5LVE1bsNqiY1DSnv8dGn X-Received: by 2002:a05:6512:1386:b0:51d:aae8:646 with SMTP id 2adb3069b0e04-5220fb7671fmr682984e87.11.1715296488910; Thu, 09 May 2024 16:14:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715296488; cv=pass; d=google.com; s=arc-20160816; b=dbA4zEHLoqMp+43clMdW/UYmHUXF+PVtXTWZiaM7yW+D8o++SOPgh/S2CdtYSHezFk hjEGnf7KHSRFy8MZXk/BGcZIOHDLevqr8IZNzKWYeKTXWsPhUC0qRUJQRfwM2BVLUmsH f39ZFiWfOy64xbYE9pyIpHCazN9OfGq4Sxcz0+yLLMTNQAdKvhrmFhR5QoRFZnLViYKI Zhs6urjIJ4J62014Eyq181fv5+m/VT52FE5mOU6j6/ksAxpF23eVNchUGDQa9D6efNAE UiP6qZ8X+NMk8Ms40YLFCiLwDwOkasOUl1lwhjD2Tg444Haec5DJm3Ol79zxwqcUHREx X2mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rLZYIaHLhDSaqx9/OkcQLCVuq3j9r/yh/R1YRZ22CSI=; fh=4lYVXqPfBpIAQXguBuBwkrWVxT/oE0e7GaGvn5xCOSs=; b=RoFOMkhaa1orqK3VW6YCJVNYG+/rDDohU7sB2ZO8w4YxrbKuKH+BSBZCH47z+ko6OZ 23pH3IxpBrCfwSk0rYwebX/QRBDHj+6obHxQQcWf0sEIV6NA+80eLGumg6K0PBtJp6PE N60TTA+YswsRWp6qrFpBsD+DbOj2gdFhzMAm2d1QHSyYCah67Edb8OJ5G5K+xjZosKsA L0DribTBWLHBOhvn/1UU0bdAE8IpuUVQJPotGv+V4CyLWVLxLlshV8N/4OQ6v1o95e7d vBfBZnHxDlGV7nw3GfkGsIjOOxdk7n/VT1lfmHpbEL71BgVxlOg8FIvrwmoHXtVV8hy4 eG0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=FrWUp1Er; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-175067-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b20f40si132926866b.354.2024.05.09.16.14.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 16:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175067-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=FrWUp1Er; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-175067-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 785F31F23D72 for ; Thu, 9 May 2024 23:14:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3DD512D771; Thu, 9 May 2024 23:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="FrWUp1Er" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 4EB7A12D770 for ; Thu, 9 May 2024 23:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715296476; cv=none; b=G9SmiWd3V0Iv2nyufCEnjGzY4n87bmjxuIjOrtkDCM+zBE0+ROMKVds9BYWhyEbbwUi8OTG53EKMabouXIvWq5hglL2RilSg/qdQXMiPCZVBWMXDrPeR8W1mDOEBpG4UfQOpR9KqYfemPi+l9cJ6qPEnnPsuTZjiFL5KKOa2x0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715296476; c=relaxed/simple; bh=/hSdkj/zKVVX8+0TNGc/GW90rtt6AMMlBIYfdO4+/Uw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q8JWDKFg7w4t6fHYmN03u70NJwKixlELCws99gVtunGxjOYo3QxZXQmY1sSJ/fhY9x5fZyr4IV9yMzanU3g5unfQ7Ru+xxvdzEcFzKJJR3Pk7vJEq0AfDO+sK2YtCUkx+8YWHHUC3U1gtcoW/EsQyo3q6OWJrtnkFDoe7veG1LM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=FrWUp1Er; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e3c3aa8938so10110185ad.1 for ; Thu, 09 May 2024 16:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1715296475; x=1715901275; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rLZYIaHLhDSaqx9/OkcQLCVuq3j9r/yh/R1YRZ22CSI=; b=FrWUp1Er16N/OjoU12wGIz1WAT8xLXcP43eaW63HbzaZrhaT6w+2YHw66lYaLigq/9 Oxa7Id0209KhfdtGbdycnNQ4CXKi+1K0rt8LNxhjqra1uglRbJtD9SOBDBOVWFqwNk8D hmXafG6bV6jemugdsSWmjyaXZYztqJ7cNkoQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715296475; x=1715901275; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rLZYIaHLhDSaqx9/OkcQLCVuq3j9r/yh/R1YRZ22CSI=; b=IP82a4xyeUv4SnoB032J7GR4141iZZfqEpiLEjeU6ZgdVw6nVRn8vLcaj/Z+CwYbtw 5G05yltbctUoC3HwEIU0y9M4EL4Fut3EZvSr2VZBYJ93FRco/YIZHUGFtEcCN5p2d3/c zf4E2sokfK99exCqjJzq5GQ822VjrekhCOSw3+s/RfpdLo4p50T8jrOuzOGSJR+KO0ZF PDccGJu+eKXt/4Ub3UAP+zXZWI5wt2x4puOeZ7ExRSJGw0hi1MY5cYlEkt2MmGbwc6ST 1Ip+2gRbIvsOxtU6orN1rVPyekwApMDZTZdv02VugzEUmrk7DF12bE8tBLiEdmcsmPEZ nN5g== X-Forwarded-Encrypted: i=1; AJvYcCXCzbclvm+x7W/umo7Kyrz6hEhEU8BpVb0xIP/wrurZ/6kqWD+E5lykkCLEOdInFh8AdI32igXcQmEW3wWTb8L50L8U0y9mz92DIOUD X-Gm-Message-State: AOJu0Yz4P/+t5QlUz4UINOaqftD+wcci6tYIm0a2lznOGviowVfqlsmZ 2XU+SRrrjTTiRTuQCzT3ZM5pLFUdX7Ih9uU9HBKjw/L+Xlw1Y1eXp8v525bqhUg= X-Received: by 2002:a17:902:b495:b0:1e9:470:87e6 with SMTP id d9443c01a7336-1ef43d1853emr11389735ad.23.1715296474690; Thu, 09 May 2024 16:14:34 -0700 (PDT) Received: from LQ3V64L9R2 (c-24-6-151-244.hsd1.ca.comcast.net. [24.6.151.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c2565b6sm19558275ad.295.2024.05.09.16.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 16:14:34 -0700 (PDT) Date: Thu, 9 May 2024 16:14:31 -0700 From: Joe Damato To: Tariq Toukan Cc: Jakub Kicinski , 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 Subject: Re: [PATCH net-next 0/1] mlx5: Add netdev-genl queue stats Message-ID: References: <20240503173429.10402325@kernel.org> <8678e62c-f33b-469c-ac6c-68a060273754@gmail.com> <20240508175638.7b391b7b@kernel.org> <20240508190839.16ec4003@kernel.org> <32495a72-4d41-4b72-84e7-0d86badfd316@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32495a72-4d41-4b72-84e7-0d86badfd316@gmail.com> On Thu, May 09, 2024 at 01:16:15PM +0300, Tariq Toukan wrote: > > > 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: Thanks for the guiding points - it is very helpful. > 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). Thanks yea this is what I was working on last night -- I realized that I need to include the non-active TCs on the active channels, too and have some code that does that. I'm still off slightly, but am giving it another look now. > 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]. OK, thanks for explaining that, I'll take a closer look at this as well. > > 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.