Skip to content

Commit 28ee8b0

Browse files
svenauhagenherbertx
authored andcommitted
crypto: marvell/cesa - irq balance
Balance the irqs of the marvell cesa driver over all available cpus. Currently all interrupts are handled by the first CPU. From my testing with IPSec AES 256 SHA256 on my clearfog base with 2 Cores I get a 2x speed increase: Before the patch: 26.74 Kpps With the patch: 56.11 Kpps Signed-off-by: Sven Auhagen <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent c672041 commit 28ee8b0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

drivers/crypto/marvell/cesa/cesa.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static int mv_cesa_probe(struct platform_device *pdev)
438438
struct mv_cesa_dev *cesa;
439439
struct mv_cesa_engine *engines;
440440
struct resource *res;
441-
int irq, ret, i;
441+
int irq, ret, i, cpu;
442442
u32 sram_size;
443443

444444
if (cesa_dev) {
@@ -505,6 +505,8 @@ static int mv_cesa_probe(struct platform_device *pdev)
505505
goto err_cleanup;
506506
}
507507

508+
engine->irq = irq;
509+
508510
/*
509511
* Not all platforms can gate the CESA clocks: do not complain
510512
* if the clock does not exist.
@@ -548,6 +550,10 @@ static int mv_cesa_probe(struct platform_device *pdev)
548550
if (ret)
549551
goto err_cleanup;
550552

553+
/* Set affinity */
554+
cpu = cpumask_local_spread(engine->id, NUMA_NO_NODE);
555+
irq_set_affinity_hint(irq, get_cpu_mask(cpu));
556+
551557
crypto_init_queue(&engine->queue, CESA_CRYPTO_DEFAULT_MAX_QLEN);
552558
atomic_set(&engine->load, 0);
553559
INIT_LIST_HEAD(&engine->complete_queue);
@@ -570,6 +576,8 @@ static int mv_cesa_probe(struct platform_device *pdev)
570576
clk_disable_unprepare(cesa->engines[i].zclk);
571577
clk_disable_unprepare(cesa->engines[i].clk);
572578
mv_cesa_put_sram(pdev, i);
579+
if (cesa->engines[i].irq > 0)
580+
irq_set_affinity_hint(cesa->engines[i].irq, NULL);
573581
}
574582

575583
return ret;
@@ -586,6 +594,7 @@ static int mv_cesa_remove(struct platform_device *pdev)
586594
clk_disable_unprepare(cesa->engines[i].zclk);
587595
clk_disable_unprepare(cesa->engines[i].clk);
588596
mv_cesa_put_sram(pdev, i);
597+
irq_set_affinity_hint(cesa->engines[i].irq, NULL);
589598
}
590599

591600
return 0;

drivers/crypto/marvell/cesa/cesa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ struct mv_cesa_engine {
457457
atomic_t load;
458458
struct mv_cesa_tdma_chain chain;
459459
struct list_head complete_queue;
460+
int irq;
460461
};
461462

462463
/**

0 commit comments

Comments
 (0)