From: Stefan Wahren <wahrenst@gmx.net>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH 2/2 net V2] net: vertexcom: mse102x: Fix tx_bytes calculation
Date: Tue, 5 Nov 2024 17:35:45 +0100 [thread overview]
Message-ID: <20241105163545.33585-2-wahrenst@gmx.net> (raw)
In-Reply-To: <20241105163545.33585-1-wahrenst@gmx.net>
The tx_bytes should consider the actual size of the Ethernet frames
without the SPI encapsulation. But we still need to take care of
Ethernet padding.
Fixes: 2f207cbf0dd4 ("net: vertexcom: Add MSE102x SPI support")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/net/ethernet/vertexcom/mse102x.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/vertexcom/mse102x.c b/drivers/net/ethernet/vertexcom/mse102x.c
index 2c37957478fb..1fffae6596de 100644
--- a/drivers/net/ethernet/vertexcom/mse102x.c
+++ b/drivers/net/ethernet/vertexcom/mse102x.c
@@ -443,7 +443,8 @@ static void mse102x_tx_work(struct work_struct *work)
if (ret) {
mse->ndev->stats.tx_dropped++;
} else {
- mse->ndev->stats.tx_bytes += txb->len;
+ mse->ndev->stats.tx_bytes += max_t(unsigned int,
+ txb->len, ETH_ZLEN);
mse->ndev->stats.tx_packets++;
}
--
2.34.1
next prev parent reply other threads:[~2024-11-05 16:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 16:31 [PATCH 1/2 net V2] net: vertexcom: mse102x: Fix possible double free of TX skb Stefan Wahren
2024-11-05 16:35 ` [PATCH 0/2 net V2] net: vertexcom: mse102x: Fix mse102x_tx_work Stefan Wahren
2024-11-05 16:35 ` Stefan Wahren [this message]
2024-11-07 2:00 ` [PATCH 2/2 net V2] net: vertexcom: mse102x: Fix tx_bytes calculation Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241105163545.33585-2-wahrenst@gmx.net \
--to=wahrenst@gmx.net \
--cc=andrew+netdev@lunn.ch \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®