Skip to contentSkip to conversation

libertas: increase spi driver thread priority

PATCH In review Anna Neal 2 participants 2 messages Apr 2, 2009 – Apr 6, 2009 Networking drivers (wireless)

lore
Share & tools
lore

Anna Neal

author
#0 lore raw

PATCH 1/1 libertas: increase spi driver thread priority

Currently, the libertas main thread contends with the spi driver thread in the TX path. To improve throughput, ensure that the driver thread has higher scheduling priority than the libertas main thread. Do this by making the libertas spi driver thread a low priority real time thread.

We measured an average throughput improvement of 13%.

---
 drivers/net/wireless/libertas/if_spi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/libertas/if_spi.c +4 -0
index 07311e7..97493e2 100644
@@ -1020,6 +1020,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 	struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
 	int err = 0;
 	u32 scratch;
+	struct sched_param param = { .sched_priority = 1 };
 
 	lbs_deb_enter(LBS_DEB_SPI);
 
@@ -1123,6 +1124,9 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 		lbs_pr_err("error creating SPI thread: err=%d\n", err);
 		goto remove_card;
 	}
+	if (sched_setscheduler(card->spi_thread, SCHED_FIFO, &param))
+		lbs_pr_err("Error setting scheduler, using default.\n");
+
 	err = request_irq(spi->irq, if_spi_host_interrupt,
 			IRQF_TRIGGER_FALLING, "libertas_spi", card);
 	if (err) {
Signature · 1 line
1.5.6.3
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Anna Neal

Currently, the libertas main thread contends with the spi driver thread in the TX path. To improve throughput, ensure that the driver thread has higher scheduling priority than the libertas main thread. Do this by making the libertas spi driver thread a low priority real time thread.

We measured an average throughput improvement of 13%.

Sure; looks fine to me.

Quoted 26 lines
---
 drivers/net/wireless/libertas/if_spi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/libertas/if_spi.c +4 -0
index 07311e7..97493e2 100644
@@ -1020,6 +1020,7 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 	struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
 	int err = 0;
 	u32 scratch;
+	struct sched_param param = { .sched_priority = 1 };
 
 	lbs_deb_enter(LBS_DEB_SPI);
 
@@ -1123,6 +1124,9 @@ static int __devinit if_spi_probe(struct spi_device *spi)
 		lbs_pr_err("error creating SPI thread: err=%d\n", err);
 		goto remove_card;
 	}
+	if (sched_setscheduler(card->spi_thread, SCHED_FIFO, &param))
+		lbs_pr_err("Error setting scheduler, using default.\n");
+
 	err = request_irq(spi->irq, if_spi_host_interrupt,
 			IRQF_TRIGGER_FALLING, "libertas_spi", card);
 	if (err) {