From: Al Viro <viro@ftp.linux.org.uk>
To: netdev@vger.kernel.org
Cc: <romieu@fr.zoreil.com>,
Romieu@ftp.linux.org.uk, Francois@ftp.linux.org.uk
Subject: Subject: [RFC][PATCH 02/11] via-velocity breakage on big-endian
Date: Fri, 05 Jan 2018 19:31:38 +0000 [thread overview]
Message-ID: <E1eXXiM-00029r-Hj@ZenIV.linux.org.uk> (raw)
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@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.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
reply other threads:[~2018-01-05 19:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1eXXiM-00029r-Hj@ZenIV.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=Francois@ftp.linux.org.uk \
--cc=Romieu@ftp.linux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.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