aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/cxgb3/sge.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 882beafeb74c..808b8af0c740 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -338,6 +338,18 @@ static inline int should_restart_tx(const struct sge_txq *q)
338 return q->in_use - r < (q->size >> 1); 338 return q->in_use - r < (q->size >> 1);
339} 339}
340 340
341static void clear_rx_desc(const struct sge_fl *q, struct rx_sw_desc *d)
342{
343 if (q->use_pages) {
344 if (d->pg_chunk.page)
345 put_page(d->pg_chunk.page);
346 d->pg_chunk.page = NULL;
347 } else {
348 kfree_skb(d->skb);
349 d->skb = NULL;
350 }
351}
352
341/** 353/**
342 * free_rx_bufs - free the Rx buffers on an SGE free list 354 * free_rx_bufs - free the Rx buffers on an SGE free list
343 * @pdev: the PCI device associated with the adapter 355 * @pdev: the PCI device associated with the adapter
@@ -355,14 +367,7 @@ static void free_rx_bufs(struct pci_dev *pdev, struct sge_fl *q)
355 367
356 pci_unmap_single(pdev, pci_unmap_addr(d, dma_addr), 368 pci_unmap_single(pdev, pci_unmap_addr(d, dma_addr),
357 q->buf_size, PCI_DMA_FROMDEVICE); 369 q->buf_size, PCI_DMA_FROMDEVICE);
358 if (q->use_pages) { 370 clear_rx_desc(q, d);
359 if (d->pg_chunk.page)
360 put_page(d->pg_chunk.page);
361 d->pg_chunk.page = NULL;
362 } else {
363 kfree_skb(d->skb);
364 d->skb = NULL;
365 }
366 if (++cidx == q->size) 371 if (++cidx == q->size)
367 cidx = 0; 372 cidx = 0;
368 } 373 }
@@ -475,10 +480,7 @@ nomem: q->alloc_failed++;
475 err = add_one_rx_buf(buf_start, q->buf_size, d, sd, q->gen, 480 err = add_one_rx_buf(buf_start, q->buf_size, d, sd, q->gen,
476 adap->pdev); 481 adap->pdev);
477 if (unlikely(err)) { 482 if (unlikely(err)) {
478 if (!q->use_pages) { 483 clear_rx_desc(q, sd);
479 kfree_skb(sd->skb);
480 sd->skb = NULL;
481 }
482 break; 484 break;
483 } 485 }
484 486