VOL-513: Support ASFVOLT16 Adapter in Swarm Mode -VOL-467 Phase 1 - Polling Mode
Follow up changes to do the following.
1) Remove reduntant spaces in the code
2) Change the grpc-c stream write mechanism from non-blocking to blocking
3) Increase the bal_indication queue size from 25 to 1000
4) Compilation warning fixes
Change-Id: I3917d526d4db59601ca9d8468f66f4219d735e17
diff --git a/src/bal_indications_queue.c b/src/bal_indications_queue.c
index ffc9a15..36ec466 100644
--- a/src/bal_indications_queue.c
+++ b/src/bal_indications_queue.c
@@ -15,6 +15,9 @@
*/
#include "bal_indications_queue.h"
+#include "asfvolt16_driver.h"
+
+long unsigned int indication_drop_count = 0;
/*
* Implements a circular queue whose size can grow upto MAX_QUEUE_SIZE defined.
@@ -50,8 +53,8 @@
/*'bal_ind_queue_head' should be thread safe there could be simultaneous
write from BAL and adapter trying to read from the 'bal_ind_queue_head'.
So, protect it under a mutex(bal_ind_queue_lock), before using this MACRO*/
- if (num_of_nodes == 0 &&
- bal_ind_queue_head == NULL &&
+ if (num_of_nodes == 0 &&
+ bal_ind_queue_head == NULL &&
bal_ind_queue_tail == NULL ) {
/*Case where the queue is empty*/
bal_ind_queue_head = node;
@@ -60,27 +63,29 @@
bal_ind_queue_tail->next = node;
++num_of_nodes;
}
- else if (num_of_nodes == 1 &&
- bal_ind_queue_head != NULL &&
+ else if (num_of_nodes == 1 &&
+ bal_ind_queue_head != NULL &&
bal_ind_queue_tail != NULL ) {
bal_ind_queue_head->next = node;
bal_ind_queue_tail = node;
bal_ind_queue_tail->next = bal_ind_queue_head;
++num_of_nodes;
}
- else if (num_of_nodes > 1 &&
- num_of_nodes < MAX_QUEUE_SIZE &&
- bal_ind_queue_head != NULL &&
+ else if (num_of_nodes > 1 &&
+ num_of_nodes < MAX_QUEUE_SIZE &&
+ bal_ind_queue_head != NULL &&
bal_ind_queue_tail != NULL ) {
bal_ind_queue_tail->next = node;
bal_ind_queue_tail = node;
bal_ind_queue_tail->next = bal_ind_queue_head;
++num_of_nodes;
}
- else if (num_of_nodes == MAX_QUEUE_SIZE &&
- bal_ind_queue_head != NULL &&
+ else if (num_of_nodes == MAX_QUEUE_SIZE &&
+ bal_ind_queue_head != NULL &&
bal_ind_queue_tail != NULL ) {
list_node *head_ref = bal_ind_queue_head;
+ ASFVOLT_LOG(ASFVOLT_DEBUG, "Queue full, deleting a node. Drop cnt = %lu\n",\
+ ++indication_drop_count);
bal_ind_queue_tail->next = node;
bal_ind_queue_tail = node;
bal_ind_queue_head = bal_ind_queue_head->next;