* pch_gbe: set dma mask to only 32 bit
@ 2012-02-07 19:23 Veaceslav Falico
2012-02-09 1:06 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Veaceslav Falico @ 2012-02-07 19:23 UTC (permalink / raw)
To: netdev
Cc: Toshiharu Okada, Paul Gortmaker, Michał Mirosław,
David S. Miller
Because pch_gbe_rx_desc->buffer_addr is u32, we cannot set dma mask to 64
bit or otherwise we could end up loosing the higher 32 bit from the return
of dma_map_single(). Removing DMA_BIT_MASK(64) setting will solve it.
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
---
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 3ead111..6c6713b 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -2397,17 +2397,13 @@ static int pch_gbe_probe(struct pci_dev *pdev,
if (ret)
return ret;
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
- || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
- ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
+ ret = pci_set_consistent_dma_mask(pdev,
+ DMA_BIT_MASK(32));
if (ret) {
- ret = pci_set_consistent_dma_mask(pdev,
- DMA_BIT_MASK(32));
- if (ret) {
- dev_err(&pdev->dev, "ERR: No usable DMA "
- "configuration, aborting\n");
- goto err_disable_device;
- }
+ dev_err(&pdev->dev, "ERR: No usable DMA "
+ "configuration, aborting\n");
+ goto err_disable_device;
}
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: pch_gbe: set dma mask to only 32 bit
2012-02-07 19:23 pch_gbe: set dma mask to only 32 bit Veaceslav Falico
@ 2012-02-09 1:06 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-02-09 1:06 UTC (permalink / raw)
To: vfalico; +Cc: netdev, toshiharu-linux, paul.gortmaker, mirq-linux
From: Veaceslav Falico <vfalico@redhat.com>
Date: Tue, 7 Feb 2012 20:23:54 +0100
> Because pch_gbe_rx_desc->buffer_addr is u32, we cannot set dma mask to 64
> bit or otherwise we could end up loosing the higher 32 bit from the return
> of dma_map_single(). Removing DMA_BIT_MASK(64) setting will solve it.
>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
The logic here makes no sense.
> - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
> - || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
> - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
> + if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
> + ret = pci_set_consistent_dma_mask(pdev,
> + DMA_BIT_MASK(32));
You want to take this branch on success, not failure. pci_set_dma_mask()
returns 0 on success.
Something like:
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (ret ||
(ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) {
dev_err(&pdev->dev, "ERR: No usable DMA "
"configuration, aborting\n");
goto err_disable_device;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-09 1:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 19:23 pch_gbe: set dma mask to only 32 bit Veaceslav Falico
2012-02-09 1:06 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.