From nobody Mon Feb 9 13:36:48 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 B9BBB3093B2 for ; Mon, 2 Feb 2026 19:39:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061180; cv=none; b=c9jQEr4Xh7DLPS5afdSpnfYVuSBWoHxHtYfR1/U1Ih0OyAuDi/g9wJWmeTOeIbzwbrF3hXasHJ4sScW33VwNba1Vur50nJGOU7zfG34QFfg7qMLa6X8mGjv6KxJX2bqIUvUgAbLK6ngDQ77rF5fJ6S6EfAtKR9dz9HpU1yqLKDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770061180; c=relaxed/simple; bh=n6E9zvFMWoY03F3m73ZI1gx6xlels/hxNGufX6evA1g=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NpCXVFOepq1OqqQoIXEYF3lNtbZVhyFetiCBSpmdZFZnqTnZSgpLA32HlP9tzA3D0GIupBQpHKJzrbjxeB+f3R9J9cCRgeYNKfjKT2okQIjoKCTyDq4iJ9R2J87MY8tQ9W22u6prcj54ve30Bmyy9DgiKrGrp7I64O4ZJVBf0TU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--hramamurthy.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JSQCeXBB; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--hramamurthy.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JSQCeXBB" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-29f2381ea85so112205595ad.0 for ; Mon, 02 Feb 2026 11:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770061178; x=1770665978; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=sq8UgQHMkDt9URltVgoRQ8Smj0jrcUPq0dpsGS66bCA=; b=JSQCeXBBA8DPCXpZzgvVKmiTIwHypuwAr/vKsFpQQUFkLvZHy6F/Pag9l85UAmN7Al JcweXrfDTaQmRxyKO0YckBAmQVN0dlpadq5EmeZTTB+32Ln24HXbKKuu268w7vjIjvqn bUT+zqLxI8vgfdfsOo/NkvkgaZ14KLV51g/yf5GiG90vRBCBpHrBH6kRET//3alm9LHL i0qRq2ousufwcSLd46mNRN08Q2Rntacn/PB+/vyTtzqN+QKJDITTXLEDGkVzWGYR1Djh 4YYFs4Hdy8qCJesqzgkkjsBm1lSifaExcQt7SN/sCkvPk5nKSG0KpMOmUDsiA0ff5Xry tnQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770061178; x=1770665978; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sq8UgQHMkDt9URltVgoRQ8Smj0jrcUPq0dpsGS66bCA=; b=Lk5loKEToiQ6WNccSPcWYFcwGg0rB9bCHdcfybjMWHJYq8FF5H1Im9w7Yo03DhZiNd QXEc6OliTcHUB5Wh6Y0kMG7a0oLrW61HV0hZpEg9lq6yxmZrG8rt8ckxINTYylCyDEmH 71ddSfoyjDF+ybI9UA0bSZBkXgfqUCzaiDaZ1b0OPe+0niDiNAaxcLC/k3SDL4MyQ7T/ XIjkHN0mXGJbpqag4gLi9BUMxLkklPyxOK26lr7X6RI1ZVvfq11dHwDO5cxb3RpuOBcG 6AjQivNjkX7/MenKn/jv5/K63xS4bigm9+4SztZoRbt+TBFb7t+9cJN3XZ8VMfUg3utk qZnA== X-Forwarded-Encrypted: i=1; AJvYcCWfHcQJuLPHlLUAim5vTto1a4DsxF2vjaxuuEzJqgIsTZdG3mOi1cNoAXMQUwC1Ip3NuxGZgxMAc6uhM2A=@vger.kernel.org X-Gm-Message-State: AOJu0YyQJbH9AidwlIo/j08yB1aypqLV9vyh80M2JZ0Gr+oH83Emaioy G+QMoNAGEwoJTAweJiLEu0irCalOoyxB3HBgv07WejleST7ACZR2IbEhwVlyIPjRw6tLxtLZAQA VLdv71rMOPEks34J4eTomEZhpcA== X-Received: from plbjw4.prod.google.com ([2002:a17:903:2784:b0:2a0:f5f5:419d]) (user=hramamurthy job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:d4c5:b0:2a9:4c2:e47 with SMTP id d9443c01a7336-2a904c241c5mr61022835ad.56.1770061178166; Mon, 02 Feb 2026 11:39:38 -0800 (PST) Date: Mon, 2 Feb 2026 19:39:25 +0000 In-Reply-To: <20260202193925.3106272-1-hramamurthy@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260202193925.3106272-1-hramamurthy@google.com> X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: <20260202193925.3106272-3-hramamurthy@google.com> Subject: [PATCH net 2/2] gve: Correct ethtool rx_dropped calculation From: Harshitha Ramamurthy To: netdev@vger.kernel.org Cc: joshwash@google.com, hramamurthy@google.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, ziweixiao@google.com, jordanrhee@google.com, nktgrg@google.com, kuozhao@google.com, yangchun@google.com, awogbemila@google.com, maolson@google.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.com, Max Yuan , stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Max Yuan The gve driver's "rx_dropped" statistic, exposed via `ethtool -S`, incorrectly includes `rx_buf_alloc_fail` counts. These failures represent an inability to allocate receive buffers, not true packet drops where a received packet is discarded. This misrepresentation can lead to inaccurate diagnostics. This patch rectifies the ethtool "rx_dropped" calculation. It removes `rx_buf_alloc_fail` from the total and adds `xdp_tx_errors` and `xdp_redirect_errors`, which represent legitimate packet drops within the XDP path. Cc: stable@vger.kernel.org Fixes: 433e274b8f7b ("gve: Add stats for gve.") Signed-off-by: Max Yuan Reviewed-by: Jordan Rhee Reviewed-by: Joshua Washington Reviewed-by: Matt Olson Signed-off-by: Harshitha Ramamurthy Reviewed-by: Jacob Keller --- drivers/net/ethernet/google/gve/gve_ethtool.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/et= hernet/google/gve/gve_ethtool.c index f7864ae7..9fd954d1 100644 --- a/drivers/net/ethernet/google/gve/gve_ethtool.c +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c @@ -152,10 +152,11 @@ gve_get_ethtool_stats(struct net_device *netdev, u64 tmp_rx_pkts, tmp_rx_hsplit_pkt, tmp_rx_bytes, tmp_rx_hsplit_bytes, tmp_rx_skb_alloc_fail, tmp_rx_buf_alloc_fail, tmp_rx_desc_err_dropped_pkt, tmp_rx_hsplit_unsplit_pkt, - tmp_tx_pkts, tmp_tx_bytes; + tmp_tx_pkts, tmp_tx_bytes, + tmp_xdp_tx_errors, tmp_xdp_redirect_errors; u64 rx_buf_alloc_fail, rx_desc_err_dropped_pkt, rx_hsplit_unsplit_pkt, rx_pkts, rx_hsplit_pkt, rx_skb_alloc_fail, rx_bytes, tx_pkts, tx_bytes, - tx_dropped; + tx_dropped, xdp_tx_errors, xdp_redirect_errors; int rx_base_stats_idx, max_rx_stats_idx, max_tx_stats_idx; int stats_idx, stats_region_len, nic_stats_len; struct stats *report_stats; @@ -199,6 +200,7 @@ gve_get_ethtool_stats(struct net_device *netdev, for (rx_pkts =3D 0, rx_bytes =3D 0, rx_hsplit_pkt =3D 0, rx_skb_alloc_fail =3D 0, rx_buf_alloc_fail =3D 0, rx_desc_err_dropped_pkt =3D 0, rx_hsplit_unsplit_pkt =3D 0, + xdp_tx_errors =3D 0, xdp_redirect_errors =3D 0, ring =3D 0; ring < priv->rx_cfg.num_queues; ring++) { if (priv->rx) { @@ -216,6 +218,9 @@ gve_get_ethtool_stats(struct net_device *netdev, rx->rx_desc_err_dropped_pkt; tmp_rx_hsplit_unsplit_pkt =3D rx->rx_hsplit_unsplit_pkt; + tmp_xdp_tx_errors =3D rx->xdp_tx_errors; + tmp_xdp_redirect_errors =3D + rx->xdp_redirect_errors; } while (u64_stats_fetch_retry(&priv->rx[ring].statss, start)); rx_pkts +=3D tmp_rx_pkts; @@ -225,6 +230,8 @@ gve_get_ethtool_stats(struct net_device *netdev, rx_buf_alloc_fail +=3D tmp_rx_buf_alloc_fail; rx_desc_err_dropped_pkt +=3D tmp_rx_desc_err_dropped_pkt; rx_hsplit_unsplit_pkt +=3D tmp_rx_hsplit_unsplit_pkt; + xdp_tx_errors +=3D tmp_xdp_tx_errors; + xdp_redirect_errors +=3D tmp_xdp_redirect_errors; } } for (tx_pkts =3D 0, tx_bytes =3D 0, tx_dropped =3D 0, ring =3D 0; @@ -250,8 +257,8 @@ gve_get_ethtool_stats(struct net_device *netdev, data[i++] =3D rx_bytes; data[i++] =3D tx_bytes; /* total rx dropped packets */ - data[i++] =3D rx_skb_alloc_fail + rx_buf_alloc_fail + - rx_desc_err_dropped_pkt; + data[i++] =3D rx_skb_alloc_fail + rx_desc_err_dropped_pkt + + xdp_tx_errors + xdp_redirect_errors; data[i++] =3D tx_dropped; data[i++] =3D priv->tx_timeo_cnt; data[i++] =3D rx_skb_alloc_fail; @@ -330,6 +337,9 @@ gve_get_ethtool_stats(struct net_device *netdev, tmp_rx_buf_alloc_fail =3D rx->rx_buf_alloc_fail; tmp_rx_desc_err_dropped_pkt =3D rx->rx_desc_err_dropped_pkt; + tmp_xdp_tx_errors =3D rx->xdp_tx_errors; + tmp_xdp_redirect_errors =3D + rx->xdp_redirect_errors; } while (u64_stats_fetch_retry(&priv->rx[ring].statss, start)); data[i++] =3D tmp_rx_bytes; @@ -340,8 +350,9 @@ gve_get_ethtool_stats(struct net_device *netdev, data[i++] =3D rx->rx_frag_alloc_cnt; /* rx dropped packets */ data[i++] =3D tmp_rx_skb_alloc_fail + - tmp_rx_buf_alloc_fail + - tmp_rx_desc_err_dropped_pkt; + tmp_rx_desc_err_dropped_pkt + + tmp_xdp_tx_errors + + tmp_xdp_redirect_errors; data[i++] =3D rx->rx_copybreak_pkt; data[i++] =3D rx->rx_copied_pkt; /* stats from NIC */ --=20 2.53.0.rc1.225.gd81095ad13-goog