mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
via-velocity: Fix DMA mapping length errors on transmit.
From: Dave Jones <davej@redhat.com> The dma-debug changes caught that this driver uses the wrong DMA mapping length when skb_padto() does something. With suggestions from Eric Dumazet. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
855b0993f2
commit
59f8e169e2
1 changed files with 7 additions and 8 deletions
|
@ -1838,17 +1838,19 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_
|
||||||
{
|
{
|
||||||
struct sk_buff *skb = tdinfo->skb;
|
struct sk_buff *skb = tdinfo->skb;
|
||||||
int i;
|
int i;
|
||||||
|
int pktlen;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't unmap the pre-allocated tx_bufs
|
* Don't unmap the pre-allocated tx_bufs
|
||||||
*/
|
*/
|
||||||
if (tdinfo->skb_dma) {
|
if (tdinfo->skb_dma) {
|
||||||
|
|
||||||
|
pktlen = (skb->len > ETH_ZLEN ? : ETH_ZLEN);
|
||||||
for (i = 0; i < tdinfo->nskb_dma; i++) {
|
for (i = 0; i < tdinfo->nskb_dma; i++) {
|
||||||
#ifdef VELOCITY_ZERO_COPY_SUPPORT
|
#ifdef VELOCITY_ZERO_COPY_SUPPORT
|
||||||
pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);
|
pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);
|
||||||
#else
|
#else
|
||||||
pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], skb->len, PCI_DMA_TODEVICE);
|
pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], pktlen, PCI_DMA_TODEVICE);
|
||||||
#endif
|
#endif
|
||||||
tdinfo->skb_dma[i] = 0;
|
tdinfo->skb_dma[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -2080,17 +2082,14 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
struct tx_desc *td_ptr;
|
struct tx_desc *td_ptr;
|
||||||
struct velocity_td_info *tdinfo;
|
struct velocity_td_info *tdinfo;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int pktlen = skb->len;
|
int pktlen;
|
||||||
__le16 len;
|
__le16 len;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
|
|
||||||
|
if (skb_padto(skb, ETH_ZLEN))
|
||||||
if (skb->len < ETH_ZLEN) {
|
goto out;
|
||||||
if (skb_padto(skb, ETH_ZLEN))
|
pktlen = max_t(unsigned int, skb->len, ETH_ZLEN);
|
||||||
goto out;
|
|
||||||
pktlen = ETH_ZLEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = cpu_to_le16(pktlen);
|
len = cpu_to_le16(pktlen);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue