Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1300782lqj; Mon, 3 Jun 2024 17:46:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7T3+nqVWkKGiwPiGV1wfULnU+nFxyYWb9FdpmCieXpi38kfEh/lDrKjcOk2R8nB2VsA/kUsayy49a/SueK7B+U3m4iAdORviwAceLdw== X-Google-Smtp-Source: AGHT+IH+/Petd0/XXoqcldnwC6Q6vAWpmwzfmVt0IDVEm8GJ/OJ2Pq2eluYU/dKQ/9JDmJYrYRQY X-Received: by 2002:a05:6a20:6a14:b0:1a9:d27c:3151 with SMTP id adf61e73a8af0-1b2a345c04bmr1943824637.23.1717462011273; Mon, 03 Jun 2024 17:46:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717462011; cv=pass; d=google.com; s=arc-20160816; b=T3eLaNQlIfsKOlH8UvZ47rUz0o5figQa0ulE4F1H0bG1Fo65Lg501XpoI0OTpbFRkG YGMCPOxGPqf4gDHYM3XPfgBx1iRD+70ixrpaLgeUoVHTPCsso68OBLSxzybcZT/q/LB2 CHAYhkghnD5ZD712BFGmNUq8vi7PQte18mJQTNAP/5+cpQYelc1VykD39Pum2h2eeGqz tP/tW8AmzD3WTFbxi+MUJ/Z4JYx8iRv8Ww/pr1nkvllTIwgWVs5cdTRNgl71PtjKe3AF XEduYVzWfWrRb6kkyrjEntuj57svK6xsE1ORb54EcswZAJrrBLpj4BLZmsIen2xHkwFP ErtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=j6qJ3cMHA2ZvV0BHrtuqD+iovtfIMHyhYFzDZ7OtxxQ=; fh=RVebdEyTzGuYcSULD2Ikc0H+2Y0rrgfCe5cI4X/0jBs=; b=xxFuib0lYb1DRmH7ur7X12g/X9FDx1/SaLmZxgQ1Gbm/FO7ST9ifiwyM5GXTjtG3MY SCilgdgtmQYU+RBufymqHUyWFREuREzWW3raIx1ueMHeGyeGbLNDIwSxslEQxWbRA2bG guHCX/gt1pzf5Jic7epfw74m/IGgiaKPQUL239MJ6GbC4DowX+0saYOD5sKOKC1OlHsP 3RmkisTxNu1iCtlipYQQOgL+1Xwp3Dqi/XZNIrtbpmbg5HZNTqP3o5xnHqG6cY0kyYXs Q3YdiF7rHOIUh8dukhKyXRdvKH9wolukftOM5eOSSMvkUiDhhknrT1f2RYmoTrTPtBgP rz8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=h64O2c+v; 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-199878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c359e098bdsi7296646a12.314.2024.06.03.17.46.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 17:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=h64O2c+v; 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-199878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199878-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3F3F228605A for ; Tue, 4 Jun 2024 00:46:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4DCC7462; Tue, 4 Jun 2024 00:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="h64O2c+v" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.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 7A0CB7E2 for ; Tue, 4 Jun 2024 00:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717462000; cv=none; b=fI5kqLcy7pTk3RRCnxvrZcNKOArV7wkoeNhoxzK+XVM1Ieuo5cy6CNm3rZTus3txp6R8pUddELyhdM9Z+SWJprcXHyTQx7I0X/vPvk9nXWxyj1MthiI2XgiY9Yk27xuHnK2mPIj/Q/LRArLY/PYkKd9JWBV/7qV8st9ZPz17k20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717462000; c=relaxed/simple; bh=CcYTAVWyB3ymSj/OaY1OftSd6VsNT505IUtr0hifhfE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BcH0WbNj9rNUfwrT6win+eFfV5IOVnCpxnX3IEsrlvkG3OVNpbYiC/UDHdmCQA0MndDP+YE69DBFXcCmtocjPD6lDMJK4W1n9uxB2DDFMyu9jnK2xOP3HTdKnsEuuOY3B7uyq3/55NAyw3nbd7ZRtNetsZ/IbNxAcEYuRHgFbXA= 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=h64O2c+v; arc=none smtp.client-ip=209.85.210.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 Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7025f4f4572so1384517b3a.1 for ; Mon, 03 Jun 2024 17:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1717461999; x=1718066799; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=j6qJ3cMHA2ZvV0BHrtuqD+iovtfIMHyhYFzDZ7OtxxQ=; b=h64O2c+vb0/hkqU+j9xiH+oAo/4BANflqg4hW7j+kVwpE7XHPT2g9KvMqWp1OONrBo G91IdPe6AVx0cowx4wB70eyAgmss4XprBoq3GZVQffhyGOCsSZBjUm5QG2d2pMUmvNWu nAyQZL8hNYYovwlqCHv+qhxC86OZdHK0Tq3h0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717461999; x=1718066799; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j6qJ3cMHA2ZvV0BHrtuqD+iovtfIMHyhYFzDZ7OtxxQ=; b=B1U/Ey7AiibBtVe4ZA+2iJwgc66aKsXquYHFvCm5SoCtpZAuvVhA+lfqDX6KuUs/dj R5VX5XINkU3gjHs2NzIAAmLn6DByz3F3vpipri+EZsReiW8QeMupPeLcC2FAGoiKIf8M Se99nmrmbsISt6eFIWWwly0qBmvmJLqD4p906myifYCtOsH5TJlYy30nOartHsicXM75 /WO4UX/bHhMWnd7PD7Pmpw2SrO6TUJbrYnnxyy0dpFe6kKXGt/kPRW5oeEzQA4skZPmZ JV+cgh/rACsT4YIwwEXRbugFIdgwZlCFKC02Dcq8y1Zjvcs3M70e9IDRZbvP2QxFEoiG wGPQ== X-Forwarded-Encrypted: i=1; AJvYcCXU/hXz10bX7M+aJI7nNCWvkgU4FPSEE+hVsuM1AzKeTEzWllxb2ad12q1KV1DxdwboIMNYNyHPxzvueWkx/0IAPN/PCRY/n+fZqA+j X-Gm-Message-State: AOJu0YyDdXKZUr1/EGRVDFJp/rC8MYU0WPUL4zhtW/ct9VrAdRt0qiL8 lgmUNHuRiGvrdvmc/ZnpPsn8duUWCASEQwsaJu7CU+Wvg91lVGr0pfHzt3cm0WU= X-Received: by 2002:a05:6a20:8418:b0:1a7:590e:279e with SMTP id adf61e73a8af0-1b2a2b84011mr1872915637.5.1717461998677; Mon, 03 Jun 2024 17:46:38 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242c26067sm6049316b3a.218.2024.06.03.17.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 17:46:38 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: nalramli@fastly.com, Joe Damato , Carolina Jubran , "David S. Miller" , Eric Dumazet , Gal Pressman , Hariprasad Kelam , Jakub Kicinski , Leon Romanovsky , linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI driver), Naveen Mamindlapalli , Paolo Abeni , Richard Cochran , Saeed Mahameed , Tariq Toukan Subject: [RFC net-next v4 0/2] mlx5: Add netdev-genl queue stats Date: Tue, 4 Jun 2024 00:46:24 +0000 Message-Id: <20240604004629.299699-1-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Greetings: Welcome to rfc v4. Significant rewrite from v3 and hopefully getting closer to correctly exporting per queue stats from mlx5. Please see changelog below for detailed changes, especially regarding PTP stats. Note that my NIC does not seem to support PTP and I couldn't get the mlnx-tools mlnx_qos script to work, so I was only able to test the following cases: - device up at booot - adjusting queue counts - device down (e.g. ip link set dev eth4 down) Please see the commit message of patch 2/2 for more details on output and test cases. v3 thread: https://lore.kernel.org/lkml/20240601113913.GA696607@kernel.org/T/ Thanks, Joe rfcv3 -> rfcv4: - Patch 1/2 now creates a mapping (priv->txq2sq_stats) which maps txq indices to sq_stats structures so stats can be accessed directly. This mapping is kept up to date along side txq2sq. - Patch 2/2: - All mutex_lock/unlock on state_lock has been dropped. - mlx5e_get_queue_stats_rx now uses ASSERT_RTNL() and has a special case for PTP. If PTP was ever opened, is currently opened, and the channel index matches, stats for PTP RX are output. - mlx5e_get_queue_stats_tx rewritten to use priv->txq2sq_stats. No corner cases are needed here because any txq idx (passed in as i) will have an up to date mapping in priv->txq2sq_stats. - mlx5e_get_base_stats: - in the RX case: - iterates from [params.num_channels, stats_nch) collecting stats. - if ptp was ever opened but is currently closed, add the PTP stats. - in the TX case: - handle 2 cases: - the channel is available, so sum only the unavailable TCs [mlx5e_get_dcb_num_tc, max_opened_tc). - the channel is unavailable, so sum all TCs [0, max_opened_tc). - if ptp was ever opened but is currently closed, add the PTP sq stats. v2 -> rfcv3: - Added patch 1/2 which creates some helpers for computing the txq_ix and ch_ix/tc_ix. - Patch 2/2 modified in several ways: - Fixed variable declarations in mlx5e_get_queue_stats_rx to be at the start of the function. - mlx5e_get_queue_stats_tx rewritten to access sq stats directly by using the helpers added in the previous patch. - mlx5e_get_base_stats modified in several ways: - Took the state_lock when accessing priv->channels. - For the base RX stats, code was simplified to call mlx5e_get_queue_stats_rx instead of repeating the same code. - For the base TX stats, I attempted to implement what I think Tariq suggested in the previous thread: - for available channels, only unavailable TC stats are summed - for unavailable channels, all stats for TCs up to max_opened_tc are summed. v1 - > v2: - Essentially a full rewrite after comments from Jakub, Tariq, and Zhu. Joe Damato (2): net/mlx5e: Add txq to sq stats mapping net/mlx5e: Add per queue netdev-genl stats drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 + .../net/ethernet/mellanox/mlx5/core/en/qos.c | 13 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 149 +++++++++++++++++- 3 files changed, 161 insertions(+), 3 deletions(-) -- 2.25.1