Merge branch 'next_novolk' into mobility

master
Ismael Gomez 7 years ago
commit db87a41d80

@ -93,7 +93,7 @@ public:
available.pop();
if (available.size() < capacity/20) {
printf("Warning buffer pool capacity is %f %%\n", (float) available.size()/capacity);
printf("Warning buffer pool capacity is %f %%\n", (float) 100*available.size()/capacity);
}
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
if (debug_name) {

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

@ -55,7 +55,7 @@ void logger_file::init(std::string file) {
filename = file;
logfile = fopen(filename.c_str(), "w");
if(logfile==NULL) {
printf("Error: could not create log file, no messages will be logged");
printf("Error: could not create log file, no messages will be logged!\n");
}
start();
inited = true;

@ -86,11 +86,7 @@ uint32_t srslte_refsignal_cs_nof_symbols(uint32_t port_id)
uint32_t srslte_refsignal_mbsfn_nof_symbols()
{
if(false){
return 3;
}else{
return 3;
}
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);
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));
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));
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));
}
@ -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,
* 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);
/* descramble */
srslte_scrambling_s_offset(&q->seqs[area_id]->seq[cfg->sf_idx], q->e, 0, cfg->nbits[0].nof_bits);
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));
}
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);
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);
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 (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");
exit(-1);
}

@ -157,7 +157,7 @@ int base_init() {
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;
}

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

@ -649,12 +649,14 @@ int rf_uhd_recv_with_time_multi(void *h,
fprintf(stderr, "Error receiving from UHD: %d\n", error);
return -1;
}
uhd_rx_metadata_error_code_t error_code = 0;
uhd_rx_metadata_error_code(*md, &error_code);
md = &handler->rx_md;
n += rxd_samples;
trials++;
uhd_rx_metadata_error_code_t error_code;
uhd_rx_metadata_error_code(*md, &error_code);
if (error_code == UHD_RX_METADATA_ERROR_CODE_OVERFLOW) {
log_overflow(handler);
} else if (error_code == UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND) {

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

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

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

@ -252,12 +252,12 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
if (TTI_TX(dl_harq[i].get_tti()) == current_tti) {
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) {
for (int i=0;i<2;i++) {
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, i);
for (int j=0;j<2;j++) {
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",
rnti, prb_idx[0], prb_idx[1], n_pucch, dl_harq[i].get_n_cce(), has_sr, pucch_sched.N_pucch_1);
}
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);
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++) {
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",
rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx);
}
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);
return true;
}

@ -82,6 +82,7 @@ bool gtpu::init(std::string gtp_bind_addr_, std::string mme_addr_, srsenb::pdcp_
#endif
struct sockaddr_in bindaddr;
bzero(&bindaddr, sizeof(struct sockaddr_in));
bindaddr.sin_family = AF_INET;
bindaddr.sin_addr.s_addr = inet_addr(gtp_bind_addr.c_str());
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);
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);
}

@ -223,9 +223,13 @@ void rrc::rem_user(uint16_t rnti)
if (users.count(rnti) == 1) {
rrc_log->console("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
pthread_mutex_unlock(&user_mutex);
usleep(50000);
pthread_mutex_lock(&user_mutex);
rlc->rem_user(rnti);
pdcp->rem_user(rnti);
gtpu->rem_user(rnti);

@ -99,7 +99,7 @@ private:
uint8_t nof_harq_proc;
/* Msg3 Buffer */
static const uint32_t MSG3_BUFF_SZ = 128;
static const uint32_t MSG3_BUFF_SZ = 1024;
uint8_t msg3_buff[MSG3_BUFF_SZ];
/* PDU Buffer */

@ -417,7 +417,7 @@ void mac::get_metrics(mac_metrics_t &m)
metrics.rx_pkts?((float) 100*metrics.rx_errors/metrics.rx_pkts):0.0,
dl_harq.get_average_retx(),
metrics.tx_pkts?((float) 100*metrics.tx_errors/metrics.tx_pkts):0.0,
dl_harq.get_average_retx());
ul_harq.get_average_retx());
metrics.ul_buffer = (int) bsr_procedure.get_buffer_state();
m = metrics;

@ -349,14 +349,19 @@ bool mux::msg3_is_transmitted()
/* Returns a pointer to the Msg3 buffer */
uint8_t* mux::msg3_get(uint8_t *payload, uint32_t pdu_sz)
{
uint8_t* msg3_buff_start_pdu = pdu_get(msg3_buff, pdu_sz, 0, 0);
if (!msg3_buff_start_pdu) {
Error("Moving PDU from Mux unit to Msg3 buffer\n");
if (pdu_sz < MSG3_BUFF_SZ - 32) {
uint8_t* msg3_buff_start_pdu = pdu_get(msg3_buff, pdu_sz, 0, 0);
if (!msg3_buff_start_pdu) {
Error("Moving PDU from Mux unit to Msg3 buffer\n");
return NULL;
}
memcpy(payload, msg3_buff_start_pdu, sizeof(uint8_t)*pdu_sz);
msg3_has_been_transmitted = true;
return payload;
} else {
Error("Msg3 size (%d) is longer than internal msg3_buff size=%d, (see mux.h)\n", pdu_sz, MSG3_BUFF_SZ-32);
return NULL;
}
memcpy(payload, msg3_buff_start_pdu, sizeof(uint8_t)*pdu_sz);
msg3_has_been_transmitted = true;
return payload;
}

@ -233,7 +233,6 @@ void rrc::run_thread() {
set_phy_default();
set_mac_default();
mac->pcch_start_rx();
mac_timers->timer_get(t311)->run();
mac_timers->timer_get(t310)->stop();
mac_timers->timer_get(t311)->stop();
state = RRC_STATE_IDLE;

@ -105,20 +105,18 @@ void usim::stop()
void usim::get_imsi_vec(uint8_t* imsi_, uint32_t n)
{
if (!initiated)
{
usim_log->error("Getting IMSI: USIM not initiated\n");
if (!initiated) {
fprintf(stderr, "USIM not initiated!\n");
return;
}
if(NULL == imsi_ || n < 15)
{
if(NULL == imsi_ || n < 15) {
usim_log->error("Invalid parameters to get_imsi_vec");
return;
}
uint64_t temp = imsi;
for(int i=14;i>=0;i--)
{
for(int i=14;i>=0;i--) {
imsi_[i] = temp % 10;
temp /= 10;
}
@ -126,13 +124,12 @@ void usim::get_imsi_vec(uint8_t* imsi_, uint32_t n)
void usim::get_imei_vec(uint8_t* imei_, uint32_t n)
{
if (!initiated)
{
usim_log->error("Getting IMEI: USIM not initiated\n");
if (!initiated) {
fprintf(stderr, "USIM not initiated!\n");
return;
}
if(NULL == imei_ || n < 15)
{
if(NULL == imei_ || n < 15) {
usim_log->error("Invalid parameters to get_imei_vec");
return;
}
@ -147,9 +144,8 @@ void usim::get_imei_vec(uint8_t* imei_, uint32_t n)
int usim::get_home_plmn_id(LIBLTE_RRC_PLMN_IDENTITY_STRUCT *home_plmn_id)
{
if (!initiated)
{
usim_log->error("Getting Home PLMN Id: USIM not initiated\n");
if (!initiated) {
fprintf(stderr, "USIM not initiated!\n");
return -1;
}

Loading…
Cancel
Save