aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wimax
diff options
context:
space:
mode:
authorPrasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>2010-04-08 19:24:29 -0400
committerInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>2010-05-11 17:06:20 -0400
commit718e94907d79e74bbc7cfdb3cda2266079c5e993 (patch)
treed4204aa311601871d3a66d28c185dedfb28bddc7 /drivers/net/wimax
parenta40242f2cde38ccb04d4c35cad66aab3c047fa6a (diff)
wimax/i2400m: fix BUILD_BUG_ON() to use the maximum message size constant [v1]
The older method of computing the maximum PDU size relied on a method that doesn't work when we prop the maximum number of payloads up to the physical limit, and thus we kill the whole computation and just verify that the constants are congruent. Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
Diffstat (limited to 'drivers/net/wimax')
-rw-r--r--drivers/net/wimax/i2400m/tx.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/net/wimax/i2400m/tx.c b/drivers/net/wimax/i2400m/tx.c
index a5002c8467c2..1725f2b022a2 100644
--- a/drivers/net/wimax/i2400m/tx.c
+++ b/drivers/net/wimax/i2400m/tx.c
@@ -287,19 +287,6 @@ enum {
287 * documents, the maximum size of each message can be up to 16KiB. 287 * documents, the maximum size of each message can be up to 16KiB.
288 */ 288 */
289 I2400M_TX_MSG_SIZE = 16384, 289 I2400M_TX_MSG_SIZE = 16384,
290 /*
291 * 16 byte aligned MAX_MTU + 4 byte payload prefix.
292 */
293 I2400M_MAX_MTU_ALIGN = 16,
294 I2400M_TX_PDU_SIZE = I2400M_MAX_MTU % I2400M_MAX_MTU_ALIGN
295 + I2400M_MAX_MTU + sizeof(struct i2400m_pl_data_hdr),
296 /*
297 * 256 byte aligned toal size of 12 PDUs including msg header,
298 */
299 I2400M_TX_PDU_ALIGN = 256,
300 I2400M_TX_PDU_TOTAL_SIZE = ((I2400M_TX_PDU_SIZE * I2400M_TX_PLD_MAX
301 + sizeof(struct i2400m_msg_hdr))/I2400M_TX_PDU_ALIGN + 1)
302 * I2400M_TX_PDU_ALIGN * 2,
303}; 290};
304 291
305#define TAIL_FULL ((void *)~(unsigned long)NULL) 292#define TAIL_FULL ((void *)~(unsigned long)NULL)
@@ -915,8 +902,11 @@ int i2400m_tx_setup(struct i2400m *i2400m)
915 goto error_kmalloc; 902 goto error_kmalloc;
916 } 903 }
917 904
918 /* Warn if the calculated buffer size exceeds I2400M_TX_BUF_SIZE. */ 905 /*
919 BUILD_BUG_ON(I2400M_TX_PDU_TOTAL_SIZE > I2400M_TX_BUF_SIZE); 906 * Fail the build if we can't fit at least two maximum size messages
907 * on the TX FIFO [one being delivered while one is constructed].
908 */
909 BUILD_BUG_ON(2 * I2400M_TX_MSG_SIZE > I2400M_TX_BUF_SIZE);
920 spin_lock_irqsave(&i2400m->tx_lock, flags); 910 spin_lock_irqsave(&i2400m->tx_lock, flags);
921 i2400m->tx_sequence = 0; 911 i2400m->tx_sequence = 0;
922 i2400m->tx_in = 0; 912 i2400m->tx_in = 0;