diff options
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 | ||