batman-adv: ELP - creating neighbor structures
[deliverable/linux.git] / net / batman-adv / bat_v.c
1 /* Copyright (C) 2013-2016 B.A.T.M.A.N. contributors:
2 *
3 * Linus Lüssing, Marek Lindner
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "bat_algo.h"
19 #include "main.h"
20
21 #include <linux/cache.h>
22 #include <linux/init.h>
23
24 #include "bat_v_elp.h"
25 #include "packet.h"
26
27 static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
28 {
29 return batadv_v_elp_iface_enable(hard_iface);
30 }
31
32 static void batadv_v_iface_disable(struct batadv_hard_iface *hard_iface)
33 {
34 batadv_v_elp_iface_disable(hard_iface);
35 }
36
37 static void batadv_v_iface_update_mac(struct batadv_hard_iface *hard_iface)
38 {
39 }
40
41 static void batadv_v_primary_iface_set(struct batadv_hard_iface *hard_iface)
42 {
43 batadv_v_elp_primary_iface_set(hard_iface);
44 }
45
46 static void
47 batadv_v_hardif_neigh_init(struct batadv_hardif_neigh_node *hardif_neigh)
48 {
49 ewma_throughput_init(&hardif_neigh->bat_v.throughput);
50 }
51
52 static void batadv_v_ogm_schedule(struct batadv_hard_iface *hard_iface)
53 {
54 }
55
56 static void batadv_v_ogm_emit(struct batadv_forw_packet *forw_packet)
57 {
58 }
59
60 static struct batadv_algo_ops batadv_batman_v __read_mostly = {
61 .name = "BATMAN_V",
62 .bat_iface_enable = batadv_v_iface_enable,
63 .bat_iface_disable = batadv_v_iface_disable,
64 .bat_iface_update_mac = batadv_v_iface_update_mac,
65 .bat_primary_iface_set = batadv_v_primary_iface_set,
66 .bat_hardif_neigh_init = batadv_v_hardif_neigh_init,
67 .bat_ogm_emit = batadv_v_ogm_emit,
68 .bat_ogm_schedule = batadv_v_ogm_schedule,
69 };
70
71 /**
72 * batadv_v_init - B.A.T.M.A.N. V initialization function
73 *
74 * Description: Takes care of initializing all the subcomponents.
75 * It is invoked upon module load only.
76 *
77 * Return: 0 on success or a negative error code otherwise
78 */
79 int __init batadv_v_init(void)
80 {
81 int ret;
82
83 /* B.A.T.M.A.N. V echo location protocol packet */
84 ret = batadv_recv_handler_register(BATADV_ELP,
85 batadv_v_elp_packet_recv);
86 if (ret < 0)
87 return ret;
88
89 ret = batadv_algo_register(&batadv_batman_v);
90
91 if (ret < 0)
92 batadv_recv_handler_unregister(BATADV_ELP);
93
94 return ret;
95 }
This page took 0.036039 seconds and 6 git commands to generate.