firewire: Split the iso buffer out from fw_iso_context and avoid vmalloc.

This patch splits out the iso buffer so we can initialize it at mmap
time with the size provided in the mmap call.  Furthermore, allocate
the backing pages using alloc_page to avoid setting up kernel side
virtual memory mappings for the pages.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
这个提交包含在:
Kristian Høgsberg
2007-02-16 17:34:38 -05:00
提交者 Stefan Richter
父节点 6e2e8424d3
当前提交 9aad812538
修改 5 个文件,包含 148 行新增81 行删除

查看文件

@@ -27,6 +27,7 @@
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/fs.h>
#include <linux/dma-mapping.h>
#define TCODE_WRITE_QUADLET_REQUEST 0
#define TCODE_WRITE_BLOCK_REQUEST 1
@@ -336,6 +337,18 @@ struct fw_iso_context;
typedef void (*fw_iso_callback_t) (struct fw_iso_context *context,
int status, u32 cycle, void *data);
/* An iso buffer is just a set of pages mapped for DMA in the
* specified direction. Since the pages are to be used for DMA, they
* are not mapped into the kernel virtual address space. We store the
* DMA address in the page private. The helper function
* fw_iso_buffer_map() will map the pages into a given vma. */
struct fw_iso_buffer {
enum dma_data_direction direction;
struct page **pages;
int page_count;
};
struct fw_iso_context {
struct fw_card *card;
int type;
@@ -343,19 +356,24 @@ struct fw_iso_context {
int speed;
fw_iso_callback_t callback;
void *callback_data;
void *buffer;
size_t buffer_size;
dma_addr_t *pages;
int page_count;
};
int
fw_iso_buffer_init(struct fw_iso_buffer *buffer,
struct fw_card *card,
int page_count,
enum dma_data_direction direction);
int
fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma);
void
fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
struct fw_iso_context *
fw_iso_context_create(struct fw_card *card, int type,
size_t buffer_size,
fw_iso_callback_t callback,
void *callback_data);
void
fw_iso_context_destroy(struct fw_iso_context *ctx);
@@ -365,7 +383,9 @@ fw_iso_context_start(struct fw_iso_context *ctx,
int
fw_iso_context_queue(struct fw_iso_context *ctx,
struct fw_iso_packet *packet, void *payload);
struct fw_iso_packet *packet,
struct fw_iso_buffer *buffer,
unsigned long payload);
int
fw_iso_context_send(struct fw_iso_context *ctx,
@@ -410,7 +430,9 @@ struct fw_card_driver {
int (*send_iso)(struct fw_iso_context *ctx, s32 cycle);
int (*queue_iso)(struct fw_iso_context *ctx,
struct fw_iso_packet *packet, void *payload);
struct fw_iso_packet *packet,
struct fw_iso_buffer *buffer,
unsigned long payload);
};
int