Fix coverty issues

master
Ismael Gomez 7 years ago
parent 51c2c041d7
commit db5d747c66

@ -31,6 +31,9 @@ template<typename metrics_t>
class metrics_hub : public periodic_thread class metrics_hub : public periodic_thread
{ {
public: public:
metrics_hub() {
m = NULL;
}
bool init(metrics_interface<metrics_t> *m_, float report_period_secs=1.0) { bool init(metrics_interface<metrics_t> *m_, float report_period_secs=1.0) {
m = m_; m = m_;
start_periodic(report_period_secs*1e6); start_periodic(report_period_secs*1e6);
@ -47,6 +50,7 @@ public:
private: private:
void run_period() { void run_period() {
if (m) {
metrics_t metric; metrics_t metric;
bzero(&metric, sizeof(metrics_t)); bzero(&metric, sizeof(metrics_t));
m->get_metrics(metric); m->get_metrics(metric);
@ -54,6 +58,7 @@ private:
listeners[i]->set_metrics(metric); listeners[i]->set_metrics(metric);
} }
} }
}
metrics_interface<metrics_t> *m; metrics_interface<metrics_t> *m;
std::vector<metrics_listener<metrics_t>*> listeners; std::vector<metrics_listener<metrics_t>*> listeners;

@ -86,11 +86,7 @@ uint32_t srslte_refsignal_cs_nof_symbols(uint32_t port_id)
uint32_t srslte_refsignal_mbsfn_nof_symbols() uint32_t srslte_refsignal_mbsfn_nof_symbols()
{ {
if(false){
return 3; return 3;
}else{
return 3;
}
} }

@ -381,11 +381,11 @@ int srslte_pmch_decode_multi(srslte_pmch_t *q,
srslte_predecoding_single_multi(q->symbols, q->ce[0], q->d, q->nof_rx_antennas, cfg->nbits[0].nof_re, noise_estimate); srslte_predecoding_single_multi(q->symbols, q->ce[0], q->d, q->nof_rx_antennas, cfg->nbits[0].nof_re, noise_estimate);
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSLTE_VERBOSE_ISDEBUG()) {
DEBUG("SAVED FILE subframe.dat: received subframe symbols\n",0); DEBUG("SAVED FILE subframe.dat: received subframe symbols\n");
srslte_vec_save_file("subframe.dat", sf_symbols, SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t)); srslte_vec_save_file("subframe.dat", sf_symbols, SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
DEBUG("SAVED FILE hest0.dat: channel estimates for port 4\n",0); DEBUG("SAVED FILE hest0.dat: channel estimates for port 4\n");
srslte_vec_save_file("hest0.dat", ce[0], SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t)); srslte_vec_save_file("hest0.dat", ce[0], SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
DEBUG("SAVED FILE pmch_symbols.dat: symbols after equalization\n",0); DEBUG("SAVED FILE pmch_symbols.dat: symbols after equalization\n");
srslte_vec_save_file("pmch_symbols.bin", q->d, cfg->nbits[0].nof_re*sizeof(cf_t)); srslte_vec_save_file("pmch_symbols.bin", q->d, cfg->nbits[0].nof_re*sizeof(cf_t));
} }
@ -393,16 +393,13 @@ int srslte_pmch_decode_multi(srslte_pmch_t *q,
* The MAX-log-MAP algorithm used in turbo decoding is unsensitive to SNR estimation, * The MAX-log-MAP algorithm used in turbo decoding is unsensitive to SNR estimation,
* thus we don't need tot set it in thde LLRs normalization * thus we don't need tot set it in thde LLRs normalization
*/ */
srslte_demod_soft_demodulate_s(cfg->grant.mcs[0].mod, q->d, q->e, cfg->nbits[0].nof_re); srslte_demod_soft_demodulate_s(cfg->grant.mcs[0].mod, q->d, q->e, cfg->nbits[0].nof_re);
/* descramble */ /* descramble */
srslte_scrambling_s_offset(&q->seqs[area_id]->seq[cfg->sf_idx], q->e, 0, cfg->nbits[0].nof_bits); srslte_scrambling_s_offset(&q->seqs[area_id]->seq[cfg->sf_idx], q->e, 0, cfg->nbits[0].nof_bits);
if (SRSLTE_VERBOSE_ISDEBUG()) { if (SRSLTE_VERBOSE_ISDEBUG()) {
DEBUG("SAVED FILE llr.dat: LLR estimates after demodulation and descrambling\n",0); DEBUG("SAVED FILE llr.dat: LLR estimates after demodulation and descrambling\n");
srslte_vec_save_file("llr.dat", q->e, cfg->nbits[0].nof_bits*sizeof(int16_t)); srslte_vec_save_file("llr.dat", q->e, cfg->nbits[0].nof_bits*sizeof(int16_t));
} }
return srslte_dlsch_decode(&q->dl_sch, cfg, softbuffer, q->e, data); return srslte_dlsch_decode(&q->dl_sch, cfg, softbuffer, q->e, data);

@ -323,7 +323,7 @@ int srslte_pusch_set_cell(srslte_pusch_t *q, srslte_cell_t cell) {
q->max_re = cell.nof_prb * MAX_PUSCH_RE(q->cell.cp); q->max_re = cell.nof_prb * MAX_PUSCH_RE(q->cell.cp);
INFO("PUSCH: Cell config PCI=5d, %d ports %d PRBs, max_symbols: %d\n", INFO("PUSCH: Cell config PCI=%d, %d ports %d PRBs, max_symbols: %d\n",
q->cell.id, q->cell.nof_ports, q->cell.nof_prb, q->max_re); q->cell.id, q->cell.nof_ports, q->cell.nof_prb, q->max_re);
if (q->cell.id != cell.id || q->cell.nof_prb == 0) { if (q->cell.id != cell.id || q->cell.nof_prb == 0) {

@ -263,7 +263,11 @@ int main(int argc, char **argv) {
for (ngroup=0;ngroup<srslte_phich_ngroups(&phich);ngroup++) { for (ngroup=0;ngroup<srslte_phich_ngroups(&phich);ngroup++) {
for (nseq=0;nseq<max_nseq;nseq++) { for (nseq=0;nseq<max_nseq;nseq++) {
if (srslte_phich_decode(&phich, &fft_buffer, &ce, srslte_chest_dl_get_noise_estimate(&chest), ngroup, nseq, numsubframe, &ack_rx, &distance)<0) { cf_t *input[SRSLTE_MAX_PORTS] = {fft_buffer, NULL};
cf_t *cebuf[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS] = {{ce[0], ce[1]},{ce[0], ce[1]}};
if (srslte_phich_decode(&phich, input, cebuf, srslte_chest_dl_get_noise_estimate(&chest),
ngroup, nseq, numsubframe, &ack_rx, &distance)<0)
{
printf("Error decoding ACK\n"); printf("Error decoding ACK\n");
exit(-1); exit(-1);
} }

@ -157,7 +157,7 @@ int base_init() {
srslte_ue_dl_set_non_mbsfn_region(&ue_dl, non_mbsfn_region); srslte_ue_dl_set_non_mbsfn_region(&ue_dl, non_mbsfn_region);
DEBUG("Memory init OK\n",0); DEBUG("Memory init OK\n");
return 0; return 0;
} }

@ -220,7 +220,7 @@ int main(int argc, char **argv) {
for (i=0;i<SRSLTE_MAX_PORTS;i++) { for (i=0;i<SRSLTE_MAX_PORTS;i++) {
for (j = 0; j < SRSLTE_MAX_PORTS; j++) { for (j = 0; j < SRSLTE_MAX_PORTS; j++) {
ce[i][j] = srslte_vec_malloc(sizeof(cf_t) * NOF_CE_SYMBOLS); ce[i][j] = srslte_vec_malloc(sizeof(cf_t) * NOF_CE_SYMBOLS);
if (!ce[i]) { if (!ce[i][j]) {
perror("srslte_vec_malloc"); perror("srslte_vec_malloc");
goto quit; goto quit;
} }

@ -261,10 +261,10 @@ int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t * q,
uint32_t nof_frames = 0; uint32_t nof_frames = 0;
int mib_ret = SRSLTE_UE_MIB_NOTFOUND; int mib_ret = SRSLTE_UE_MIB_NOTFOUND;
srslte_ue_mib_sync_reset(q);
if (q != NULL) if (q != NULL)
{ {
srslte_ue_mib_sync_reset(q);
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
do { do {
mib_ret = SRSLTE_UE_MIB_NOTFOUND; mib_ret = SRSLTE_UE_MIB_NOTFOUND;

@ -63,10 +63,10 @@ bool radio::init(char *args, char *devname)
} }
if (args) { if (args) {
strncpy(saved_args, args, 128); strncpy(saved_args, args, 127);
} }
if (devname) { if (devname) {
strncpy(saved_devname, devname, 128); strncpy(saved_devname, devname, 127);
} }
return true; return true;

@ -31,10 +31,10 @@ bool radio_multi::init_multi(uint32_t nof_rx_antennas, char* args, char* devname
} }
if (args) { if (args) {
strncpy(saved_args, args, 128); strncpy(saved_args, args, 127);
} }
if (devname) { if (devname) {
strncpy(saved_devname, devname, 128); strncpy(saved_devname, devname, 127);
} }
return true; return true;

@ -252,12 +252,12 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
if (((dl_harq[i].get_tti()+4)%10240) == current_tti) { if (((dl_harq[i].get_tti()+4)%10240) == current_tti) {
uint32_t n_pucch = srslte_pucch_get_npucch(dl_harq[i].get_n_cce(), SRSLTE_PUCCH_FORMAT_1A, has_sr, &pucch_sched); uint32_t n_pucch = srslte_pucch_get_npucch(dl_harq[i].get_n_cce(), SRSLTE_PUCCH_FORMAT_1A, has_sr, &pucch_sched);
if (prb_idx) { if (prb_idx) {
for (int i=0;i<2;i++) { for (int j=0;j<2;j++) {
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, i); prb_idx[j] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, j);
}
} }
Debug("SCHED: Reserved Format1A PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, ncce=%d, has_sr=%d, n_pucch_1=%d\n", Debug("SCHED: Reserved Format1A PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, ncce=%d, has_sr=%d, n_pucch_1=%d\n",
rnti, prb_idx[0], prb_idx[1], n_pucch, dl_harq[i].get_n_cce(), has_sr, pucch_sched.N_pucch_1); rnti, prb_idx[0], prb_idx[1], n_pucch, dl_harq[i].get_n_cce(), has_sr, pucch_sched.N_pucch_1);
}
return true; return true;
} }
} }
@ -277,9 +277,9 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
for (int i=0;i<2;i++) { for (int i=0;i<2;i++) {
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_2, cfg.cqi_pucch, cell.nof_prb, cell.cp, i); prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_2, cfg.cqi_pucch, cell.nof_prb, cell.cp, i);
} }
}
Debug("SCHED: Reserved Format2 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, pmi_idx=%d\n", Debug("SCHED: Reserved Format2 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, pmi_idx=%d\n",
rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx); rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx);
}
return true; return true;
} }

@ -82,6 +82,7 @@ bool gtpu::init(std::string gtp_bind_addr_, std::string mme_addr_, srsenb::pdcp_
#endif #endif
struct sockaddr_in bindaddr; struct sockaddr_in bindaddr;
bzero(&bindaddr, sizeof(struct sockaddr_in));
bindaddr.sin_family = AF_INET; bindaddr.sin_family = AF_INET;
bindaddr.sin_addr.s_addr = inet_addr(gtp_bind_addr.c_str()); bindaddr.sin_addr.s_addr = inet_addr(gtp_bind_addr.c_str());
bindaddr.sin_port = htons(GTPU_PORT); bindaddr.sin_port = htons(GTPU_PORT);
@ -137,7 +138,10 @@ void gtpu::write_pdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t* pdu)
servaddr.sin_port = htons(GTPU_PORT); servaddr.sin_port = htons(GTPU_PORT);
gtpu_write_header(&header, pdu); gtpu_write_header(&header, pdu);
sendto(snk_fd, pdu->msg, pdu->N_bytes, MSG_EOR, (struct sockaddr*)&servaddr, sizeof(struct sockaddr_in)); if (sendto(snk_fd, pdu->msg, pdu->N_bytes, MSG_EOR, (struct sockaddr*)&servaddr, sizeof(struct sockaddr_in))<0) {
perror("sendto");
}
pool->deallocate(pdu); pool->deallocate(pdu);
} }

@ -223,9 +223,13 @@ void rrc::rem_user(uint16_t rnti)
if (users.count(rnti) == 1) { if (users.count(rnti) == 1) {
rrc_log->console("Disconnecting rnti=0x%x.\n", rnti); rrc_log->console("Disconnecting rnti=0x%x.\n", rnti);
rrc_log->info("Disconnecting rnti=0x%x.\n", rnti); rrc_log->info("Disconnecting rnti=0x%x.\n", rnti);
/* **Caution** order of removal here is imporant: from bottom to top */ /* **Caution** order of removal here is important: from bottom to top */
mac->ue_rem(rnti); // MAC handles PHY mac->ue_rem(rnti); // MAC handles PHY
pthread_mutex_unlock(&user_mutex);
usleep(50000); usleep(50000);
pthread_mutex_lock(&user_mutex);
rlc->rem_user(rnti); rlc->rem_user(rnti);
pdcp->rem_user(rnti); pdcp->rem_user(rnti);
gtpu->rem_user(rnti); gtpu->rem_user(rnti);

Loading…
Cancel
Save