aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wimax
diff options
context:
space:
mode:
authorPrasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>2010-04-08 19:24:30 -0400
committerInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>2010-05-11 17:06:29 -0400
commit9e6e3bd52b0f77ca5cc385892c14ff8ba5ecfa67 (patch)
tree21d9c92e7bab1afa0b3da9f98335d45915f88aa3 /drivers/net/wimax
parent718e94907d79e74bbc7cfdb3cda2266079c5e993 (diff)
wimax/i2400m: modify i2400m_tx_fifo_push() to check for head room space in the TX FIFO [v1]
This fixes i2400m_tx_fifo_push(); the check for having enough space in the TX FIFO's tail was obscure and broken in certain corner cases. The new check works in all cases and is way clearer. Please refer the documentation in the code for details. 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.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/wimax/i2400m/tx.c b/drivers/net/wimax/i2400m/tx.c
index 1725f2b022a2..101550a2f5a2 100644
--- a/drivers/net/wimax/i2400m/tx.c
+++ b/drivers/net/wimax/i2400m/tx.c
@@ -396,8 +396,20 @@ void *i2400m_tx_fifo_push(struct i2400m *i2400m, size_t size, size_t padding)
396 /* Is there space at the tail? */ 396 /* Is there space at the tail? */
397 tail_room = __i2400m_tx_tail_room(i2400m); 397 tail_room = __i2400m_tx_tail_room(i2400m);
398 if (tail_room < needed_size) { 398 if (tail_room < needed_size) {
399 if (i2400m->tx_out % I2400M_TX_BUF_SIZE 399 /*
400 < i2400m->tx_in % I2400M_TX_BUF_SIZE) { 400 * If the tail room space is not enough to push the message
401 * in the TX FIFO, then there are two possibilities:
402 * 1. There is enough head room space to accommodate
403 * this message in the TX FIFO.
404 * 2. There is not enough space in the head room and
405 * in tail room of the TX FIFO to accommodate the message.
406 * In the case (1), return TAIL_FULL so that the caller
407 * can figure out, if the caller wants to push the message
408 * into the head room space.
409 * In the case (2), return NULL, indicating that the TX FIFO
410 * cannot accommodate the message.
411 */
412 if (room - tail_room >= needed_size) {
401 d_printf(2, dev, "fifo push %zu/%zu: tail full\n", 413 d_printf(2, dev, "fifo push %zu/%zu: tail full\n",
402 size, padding); 414 size, padding);
403 return TAIL_FULL; /* There might be head space */ 415 return TAIL_FULL; /* There might be head space */