cxgb3: fix premature page unmap
authorDivy Le Ray <divy@chelsio.com>
Tue, 17 Nov 2009 16:38:28 +0000 (16:38 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Nov 2009 13:11:14 +0000 (05:11 -0800)
unmap Rx page only when guaranteed that this page won't be
used anymore to allocate rx page chunks.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cxgb3/sge.c

index f86612857a73b2bb470aecb92dfe94b5c50a1cd7..6366061712f447c198b31e5c5307ede58de51c06 100644 (file)
@@ -879,7 +879,7 @@ recycle:
        pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len,
                                    PCI_DMA_FROMDEVICE);
        (*sd->pg_chunk.p_cnt)--;
-       if (!*sd->pg_chunk.p_cnt)
+       if (!*sd->pg_chunk.p_cnt && sd->pg_chunk.page != fl->pg_chunk.page)
                pci_unmap_page(adap->pdev,
                               sd->pg_chunk.mapping,
                               fl->alloc_size,
@@ -2088,7 +2088,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
                                    PCI_DMA_FROMDEVICE);
 
        (*sd->pg_chunk.p_cnt)--;
-       if (!*sd->pg_chunk.p_cnt)
+       if (!*sd->pg_chunk.p_cnt && sd->pg_chunk.page != fl->pg_chunk.page)
                pci_unmap_page(adap->pdev,
                               sd->pg_chunk.mapping,
                               fl->alloc_size,