From patchwork Fri May 10 20:19:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Jurgens X-Patchwork-Id: 13661916 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3753A4D9EA for ; Fri, 10 May 2024 20:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715372414; cv=fail; b=MsfzQ2EZVNfvmu787NHqSDknDgX5qMXUrL64kdwpmgXnXHI7qxerz14G7/dEz6dY4bTyZwQfc13OL1EeJ7H83N185Ds4ls6Jld0I1g71kNl+j8AdXFj8RuQOXQkpY8TNxOKe2JwcEXurBipILVYT2q5yTTuYGxeeFTGnpnkh/vA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715372414; c=relaxed/simple; bh=LExsIF09fYECiGChUExPQStEbHuCJkvZVeAvgcGh3dY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D/SNh3e7UmYljeaz9wv0Tr1RD7r480Iu9P4gB2+rRCWnhmgCyu+JNRPqH94wUkPblfqKdG1H0MxDP6hvXqE5lNFD9MDh9iuzEaWT6JUWILxJMnd6AZVjia/dmxRpf13iP6BunTPDuXEpYADXWStMeZstKIszsEHwnfJXtl9kwpc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=lcqda0Tr; arc=fail smtp.client-ip=40.107.237.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lcqda0Tr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EgCcdAkEcDKa6Uu0ToAKUNmY03bXtHyPjlrWIJ1KjkxAJAPHz7xcgRr9mUsvF+k2A5AHSzvyOkrUCsKbxu4WU75aKmn2Pk1ylqWb0MLy6TX/H2//9NfvdyVeK2tohOlkUvYVeBxcrBT0hMPUi7LByZdMc+RROqFIBQo3o8hiS64xTfdCi6JRr0GWODx2TmadmfBXjYpfusecOK9u54l+u+R7WEI/q2v7tQioqURGOSf+eNARbYeayICH8rwgkQ+n1Jp47HDD9Ccwc6ZHiQkCa61+CImTVdcfltVneATrqasUQYYn4Mn0dlcPeGgvQhmfyKCcYT3r4K2dI/cYPNELNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BzU/RTGSlpJlzeO17sccM3INT6bEJZPrxtGViow6rJ4=; b=NDD1cqE02t1UBFPKC7scD9boRuMCgj3W5LXF1VtV5+ukuZ7pJbZSJ8lQ7jFKw7dy7wt/b+MDVOmbVJJxRgkoy007YrwGd5UOa1U9k1mdr678Z/POc9xSBFcWAPCkSaUaEtNHMyqfLpcKuIXwyOLuhJU5lgz8FNrGIhojGXSxJ12pPtmKFsFXVLL5jVQNiUNzDS6V7lZHLPadfPyb5M3WWVuk2s8IcWqdDiCCEzTF8Z6zTpHK8irU/VPSC+Xgek1iE/XCQSQjMmf1DDpXJWx+QqRiJgCmpMBEvcigk9wQdHIEanKts95SReuPARvINogvFSIZueXS6W0OsjYIQNNMIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BzU/RTGSlpJlzeO17sccM3INT6bEJZPrxtGViow6rJ4=; b=lcqda0Tr9d89N+5se7Js0JtVBvxlVcWZtY1dkCCXNjJNbFuI81yM60K3iBGVVIpXvvoVjYD+OvhtPAafDDGgEfZ30qAH5ajsbrbAKWy1UJ+pJj7rWagN64fGVzZoWhaHu8RAvp7bgGK/Sum3A/2F+0+7GwN240TfE6pCzGfcYqrhKykFkBlvLYST7zelLZYWZMM/hET2Rtah2Bar+Zu6wu8NRCLR8anST/ThWDeqfSv1vAF2FdJ/xWYFMRnOI8mNoXi1ZigGYaSfvjf5vvPKRqs/ZUpKt+M09hvrACQgtgnastV6LvN3rALgkaG/ZwkjGehM8SyAMZcUKVG3jTlweQ== Received: from CH2PR07CA0037.namprd07.prod.outlook.com (2603:10b6:610:5b::11) by SA1PR12MB8118.namprd12.prod.outlook.com (2603:10b6:806:333::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.52; Fri, 10 May 2024 20:20:07 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:5b:cafe::2a) by CH2PR07CA0037.outlook.office365.com (2603:10b6:610:5b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36 via Frontend Transport; Fri, 10 May 2024 20:20:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Fri, 10 May 2024 20:20:06 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 13:19:47 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 13:19:47 -0700 Received: from vdi.nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 13:19:46 -0700 From: Daniel Jurgens To: CC: , , , , , , , , , Daniel Jurgens Subject: [PATCH net-next v2 1/2] netdev: Add queue stats for TX stop and wake Date: Fri, 10 May 2024 23:19:26 +0300 Message-ID: <20240510201927.1821109-2-danielj@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240510201927.1821109-1-danielj@nvidia.com> References: <20240510201927.1821109-1-danielj@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD76:EE_|SA1PR12MB8118:EE_ X-MS-Office365-Filtering-Correlation-Id: e7650a5d-bb98-4fd8-9064-08dc712e956e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|82310400017|376005|1800799015; X-Microsoft-Antispam-Message-Info: RfBsEBbosR1DOjdpZoqCQEJ9p9iZBluz2yWuoKPRE2EChi7ncJug/reEzUd49Dc/cYfrupDQbFWkoqRStOTngZWNlIfcJhrbl2AXEz99CazL1IiPyta9hvUmiDy36D6akX6KUXLN8PoPeeXZ0WALAURKHMUSWi7UwazSPCLND6/qljAlTUsoASQkxLDxUtXgilnWgb2LWUTRAW3f1nutubjS2b9/XGdKdqBgTO5Gi0abJN1DWYfU7ZfH2EdEx1b/SORx6Fucaa30RzL2iieTLgq0uY3kHwuLqMx6PjInU9R4mCN0Yv+yepmCQGGetmMbYedFCS4t8b+UDQ8erNwYhjjw0Ya2P4sntXQ9wwQIix8Zfe1L1vUGRaDmtbNq88cLRs6ywWUMEJ68gPDmqx7wrYA7JzXt7CaL9l2NjlrUcG9IOCEmUoWbypAzpsxUefeB2tqPDc/RyTLcw4L0u5lhMxBMixN/KnzlX7eSwoj4PI6RwJru5IKqWs4xioxQJ5oG5w4vovkjjwRu3nkfq6T7FmkB3TeFIyP3qPLXL67Xvn2B3aXnGp4tq7OlBJhxcvcWWdwu85+x9E9jP5oH/MM9nXAr+p5MUA9rCF3hs4Ljk+wD634X7PKlp14omJU3T48CL3UWflqMndVZeE5eZDNJlWSv/04cd3Na1D7HeCre7Zq0udqXR23bf4vzsS9B7C8FzH2X2M2XgvJx9qzOT5dxqZXafhkgLdwlBtdyJW13TO5bG0+QcgOiRIf0RZpI5Y8tNpsHPtXX+hnXbSTSpaoQJcAcI6oettxIwhw6E4cwdOeGO9tFwuRjRIl7mScTe4g+CYDyxgVpKZJ57ZLS+RwJvTY7RFPZpqnX5mw8fZSgFzWA1EIiQicbiJQhGc8oxhGitSNrRGlxwf7BVlJ7vsMqdT3TxWaAZcqlbWKK9YGeSKjUZPBToha3vL9NTHRVGFptDKLCzyzUn7VQq0AGXbUfkNEUwTYYWHZB8YOWSXisWfX4ttNBHdaL/NQwusnGXNtsdUW6SheOk9DPUlYlkUTE1vU7mSElEgvdBjdtxNaL+pRNLbVZQ4hwZ1AFkDnOBKnhD+JqItyA1pCYMriIsrKvh4mWWY8vFrEHnxkRtrUzef6mhrFF1a2kXLiDV3u0vEBuoC7myJuH4KBVRFwgM+sx75eElNQacL/exyn4ZmxiL3j79bxluRNj5F2pw2n9xENV/sZyYwHhFAKh/mOgxGRVOSzjiYVCOv98henP/F/UuYDIHgs3NMVXVcNEF8U0j6j0D8hv6dIQQpNK706hvJ15SfHv4ynr8c6+WM3HthehiJ8ArxE8yEIapP3cmze3Kj2ht7dSxbiLHIJC7O8hU/TXg8z4Xh+RFqTdt21ot2UwN7x5Zeb05LIKTPKmwN2zb8Ww X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(82310400017)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2024 20:20:06.7534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7650a5d-bb98-4fd8-9064-08dc712e956e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8118 X-Patchwork-Delegate: kuba@kernel.org TX queue stop and wake are counted by some drivers. Support reporting these via netdev-genl queue stats. Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko Reviewed-by: Jason Xing --- Documentation/netlink/specs/netdev.yaml | 14 ++++++++++++++ include/net/netdev_queues.h | 3 +++ include/uapi/linux/netdev.h | 2 ++ net/core/netdev-genl.c | 4 +++- tools/include/uapi/linux/netdev.h | 2 ++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml index 2be4b3714d17..11a32373365a 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -439,6 +439,20 @@ attribute-sets: Number of the packets dropped by the device due to the transmit packets bitrate exceeding the device rate limit. type: uint + - + name: tx-stop + doc: | + Number of times driver paused accepting new tx packets + from the stack to this queue, because the queue was full. + Note that if BQL is supported and enabled on the device + the networking stack will avoid queuing a lot of data at once. + type: uint + - + name: tx-wake + doc: | + Number of times driver re-started accepting send + requests to this queue from the stack. + type: uint operations: list: diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h index e7b84f018cee..a8a7e48dfa6c 100644 --- a/include/net/netdev_queues.h +++ b/include/net/netdev_queues.h @@ -41,6 +41,9 @@ struct netdev_queue_stats_tx { u64 hw_gso_wire_bytes; u64 hw_drop_ratelimits; + + u64 stop; + u64 wake; }; /** diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h index cf24f1d9adf8..a8188202413e 100644 --- a/include/uapi/linux/netdev.h +++ b/include/uapi/linux/netdev.h @@ -165,6 +165,8 @@ enum { NETDEV_A_QSTATS_TX_HW_GSO_WIRE_PACKETS, NETDEV_A_QSTATS_TX_HW_GSO_WIRE_BYTES, NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS, + NETDEV_A_QSTATS_TX_STOP, + NETDEV_A_QSTATS_TX_WAKE, __NETDEV_A_QSTATS_MAX, NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1) diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 4b5054087309..1f6ae6379e0f 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -517,7 +517,9 @@ netdev_nl_stats_write_tx(struct sk_buff *rsp, struct netdev_queue_stats_tx *tx) netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_GSO_BYTES, tx->hw_gso_bytes) || netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_GSO_WIRE_PACKETS, tx->hw_gso_wire_packets) || netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_GSO_WIRE_BYTES, tx->hw_gso_wire_bytes) || - netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS, tx->hw_drop_ratelimits)) + netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS, tx->hw_drop_ratelimits) || + netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_STOP, tx->stop) || + netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_WAKE, tx->wake)) return -EMSGSIZE; return 0; } diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h index cf24f1d9adf8..a8188202413e 100644 --- a/tools/include/uapi/linux/netdev.h +++ b/tools/include/uapi/linux/netdev.h @@ -165,6 +165,8 @@ enum { NETDEV_A_QSTATS_TX_HW_GSO_WIRE_PACKETS, NETDEV_A_QSTATS_TX_HW_GSO_WIRE_BYTES, NETDEV_A_QSTATS_TX_HW_DROP_RATELIMITS, + NETDEV_A_QSTATS_TX_STOP, + NETDEV_A_QSTATS_TX_WAKE, __NETDEV_A_QSTATS_MAX, NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1) From patchwork Fri May 10 20:19:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Jurgens X-Patchwork-Id: 13661915 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 043C64DA13 for ; Fri, 10 May 2024 20:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715372412; cv=fail; b=XnTp/md8bC4+oWelx8Rer6Y2abHvt+baalOlaSDJT4wZ/ixgbZfVZfyAlqVu09Hx3nq0v/HRAXaBm6am6tGzFFwIkAynBtg9erfiVLDmRwz7NMevbKxZt5cx1bj/CL5hzq46sH7nzPf+HmKkFlpDJ039tk9IEgWbRvySPzvalMs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715372412; c=relaxed/simple; bh=XZyKxj8wyPtk4gZF7RgNKU6aBJi/k1Wk9G6+0DgT+QM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lntKsYP+85Sb+3in59svc5jJH5EDPpHIDj32wSRoBZn/6Ocnw870GwPAfK61g4no7r2FQ2SZvLhwPXDphayGntSr4X7lsCXHLSuJqQdu/n2ae7ArhdBR2uZptdBQzyjhaOppNxsqqBA7QZlCG5kxHDH8BgLsEqsminYTw0pmE2w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=IswBs96Z; arc=fail smtp.client-ip=40.107.237.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="IswBs96Z" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=egR0+ddiM+FiGrnyjXKpXPZ8IwLdRibcVb9ff2UiAwSgRRvRta6F8Jn1XWj+XMmVHJQdPMtUGT6hElMGYh7gCDh2weiIbE8T1GA2geMabokW9EcWh0t2SBS7Vxn35NvdTG7yMyUDsR2AWygp87b15wmbsBZIaav2KFi4FCTdHN7CgU5BliI/TGJEdG2B0hIp2br8gi9dgdLE8sGG6RdOOwANgw16yqi+WNmSsSlzIzIlkmzypwZsTKZeNYaKEJZzvKNM2RMzB+APc1ELp3Gw9hlwvTySSTTTTEhcUcS0b+OVm8b0XHeVtQ0ENJ+O/ZcX5Z6b8ST0XR7dlxJYSy3mFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nEgjrIZxDvrzHAtwJEwyYQ6KjX7VQQYcLtK12m5JJxM=; b=Bn5htB7yuV+6jbReif+DgTImvnncqqA9UaBI6trJ7PGRrHeW/+MVSJunjcEz5w0ONFensKpeBffEePEs6DSoymqJiz1h6yPIO9KbrbgWg60ki9uLBg7petJRwqpMDUF0Ffj8lJMMbDIBLVwJl85YFdvDYq01i2nsO/3Y37W6tr0ooOIk9Gf6T3ikXIQVVRw2o+djM0iTtzYyafP8oN+zpDtbRZ9T74ONEV0e4egVN+tpetjMg1nnSx+u3ZP+4CA5OZhy5MfrpqdgtK3wOKT7ZSul71DsYVzFdtR66n+wxSHjieWTto9/xpw5H9GBfsMaVa0OM1gHxLILYfklPkv+gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nEgjrIZxDvrzHAtwJEwyYQ6KjX7VQQYcLtK12m5JJxM=; b=IswBs96Z+NTSmDMbL3Gt7J7z6mPT2vP4oY6skwPCWfVy+wUZJDhGQV+vZjEAXDXoah3QruSuetNhthODzrnBore2ITdgRmjYU2MKjsSO6iXFw4F51H2sSN6K0R8YhMcD8qce6Hx3DglJ64+4aFm7P2iLZkE7nyq9123lIvpt6w5nYuQT+OjwyVogTDI5iQu8YgScFQzYZLFyuvoXbMaFMumat2uT7Yxtk0jlFAxhGWGxVqPy7D1WvuPln+Nv7Kmxp1Ob/bKVfWZRcOBA+LeWGg9R2VsYIPPAOeo/2uV8wvSoAEPTy/V0jykOaDeRrD/+x8rRp4ceFRJkSXI4WtSEUQ== Received: from CH2PR07CA0040.namprd07.prod.outlook.com (2603:10b6:610:5b::14) by CH2PR12MB4104.namprd12.prod.outlook.com (2603:10b6:610:a4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.51; Fri, 10 May 2024 20:20:07 +0000 Received: from CH1PEPF0000AD76.namprd04.prod.outlook.com (2603:10b6:610:5b:cafe::ad) by CH2PR07CA0040.outlook.office365.com (2603:10b6:610:5b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34 via Frontend Transport; Fri, 10 May 2024 20:20:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000AD76.mail.protection.outlook.com (10.167.244.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Fri, 10 May 2024 20:20:07 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 13:19:49 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Fri, 10 May 2024 13:19:48 -0700 Received: from vdi.nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Fri, 10 May 2024 13:19:47 -0700 From: Daniel Jurgens To: CC: , , , , , , , , , Daniel Jurgens Subject: [PATCH net-next v2 2/2] virtio_net: Add TX stopped and wake counters Date: Fri, 10 May 2024 23:19:27 +0300 Message-ID: <20240510201927.1821109-3-danielj@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240510201927.1821109-1-danielj@nvidia.com> References: <20240510201927.1821109-1-danielj@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD76:EE_|CH2PR12MB4104:EE_ X-MS-Office365-Filtering-Correlation-Id: 842f8dc4-120f-4ca1-26d9-08dc712e9607 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|82310400017|36860700004; X-Microsoft-Antispam-Message-Info: uGXZQ9IqWtLU1+n+A8mxSliHv5/aai5gTInGN6bExZL1mWvEf6g0j7DkpAjy5YiFGywBer1Q3Lwg/JI14GafX0rV904Nm7F+jBLbYNrbuf4sD0fZnqO2OUMiAGGkRXbVH6PC3YemZEaJXZ1MJNgzuYT7FNyVC2wl6zkUl6YFv6w24g+1l9ngsuMCDRopNh2C1J80J7nv6GOQUN2Oummx1oAHUz6PnKbcfI6MqaDKXhtMSHB5wnBpn5LstoX341texbF6Lyfu0wmpNFU8ApV40DSfwwrmYpLUPP16LVQ5raWlQq3ldO3kODtVL9QD4Q73lGDQQIryLFfW/j3z+Q4VjxUv0VOrEDikqqqIhjVvjgV/gUTZS/EY5Nmsc2y0jQf+etCIWSdO+56B9imlnh7pMybyiqKBfWfXE0wbD0ikhOIAD7kxS9WNV1ZQNnTQNN49EHKG2VFpNIJ4ejOO6D3doRgqSXB39AaIPVCtF5DZ9ejt7flcq6aqZJKJSod0f5ItTdS/lvzcBCvo2lOXttp9GVAdC3O/2z1lwK4QPXxoWRVgYb4zs13kNA9ko6a3PnxDgPP66vEZPZM7BKvs1nqyCrgL2ztmAQaEfMwdED+KZXz5VwsFKapDH7MxBRF9c0k6Lx9cs/dd6r5Etx75ZUATf5MprID7N5vBDHK/wom5aNrMpAADXs3Ec5cXEGLdDHxeK+vPK12brLj7uoAIgUo+Db46Jac7mZ3R8SzvaWddJ3vw6YAW+XxxRWD8pkQy2CvVxXLbkL6q+jF2OMnFdPulQlYa2pJ/8VTHMzK6VhC3PnNqU2iMpisIX09LdrcUC6jEUutuH4ENLiaRsb6JBbHtZLb2z9ne7VQascDXSZK9QweEXuXKV62GwZvKVwiiKlXioPrJ/J1dpz8R4lFHrDeJSe3tvlcUTaHwgnW6c9Te3YDGSMaG+Klbvsm+vLDNQEK9e4UPvJEYFByJcIwxyCYhPSEnbaGwjlPt04FDSJ/uz9GzUN2+vMsPcy8/OglF68GKlcaoFa7b/VBhOfTdQgUDJ/fZiWSTGfAR8vKLOK1ug5GwHV3J5HK2XKpScTMKp+2zIl4U1R/BT/Lzg93a3UXpST2vDZIewXOV79Cb1uU1D6NEzzSv6d9ZYgXoOQwX0BqJY3UXcbUO/3OU9cct6Q/UuvWx1ipP1puRTZp7PYwVgXFH4Rw/ZNUjpdBc1NK/QvTJuitunYmYWOgT+g/aLxYMfeNVfp+ylr10RuTxW3W60pLJEn/a/F6eFsOUzYPn6DDziKpsvEowjlJqB0UL7PCPRj2xX+0I9BHWeB5BlwQB07yjrv/dhxKaePwspi9oKMBjxKhpRINKLjsJjzsMTv4YsAyhvF6Cx5w26nuPwHnRbOo= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(1800799015)(376005)(82310400017)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2024 20:20:07.7690 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 842f8dc4-120f-4ca1-26d9-08dc712e9607 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD76.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4104 X-Patchwork-Delegate: kuba@kernel.org Add a tx queue stop and wake counters, they are useful for debugging. $ ./tools/net/ynl/cli.py --spec netlink/specs/netdev.yaml \ --dump qstats-get --json '{"scope": "queue"}' ... {'ifindex': 13, 'queue-id': 0, 'queue-type': 'tx', 'tx-bytes': 14756682850, 'tx-packets': 226465, 'tx-stop': 113208, 'tx-wake': 113208}, {'ifindex': 13, 'queue-id': 1, 'queue-type': 'tx', 'tx-bytes': 18167675008, 'tx-packets': 278660, 'tx-stop': 8632, 'tx-wake': 8632}] Signed-off-by: Daniel Jurgens Reviewed-by: Jiri Pirko Reviewed-by: Jason Xing --- drivers/net/virtio_net.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 218a446c4c27..df6121c38a1b 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -95,6 +95,8 @@ struct virtnet_sq_stats { u64_stats_t xdp_tx_drops; u64_stats_t kicks; u64_stats_t tx_timeouts; + u64_stats_t stop; + u64_stats_t wake; }; struct virtnet_rq_stats { @@ -145,6 +147,8 @@ static const struct virtnet_stat_desc virtnet_rq_stats_desc[] = { static const struct virtnet_stat_desc virtnet_sq_stats_desc_qstat[] = { VIRTNET_SQ_STAT_QSTAT("packets", packets), VIRTNET_SQ_STAT_QSTAT("bytes", bytes), + VIRTNET_SQ_STAT_QSTAT("stop", stop), + VIRTNET_SQ_STAT_QSTAT("wake", wake), }; static const struct virtnet_stat_desc virtnet_rq_stats_desc_qstat[] = { @@ -1014,6 +1018,9 @@ static void check_sq_full_and_disable(struct virtnet_info *vi, */ if (sq->vq->num_free < 2+MAX_SKB_FRAGS) { netif_stop_subqueue(dev, qnum); + u64_stats_update_begin(&sq->stats.syncp); + u64_stats_inc(&sq->stats.stop); + u64_stats_update_end(&sq->stats.syncp); if (use_napi) { if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) virtqueue_napi_schedule(&sq->napi, sq->vq); @@ -1022,6 +1029,9 @@ static void check_sq_full_and_disable(struct virtnet_info *vi, free_old_xmit(sq, false); if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { netif_start_subqueue(dev, qnum); + u64_stats_update_begin(&sq->stats.syncp); + u64_stats_inc(&sq->stats.wake); + u64_stats_update_end(&sq->stats.syncp); virtqueue_disable_cb(sq->vq); } } @@ -2322,8 +2332,14 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) free_old_xmit(sq, true); } while (unlikely(!virtqueue_enable_cb_delayed(sq->vq))); - if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) + if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) { + if (netif_tx_queue_stopped(txq)) { + u64_stats_update_begin(&sq->stats.syncp); + u64_stats_inc(&sq->stats.wake); + u64_stats_update_end(&sq->stats.syncp); + } netif_tx_wake_queue(txq); + } __netif_tx_unlock(txq); } @@ -2473,8 +2489,14 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) virtqueue_disable_cb(sq->vq); free_old_xmit(sq, true); - if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) + if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) { + if (netif_tx_queue_stopped(txq)) { + u64_stats_update_begin(&sq->stats.syncp); + u64_stats_inc(&sq->stats.wake); + u64_stats_update_end(&sq->stats.syncp); + } netif_tx_wake_queue(txq); + } opaque = virtqueue_enable_cb_prepare(sq->vq); @@ -4790,6 +4812,8 @@ static void virtnet_get_base_stats(struct net_device *dev, tx->bytes = 0; tx->packets = 0; + tx->stop = 0; + tx->wake = 0; if (vi->device_stats_cap & VIRTIO_NET_STATS_TYPE_TX_BASIC) { tx->hw_drops = 0;