diff options
author | Simon Wunderlich <simon@open-mesh.com> | 2013-11-13 13:14:46 -0500 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2014-01-12 08:41:10 -0500 |
commit | 89652331c00f43574515059ecbf262d26d885717 (patch) | |
tree | 907828c7834896ef46ad868466cbeb4b87b58583 /net/batman-adv/network-coding.c | |
parent | f6c8b71173ad50e48e6569a1ef5d7d4486268b4d (diff) |
batman-adv: split tq information in neigh_node struct
For the network wide multi interface optimization it is required to save
metrics per outgoing interface in one neighbor. Therefore a new type is
introduced to keep interface-specific information. This also requires
some changes in access and list management.
The compare and equiv_or_better API calls are changed to take the
outgoing interface into consideration.
Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/network-coding.c')
-rw-r--r-- | net/batman-adv/network-coding.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index d6f0be346a3d..aec3fa564027 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -1008,6 +1008,8 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, | |||
1008 | struct batadv_coded_packet *coded_packet; | 1008 | struct batadv_coded_packet *coded_packet; |
1009 | struct batadv_neigh_node *neigh_tmp, *router_neigh; | 1009 | struct batadv_neigh_node *neigh_tmp, *router_neigh; |
1010 | struct batadv_neigh_node *router_coding = NULL; | 1010 | struct batadv_neigh_node *router_coding = NULL; |
1011 | struct batadv_neigh_ifinfo *router_neigh_ifinfo = NULL; | ||
1012 | struct batadv_neigh_ifinfo *router_coding_ifinfo = NULL; | ||
1011 | uint8_t *first_source, *first_dest, *second_source, *second_dest; | 1013 | uint8_t *first_source, *first_dest, *second_source, *second_dest; |
1012 | __be32 packet_id1, packet_id2; | 1014 | __be32 packet_id1, packet_id2; |
1013 | size_t count; | 1015 | size_t count; |
@@ -1021,15 +1023,25 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, | |||
1021 | if (!router_neigh) | 1023 | if (!router_neigh) |
1022 | goto out; | 1024 | goto out; |
1023 | 1025 | ||
1026 | router_neigh_ifinfo = batadv_neigh_ifinfo_get(router_neigh, | ||
1027 | BATADV_IF_DEFAULT); | ||
1028 | if (!router_neigh_ifinfo) | ||
1029 | goto out; | ||
1030 | |||
1024 | neigh_tmp = nc_packet->neigh_node; | 1031 | neigh_tmp = nc_packet->neigh_node; |
1025 | router_coding = batadv_orig_node_get_router(neigh_tmp->orig_node); | 1032 | router_coding = batadv_orig_node_get_router(neigh_tmp->orig_node); |
1026 | if (!router_coding) | 1033 | if (!router_coding) |
1027 | goto out; | 1034 | goto out; |
1028 | 1035 | ||
1029 | tq_tmp = batadv_nc_random_weight_tq(router_neigh->bat_iv.tq_avg); | 1036 | router_coding_ifinfo = batadv_neigh_ifinfo_get(router_coding, |
1030 | tq_weighted_neigh = tq_tmp; | 1037 | BATADV_IF_DEFAULT); |
1031 | tq_tmp = batadv_nc_random_weight_tq(router_coding->bat_iv.tq_avg); | 1038 | if (!router_coding_ifinfo) |
1032 | tq_weighted_coding = tq_tmp; | 1039 | goto out; |
1040 | |||
1041 | tq_tmp = router_neigh_ifinfo->bat_iv.tq_avg; | ||
1042 | tq_weighted_neigh = batadv_nc_random_weight_tq(tq_tmp); | ||
1043 | tq_tmp = router_coding_ifinfo->bat_iv.tq_avg; | ||
1044 | tq_weighted_coding = batadv_nc_random_weight_tq(tq_tmp); | ||
1033 | 1045 | ||
1034 | /* Select one destination for the MAC-header dst-field based on | 1046 | /* Select one destination for the MAC-header dst-field based on |
1035 | * weighted TQ-values. | 1047 | * weighted TQ-values. |
@@ -1153,6 +1165,10 @@ out: | |||
1153 | batadv_neigh_node_free_ref(router_neigh); | 1165 | batadv_neigh_node_free_ref(router_neigh); |
1154 | if (router_coding) | 1166 | if (router_coding) |
1155 | batadv_neigh_node_free_ref(router_coding); | 1167 | batadv_neigh_node_free_ref(router_coding); |
1168 | if (router_neigh_ifinfo) | ||
1169 | batadv_neigh_ifinfo_free_ref(router_neigh_ifinfo); | ||
1170 | if (router_coding_ifinfo) | ||
1171 | batadv_neigh_ifinfo_free_ref(router_coding_ifinfo); | ||
1156 | return res; | 1172 | return res; |
1157 | } | 1173 | } |
1158 | 1174 | ||