Merge branch 'next' of github.com:softwareradiosystems/srsLTE into next

master
Andre Puschmann 7 years ago
commit e7502d5c6c

@ -80,6 +80,9 @@ public:
}
}
bool is_almost_empty() {
return available.size() < capacity/20;
}
buffer_t* allocate(const char *debug_name = NULL)
{
@ -92,8 +95,9 @@ public:
used.push_back(b);
available.pop();
if (available.size() < capacity/20) {
if (is_almost_empty()) {
printf("Warning buffer pool capacity is %f %%\n", (float) 100*available.size()/capacity);
print_all_buffers();
}
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
if (debug_name) {

@ -63,7 +63,7 @@
#define SRSLTE_MAX_BUFFER_SIZE_BYTES 12756
#define SRSLTE_BUFFER_HEADER_OFFSET 1024
//#define SRSLTE_BUFFER_POOL_LOG_ENABLED
#define SRSLTE_BUFFER_POOL_LOG_ENABLED
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
#define pool_allocate (pool->allocate(__FUNCTION__))

@ -193,7 +193,7 @@ int main(int argc, char **argv) {
uci_data_tx.uci_ack_len = 1;
memcpy(&uci_data_rx, &uci_data_tx, sizeof(srslte_uci_data_t));
for (uint32_t i=0;i<20;i++) {
for (uint32_t i=0;i<uci_data_tx.uci_cqi_len;i++) {
uci_data_tx.uci_cqi [i] = 1;
}
uci_data_tx.uci_ri = 1;

@ -444,7 +444,6 @@ int srslte_ue_ul_pusch_encode_rnti_softbuffer(srslte_ue_ul_t *q,
int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q != NULL &&
softbuffer != NULL &&
output_signal != NULL)
{

@ -121,7 +121,7 @@ private:
static const uint32_t cfi = 3;
srslte_dci_location_t locations[MAX_LOCATIONS];
static const int MAC_PDU_THREAD_PRIO = 3;
static const int MAC_PDU_THREAD_PRIO = 60;

@ -84,7 +84,7 @@ public:
private:
static const int THREAD_PRIO = 7;
static const int THREAD_PRIO = 65;
static const int GTPU_PORT = 2152;
srslte::byte_buffer_pool *pool;
bool running;

@ -321,7 +321,7 @@ private:
const static uint32_t LCID_REM_USER = 0xffff0001;
bool running;
static const int RRC_THREAD_PRIO = 7;
static const int RRC_THREAD_PRIO = 65;
srslte::block_queue<rrc_pdu> rx_pdu_queue;
typedef struct {

@ -85,7 +85,7 @@ public:
//void ue_capabilities(uint16_t rnti, LIBLTE_RRC_UE_EUTRA_CAPABILITY_STRUCT *caps);
private:
static const int S1AP_THREAD_PRIO = 7;
static const int S1AP_THREAD_PRIO = 65;
static const int MME_PORT = 36412;
static const int ADDR_FAMILY = AF_INET;
static const int SOCK_TYPE = SOCK_STREAM;

@ -366,7 +366,6 @@ int main(int argc, char *argv[])
{
signal(SIGINT, sig_int_handler);
signal(SIGTERM, sig_int_handler);
signal(SIGKILL, sig_int_handler);
all_args_t args;
metrics_stdout metrics;
enb *enb = enb::get_instance();

@ -219,7 +219,13 @@ private:
// Receive and route HARQ feedbacks
if (grant) {
if ((!(grant->rnti_type == SRSLTE_RNTI_TEMP) && grant->ndi[0] != get_ndi() && harq_feedback) ||
if (grant->has_cqi_request && grant->phy_grant.ul.mcs.tbs == 0) {
/* Only CQI reporting (without SCH) */
memcpy(&action->phy_grant.ul, &grant->phy_grant.ul, sizeof(srslte_ra_ul_grant_t));
memcpy(&cur_grant, grant, sizeof(Tgrant));
action->tx_enabled = true;
action->rnti = grant->rnti;
} else if ((!(grant->rnti_type == SRSLTE_RNTI_TEMP) && grant->ndi[0] != get_ndi() && harq_feedback) ||
(grant->rnti_type == SRSLTE_RNTI_USER && !has_grant()) ||
grant->is_from_rar)
{

@ -46,6 +46,7 @@ namespace srsue {
class chest_feedback_itf
{
public:
virtual void in_sync() = 0;
virtual void out_of_sync() = 0;
virtual void set_cfo(float cfo) = 0;
};

@ -75,6 +75,7 @@ public:
bool status_is_sync();
// from chest_feedback_itf
void in_sync();
void out_of_sync();
void set_cfo(float cfo);
@ -153,7 +154,7 @@ private:
srslte_ue_mib_t ue_mib;
uint32_t cnt;
uint32_t timeout;
const static uint32_t SYNC_SFN_TIMEOUT = 200;
const static uint32_t SYNC_SFN_TIMEOUT = 500;
};
// Class to perform cell measurements
@ -324,9 +325,6 @@ private:
int cur_earfcn_index;
bool cell_search_in_progress;
uint32_t out_of_sync_cnt;
uint32_t out_of_sync2_cnt;
float dl_freq;
float ul_freq;

@ -56,6 +56,7 @@ namespace srsue {
bool set_cell(srslte_cell_t cell);
bool prepare_to_send(uint32_t preamble_idx, int allowed_subframe = -1, float target_power_dbm = -1);
bool is_ready_to_send(uint32_t current_tti);
bool is_pending();
int tx_tti();
void send(srslte::radio* radio_handler, float cfo, float pathloss, srslte_timestamp_t rx_time);

@ -426,7 +426,6 @@ int main(int argc, char *argv[])
srslte::metrics_hub<ue_metrics_t> metricshub;
signal(SIGINT, sig_int_handler);
signal(SIGTERM, sig_int_handler);
signal(SIGKILL, sig_int_handler);
all_args_t args;
srslte_debug_handle_crash(argc, argv);

@ -97,7 +97,7 @@ void phch_recv::init(srslte::radio_multi *_radio_handler, mac_interface_phy *_ma
intra_freq_meas.init(worker_com, rrc, log_h);
reset();
running = true;
// Start main thread
if (sync_cpu_affinity < 0) {
start(prio);
@ -125,7 +125,6 @@ void phch_recv::stop()
void phch_recv::reset()
{
tx_mutex_cnt = 0;
running = true;
phy_state = IDLE;
time_adv_sec = 0;
next_offset = 0;
@ -690,6 +689,12 @@ void phch_recv::run_thread()
worker->set_tti(tti, tx_mutex_cnt);
tx_mutex_cnt = (tx_mutex_cnt+1) % nof_tx_mutex;
// Reset Uplink TX buffer to avoid mixing packets in TX queue
if (prach_buffer->is_pending()) {
Info("SYNC: PRACH pending: Reset UL\n");
worker_com->reset_ul();
}
// Check if we need to TX a PRACH
if (prach_buffer->is_ready_to_send(tti)) {
srslte_timestamp_copy(&tx_time_prach, &rx_time);
@ -706,21 +711,11 @@ void phch_recv::run_thread()
srslte_pss_sic(&ue_sync.strack.pss, &buffer[0][SRSLTE_SF_LEN_PRB(cell.nof_prb)/2-ue_sync.strack.fft_size]);
}
intra_freq_meas.write(tti, buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb));
out_of_sync_cnt = 0;
break;
case 0:
// Signal every 5 errors only (PSS is every 5)
if (out_of_sync_cnt == 0) {
// Notify RRC of out-of-sync frame
log_h->error("SYNC: Sync error. Sending out-of-sync to RRC\n");
rrc->out_of_sync();
}
out_of_sync();
worker->release();
worker_com->reset_ul();
out_of_sync_cnt++;
if (out_of_sync_cnt >= 5) {
out_of_sync_cnt = 0;
}
break;
default:
radio_error();
@ -746,14 +741,12 @@ void phch_recv::run_thread()
}
}
void phch_recv::in_sync() {
rrc->in_sync();
}
void phch_recv::out_of_sync() {
out_of_sync2_cnt++;
Info("SYNC: Received out_of_sync from channel estimator (%d)\n", out_of_sync2_cnt);
if (out_of_sync2_cnt >= 2) {
out_of_sync2_cnt = 0;
Info("SYNC: Trying to resync signal\n");
resync_sfn(true, true);
}
rrc->out_of_sync();
}
@ -1085,7 +1078,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_subframe_sync(srslte_ue_syn
{
int sync_res = srslte_ue_sync_zerocopy_multi(ue_sync, buffer);
if (sync_res == 1) {
log_h->info("SYNC: CFO=%.1f KHz\n", srslte_ue_sync_get_cfo(ue_sync));
log_h->info("SYNC: CFO=%.1f KHz\n", srslte_ue_sync_get_cfo(ue_sync)/1000);
return run_subframe(sf_idx);
} else {
log_h->error("SYNC: Measuring RSRP: Sync error\n");
@ -1284,10 +1277,11 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset,
srslte_sync_reset(&sync_find);
srslte_sync_cfo_reset(&sync_find);
uint32_t sf5_cnt=0;
int sf5_cnt=-1;
do {
sf5_cnt++;
sync_res = srslte_sync_find(&sync_find, input_buffer, sf5_cnt*5*sf_len, &peak_idx);
} while(sync_res != SRSLTE_SYNC_FOUND && sf5_cnt < nof_sf/5);
} while(sync_res != SRSLTE_SYNC_FOUND && (uint32_t) sf5_cnt + 1 < nof_sf/5);
switch(sync_res) {
case SRSLTE_SYNC_ERROR:
@ -1315,20 +1309,20 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset,
-srslte_sync_get_cfo(&sync_find)/sync_find.fft_size);
switch(measure_p.run_multiple_subframes(input_cfo_corrected, peak_idx, sf_idx, nof_sf)) {
switch(measure_p.run_multiple_subframes(input_cfo_corrected, peak_idx+sf5_cnt*5*sf_len, sf_idx, nof_sf)) {
case measure::MEASURE_OK:
cells[nof_cells].pci = found_cell.id;
cells[nof_cells].rsrp = measure_p.rsrp();
cells[nof_cells].rsrq = measure_p.rsrq();
cells[nof_cells].offset = measure_p.frame_st_idx();
Info("INTRA: Found neighbour cell %d: PCI=%03d, RSRP=%5.1f dBm, peak_idx=%5d, peak_value=%3.2f n_id_2=%d, CFO=%6.1f Hz\n",
nof_cells, cell_id, measure_p.rsrp(), measure_p.frame_st_idx(), sync_find.peak_value, n_id_2, 15000*srslte_sync_get_cfo(&sync_find));
Info("INTRA: Found neighbour cell %d: PCI=%03d, RSRP=%5.1f dBm, peak_idx=%5d, peak_value=%3.2f, sf5_cnt=%d, n_id_2=%d, CFO=%6.1f Hz\n",
nof_cells, cell_id, measure_p.rsrp(), measure_p.frame_st_idx(), sync_find.peak_value, sf5_cnt, n_id_2, 15000*srslte_sync_get_cfo(&sync_find));
nof_cells++;
if (sic_pss_enabled) {
srslte_pss_sic(&sync_find.pss, &input_buffer[sf_len/2-fft_sz]);
srslte_pss_sic(&sync_find.pss, &input_buffer[sf5_cnt*5*sf_len+sf_len/2-fft_sz]);
}
break;
@ -1349,7 +1343,7 @@ int phch_recv::scell_recv::find_cells(cf_t *input_buffer, float rx_gain_offset,
default:
break;
}
} while (sync_res == SRSLTE_SYNC_FOUND && sic_pss_enabled);
} while (sync_res == SRSLTE_SYNC_FOUND && sic_pss_enabled && nof_cells < MAX_CELLS);
}
}
return nof_cells;

@ -175,8 +175,6 @@ void phch_worker::set_tti(uint32_t tti_, uint32_t tx_tti_)
tx_tti = tx_tti_;
log_h->step(tti);
log_phy_lib_h->step(tti);
}
void phch_worker::set_cfo(float cfo_)
@ -364,13 +362,12 @@ void phch_worker::work_imp()
if (chest_ok) {
if (snr_th_ok) {
phy->rrc->in_sync();
log_h->debug("SYNC: Sending in-sync to RRC\n");
log_h->debug("SNR=%.1f dB sync=in-sync from channel estimator\n", 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)));
chest_loop->in_sync();
} else if (snr_th_err) {
chest_loop->out_of_sync();
phy->rrc->out_of_sync();
log_h->info("SNR=%.1f dB under threshold. Sending out-of-sync to RRC\n",
log_h->info("SNR=%.1f dB sync=out-of-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)));
chest_loop->out_of_sync();
}
}
@ -771,7 +768,7 @@ bool phch_worker::decode_pdcch_ul(mac_interface_phy::mac_grant_t* grant)
// Handle Format0 adaptive retx
if (ret) {
// Use last TBS for this TB in case of mcs>28
if (grant->phy_grant.ul.mcs.idx > 28) {
if (grant->phy_grant.ul.mcs.idx > 28 && grant->phy_grant.ul.mcs.mod == SRSLTE_MOD_LAST) {
// Make sure we received a grant in the previous TTI for this PID
grant->phy_grant.ul.mcs.tbs = phy->last_ul_tbs[UL_PIDOF(TTI_TX(tti))];
grant->phy_grant.ul.mcs.mod = phy->last_ul_mod[UL_PIDOF(TTI_TX(tti))];
@ -924,8 +921,16 @@ void phch_worker::set_uci_aperiodic_cqi()
cqi_report.subband_hl.subband_diff_cqi_cw0 = 0; // Always report zero offset on all subbands
cqi_report.subband_hl.N = (cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0;
Info("PUSCH: Aperiodic CQI=%d, SNR=%.1f dB, for %d subbands\n", cqi_report.wideband.wideband_cqi, phy->avg_snr_db, cqi_report.subband_hl.N);
uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
char cqi_str[64] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64);
Info("PUSCH: Aperiodic CQI=%s, SNR=%.1f dB, for %d subbands\n", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N);
/* Fake RI = 1 */
uci_data.uci_ri = 0;
uci_data.uci_ri_len = 0;
}
break;
case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31:
@ -966,6 +971,11 @@ void phch_worker::set_uci_aperiodic_cqi()
// TODO: implement subband CQI properly
cqi_report.subband_hl.N = (uint32_t) ((cell.nof_prb > 7) ? srslte_cqi_hl_get_no_subbands(cell.nof_prb) : 0);
uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
char cqi_str[64] = {0};
srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, 64);
if (cqi_report.subband_hl.rank_is_not_one) {
Info("PUSCH: Aperiodic ri~1, CQI=%02d/%02d, SINR=%2.1f/%2.1fdB, pmi=%d for %d subbands\n",
cqi_report.subband_hl.wideband_cqi_cw0, cqi_report.subband_hl.wideband_cqi_cw1,
@ -975,7 +985,6 @@ void phch_worker::set_uci_aperiodic_cqi()
cqi_report.subband_hl.wideband_cqi_cw0,
sinr_db, pmi, cqi_report.subband_hl.N);
}
uci_data.uci_cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi);
}
break;
default:
@ -1048,7 +1057,7 @@ void phch_worker::encode_pusch(srslte_ra_ul_grant_t *grant, uint8_t *payload, ui
(tti + HARQ_DELAY_MS) % 10240,
grant->n_prb[0], grant->n_prb[0] + grant->L_prb,
grant->mcs.tbs / 8, grant->mcs.idx, rv,
uci_data.uci_ack_len > 0 ? (uci_data.uci_ack ? ", ack=1" : "0") : "",
uci_data.uci_ack_len > 0 ? (uci_data.uci_ack ? ", ack=1" : ", ack=0") : "",
uci_data.uci_ack_len > 1 ? (uci_data.uci_ack_2 ? "1" : "0") : "",
uci_data.uci_ri_len > 0 ? (uci_data.uci_ri ? ", ri=1" : ", ri=0") : "",
cfo * 15, timestr,

@ -152,8 +152,12 @@ bool prach::prepare_to_send(uint32_t preamble_idx_, int allowed_subframe_, float
}
}
bool prach::is_pending() {
return cell_initiated && preamble_idx >= 0 && preamble_idx < 64;
}
bool prach::is_ready_to_send(uint32_t current_tti_) {
if (cell_initiated && preamble_idx >= 0 && preamble_idx < 64) {
if (is_pending()) {
// consider the number of subframes the transmission must be anticipated
uint32_t current_tti = (current_tti_ + tx_advance_sf)%10240;
if (srslte_prach_tti_opportunity(&prach_obj, current_tti, allowed_subframe)) {

@ -722,7 +722,6 @@ float rrc::get_squal(float Qqualmeas) {
// Detection of physical layer problems (5.3.11.1)
void rrc::out_of_sync() {
// attempt resync
current_cell->in_sync = false;
if (!mac_timers->timer_get(t311)->is_running() && !mac_timers->timer_get(t310)->is_running()) {
n310_cnt++;
@ -730,7 +729,8 @@ void rrc::out_of_sync() {
mac_timers->timer_get(t310)->reset();
mac_timers->timer_get(t310)->run();
n310_cnt = 0;
rrc_log->info("Detected %d out-of-sync from PHY. Starting T310 timer\n", N310);
phy->sync_reset();
rrc_log->info("Detected %d out-of-sync from PHY. Trying to resync. Starting T310 timer\n", N310);
}
}
}

Loading…
Cancel
Save