Subject: [RFC][PATCH 02/11] via-velocity breakage on big-endian
Subsystems (3)
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)
Signed-off-by Al Viro <[email protected]>
--- drivers/net/ethernet/via/via-velocity.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/via/via-velocity.c +5 -4
@@ -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 ;
Signature · 1 line
2.11.0