Skip to contentSkip to conversation

sfc: Fix DMA mapping cleanup in case of an error in TSO

PATCH In review Ben Hutchings 1 participant 1 message Dec 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/8 sfc: Fix DMA mapping cleanup in case of an error in TSO

From: Neil Turton <[email protected]>

We need buffer->len to remain valid to work out the correct address to be unmapped. We therefore need to clear buffer->len after the unmap operation.

---
 drivers/net/sfc/tx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/tx.c +2 -2
index e669f94..a8b70ef 100644
@@ -821,8 +821,6 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
 					   EFX_TXQ_MASK];
 		efx_tsoh_free(tx_queue, buffer);
 		EFX_BUG_ON_PARANOID(buffer->skb);
-		buffer->len = 0;
-		buffer->continuation = true;
 		if (buffer->unmap_len) {
 			unmap_addr = (buffer->dma_addr + buffer->len -
 				      buffer->unmap_len);
@@ -836,6 +834,8 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
 					       PCI_DMA_TODEVICE);
 			buffer->unmap_len = 0;
 		}
+		buffer->len = 0;
+		buffer->continuation = true;
 	}
 }
 
Signature · 7 lines
1.5.5


-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.