Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63923
b: refs/heads/master
c: c6d0e80
h: refs/heads/master
i:
  63921: d8230dc
  63919: a1a6197
v: v3
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Aug 10, 2007
1 parent b648391 commit a77a147
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b01af5ba9105094ba4f1af60da8f7be44321a0c7
refs/heads/master: c6d0e8014a59b641c0669cf5df151667144f220e
92 changes: 47 additions & 45 deletions trunk/drivers/s390/cio/qdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static __u32 volatile spare_indicator;
static atomic_t spare_indicator_usecount;
#define QDIO_MEMPOOL_SCSSC_ELEMENTS 2
static mempool_t *qdio_mempool_scssc;
static struct kmem_cache *qdio_q_cache;

static debug_info_t *qdio_dbf_setup;
static debug_info_t *qdio_dbf_sbal;
Expand Down Expand Up @@ -1617,23 +1618,21 @@ static void
qdio_release_irq_memory(struct qdio_irq *irq_ptr)
{
int i;
struct qdio_q *q;

for (i=0;i<QDIO_MAX_QUEUES_PER_IRQ;i++) {
if (!irq_ptr->input_qs[i])
goto next;

kfree(irq_ptr->input_qs[i]->slib);
kfree(irq_ptr->input_qs[i]);

next:
if (!irq_ptr->output_qs[i])
continue;

kfree(irq_ptr->output_qs[i]->slib);
kfree(irq_ptr->output_qs[i]);

for (i = 0; i < QDIO_MAX_QUEUES_PER_IRQ; i++) {
q = irq_ptr->input_qs[i];
if (q) {
free_page((unsigned long) q->slib);
kmem_cache_free(qdio_q_cache, q);
}
q = irq_ptr->output_qs[i];
if (q) {
free_page((unsigned long) q->slib);
kmem_cache_free(qdio_q_cache, q);
}
}
kfree(irq_ptr->qdr);
free_page((unsigned long) irq_ptr->qdr);
free_page((unsigned long) irq_ptr);
}

Expand Down Expand Up @@ -1680,44 +1679,35 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
{
int i;
struct qdio_q *q;
int result=-ENOMEM;

for (i=0;i<no_input_qs;i++) {
q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);

if (!q) {
QDIO_PRINT_ERR("kmalloc of q failed!\n");
goto out;
}
for (i = 0; i < no_input_qs; i++) {
q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
if (!q)
return -ENOMEM;
memset(q, 0, sizeof(*q));

q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL);
q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
if (!q->slib) {
QDIO_PRINT_ERR("kmalloc of slib failed!\n");
goto out;
kmem_cache_free(qdio_q_cache, q);
return -ENOMEM;
}

irq_ptr->input_qs[i]=q;
}

for (i=0;i<no_output_qs;i++) {
q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);

if (!q) {
goto out;
}
for (i = 0; i < no_output_qs; i++) {
q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
if (!q)
return -ENOMEM;
memset(q, 0, sizeof(*q));

q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
if (!q->slib) {
QDIO_PRINT_ERR("kmalloc of slib failed!\n");
goto out;
kmem_cache_free(qdio_q_cache, q);
return -ENOMEM;
}

irq_ptr->output_qs[i]=q;
}

result=0;
out:
return result;
return 0;
}

static void
Expand Down Expand Up @@ -2985,17 +2975,17 @@ qdio_allocate(struct qdio_initialize *init_data)
QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));

if (!irq_ptr) {
QDIO_PRINT_ERR("kmalloc of irq_ptr failed!\n");
QDIO_PRINT_ERR("allocation of irq_ptr failed!\n");
return -ENOMEM;
}

init_MUTEX(&irq_ptr->setting_up_sema);

/* QDR must be in DMA area since CCW data address is only 32 bit */
irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA);
irq_ptr->qdr = (struct qdr *) __get_free_page(GFP_KERNEL | GFP_DMA);
if (!(irq_ptr->qdr)) {
free_page((unsigned long) irq_ptr);
QDIO_PRINT_ERR("kmalloc of irq_ptr->qdr failed!\n");
QDIO_PRINT_ERR("allocation of irq_ptr->qdr failed!\n");
return -ENOMEM;
}
QDIO_DBF_TEXT0(0,setup,"qdr:");
Expand All @@ -3004,6 +2994,7 @@ qdio_allocate(struct qdio_initialize *init_data)
if (qdio_alloc_qs(irq_ptr,
init_data->no_input_qs,
init_data->no_output_qs)) {
QDIO_PRINT_ERR("queue allocation failed!\n");
qdio_release_irq_memory(irq_ptr);
return -ENOMEM;
}
Expand Down Expand Up @@ -3895,9 +3886,19 @@ init_QDIO(void)
if (res)
return res;

qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q),
256, 0, NULL);
if (!qdio_q_cache) {
qdio_release_qdio_memory();
return -ENOMEM;
}

res = qdio_register_dbf_views();
if (res)
if (res) {
kmem_cache_destroy(qdio_q_cache);
qdio_release_qdio_memory();
return res;
}

QDIO_DBF_TEXT0(0,setup,"initQDIO");
res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
Expand Down Expand Up @@ -3929,6 +3930,7 @@ cleanup_QDIO(void)
qdio_release_qdio_memory();
qdio_unregister_dbf_views();
mempool_destroy(qdio_mempool_scssc);
kmem_cache_destroy(qdio_q_cache);
bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
printk("qdio: %s: module removed\n",version);
}
Expand Down

0 comments on commit a77a147

Please sign in to comment.