Skip to contentSkip to conversation

b43: Add slot count compiletime assertion

PATCH Superseded Michael Buesch 1 participant 2 messages Feb 19, 2009 – Feb 20, 2009 Networking drivers (wireless)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: Add slot count compiletime assertion

This adds a compiletime assertion for a recently introduced assumption on the slot counts.
The tx header cache handling code assumes that the TX slot count can be divided evenly by the number of TX slots per frame.

---

Please queue on top of the DMA optimizations.

drivers/net/wireless/b43/dma.c +4 -0
Index: wireless-testing/drivers/net/wireless/b43/dma.c
===================================================================
@@ -839,12 +839,16 @@ struct b43_dmaring *b43_setup_dmaring(st
 	spin_lock_init(&ring->lock);
 #ifdef CONFIG_B43_DEBUG
 	ring->last_injected_overflow = jiffies;
 #endif
 
 	if (for_tx) {
+		/* Assumption: B43_TXRING_SLOTS can be divided by TX_SLOTS_PER_FRAME */
+		BUILD_BUG_ON((B43_TXRING_SLOTS * 1000000) / TX_SLOTS_PER_FRAME !=
+			     (B43_TXRING_SLOTS / TX_SLOTS_PER_FRAME) * 1000000);
+
 		ring->txhdr_cache = kcalloc(ring->nr_slots / TX_SLOTS_PER_FRAME,
 					    b43_txhdr_size(dev),
 					    GFP_KERNEL);
 		if (!ring->txhdr_cache)
 			goto err_kfree_meta;
 
Signature · 1 line
Greetings, Michael.
#1 lore raw
Quoted 10 lines · On Friday 20 February 2009 00:09:42 Michael Buesch wrote:

This adds a compiletime assertion for a recently introduced assumption on the slot counts.
The tx header cache handling code assumes that the TX slot count can be divided evenly by the number of TX slots per frame.

---

Please queue on top of the DMA optimizations.

I wonder what I was smoking when doing this patch, yesterday.

I'll immediately get a brown paper bag and redo a sane version of this... :)

Signature · 1 line
Greetings, Michael.