diff options
| -rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 27 | ||||
| -rw-r--r-- | net/batman-adv/hard-interface.h | 1 | ||||
| -rw-r--r-- | net/batman-adv/soft-interface.c | 2 |
3 files changed, 24 insertions, 6 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 1f9fe4270454..789aaa9f2e3a 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
| @@ -1088,6 +1088,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | |||
| 1088 | unsigned int neigh_rq_inv_cube, neigh_rq_max_cube; | 1088 | unsigned int neigh_rq_inv_cube, neigh_rq_max_cube; |
| 1089 | int tq_asym_penalty, inv_asym_penalty, if_num, ret = 0; | 1089 | int tq_asym_penalty, inv_asym_penalty, if_num, ret = 0; |
| 1090 | unsigned int combined_tq; | 1090 | unsigned int combined_tq; |
| 1091 | int tq_iface_penalty; | ||
| 1091 | 1092 | ||
| 1092 | /* find corresponding one hop neighbor */ | 1093 | /* find corresponding one hop neighbor */ |
| 1093 | rcu_read_lock(); | 1094 | rcu_read_lock(); |
| @@ -1169,15 +1170,31 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | |||
| 1169 | inv_asym_penalty /= neigh_rq_max_cube; | 1170 | inv_asym_penalty /= neigh_rq_max_cube; |
| 1170 | tq_asym_penalty = BATADV_TQ_MAX_VALUE - inv_asym_penalty; | 1171 | tq_asym_penalty = BATADV_TQ_MAX_VALUE - inv_asym_penalty; |
| 1171 | 1172 | ||
| 1172 | combined_tq = batadv_ogm_packet->tq * tq_own * tq_asym_penalty; | 1173 | /* penalize if the OGM is forwarded on the same interface. WiFi |
| 1173 | combined_tq /= BATADV_TQ_MAX_VALUE * BATADV_TQ_MAX_VALUE; | 1174 | * interfaces and other half duplex devices suffer from throughput |
| 1175 | * drops as they can't send and receive at the same time. | ||
| 1176 | */ | ||
| 1177 | tq_iface_penalty = BATADV_TQ_MAX_VALUE; | ||
| 1178 | if (if_outgoing && (if_incoming == if_outgoing) && | ||
| 1179 | batadv_is_wifi_netdev(if_outgoing->net_dev)) | ||
| 1180 | tq_iface_penalty = batadv_hop_penalty(BATADV_TQ_MAX_VALUE, | ||
| 1181 | bat_priv); | ||
| 1182 | |||
| 1183 | combined_tq = batadv_ogm_packet->tq * | ||
| 1184 | tq_own * | ||
| 1185 | tq_asym_penalty * | ||
| 1186 | tq_iface_penalty; | ||
| 1187 | combined_tq /= BATADV_TQ_MAX_VALUE * | ||
| 1188 | BATADV_TQ_MAX_VALUE * | ||
| 1189 | BATADV_TQ_MAX_VALUE; | ||
| 1174 | batadv_ogm_packet->tq = combined_tq; | 1190 | batadv_ogm_packet->tq = combined_tq; |
| 1175 | 1191 | ||
| 1176 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | 1192 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
| 1177 | "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n", | 1193 | "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, iface_penalty: %3i, total tq: %3i, if_incoming = %s, if_outgoing = %s\n", |
| 1178 | orig_node->orig, orig_neigh_node->orig, total_count, | 1194 | orig_node->orig, orig_neigh_node->orig, total_count, |
| 1179 | neigh_rq_count, tq_own, | 1195 | neigh_rq_count, tq_own, tq_asym_penalty, tq_iface_penalty, |
| 1180 | tq_asym_penalty, batadv_ogm_packet->tq); | 1196 | batadv_ogm_packet->tq, if_incoming->net_dev->name, |
| 1197 | if_outgoing ? if_outgoing->net_dev->name : "DEFAULT"); | ||
| 1181 | 1198 | ||
| 1182 | /* if link has the minimum required transmission quality | 1199 | /* if link has the minimum required transmission quality |
| 1183 | * consider it bidirectional | 1200 | * consider it bidirectional |
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 8d4304b74b5d..ccd42c2b95ba 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h | |||
| @@ -40,6 +40,7 @@ enum batadv_hard_if_cleanup { | |||
| 40 | extern struct notifier_block batadv_hard_if_notifier; | 40 | extern struct notifier_block batadv_hard_if_notifier; |
| 41 | 41 | ||
| 42 | bool batadv_is_wifi_netdev(struct net_device *net_device); | 42 | bool batadv_is_wifi_netdev(struct net_device *net_device); |
| 43 | bool batadv_is_wifi_iface(int ifindex); | ||
| 43 | struct batadv_hard_iface* | 44 | struct batadv_hard_iface* |
| 44 | batadv_hardif_get_by_netdev(const struct net_device *net_dev); | 45 | batadv_hardif_get_by_netdev(const struct net_device *net_dev); |
| 45 | int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, | 46 | int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface, |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index c50f64337f55..2dc22702dd11 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -697,7 +697,7 @@ static int batadv_softif_init_late(struct net_device *dev) | |||
| 697 | atomic_set(&bat_priv->gw.bandwidth_down, 100); | 697 | atomic_set(&bat_priv->gw.bandwidth_down, 100); |
| 698 | atomic_set(&bat_priv->gw.bandwidth_up, 20); | 698 | atomic_set(&bat_priv->gw.bandwidth_up, 20); |
| 699 | atomic_set(&bat_priv->orig_interval, 1000); | 699 | atomic_set(&bat_priv->orig_interval, 1000); |
| 700 | atomic_set(&bat_priv->hop_penalty, 30); | 700 | atomic_set(&bat_priv->hop_penalty, 15); |
| 701 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 701 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
| 702 | atomic_set(&bat_priv->log_level, 0); | 702 | atomic_set(&bat_priv->log_level, 0); |
| 703 | #endif | 703 | #endif |
