From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 821D979DC for ; Fri, 7 Jun 2024 01:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717722133; cv=none; b=U9bgFb499arKk7e5LNFt2kuoKyVd8q2RZ4D5vYi/28j56/34LTqQ4cVrfcKGqTsQrX70qe+zhyeywommMPMqfW4+ZDFFsIEqBksQPhoLkOyxOF07QAv5zGwO34PJSeECIWaOfdAxMEPpDsaKfbjC8YuuYgNyp7t6n68iUfPKqKk= 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=sr5yhIAG; arc=none smtp.client-ip=209.85.214.176 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="sr5yhIAG" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1f4a5344ec7so12123545ad.1 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=1717722132; x=1718326932; 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=sr5yhIAG41GN4+pdf9DWdTTx7BtQy9T6R28WJo9yWNGkmtPBmURrhnXyxSfQn8/977 wXzSmaM6EIGVX89LBnUXhcZ1qmP7I4abFTKNX3KFGgvdKHjEXiH3xdiHEvAmhHWjZ+DC ALHP+Gw51FXCxYUhAW/J2LsI65mtKSs0C4g2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717722132; x=1718326932; 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=ECE2LhWWKMPyHEBXQk48pAZYiL94D07pRcoCZ6delg6MB6/VI9YA69uxThmufifo/v 1QGsOQBBbzReeKIjwu0TiEGXXlt4H1HIactxR+kQ8tXywYlBisN49zqK3b7v/Be6xBGf uD6k7KsqhM1JMcmSjeD1oxj85dAoTuY9wBJZZ2okezE6PLWKLJB/l/LBjS+1X89Oh9p4 ZQke0tmb1eb6jTDejVma2WASnusrz36NtLJOBYkWugCP2HBuE78tFyZYIiANrGPG95ay iuhThzewV+WOoB5n84kBdgpcHDFKI+J5aKTmv8ssFFEOyPZQ6c8mbi1Hj2+dbQYb4GnN x+/g== X-Forwarded-Encrypted: i=1; AJvYcCXOz4yP/1Hgt/cNyK+Npi7vivPJfiRMwOI3Kn0CaksB1PvfFNsInLcbRQBQ8M7LBvYHXCeB35ecHgZC659FU8JmH8XABKcA X-Gm-Message-State: AOJu0YzHERmqXY2cAmMmSXMAX6yx4kUkLmDbJDSDwAc77AJH+hdg8Ljj 5kLLQeR40AgtkgATkJ1bEFYZCwEralYISltzISzg8CW40r75+yGkzSJpLtToCOg= X-Google-Smtp-Source: AGHT+IFcBgdym20higsdPt+vBoI3sriQzqsZZxnlyi7NoJdl0XPH6dDC05Y4UuIX+LgQAMe7MRTE8g== 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: netdev@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?