aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/ring_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/ring_buffer.c')
-rw-r--r--net/batman-adv/ring_buffer.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/batman-adv/ring_buffer.c b/net/batman-adv/ring_buffer.c
index fd63951d118d..c8f61e395b74 100644
--- a/net/batman-adv/ring_buffer.c
+++ b/net/batman-adv/ring_buffer.c
@@ -1,5 +1,4 @@
1/* 1/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 2 *
4 * Marek Lindner 3 * Marek Lindner
5 * 4 *
@@ -16,26 +15,26 @@
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA 17 * 02110-1301, USA
19 *
20 */ 18 */
21 19
22#include "main.h" 20#include "main.h"
23#include "ring_buffer.h" 21#include "ring_buffer.h"
24 22
25void ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index, uint8_t value) 23void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
24 uint8_t value)
26{ 25{
27 lq_recv[*lq_index] = value; 26 lq_recv[*lq_index] = value;
28 *lq_index = (*lq_index + 1) % TQ_GLOBAL_WINDOW_SIZE; 27 *lq_index = (*lq_index + 1) % BATADV_TQ_GLOBAL_WINDOW_SIZE;
29} 28}
30 29
31uint8_t ring_buffer_avg(const uint8_t lq_recv[]) 30uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
32{ 31{
33 const uint8_t *ptr; 32 const uint8_t *ptr;
34 uint16_t count = 0, i = 0, sum = 0; 33 uint16_t count = 0, i = 0, sum = 0;
35 34
36 ptr = lq_recv; 35 ptr = lq_recv;
37 36
38 while (i < TQ_GLOBAL_WINDOW_SIZE) { 37 while (i < BATADV_TQ_GLOBAL_WINDOW_SIZE) {
39 if (*ptr != 0) { 38 if (*ptr != 0) {
40 count++; 39 count++;
41 sum += *ptr; 40 sum += *ptr;