pping: Reverse the interpretation of rx/tx for aggregated stats

For the aggregated stats, report RX and TX from the perspective of the
capture point, instead of the perspective of the subnet.

Consider the following setup, consisting of subnet A, the capture
point (CP) where we're running ePPing, and subnet B.

A <-----> CP <-----> B

Now consider that we have a TCP stream uploading data from A to B, so
that we can capture RTTs between when the data packet from A reaches
CP to when the ACK from B gets back to the CP, i.e. CP -> B -> CP.

Previously, the RX stats for a subnet referred to packets received by
the subnet, i.e. packets with dst address in the subnet. Likewise, TX
packets were packets transmitted by the subnet, i.e. packets with src
address in the subnet. So the data packet from A -> B would be
reported as TX for subnet A and RX for subnet B.

However, the RTTs are by default (can be changed by the
--aggregate-reverse flag) aggregated from the perspective of the
capture point, so that the RTT CP -> B -> CP would be reported as an
RTT observed for subnet B.

Make the TX and RX stats consistent with the RTT, so that all subnet
stats are from the perspective of the CP. Make RX refer to packets the
CP has received from the subnet, i.e. packets with src in A, and TX
refer to packets the CP has transmitted to the subnet, i.e. packets
with dst in the subnet. So report a data packet from A -> B as RX for
subnet A and TX for subnet B.

Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
This commit is contained in:
Simon Sundberg
2023-10-17 16:54:43 +02:00
parent a7972a6f0f
commit d13f429907

View File

@@ -1132,16 +1132,16 @@ static void update_aggregate_stats(struct aggregated_stats **src_stats,
&p_info->pid.flow.saddr.ip, p_info->pid.flow.ipv);
if (*src_stats) {
(*src_stats)->last_updated = p_info->time;
(*src_stats)->tx_packet_count++;
(*src_stats)->tx_byte_count += p_info->pkt_len;
(*src_stats)->rx_packet_count++;
(*src_stats)->rx_byte_count += p_info->pkt_len;
}
*dst_stats = lookup_or_create_aggregation_stats(
&p_info->pid.flow.daddr.ip, p_info->pid.flow.ipv);
if (*dst_stats) {
(*dst_stats)->last_updated = p_info->time;
(*dst_stats)->rx_packet_count++;
(*dst_stats)->rx_byte_count += p_info->pkt_len;
(*dst_stats)->tx_packet_count++;
(*dst_stats)->tx_byte_count += p_info->pkt_len;
}
}