Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp737697lqt; Thu, 6 Jun 2024 18:02:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1qvpYrtt7enXaN6Y5GMM0VCEDZ2fzSiQbpqmsMToJB/hu3wCcebKvT7WcFV69czOtVbaVOFSVbdHm8zgn2zsAcJvEdtR5riVPT8GeYQ== X-Google-Smtp-Source: AGHT+IEqycbxjmKnC9TSsw6qNQM3ETVkYrIBE9MmMfmHWQtu8UqTVq8TGSfYOp1nF+dK3Jit6ReV X-Received: by 2002:a05:622a:1b92:b0:43d:e767:f106 with SMTP id d75a77b69052e-44041b06fc3mr25207471cf.30.1717722144248; Thu, 06 Jun 2024 18:02:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717722144; cv=pass; d=google.com; s=arc-20160816; b=VF+gMV6/BOZhzfVpgshBYFxU3hDtF9iQmwSNbWSUrFid7tCXD+Mi/+OERla7rhheQa 0/rhG4ljvh9mAOBqQWJMJ1FxkWSnerVE4R9grFuN/6DC1DnIQaexXGznZO62fkKT+hNU ZLMBG3+KAoFlx9Mx6E86WDNRcS8/Y+/DIac7Cwi6lvEPVfuB5/Wcy6d7rWzte55T+Ezb l4slWU4gmzDqsTCnf0IgMh+fs8f1TFjTZ/xODFMdwLzZnTfxlftdtLjBwE+PTrbk0T4p r2s/NWpYThPi3ycNmiG/Z25rQDPk9KKl872E9D3/JwjYVuSL2MfQRfNPvdIDNdN22FoI Mbkw== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=KUNbkcgn6ZFtJ0WPgugUHBmOtaRPBWaMM6dzuoXYIbI=; fh=QxPqZbznuT1Fph7fbQwU/dCCpUvsUGSAkupd2eDiuXY=; b=c/cZs9aOSDWYm2djujNuMLKo1Tfxc3HWR0yiOGJoL0gRviWIbycDq4SfBFxIW846YN eIF1W2ZEAdyrzWHCjmsc4ybXYOGl0ttCo50SLOLSVXZ97NqUFwg4+3nPk9x8gwL113sH Etu554uc2RA6NOTQo9sQrn+yKPZAz2ZDvNp88q32KLR8aL5S8fIQCNdzqyJZR5ORGcR5 S3r7aP/TE4j0+tCm7DmZmzzwNXjzJpelUYhf9PqYWecocSs1WiI5ROepSooIJFag0Eet rk2YyZI1Ywth/E465WRm+2zB16XnkJy8USNu4egKTYhEgRXlOWhKLatJ6a5PlaGZYx2k 7MdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b="D1/n4Mmw"; 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-205209-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205209-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b15e74si30174381cf.290.2024.06.06.18.02.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 18:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205209-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b="D1/n4Mmw"; 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-205209-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205209-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E27871C2463C for ; Fri, 7 Jun 2024 01:02:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E72CDF53; Fri, 7 Jun 2024 01:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="D1/n4Mmw" 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 503A319D883 for ; Fri, 7 Jun 2024 01:02:12 +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=1717722133; cv=none; b=Hx04uLMRd7x3t51vUZn1thYyNJUrU19ohZIs0PoL0ikzhXFooAFUc4tF7QLZVc+w191lcWEZnMrik9mXtOJhZaxrDDjmXMDRBLMpno+zw/0E6EgOuT13GTfX129Z6Ekr/6/MhCr8Cib4SD6ofV+ySR+97WaQ4+IzdySwvbZkorA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717722133; c=relaxed/simple; bh=PymsS2+bwa3WplcCpWVaQsEHbhZcs6L5674DPfMY+OQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JVf6yg4VG1i4ERFZbyFlMs/UutNgbiXAnkUesbMeSOsDur9VTWzXtA0F7wsx8KlqxSkqmil2tNFDWltgrT6vqBrCPtsCLfHygqHxxQYPdYezhUojE9zYPn9UfQD50zNXEtHKFpfCUjnxFAuKFqfDualtHcPKK67DlGVnsrGVoo4= 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=D1/n4Mmw; 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-1f612d7b0f5so10491385ad.0 for ; Thu, 06 Jun 2024 18:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1717722131; x=1718326931; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=KUNbkcgn6ZFtJ0WPgugUHBmOtaRPBWaMM6dzuoXYIbI=; b=D1/n4Mmw8Q6J5RnHgmTuYnnvFbUYUoCvohemen4JEyYtWVq2uDDoCoEf8T6AOvHcWb VaKDQx8RUcUuCLaWnPg/lkYbYC9gQ/1o3IdVxfdesxdke26wYWJk7wR/nE8e3Y6VnkHi vMI+6MdyNOVvgtGxdHZs52lr0H3Of/ow7YszY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717722131; x=1718326931; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KUNbkcgn6ZFtJ0WPgugUHBmOtaRPBWaMM6dzuoXYIbI=; b=A9g/LBBsPvyUaJOVskIeHJrzaqBjWHMrGHtwGUbLCuO4TPq/SMLGE5Zoskl5Ytwn5r 7SvGP+kt9PnZxNzpuuO+0yHFnEhJDi6IVOHbN1kxoMPFbcXkdsQsFxFmr8Oxf9fPvARN gn+DPJ56Net6ZEcGQE1VuI36Vln/AU9RLOrLccudqWn0Cf54v8T6W6OHP5NQ1T4oTto7 Cmhx61s2BQMPlMLTFC7W/9lTMqfJ5q/I+1HqY0erGkFtB7ca11KrrxO+hNAf5ED5PpUD ZTgP+4VKkygbjnuT82bahhHn1NVzhyZ7nIhLq6tQJQQZ9q2czhhHhEmos9ZTAp8kv150 /R5w== X-Forwarded-Encrypted: i=1; AJvYcCXmAzZzsZK5knNIYA8g6wuX3yPDNjvVHP6hffq38SXE0e8PxFgcv92rjANPv0ARUcOitV4M4fOgtUvlbSS39f9GTHLDkyJ+PxHiITGl X-Gm-Message-State: AOJu0Yxk26qUcxUuF5EvlIVXIAWJRGj+cHGsDPM4vdWhROitL6RbBgz6 2/TkRg0Kn0eESTCwKwUFFFZ0jy/qoq6eiVXsp5suXfXbgmhUelZV561CkIDrqps= X-Received: by 2002:a17:902:d2d2:b0:1f6:6c39:9714 with SMTP id d9443c01a7336-1f6b8f08786mr57694725ad.21.1717722131413; Thu, 06 Jun 2024 18:02:11 -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-1f6bd76bf66sm21602655ad.104.2024.06.06.18.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 18:02:11 -0700 (PDT) Date: Thu, 6 Jun 2024 18:02:08 -0700 From: Joe Damato To: Jakub Kicinski Cc: Tariq Toukan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nalramli@fastly.com, Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Paolo Abeni , Richard Cochran , "open list:MELLANOX MLX5 core VPI driver" , Tariq Toukan Subject: Re: [RFC net-next v4 2/2] net/mlx5e: Add per queue netdev-genl stats Message-ID: Mail-Followup-To: Joe Damato , Jakub Kicinski , Tariq Toukan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nalramli@fastly.com, Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Paolo Abeni , Richard Cochran , "open list:MELLANOX MLX5 core VPI driver" , Tariq Toukan References: <20240604004629.299699-1-jdamato@fastly.com> <20240604004629.299699-3-jdamato@fastly.com> <11b9c844-a56e-427f-aab3-3e223d41b165@gmail.com> <20240606171942.4226a854@kernel.org> 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: <20240606171942.4226a854@kernel.org> On Thu, Jun 06, 2024 at 05:19:42PM -0700, Jakub Kicinski wrote: > On Thu, 6 Jun 2024 14:54:40 -0700 Joe Damato wrote: > > > > Compare the values in /proc/net/dev match the output of cli for the same > > > > device, even while the device is down. > > > > > > > > Note that while the device is down, per queue stats output nothing > > > > (because the device is down there are no queues): > > > > > > This part is not true anymore. > > > > It is true with this patch applied and running the command below. > > Maybe I should have been more explicit that using cli.py outputs [] > > when scope = queue, which could be an internal cli.py thing, but > > this is definitely true with this patch. > > > > Did you test it and get different results? > > To avoid drivers having their own interpretations what "closed" means, > core hides all queues in closed state: > > https://elixir.bootlin.com/linux/v6.10-rc1/source/net/core/netdev-genl.c#L582 > > > > PTP RQ index is naively assigned to zero: > > > rq->ix = MLX5E_PTP_CHANNEL_IX; > > > > > > but this isn't to be used as the stats index. > > > Today, the PTP-RQ has no matcing rxq in the kernel level. > > > i.e. turning PTP-RQ on won't add a kernel-level RXQ to the > > > real_num_rx_queues. > > > Maybe we better do. > > > If not, and the current state is kept, the best we can do is let the PTP-RQ > > > naively contribute its queue-stat to channel 0. > > > > OK, it sounds like the easiest thing to do is just count PTP as > > channel 0, so if i == 0, I'll in the PTP stats. > > > > But please see below regarding testing whether or not PTP is > > actually enabled or not. > > If we can I think we should avoid making queue 0 too special. > If someone configures steering and only expects certain packets on > queue 0 - getting PTP counted there will be a surprise. > I vote to always count it towards base. I'm OK with reporting PTP RX in base and only in base. But, that would then leave PTP TX: PTP TX stats are reported in mlx5e_get_queue_stats_tx because the user will pass in an 'i' which refers to the PTP txq. This works fine with the mlx5e_get_queue_stats_tx code as-is because the PTP txqs are mapped in the new priv->txq2sq_stats array. However.... if PTP is enabled and then disabled by the user, that leaves us in this state: priv->tx_ptp_opened && !test_bit(MLX5E_PTP_STATE_TX, channels.ptp->state) e.g. PTP TX was opened at some point but is currently disabled as the bit is unset. In this case, when the txq2sq_stats map is built, it'll exclude PTP stats struct from that mapping if MLX5E_PTP_STATE_TX is not set. So, in this case, the stats have to be reported in base with something like this (psuedo code): if (priv->tx_ptp_opened && ! test_bit(MLX5E_PTP_STATE_TX, channels.ptp->state)) { for (tc = 0; tc < priv->channels.ptp->num_tc; tc++) { tx->packets += ...ptp_stats.sq[tc].packets; tx->bytes += ...ptp_stats.sq[tc].bytes; } } Right? Or am I just way off here?