Skip to content

Commit

Permalink
simplify tx inject error counting
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Aug 24, 2023
1 parent 771be21 commit 4477f1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/WBTxRx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool WBTxRx::inject_radiotap_packet(int card_index,const uint8_t* packet_buff, i
m_console->warn("pcap -unable to inject packet size:{} ret:{} err:[{}]",packet_size, len_injected,
pcap_geterr(m_pcap_handles[card_index].tx));
}
m_tx_stats.count_tx_errors++;
m_tx_stats.count_tx_dropped_packets++;
return false;
}
return true;
Expand Down Expand Up @@ -820,9 +820,9 @@ void WBTxRx::recalculate_pollution_perc() {
}

std::string WBTxRx::tx_stats_to_string(const WBTxRx::TxStats& data) {
return fmt::format("TxStats[injected packets:{} bytes:{} tx errors:{}:{} pps:{} bps:{}:{}]",
return fmt::format("TxStats[injected packets:{} bytes:{} tx error hint/dropped:{}:{} pps:{} bps:{}:{}]",
data.n_injected_packets,data.n_injected_bytes_including_overhead,
data.count_tx_injections_error_hint,data.count_tx_errors,
data.count_tx_injections_error_hint,data.count_tx_dropped_packets,
data.curr_packets_per_second,
StringHelper::bitrate_readable(data.curr_bits_per_second_excluding_overhead),
StringHelper::bitrate_readable(data.curr_bits_per_second_including_overhead));
Expand Down
4 changes: 2 additions & 2 deletions src/WBTxRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class WBTxRx {
// Usually, this shouldn't increase, since "injecting a frame" should be a blocking operation
// (until there is space available in the tx queue, aka either linux network or driver packet queue)
// and openhd does automatic bitrate adjust at the tx.
int32_t count_tx_errors=0;
int32_t count_tx_dropped_packets=0;
};
struct RxStats{
// Total count of received packets / bytes - can be from another wb tx, but also from someone else using wifi
Expand Down Expand Up @@ -345,7 +345,7 @@ class WBTxRx {
AvgCalculator m_tx_inject_time;
private:
// For OpenHD rate control, this method should block until the driver accepted the packet
// returns true if packet is now in driver hands, false otherwise.
// returns true if packet is now in linux kernel / driver hands, false otherwise.
// on failure, m_tx_stats.count_tx_errors is increased by one
// if injection takes "really long", tx error hint is increase
bool inject_radiotap_packet(int card_index,const uint8_t* packet_buff,int packet_size);
Expand Down

0 comments on commit 4477f1b

Please sign in to comment.