From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93FAA2BE7D0; Wed, 23 Apr 2025 15:22:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745421729; cv=none; b=rElojfN6j+pxIpk9aKqgUchRK1gc1Dl1xbAuyUSj1uMsJcVlKxkE0Xxl0DGHs89Wxpb/5uciFJL9ticONykUXS+Tv/zztW5remWuBIXPflrLgbcFLwt+p/psCr4cs5VblTHmdg99PHT0sAQRLdudIry8sEIcbEMTomdq8Q7N//s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745421729; c=relaxed/simple; bh=67mYhkQyEyqtlVggTvJ69w0a+h5pS80PyENqXdA56ZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WMh4RBvVsgmAjrAirwOWNeiXPwVLn52EkKg8o2fDG4VMkixtElrEpGdYu2UYxaID7s/ssBNj7qbE7Zkiarj6sMTx0ScTuQM1jMB52BUkigEFwiXObYpLVUDajWGn7PMSEOtBo+zMvVg6FjWczHecbcmF5nP5jZh589Vi+QzmkBA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Dpd/MIqp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Dpd/MIqp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3573C4CEE2; Wed, 23 Apr 2025 15:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745421729; bh=67mYhkQyEyqtlVggTvJ69w0a+h5pS80PyENqXdA56ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dpd/MIqpxFBWjBWE6ajXf97SBBNFHJwfq/vIKtDkn2E3gnjnxykg7Rmv0Yq+jyO1y H8nMJGmH5XfQFwNVdVqcVj7/BNTA7xmd+RKXZKB+PvZQtPMk9zK95z8SJnAcMqD2M6 yD4GZUH2w//0RZU344uxvoJGKeig86heU/5NLw2k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joshua Washington , Harshitha Ramamurthy , Michal Swiatkowski , Simon Horman , Jakub Kicinski Subject: [PATCH 6.6 217/393] gve: handle overflow when reporting TX consumed descriptors Date: Wed, 23 Apr 2025 16:41:53 +0200 Message-ID: <20250423142652.343284541@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423142643.246005366@linuxfoundation.org> References: <20250423142643.246005366@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joshua Washington commit 15970e1b23f5c25db88c613fddf9131de086f28e upstream. When the tx tail is less than the head (in cases of wraparound), the TX consumed descriptor statistic in DQ will be reported as UINT32_MAX - head + tail, which is incorrect. Mask the difference of head and tail according to the ring size when reporting the statistic. Cc: stable@vger.kernel.org Fixes: 2c9198356d56 ("gve: Add consumed counts to ethtool stats") Signed-off-by: Joshua Washington Signed-off-by: Harshitha Ramamurthy Reviewed-by: Michal Swiatkowski Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250402001037.2717315-1-hramamurthy@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/google/gve/gve_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/google/gve/gve_ethtool.c +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c @@ -356,7 +356,9 @@ gve_get_ethtool_stats(struct net_device */ data[i++] = 0; data[i++] = 0; - data[i++] = tx->dqo_tx.tail - tx->dqo_tx.head; + data[i++] = + (tx->dqo_tx.tail - tx->dqo_tx.head) & + tx->mask; } do { start =