1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-31 15:16:22 +00:00

Fix data race conditions and performance inefficiencies, update CHANGELOG

This commit is contained in:
Carles Fernandez 2023-11-28 18:06:41 +01:00
parent 346cd8f9ac
commit 1818c88983
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 111 additions and 97 deletions

View File

@ -14,6 +14,10 @@ All notable changes to GNSS-SDR will be documented in this file.
## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next) ## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next)
### Improvements in Efficiency:
- Fixed some performance inefficiencies detected by Coverity Scan.
### Improvements in Interoperability: ### Improvements in Interoperability:
- Added a new PVT configuration boolean flag (`flag_geohash_log_out`) that - Added a new PVT configuration boolean flag (`flag_geohash_log_out`) that
@ -41,6 +45,7 @@ All notable changes to GNSS-SDR will be documented in this file.
- Updated local `cpu_features` library to v0.9.0. - Updated local `cpu_features` library to v0.9.0.
- `volk_gnsssdr`: fix syntax for Python 3.12 without breaking backward - `volk_gnsssdr`: fix syntax for Python 3.12 without breaking backward
compatibility with Python 2.7. compatibility with Python 2.7.
- Fixed linking against latest GNU Radio version.
### Improvements in Repeatability: ### Improvements in Repeatability:
@ -54,6 +59,10 @@ All notable changes to GNSS-SDR will be documented in this file.
`PVT.kf_system_ecef_pos_sd_m=0.01`, in [m]; and `PVT.kf_system_ecef_pos_sd_m=0.01`, in [m]; and
`PVT.kf_system_ecef_vel_sd_ms=0.001`, in [m/s]. `PVT.kf_system_ecef_vel_sd_ms=0.001`, in [m/s].
### Improvements in Scalability:
- Fixed some potential data race conditions detected by Coverity Scan.
### Improvements in Usability: ### Improvements in Usability:
- The Galileo E1B Reduced CED parameters usage has been set to `false` by - The Galileo E1B Reduced CED parameters usage has been set to `false` by

View File

