[diag] count the number of packets that are sent succeed and failed (#11108)

When using the `diag frame -c xxxx` command to enable the CSMA-CA when
transmitting the frame, the command `diag send` won't output any message
the CCA failure happens. It is difficult for users to know whether
the CSMA-CA is actually effective via diag commands.

This commit counts the number of packets that are sent succeed and failed,
outputs the transmision failure reason and do not re-transmit the frame
after it fails to send.
This commit is contained in:
Zhanglong Xia
2025-01-04 08:44:02 +08:00
committed by GitHub
parent 0e7039599c
commit 173cb61379
7 changed files with 80 additions and 37 deletions
+3 -3
View File
@@ -549,7 +549,7 @@ class RcpCaps(object):
dut_stats = self.__dut.diag_get_stats()
ref_stats = self.__ref.diag_get_stats()
ret = dut_stats['sent_packets'] == packets and ref_stats['received_packets'] > threshold
ret = dut_stats['sent_success_packets'] == packets and ref_stats['received_packets'] > threshold
else:
ret = False
@@ -578,7 +578,7 @@ class RcpCaps(object):
dut_stats = self.__dut.diag_get_stats()
ref_stats = self.__ref.diag_get_stats()
ret = dut_stats['sent_packets'] > threshold and ref_stats['received_packets'] > threshold
ret = dut_stats['sent_success_packets'] > threshold and ref_stats['received_packets'] > threshold
else:
ret = False
@@ -612,7 +612,7 @@ class RcpCaps(object):
sender_stats = sender.diag_get_stats()
receiver_stats = receiver.diag_get_stats()
ret = sender_stats['sent_packets'] == packets and receiver_stats['received_packets'] > threshold
ret = sender_stats['sent_success_packets'] == packets and receiver_stats['received_packets'] > threshold
else:
ret = False
+6 -3
View File
@@ -2603,13 +2603,16 @@ class OTCI(object):
result = {}
result['received_packets'] = int(output[0].split(":")[1])
result['sent_packets'] = int(output[1].split(":")[1])
result['sent_success_packets'] = int(output[1].split(":")[1])
result['sent_error_cca_packets'] = int(output[2].split(":")[1])
result['sent_error_abort_packets'] = int(output[3].split(":")[1])
result['sent_error_others_packets'] = int(output[4].split(":")[1])
values = re.findall("\-?\d+", output[2])
values = re.findall("\-?\d+", output[5])
result['first_received_packet_rssi'] = int(values[0])
result['first_received_packet_lqi'] = int(values[1])
values = re.findall("\-?\d+", output[3])
values = re.findall("\-?\d+", output[6])
result['last_received_packet_rssi'] = int(values[0])
result['last_received_packet_lqi'] = int(values[1])