[<prev] [next>] [day] [month] [year] [list]
Message-Id: <E1eXXiM-00029r-Hj@ZenIV.linux.org.uk>
Date: Fri, 05 Jan 2018 19:31:38 +0000
From: Al Viro <viro@....linux.org.uk>
To: netdev@...r.kernel.org
Cc: <romieu@...zoreil.com>, Romieu@....linux.org.uk,
Francois@....linux.org.uk
Subject: Subject: [RFC][PATCH 02/11] via-velocity breakage on big-endian
Convert to host-endian first, *then* use max_t. Doing it the
other way around is broken on big-endian hosts and this chipset
does occur on pcie cards - it's not always embedded into
motherboard of a little-endian system.
Fixes: c79992fddee2 (via-velocity: Re-enable transmit scatter-gather support)
Cc: stable@...r.kernel.org
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
drivers/net/ethernet/via/via-velocity.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 7b6dc6e8d6c0..4156c33d954e 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -1733,12 +1733,13 @@ static void velocity_free_tx_buf(struct velocity_info *vptr,
size_t pktlen = max_t(size_t, skb->len, ETH_ZLEN);
/* For scatter-gather */
- if (skb_shinfo(skb)->nr_frags > 0)
- pktlen = max_t(size_t, pktlen,
- td->td_buf[i].size & ~TD_QUEUE);
+ if (skb_shinfo(skb)->nr_frags > 0) {
+ __le16 sz = td->td_buf[i].size & ~TD_QUEUE;
+ pktlen = max_t(size_t, pktlen, le16_to_cpu(sz));
+ }
dma_unmap_single(vptr->dev, tdinfo->skb_dma[i],
- le16_to_cpu(pktlen), DMA_TO_DEVICE);
+ pktlen, DMA_TO_DEVICE);
}
dev_kfree_skb_irq(skb);
tdinfo->skb = NULL;
--
2.11.0
Powered by blists - more mailing lists