[PATCH v2 4/8] staging: wilc1000: Add function to balance packet count
Aditya Shankar
aditya.shankar at microchip.com
Mon Jun 26 11:43:26 UTC 2017
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.shankar at 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
More information about the devel
mailing list