[PATCH 4/7] staging: wilc1000: Add function to balance packet count
From: Aditya Shankar <hidden>
Date: 2017-06-26 07:04:44
Subsystem:
staging subsystem, the rest · Maintainers:
Greg Kroah-Hartman, Linus Torvalds
From: Aditya Shankar <hidden>
Date: 2017-06-26 07:04:44
Subsystem:
staging subsystem, the rest · Maintainers:
Greg Kroah-Hartman, Linus Torvalds
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 <redacted> --- 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