Let's consider the below topology
+-------+ +-------+ +-------+ | OrigA | <--- ... ---- | OrigB | <------- | OrigC | +-------+ PT_ab +-------+ LT_bc +-------+
Where OrigA's OGM is received on same WiFi (non full duplex) interface as the one used to forward it to OrigC. And where LT_bc is the estimated throughput for the direct link between OrigB and OrigC. And where PT_ab is the end-to-end B.A.T.M.A.N-Adv path throughput estimation of OrigB to reach OrigA.
Let's note PT_ac the B.A.T.M.A.N-Adv path throughput estimation of OrigC to reach OrigA in this topology.
PT_ac was estimated by dividing by two the minimal value between PT_ab and LT_bc because of store & forward characteristic of OrigB wifi interface.
However the following formula seems to be a more realistic approximation of PT_ac:
PT_ac = PT_ab * LT_bc / (PT_ab * LT_bc)
This patch change the half duplex penalty to match the formula above.
NB: OrigB still sets PT_ab/2 throughput in OrigA's OGM before forwarding it to OrigC for retrocompatibility sake, and is discarded when OrigC computes the new estimated end-to-end path throughput.
Signed-off-by: Remi Pommarel repk@triplefau.lt --- net/batman-adv/bat_v_ogm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 27597f4cdf3e..9b7d4de182d0 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -866,10 +866,12 @@ static u32 batadv_v_get_throughput(struct batadv_ogm2_packet *ogm, oth = ntohl(ogm->throughput); lth = ewma_throughput_read(&neigh->bat_v.throughput);
- if ((ogm->flags & BATADV_V_HALF_DUPLEX) && lth > 10) - lth /= 2; + if (!(ogm->flags & BATADV_V_HALF_DUPLEX)) + return min_t(u32, lth, oth);
- return min_t(u32, lth, oth); + /* OGM throughput was divided by two for retrocompatibility sake */ + oth *= 2; + return oth * lth / (oth + lth); }
/**