Add a new function to track the cound of packets and
determine the ratio of current number of packets to
maximum count of packets.

Signed-off-by: Aditya Shankar <aditya.shan...@microchip.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index d1ed3ba8..655f229 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -426,6 +426,23 @@ static inline u8 ac_classify(struct wilc *wilc, struct 
txq_entry_t *tqe)
        return ac;
 }
 
+static inline int ac_balance(u8 *count, u8 *ratio)
+{
+       u8 i, max_count = 0;
+
+       if (!count || !ratio)
+               return -1;
+
+       for (i = 0; i < NQUEUES; i++)
+               if (count[i] > max_count)
+                       max_count = count[i];
+
+       for (i = 0; i < NQUEUES; i++)
+               ratio[i] = max_count - count[i];
+
+       return 0;
+}
+
 int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
                              u32 buffer_size, wilc_tx_complete_func_t func)
 {
-- 
2.7.4


_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to