On Thu, Aug 11, 2011 at 12:17 PM, Luciano Coelho <coelho@xxxxxx> wrote: > On Tue, 2011-08-09 at 12:13 +0300, Eliad Peller wrote: >> From: Arik Nemtsov <arik@xxxxxxxxxx> >> >> Track the number of freed packets in each AC when receiving an interrupt >> from the FW. This paves the way for tracking allocated packets per AC. >> >> Signed-off-by: Arik Nemtsov <arik@xxxxxxxxxx> >> Signed-off-by: Eliad Peller <eliad@xxxxxxxxxx> >> --- >> drivers/net/wireless/wl12xx/main.c | 16 +++++++++++++++- >> drivers/net/wireless/wl12xx/tx.c | 2 ++ >> drivers/net/wireless/wl12xx/wl12xx.h | 8 ++++++-- >> 3 files changed, 23 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c >> index b223c27..3bfd772 100644 >> --- a/drivers/net/wireless/wl12xx/main.c >> +++ b/drivers/net/wireless/wl12xx/main.c >> @@ -810,22 +810,32 @@ static void wl1271_irq_update_links_status(struct wl1271 *wl, >> static void wl1271_fw_status(struct wl1271 *wl, >> struct wl1271_fw_status *status) >> { >> struct timespec ts; >> u32 old_tx_blk_count = wl->tx_blocks_available; >> int avail, freed_blocks; >> + int i; >> >> wl1271_raw_read(wl, FW_STATUS_ADDR, status, sizeof(*status), false); >> >> wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " >> "drv_rx_counter = %d, tx_results_counter = %d)", >> status->intr, >> status->fw_rx_counter, >> status->drv_rx_counter, >> status->tx_results_counter); >> >> + for (i = 0; i < NUM_TX_QUEUES; i++) { >> + /* prevent wrap-around in freed-packets counter */ >> + wl->tx_allocated_pkts -= >> + (status->tx_released_pkts[i] - >> + wl->tx_pkts_freed[i] + 256) % 256; > > Isn't the "+ 256" useless here, since you'll mod the result anyway? > modulus of negative numbers is not well defined. Eliad. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html