@ -260,6 +260,7 @@ void Gr_Complex_Ip_Packet_Source::pcap_callback(__attribute__((unused)) u_char *
// eth frame parameters // eth frame parameters
// **** UDP RAW PACKET DECODER **** // **** UDP RAW PACKET DECODER ****
gr::thread::scoped_lock guard(d_setlock);
if ((packet[12] == 0x08) & (packet[13] == 0x00)) // IP FRAME if ((packet[12] == 0x08) & (packet[13] == 0x00)) // IP FRAME
{ {
// retrieve the position of the ip header // retrieve the position of the ip header
@ -296,7 +297,6 @@ void Gr_Complex_Ip_Packet_Source::pcap_callback(__attribute__((unused)) u_char *
const u_char *udp_payload = (reinterpret_cast<const u_char *>(uh) + sizeof(gr_udp_header)); const u_char *udp_payload = (reinterpret_cast<const u_char *>(uh) + sizeof(gr_udp_header));
if (fifo_items <= (FIFO_SIZE - payload_length_bytes)) if (fifo_items <= (FIFO_SIZE - payload_length_bytes))
{ {
gr::thread::scoped_lock guard(d_setlock);
int aligned_write_items = FIFO_SIZE - fifo_write_ptr; int aligned_write_items = FIFO_SIZE - fifo_write_ptr;
if (aligned_write_items >= payload_length_bytes) if (aligned_write_items >= payload_length_bytes)
{ {

View File

@ -443,6 +443,100 @@ void gps_l1_ca_telemetry_decoder_gs::check_tlm_separation()
} }
void gps_l1_ca_telemetry_decoder_gs::frame_synchronization(const Gnss_Synchro &current_gs)
{
gr::thread::scoped_lock lock(d_setlock);
switch (d_stat)
{
case 0: // no preamble information
{
// correlate with preamble
int32_t corr_value = 0;
if (d_symbol_history.size() >= d_required_symbols)
{
// ******* preamble correlation ********
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
if (d_symbol_history[i] < 0.0) // symbols clipping
{
corr_value -= d_preamble_samples[i];
}
else
{
corr_value += d_preamble_samples[i];
}
}
}
if (abs(corr_value) >= d_samples_per_preamble)
{
d_preamble_index = d_sample_counter; // record the preamble sample stamp
if (corr_value < 0)
{
d_flag_PLL_180_deg_phase_locked = true;
}
else
{
d_flag_PLL_180_deg_phase_locked = false;
}
DLOG(INFO) << "Preamble detection for GPS L1 satellite " << this->d_satellite;
d_prev_GPS_frame_4bytes = 0;
if (decode_subframe(current_gs.CN0_dB_hz, d_flag_PLL_180_deg_phase_locked))
{
d_CRC_error_counter = 0;
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
d_last_valid_preamble = d_sample_counter;
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
DLOG(INFO) << " Frame sync SAT " << this->d_satellite;
}
d_stat = 1; // preamble acquired
}
}
d_flag_TOW_set = false;
break;
}
case 1: // preamble acquired
{
if (d_sample_counter >= d_preamble_index + static_cast<uint64_t>(d_preamble_period_symbols))
{
DLOG(INFO) << "Preamble received for SAT " << this->d_satellite << "d_sample_counter=" << d_sample_counter << "\n";
// call the decoder
// 0. fetch the symbols into an array
d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P)
if (decode_subframe(current_gs.CN0_dB_hz, d_flag_PLL_180_deg_phase_locked))
{
d_CRC_error_counter = 0;
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
d_last_valid_preamble = d_sample_counter;
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
DLOG(INFO) << " Frame sync SAT " << this->d_satellite;
}
}
else
{
d_CRC_error_counter++;
if (d_CRC_error_counter > 2)
{
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite;
d_flag_frame_sync = false;
d_stat = 0;
d_TOW_at_current_symbol_ms = 0;
d_TOW_at_Preamble_ms = 0;
d_CRC_error_counter = 0;
d_flag_TOW_set = false;
}
}
}
break;
}
}
}
int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{ {
@ -480,98 +574,8 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
// check if there is a problem with the telemetry of the current satellite // check if there is a problem with the telemetry of the current satellite
check_tlm_separation(); check_tlm_separation();
// ******* frame sync ****************** // frame sync
switch (d_stat) frame_synchronization(current_symbol);
{
case 0: // no preamble information
{
// correlate with preamble
int32_t corr_value = 0;
if (d_symbol_history.size() >= d_required_symbols)
{
// ******* preamble correlation ********
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
if (d_symbol_history[i] < 0.0) // symbols clipping
{
corr_value -= d_preamble_samples[i];
}
else
{
corr_value += d_preamble_samples[i];
}
}
}
if (abs(corr_value) >= d_samples_per_preamble)
{
d_preamble_index = d_sample_counter; // record the preamble sample stamp
if (corr_value < 0)
{
d_flag_PLL_180_deg_phase_locked = true;
}
else
{
d_flag_PLL_180_deg_phase_locked = false;
}
DLOG(INFO) << "Preamble detection for GPS L1 satellite " << this->d_satellite;
d_prev_GPS_frame_4bytes = 0;
if (decode_subframe(current_symbol.CN0_dB_hz, d_flag_PLL_180_deg_phase_locked))
{
d_CRC_error_counter = 0;
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
gr::thread::scoped_lock lock(d_setlock);
d_last_valid_preamble = d_sample_counter;
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
DLOG(INFO) << " Frame sync SAT " << this->d_satellite;
}
d_stat = 1; // preamble acquired
}
}
d_flag_TOW_set = false;
break;
}
case 1: // preamble acquired
{
if (d_sample_counter >= d_preamble_index + static_cast<uint64_t>(d_preamble_period_symbols))
{
DLOG(INFO) << "Preamble received for SAT " << this->d_satellite << "d_sample_counter=" << d_sample_counter << "\n";
// call the decoder
// 0. fetch the symbols into an array
d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P)
if (decode_subframe(current_symbol.CN0_dB_hz, d_flag_PLL_180_deg_phase_locked))
{
d_CRC_error_counter = 0;
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
gr::thread::scoped_lock lock(d_setlock);
d_last_valid_preamble = d_sample_counter;
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
DLOG(INFO) << " Frame sync SAT " << this->d_satellite;
}
}
else
{
d_CRC_error_counter++;
if (d_CRC_error_counter > 2)
{
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite;
gr::thread::scoped_lock lock(d_setlock);
d_flag_frame_sync = false;
d_stat = 0;
d_TOW_at_current_symbol_ms = 0;
d_TOW_at_Preamble_ms = 0;
d_CRC_error_counter = 0;
d_flag_TOW_set = false;
}
}
}
break;
}
}
// 2. Add the telemetry decoder information // 2. Add the telemetry decoder information
if (d_flag_preamble == true) if (d_flag_preamble == true)

View File

@ -74,6 +74,7 @@ private:
gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf); gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
void check_tlm_separation(); void check_tlm_separation();
void frame_synchronization(const Gnss_Synchro &current_gs);
bool gps_word_parityCheck(uint32_t gpsword); bool gps_word_parityCheck(uint32_t gpsword);
bool decode_subframe(double cn0, bool flag_invert); bool decode_subframe(double cn0, bool flag_invert);

View File

@ -84,7 +84,7 @@ bool FileConfiguration::property(std::string property_name, bool default_value)
return overrided_->property(property_name, default_value); return overrided_->property(property_name, default_value);
} }
const std::string empty; const std::string empty;
return converter_->convert(property(property_name, empty), default_value); return converter_->convert(property(std::move(property_name), empty), default_value);
} }
@ -139,7 +139,7 @@ uint16_t FileConfiguration::property(std::string property_name, uint16_t default
return overrided_->property(property_name, default_value); return overrided_->property(property_name, default_value);
} }
const std::string empty; const std::string empty;
return converter_->convert(property(property_name, empty), default_value); return converter_->convert(property(std::move(property_name), empty), default_value);
} }
@ -150,7 +150,7 @@ int16_t FileConfiguration::property(std::string property_name, int16_t default_v
return overrided_->property(property_name, default_value); return overrided_->property(property_name, default_value);
} }
const std::string empty; const std::string empty;
return converter_->convert(property(property_name, empty), default_value); return converter_->convert(property(std::move(property_name), empty), default_value);
} }
@ -172,7 +172,7 @@ double FileConfiguration::property(std::string property_name, double default_val
return overrided_->property(property_name, default_value); return overrided_->property(property_name, default_value);
} }
const std::string empty; const std::string empty;
return converter_->convert(property(property_name, empty), default_value); return converter_->convert(property(std::move(property_name), empty), default_value);
} }