1

net: vertexcom: mse102x: Fix tx_bytes calculation

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: 2f207cbf0d ("net: vertexcom: Add MSE102x SPI support")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://patch.msgid.link/20241108114343.6174-3-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Stefan Wahren 2024-11-08 12:43:43 +01:00 committed by Jakub Kicinski
parent eb72e7fcc8
commit e68da664d3

View File

@ -437,13 +437,15 @@ static void mse102x_tx_work(struct work_struct *work)
mse = &mses->mse102x; mse = &mses->mse102x;
while ((txb = skb_dequeue(&mse->txq))) { while ((txb = skb_dequeue(&mse->txq))) {
unsigned int len = max_t(unsigned int, txb->len, ETH_ZLEN);
mutex_lock(&mses->lock); mutex_lock(&mses->lock);
ret = mse102x_tx_pkt_spi(mse, txb, work_timeout); ret = mse102x_tx_pkt_spi(mse, txb, work_timeout);
mutex_unlock(&mses->lock); mutex_unlock(&mses->lock);
if (ret) { if (ret) {
mse->ndev->stats.tx_dropped++; mse->ndev->stats.tx_dropped++;
} else { } else {
mse->ndev->stats.tx_bytes += txb->len; mse->ndev->stats.tx_bytes += len;
mse->ndev->stats.tx_packets++; mse->ndev->stats.tx_packets++;
} }