* [PATCH 1/3] e1000: ethtool: Add missing dma_mapping_error-call in e1000_setup_desc_rings
2013-03-16 10:32 [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error Christoph Paasch
@ 2013-03-16 10:32 ` Christoph Paasch
2013-03-20 0:47 ` Jeff Kirsher
2013-03-16 10:32 ` [PATCH 2/3] ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers Christoph Paasch
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Christoph Paasch @ 2013-03-16 10:32 UTC (permalink / raw)
To: Jeff Kirsher, Bruce Allan, Alex Duyck; +Cc: e1000-devel, netdev, David Miller
After dma_map_single, dma_mapping_error must be called.
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
---
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 43462d5..ffd2871 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1053,6 +1053,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
txdr->buffer_info[i].dma =
dma_map_single(&pdev->dev, skb->data, skb->len,
DMA_TO_DEVICE);
+ if (dma_mapping_error(&pdev->dev, txdr->buffer_info[i].dma)) {
+ ret_val = 4;
+ goto err_nomem;
+ }
tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma);
tx_desc->lower.data = cpu_to_le32(skb->len);
tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP |
@@ -1069,7 +1073,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer),
GFP_KERNEL);
if (!rxdr->buffer_info) {
- ret_val = 4;
+ ret_val = 5;
goto err_nomem;
}
@@ -1077,7 +1081,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
GFP_KERNEL);
if (!rxdr->desc) {
- ret_val = 5;
+ ret_val = 6;
goto err_nomem;
}
memset(rxdr->desc, 0, rxdr->size);
@@ -1101,7 +1105,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL);
if (!skb) {
- ret_val = 6;
+ ret_val = 7;
goto err_nomem;
}
skb_reserve(skb, NET_IP_ALIGN);
@@ -1110,6 +1114,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
rxdr->buffer_info[i].dma =
dma_map_single(&pdev->dev, skb->data,
E1000_RXBUFFER_2048, DMA_FROM_DEVICE);
+ if (dma_mapping_error(&pdev->dev, rxdr->buffer_info[i].dma)) {
+ ret_val = 8;
+ goto err_nomem;
+ }
rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma);
memset(skb->data, 0x00, skb->len);
}
--
1.8.1.227.g44fe835
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] e1000: ethtool: Add missing dma_mapping_error-call in e1000_setup_desc_rings
2013-03-16 10:32 ` [PATCH 1/3] e1000: ethtool: Add missing dma_mapping_error-call in e1000_setup_desc_rings Christoph Paasch
@ 2013-03-20 0:47 ` Jeff Kirsher
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-20 0:47 UTC (permalink / raw)
To: Christoph Paasch
Cc: Bruce Allan, Alex Duyck, e1000-devel, netdev, David Miller
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
On Sat, 2013-03-16 at 11:32 +0100, Christoph Paasch wrote:
>
> After dma_map_single, dma_mapping_error must be called.
>
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> ---
> drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
Added to my e1000 patch queue
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers
2013-03-16 10:32 [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error Christoph Paasch
2013-03-16 10:32 ` [PATCH 1/3] e1000: ethtool: Add missing dma_mapping_error-call in e1000_setup_desc_rings Christoph Paasch
@ 2013-03-16 10:32 ` Christoph Paasch
2013-03-20 0:48 ` Jeff Kirsher
2013-03-16 10:32 ` [PATCH 3/3] e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers Christoph Paasch
2013-03-20 0:46 ` [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error Jeff Kirsher
3 siblings, 1 reply; 8+ messages in thread
From: Christoph Paasch @ 2013-03-16 10:32 UTC (permalink / raw)
To: Jeff Kirsher, Bruce Allan, Alex Duyck; +Cc: e1000-devel, netdev, David Miller
After dma_map_single, dma_mapping_error must be called. It seems safe to
not free the skb allocated in this function, as the skb can be reused
later.
Additionally this patch fixes one coding-style error.
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
---
drivers/net/ethernet/intel/ixgb/ixgb_main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index e23f023..6662c7c 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -2155,6 +2155,10 @@ map_skb:
skb->data,
adapter->rx_buffer_len,
DMA_FROM_DEVICE);
+ if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+ adapter->alloc_rx_buff_failed++;
+ break;
+ }
rx_desc = IXGB_RX_DESC(*rx_ring, i);
rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
@@ -2164,7 +2168,8 @@ map_skb:
rx_desc->status = 0;
- if (++i == rx_ring->count) i = 0;
+ if (++i == rx_ring->count)
+ i = 0;
buffer_info = &rx_ring->buffer_info[i];
}
--
1.8.1.227.g44fe835
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers
2013-03-16 10:32 ` [PATCH 2/3] ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers Christoph Paasch
@ 2013-03-20 0:48 ` Jeff Kirsher
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-20 0:48 UTC (permalink / raw)
To: Christoph Paasch
Cc: Bruce Allan, Alex Duyck, e1000-devel, netdev, David Miller
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
On Sat, 2013-03-16 at 11:32 +0100, Christoph Paasch wrote:
> After dma_map_single, dma_mapping_error must be called. It seems safe
> to
> not free the skb allocated in this function, as the skb can be reused
> later.
>
> Additionally this patch fixes one coding-style error.
>
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> ---
> drivers/net/ethernet/intel/ixgb/ixgb_main.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Added to my ixgb patch queue
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers
2013-03-16 10:32 [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error Christoph Paasch
2013-03-16 10:32 ` [PATCH 1/3] e1000: ethtool: Add missing dma_mapping_error-call in e1000_setup_desc_rings Christoph Paasch
2013-03-16 10:32 ` [PATCH 2/3] ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers Christoph Paasch
@ 2013-03-16 10:32 ` Christoph Paasch
2013-03-20 0:47 ` Jeff Kirsher
2013-03-20 0:46 ` [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error Jeff Kirsher
3 siblings, 1 reply; 8+ messages in thread
From: Christoph Paasch @ 2013-03-16 10:32 UTC (permalink / raw)
To: Jeff Kirsher, Bruce Allan, Alex Duyck; +Cc: e1000-devel, netdev, David Miller
After dma_map_page, dma_mapping_error must be called. It seems safe to
not free the skb/page allocated in this function, as the skb/page can be
reused later.
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 142ca39..5706dcd 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -846,11 +846,16 @@ check_page:
}
}
- if (!buffer_info->dma)
+ if (!buffer_info->dma) {
buffer_info->dma = dma_map_page(&pdev->dev,
buffer_info->page, 0,
PAGE_SIZE,
DMA_FROM_DEVICE);
+ if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+ adapter->alloc_rx_buff_failed++;
+ break;
+ }
+ }
rx_desc = E1000_RX_DESC_EXT(*rx_ring, i);
rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);
--
1.8.1.227.g44fe835
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers
2013-03-16 10:32 ` [PATCH 3/3] e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers Christoph Paasch
@ 2013-03-20 0:47 ` Jeff Kirsher
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-20 0:47 UTC (permalink / raw)
To: Christoph Paasch
Cc: Bruce Allan, Alex Duyck, e1000-devel, netdev, David Miller
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
On Sat, 2013-03-16 at 11:32 +0100, Christoph Paasch wrote:
> After dma_map_page, dma_mapping_error must be called. It seems safe to
> not free the skb/page allocated in this function, as the skb/page can
> be
> reused later.
>
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Added to my e1000e patch queue
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error
2013-03-16 10:32 [PATCH 0/3] net/intel: Add missing calls to dma_mapping_error Christoph Paasch
` (2 preceding siblings ...)
2013-03-16 10:32 ` [PATCH 3/3] e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers Christoph Paasch
@ 2013-03-20 0:46 ` Jeff Kirsher
3 siblings, 0 replies; 8+ messages in thread
From: Jeff Kirsher @ 2013-03-20 0:46 UTC (permalink / raw)
To: Christoph Paasch
Cc: Bruce Allan, Alex Duyck, e1000-devel, netdev, David Miller
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
On Sat, 2013-03-16 at 11:32 +0100, Christoph Paasch wrote:
> After dma_map_single/page, dma_mapping_error must be called.
>
> Christoph Paasch (3):
> e1000: ethtool: Add missing dma_mapping_error-call in
> e1000_setup_desc_rings
> ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers
> e1000e: Add missing dma_mapping_error-call in
> e1000_alloc_jumbo_rx_buffers
>
> drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 14 +++++++++++---
> drivers/net/ethernet/intel/e1000e/netdev.c | 7 ++++++-
> drivers/net/ethernet/intel/ixgb/ixgb_main.c | 7 ++++++-
> 3 files changed, 23 insertions(+), 5 deletions(-)
Thanks Christoph, I will add the series to my queue.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread