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

master
Andre Puschmann 7 years ago
commit b73b29ff9e

@ -126,7 +126,7 @@ void log_filter::all_log(srslte::LOG_LEVEL_ENUM level,
ss << std::endl;
}
if (hex_limit > 0) {
if (hex_limit > 0 && hex && size > 0) {
ss << hex_string(hex, size);
}
str_ptr s_ptr(new std::string(ss.str()));

@ -291,6 +291,13 @@ private:
// Sync metrics
sync_metrics_t metrics;
// in-sync / out-of-sync counters
uint32_t out_of_sync_cnt;
uint32_t in_sync_cnt;
const static uint32_t NOF_OUT_OF_SYNC_SF = 200;
const static uint32_t NOF_IN_SYNC_SF = 100;
// State for primary cell
enum {
IDLE = 0,

@ -78,6 +78,7 @@ public:
void set_earfcn(std::vector<uint32_t> earfcns);
void force_freq(float dl_freq, float ul_freq);
void radio_overflow();
/********** RRC INTERFACE ********************/
void reset();

@ -73,13 +73,14 @@ public:
void start_plot();
static void rf_msg(srslte_rf_error_t error);
void handle_rf_msg(srslte_rf_error_t error);
// UE metrics interface
bool get_metrics(ue_metrics_t &m);
void pregenerate_signals(bool enable);
void radio_overflow();
private:
virtual ~ue();

@ -156,6 +156,8 @@ public:
virtual void stop() = 0;
virtual bool is_attached() = 0;
virtual void start_plot() = 0;
virtual void radio_overflow() = 0;
void handle_rf_msg(srslte_rf_error_t error);

@ -43,7 +43,6 @@ typedef enum{
typedef struct{
std::string algo;
std::string op;
std::string amf;
std::string imsi;
std::string imei;
std::string k;

@ -124,7 +124,6 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
("usim.algo", bpo::value<string>(&args->usim.algo), "USIM authentication algorithm")
("usim.op", bpo::value<string>(&args->usim.op), "USIM operator variant")
("usim.amf", bpo::value<string>(&args->usim.amf), "USIM authentication management field")
("usim.imsi", bpo::value<string>(&args->usim.imsi), "USIM IMSI")
("usim.imei", bpo::value<string>(&args->usim.imei), "USIM IMEI")
("usim.k", bpo::value<string>(&args->usim.k), "USIM K")

@ -124,6 +124,8 @@ void phch_recv::stop()
void phch_recv::reset()
{
in_sync_cnt = 0;
out_of_sync_cnt = 0;
tx_mutex_cnt = 0;
phy_state = IDLE;
time_adv_sec = 0;
@ -294,15 +296,17 @@ bool phch_recv::stop_sync() {
usleep(10000);
cnt++;
}
if (!is_in_idle) {
Warning("SYNC: Could not go to IDLE\n");
}
return is_in_idle;
}
}
void phch_recv::reset_sync() {
wait_radio_reset();
Warning("SYNC: Resetting sync, cell_search_in_progress=%s\n", cell_search_in_progress?"yes":"no");
search_p.reset();
srslte_ue_sync_reset(&ue_sync);
resync_sfn(true, true);
@ -713,6 +717,7 @@ void phch_recv::run_thread()
intra_freq_meas.write(tti, buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb));
break;
case 0:
Warning("SYNC: Out-of-sync detected in PSS/SSS\n");
out_of_sync();
worker->release();
worker_com->reset_ul();
@ -742,11 +747,24 @@ void phch_recv::run_thread()
}
void phch_recv::in_sync() {
rrc->in_sync();
out_of_sync_cnt = 0;
in_sync_cnt++;
// Send RRC in-sync signal after 100 ms consecutive subframes
if (in_sync_cnt == NOF_IN_SYNC_SF) {
rrc->in_sync();
in_sync_cnt = 0;
}
}
// Out of sync called by worker or phch_recv every 1 or 5 ms
void phch_recv::out_of_sync() {
rrc->out_of_sync();
in_sync_cnt = 0;
// Send RRC out-of-sync signal after 200 ms consecutive subframes
out_of_sync_cnt++;
if (out_of_sync_cnt >= NOF_OUT_OF_SYNC_SF) {
rrc->out_of_sync();
out_of_sync_cnt = 0;
}
}

@ -241,15 +241,12 @@ void phch_worker::work_imp()
/* Do FFT and extract PDCCH LLR, or quit if no actions are required in this subframe */
bool chest_ok = extract_fft_and_pdcch_llr();
bool snr_th_err = 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))<-20.0;
bool snr_th_ok = 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest))>-15.0;
// Call feedback loop for chest
if (chest_loop && ((1<<(tti%10)) & phy->args->cfo_ref_mask)) {
chest_loop->set_cfo(srslte_chest_dl_get_cfo(&ue_dl.chest));
}
if (chest_ok && !snr_th_err) {
if (chest_ok) {
/***** Downlink Processing *******/
@ -370,12 +367,13 @@ void phch_worker::work_imp()
update_measurements();
if (chest_ok) {
if (snr_th_ok) {
log_h->debug("SNR=%.1f dB sync=in-sync from channel estimator\n", 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)));
if (phy->avg_rsrp_dbm > -124.0 && 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)) > -30.0) {
log_h->debug("SNR=%.1f dB, RSRP=%.1f dBm sync=in-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm);
chest_loop->in_sync();
} else if (snr_th_err) {
log_h->info("SNR=%.1f dB sync=out-of-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)));
} else {
log_h->warning("SNR=%.1f dB RSRP=%.1f dBm, sync=out-of-sync from channel estimator\n",
10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm);
chest_loop->out_of_sync();
}
}

@ -352,6 +352,11 @@ int phy::prach_tx_tti()
return prach_buffer.tx_tti();
}
// Handle the case of a radio overflow. Resynchronise inmediatly
void phy::radio_overflow() {
sf_recv.reset_sync();
}
void phy::reset()
{
Info("Resetting PHY\n");

@ -297,10 +297,17 @@ bool ue::get_metrics(ue_metrics_t &m)
return false;
}
void ue::radio_overflow() {
phy.radio_overflow();
}
void ue::rf_msg(srslte_rf_error_t error)
{
ue_base *ue = ue_base::get_instance(LTE);
ue->handle_rf_msg(error);
if(error.type == srslte_rf_error_t::SRSLTE_RF_ERROR_OVERFLOW) {
ue->radio_overflow();
}
}
} // namespace srsue

@ -958,6 +958,8 @@ void rrc::send_con_setup_complete(byte_buffer_t *nas_msg) {
memcpy(ul_dcch_msg.msg.rrc_con_setup_complete.dedicated_info_nas.msg, nas_msg->msg, nas_msg->N_bytes);
ul_dcch_msg.msg.rrc_con_setup_complete.dedicated_info_nas.N_bytes = nas_msg->N_bytes;
pool->deallocate(nas_msg);
send_ul_dcch_msg();
}

@ -53,13 +53,6 @@ void usim::init(usim_args_t *args, srslte::log *usim_log_)
usim_log->console("Invalid length for OP: %d should be %d", args->op.length(), 32);
}
if(4 == args->amf.length()) {
str_to_hex(args->amf, amf);
} else {
usim_log->error("Invalid length for AMF: %d should be %d", args->amf.length(), 4);
usim_log->console("Invalid length for AMF: %d should be %d", args->amf.length(), 4);
}
if(15 == args->imsi.length()) {
imsi = 0;
for(i=0; i<15; i++)
@ -356,6 +349,11 @@ void usim::gen_auth_res_milenage( uint8_t *rand,
{
sqn[i] = autn_enb[i] ^ ak[i];
}
// Extract AMF from autn
for(int i=0;i<2;i++)
{
amf[i]=autn_enb[6+i];
}
// Generate MAC
security_milenage_f1( k,
@ -431,6 +429,10 @@ void usim::gen_auth_res_xor(uint8_t *rand,
for(i=0;i<6;i++) {
sqn[i] = autn_enb[i] ^ ak[i];
}
// Extract AMF from autn
for(int i=0;i<2;i++){
amf[i]=autn_enb[6+i];
}
// Generate cdout
for(i=0; i<6; i++) {

@ -117,7 +117,6 @@ int security_command_test()
usim_args_t args;
args.algo = "xor";
args.amf = "9001";
args.imei = "353490069873319";
args.imsi = "001010123456789";
args.k = "00112233445566778899aabbccddeeff";
@ -179,7 +178,6 @@ int mme_attach_request_test()
srsue::usim usim;
usim_args_t args;
args.algo = "xor";
args.amf = "9001";
args.imei = "353490069873319";
args.imsi = "001010123456789";
args.k = "00112233445566778899aabbccddeeff";

@ -74,7 +74,6 @@ int main(int argc, char **argv)
usim_args_t args;
args.algo = "milenage";
args.amf = "8000";
args.imei = "35609204079301";
args.imsi = "208930000000001";
args.k = "8BAF473F2F8FD09487CCCBD7097C6862";

@ -93,7 +93,6 @@ file_max_size = -1
[usim]
algo = xor
op = 63BFA50EE6523365FF14C1F45F88737D
amf = 9001
k = 00112233445566778899aabbccddeeff
imsi = 001010123456789
imei = 353490069873319

Loading…
Cancel
Save