[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-53-git-send-email-viro@ZenIV.linux.org.uk>
Date: Mon, 21 Dec 2015 23:47:26 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: linux-kernel@...r.kernel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 53/83] cavium: (partially) get rid of cargo-culting in allocator
From: Al Viro <viro@...iv.linux.org.uk>
AFAICS, it's a rudiment of a different allocator used at some earlier
point; __get_free_pages() *never* returns a pointer that wouldn't
be at least 8 bytes aligned - we don't support architectures with
4-byte pages, TYVM...
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
drivers/net/ethernet/cavium/liquidio/octeon_droq.c | 4 +---
drivers/net/ethernet/cavium/liquidio/octeon_droq.h | 3 ---
drivers/net/ethernet/cavium/liquidio/octeon_main.h | 17 ++---------------
3 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
index 4dba86e..7b0e1ac 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
@@ -218,10 +218,9 @@ int octeon_delete_droq(struct octeon_device *oct, u32 q_no)
octeon_droq_destroy_ring_buffers(oct, droq);
vfree(droq->recv_buf_list);
- if (droq->info_base_addr)
+ if (droq->info_list)
cnnic_free_aligned_dma(oct->pci_dev, droq->info_list,
droq->info_alloc_size,
- droq->info_base_addr,
droq->info_list_dma);
if (droq->desc_ring)
@@ -286,7 +285,6 @@ int octeon_init_droq(struct octeon_device *oct,
cnnic_alloc_aligned_dma(oct->pci_dev,
(droq->max_count * OCT_DROQ_INFO_SIZE),
&droq->info_alloc_size,
- &droq->info_base_addr,
&droq->info_list_dma);
if (!droq->info_list) {
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_droq.h b/drivers/net/ethernet/cavium/liquidio/octeon_droq.h
index 7940cce..95a145c 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_droq.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_droq.h
@@ -306,9 +306,6 @@ struct octeon_droq {
/** DMA mapped address of the DROQ descriptor ring. */
size_t desc_ring_dma;
- /** Info ptr list are allocated at this virtual address. */
- size_t info_base_addr;
-
/** DMA mapped address of the info list */
size_t info_list_dma;
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_main.h b/drivers/net/ethernet/cavium/liquidio/octeon_main.h
index 61dbccc..b6a90a9 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_main.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_main.h
@@ -129,7 +129,6 @@ static inline void *
cnnic_alloc_aligned_dma(struct pci_dev *pci_dev,
u32 size,
u32 *alloc_size,
- size_t *orig_ptr,
size_t *dma_addr __attribute__((unused)))
{
int retries = 0;
@@ -140,27 +139,15 @@ cnnic_alloc_aligned_dma(struct pci_dev *pci_dev,
ptr =
(void *)__get_free_pages(GFP_KERNEL,
get_order(size));
- if ((unsigned long)ptr & 0x07) {
- free_pages(ptr, get_order(size));
- ptr = NULL;
- /* Increment the size required if the first
- * attempt failed.
- */
- if (!retries)
- size += 7;
- }
retries++;
} while ((retries <= OCTEON_MAX_ALLOC_RETRIES) && !ptr);
*alloc_size = size;
- *orig_ptr = (unsigned long)ptr;
- if ((unsigned long)ptr & 0x07)
- ptr = (void *)(((unsigned long)ptr + 7) & ~(7UL));
return ptr;
}
-#define cnnic_free_aligned_dma(pci_dev, ptr, size, orig_ptr, dma_addr) \
- free_pages((void *)orig_ptr, get_order(size))
+#define cnnic_free_aligned_dma(pci_dev, ptr, size, dma_addr) \
+ free_pages(ptr, get_order(size))
static inline void
sleep_cond(wait_queue_head_t *wait_queue, int *condition)
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists