Merge branch 'next' into rlc_updates

master
Andre Puschmann 7 years ago
commit 05696a5ca7

@ -226,7 +226,7 @@ macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -std=c++03")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -Wmissing-field-initializers -Wtype-limits -std=c++03")
find_package(SSE)
if (HAVE_AVX2)
@ -243,7 +243,7 @@ endif(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clan
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR_INCOMPATIBLE)
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-write-strings -Winline -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -D_GNU_SOURCE")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")

@ -113,7 +113,7 @@ int main(int argc, char **argv) {
uint32_t m0, m1;
float m0_value, m1_value;
uint32_t N_id_2;
uint32_t sss_idx;
int sss_idx;
struct timeval tdata[3];
int *exec_time;

@ -93,6 +93,10 @@ public:
#endif
}
uint32_t nof_available_pdus() {
return available.size();
}
bool is_almost_empty() {
return available.size() < capacity/20;
}

@ -72,6 +72,8 @@
#define pool_allocate (pool->allocate())
#endif
#define ZERO_OBJECT(x) memset(&(x), 0x0, sizeof((x)))
#include "srslte/srslte.h"
/*******************************************************************************

@ -129,13 +129,13 @@ public:
virtual void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
// Same with hex dump
virtual void error_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void error_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("error_hex not implemented.\n");}
virtual void warning_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void warning_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("warning_hex not implemented.\n");}
virtual void info_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void info_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("info_hex not implemented.\n");}
virtual void debug_hex(const uint8_t *hex, int size, const char *, ...) __attribute__((format (printf, 4, 5)))
virtual void debug_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
{error("debug_hex not implemented.\n");}
protected:

@ -258,7 +258,7 @@ public:
private:
static const int MAX_CE_PAYLOAD_LEN = 8;
uint32_t lcid;
int nof_bytes;
uint32_t nof_bytes;
uint8_t* payload;
uint8_t w_payload_ce[8];
bool F_bit;

@ -103,8 +103,10 @@ void sch_pdu::parse_packet(uint8_t *ptr)
read_len += subheaders[i].size_plus_header();
}
if (pdu_len-read_len-1 >= 0) {
subheaders[nof_subheaders-1].set_payload_size(pdu_len-read_len-1);
int n_sub = pdu_len-read_len-1;
if (n_sub >= 0) {
subheaders[nof_subheaders-1].set_payload_size(n_sub);
} else {
fprintf(stderr,"Reading MAC PDU: negative payload for last subheader\n");
}
@ -584,18 +586,23 @@ int sch_subh::set_sdu(uint32_t lcid_, uint32_t requested_bytes, read_pdu_interfa
payload = ((sch_pdu*)parent)->get_current_sdu_ptr();
// Copy data and get final number of bytes written to the MAC PDU
uint32_t sdu_sz = sdu_itf->read_pdu(lcid, payload, requested_bytes);
int sdu_sz = sdu_itf->read_pdu(lcid, payload, requested_bytes);
if (sdu_sz < 0 || sdu_sz > requested_bytes) {
if (sdu_sz < 0) {
return -1;
}
if (sdu_sz == 0) {
return 0;
}
else {
// Save final number of written bytes
nof_bytes = sdu_sz;
if(nof_bytes > requested_bytes) {
return -1;
}
}
((sch_pdu*)parent)->add_sdu(nof_bytes);
((sch_pdu*)parent)->update_space_sdu(nof_bytes);
return nof_bytes;

@ -96,11 +96,6 @@ bool pdu_queue::process_pdus()
if (callback) {
callback->process_pdu(pdu->ptr, pdu->len, pdu->channel, pdu->tstamp);
}
if (pdu->channel == DCH) {
if (!pool.deallocate(pdu)) {
log_h->warning("Error deallocating from buffer pool in process_pdus(): buffer not created in this pool.\n");
}
}
cnt++;
have_data = true;
}

@ -301,7 +301,6 @@ int srslte_chest_ul_estimate(srslte_chest_ul_t *q, cf_t *input, cf_t *ce,
q->noise_estimate = 0;
}
}
// Estimate received pilot power
q->pilot_power = srslte_vec_avg_power_cf(q->pilot_recv_signal, nrefs_sf);
return 0;

@ -37,7 +37,9 @@ srslte_cell_t cell = {
6, // nof_prb
1, // nof_ports
1000, // cell_id
SRSLTE_CP_NORM // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_NORM,
SRSLTE_PHICH_R_1_6
};
char *output_matlab = NULL;

@ -37,7 +37,8 @@ srslte_cell_t cell = {
1, // nof_ports
0,
1000, // cell_id
SRSLTE_CP_NORM // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_NORM
};
char *output_matlab = NULL;
@ -116,6 +117,7 @@ int main(int argc, char **argv) {
perror("srslte_vec_malloc");
goto do_exit;
}
bzero(ce, num_re*sizeof(cf_t));
if (cell.id == 1000) {
cid = 0;

@ -36,7 +36,9 @@ srslte_cell_t cell = {
100, // nof_prb
SRSLTE_MAX_PORTS, // nof_ports
1, // cell_id
SRSLTE_CP_NORM // cyclic prefix
SRSLTE_CP_NORM, // cyclic prefix
SRSLTE_PHICH_NORM,
SRSLTE_PHICH_R_1_6
};
void usage(char *prog) {

@ -40,7 +40,7 @@ uint32_t long_cb = 0;
void usage(char *prog) {
printf("Usage: %s\n", prog);
printf("\t-l long_cb [Default check all]\n", long_cb);
printf("\t-l long_cb [Default %u]\n", long_cb);
}
void parse_args(int argc, char **argv) {

@ -244,6 +244,7 @@ int main(int argc, char **argv) {
for (j=0;j<coded_length;j++) {
llr_s[j] = (int16_t) (100*llr[j]);
}
/* decoder */
srslte_tdec_reset(&tdec, frame_length);
@ -260,10 +261,11 @@ int main(int argc, char **argv) {
for (int n=0;n<SRSLTE_TDEC_MAX_NPAR;n++) {
if (n < nof_cb) {
input[n] = llr_s;
output[n] = data_rx_bytes[n];
} else {
input[n] = NULL;
output[n] = NULL;
}
output[n] = data_rx_bytes[n];
}
gettimeofday(&tdata[1], NULL);
@ -299,11 +301,16 @@ int main(int argc, char **argv) {
}
}
for (int cb=0;cb<SRSLTE_TDEC_MAX_NPAR;cb++) {
if (data_rx_bytes[cb]) {
free(data_rx_bytes[cb]);
}
}
free(data_tx);
free(symbols);
free(llr);
free(llr_c);
free(llr_s);
free(data_rx);
srslte_tdec_free(&tdec);

@ -278,6 +278,7 @@ int main(int argc, char **argv) {
free(symbols);
free(llr);
free(llr_c);
free(llr_s);
free(data_rx);
free(data_rx2);

@ -513,9 +513,11 @@ void srslte_tdec_simd_decision_byte_cb(srslte_tdec_simd_t * h, uint8_t *output,
void srslte_tdec_simd_decision_byte(srslte_tdec_simd_t * h, uint8_t *output[SRSLTE_TDEC_MAX_NPAR], uint32_t long_cb)
{
for (int i=0;i<h->max_par_cb;i++) {
if (output[i]) {
srslte_tdec_simd_decision_byte_cb(h, output[i], i, long_cb);
}
}
}
/* Runs nof_iterations iterations and decides the output bits */

@ -333,5 +333,11 @@ int main(int argc, char **argv) {
}
}
for (i = 0; i < nof_tx_ports; i++) {
if (y[i]) {
free(y[i]);
}
}
exit(ret);
}

@ -208,7 +208,7 @@ int main(int argc, char **argv) {
/* Get channel estimates for each port */
srslte_chest_dl_estimate(&chest, fft_buffer, ce, 0);
INFO("Decoding PBCH\n", 0);
INFO("Decoding PBCH\n");
for (int i=0;i<SRSLTE_MAX_PORTS;i++) {
ce_slot1[i] = &ce[i][SRSLTE_SLOT_LEN_RE(cell.nof_prb, cell.cp)];
@ -232,6 +232,8 @@ int main(int argc, char **argv) {
} while(nread > 0 && frame_cnt < nof_frames);
base_free();
srslte_dft_exit();
if (frame_cnt == 1) {
if (n == 0) {
printf("Could not decode PBCH\n");

@ -144,6 +144,7 @@ int main(int argc, char **argv) {
srslte_vec_fprint_hex(stdout, bch_payload_tx, SRSLTE_BCH_PAYLOAD_LEN);
printf("Rx payload: ");
srslte_vec_fprint_hex(stdout, bch_payload_rx, SRSLTE_BCH_PAYLOAD_LEN);
srslte_dft_exit();
if (nof_rx_ports == cell.nof_ports && !memcmp(bch_payload_rx, bch_payload_tx, sizeof(uint8_t) * SRSLTE_BCH_PAYLOAD_LEN)) {
printf("OK\n");

@ -239,6 +239,7 @@ int main(int argc, char **argv) {
printf("cfi: %d, distance: %f\n", cfi, cfi_corr);
base_free();
srslte_dft_exit();
if (n < 0) {
fprintf(stderr, "Error decoding PCFICH\n");

@ -154,6 +154,7 @@ int main(int argc, char **argv) {
srslte_regs_free(&regs);
cid++;
}
srslte_dft_exit();
for (i=0;i<SRSLTE_MAX_PORTS;i++) {
free(ce[i]);

@ -288,5 +288,6 @@ int main(int argc, char **argv) {
} while (frame_cnt <= max_frames);
base_free();
srslte_dft_exit();
exit(ret);
}

@ -359,5 +359,6 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

@ -162,6 +162,7 @@ int main(int argc, char **argv) {
int nof_frames;
int ret;
bool acks[SRSLTE_MAX_TB];
bzero(acks, sizeof(bool)*SRSLTE_MAX_TB);
if (argc < 3) {
usage(argv[0]);
@ -199,6 +200,7 @@ int main(int argc, char **argv) {
} while (nof_frames <= max_frames && ret == 0);
base_free();
srslte_dft_exit();
if (data[0])
free(data[0]);
if (ret > 0) {

@ -546,5 +546,6 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

@ -278,6 +278,7 @@ int main(int argc, char **argv) {
}
base_free();
srslte_dft_exit();
if (n < 0) {
fprintf(stderr, "Error decoding phich\n");

@ -215,6 +215,7 @@ int main(int argc, char **argv) {
}
free(slot_symbols[i]);
}
srslte_dft_exit();
printf("OK\n");
exit(0);
}

@ -202,6 +202,7 @@ int main(int argc, char **argv) {
if (data != NULL) {
free(data);
}
srslte_dft_exit();
if (ret > 0) {
exit(0);
} else {

@ -430,6 +430,15 @@ int main(int argc, char **argv) {
ret = SRSLTE_SUCCESS;
quit:
for (i = 0; i < nof_rx_antennas; i++) {
srslte_ofdm_tx_free(&ifft_mbsfn[i]);
srslte_ofdm_rx_free(&fft_mbsfn[i]);
if (rx_sf_symbols[i]) {
free(rx_sf_symbols[i]);
}
}
srslte_pmch_free(&pmch_tx);
srslte_pmch_free(&pmch_rx);
for (i = 0; i < SRSLTE_MAX_CODEWORDS; i++) {
@ -453,6 +462,9 @@ quit:
}
for (i=0;i<SRSLTE_MAX_PORTS;i++) {
if (tx_sf_symbols[i]) {
free(tx_sf_symbols[i]);
}
for (j = 0; j < SRSLTE_MAX_PORTS; j++) {
if (ce[i][j]) {
free(ce[i][j]);

@ -123,6 +123,7 @@ int main(int argc, char **argv) {
srslte_prach_free(p);
free(p);
srslte_dft_exit();
printf("Done\n");
exit(0);

@ -138,7 +138,7 @@ int main(int argc, char **argv) {
srslte_prach_free(p);
free(p);
srslte_dft_exit();
printf("Done\n");
exit(0);
}

@ -235,6 +235,7 @@ int main(int argc, char **argv) {
srslte_rf_close(&rf);
srslte_prach_free(p);
free(p);
srslte_dft_exit();
printf("Done\n");
exit(0);

@ -244,5 +244,6 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

@ -295,6 +295,7 @@ quit:
srslte_pusch_free(&pusch_tx);
srslte_pusch_free(&pusch_rx);
srslte_softbuffer_tx_free(&softbuffer_tx);
srslte_softbuffer_rx_free(&softbuffer_rx);
if (sf_symbols) {
free(sf_symbols);
@ -310,5 +311,6 @@ quit:
} else {
printf("Ok\n");
}
srslte_dft_exit();
exit(ret);
}

@ -41,13 +41,13 @@ int rf_get_available_devices(char **devnames, int max_strlen) {
double srslte_rf_set_rx_gain_th(srslte_rf_t *rf, double gain)
{
if (gain > rf->new_rx_gain + 2 || gain < rf->new_rx_gain - 2) {
if (gain > rf->cur_rx_gain + 2 || gain < rf->cur_rx_gain - 2){
pthread_mutex_lock(&rf->mutex);
rf->new_rx_gain = gain;
pthread_cond_signal(&rf->cond);
pthread_mutex_unlock(&rf->mutex);
}
return gain;
return rf->cur_rx_gain;
}
void srslte_rf_set_tx_rx_gain_offset(srslte_rf_t *rf, double offset) {
@ -65,8 +65,9 @@ static void* thread_gain_fcn(void *h) {
pthread_cond_wait(&rf->cond, &rf->mutex);
}
if (rf->new_rx_gain != rf->cur_rx_gain) {
rf->cur_rx_gain = rf->new_rx_gain;
srslte_rf_set_rx_gain(h, rf->cur_rx_gain);
srslte_rf_set_rx_gain(h, rf->new_rx_gain);
rf->cur_rx_gain = srslte_rf_get_rx_gain(h);
rf->new_rx_gain = rf->cur_rx_gain;
}
if (rf->tx_gain_same_rx) {
printf("setting also tx\n");

@ -106,6 +106,7 @@ int main(int argc, char **argv) {
srslte_cfo_free(&cfocorr);
free(input);
free(output);
srslte_dft_exit();
printf("MSE: %f\n", mse);
if (mse > MAX_MSE) {

@ -185,6 +185,7 @@ int main(int argc, char **argv) {
srslte_sync_free(&syncobj);
srslte_ofdm_tx_free(&ifft);
srslte_dft_exit();
printf("Ok\n");
exit(0);

@ -51,13 +51,11 @@ bool radio::init(char *args, char *devname, uint32_t nof_channels)
// Suppress radio stdout
srslte_rf_suppress_stdout(&rf_device);
continuous_tx = false;
continuous_tx = true;
tx_adv_auto = true;
// Set default preamble length each known device
// We distinguish by device family, maybe we should calibrate per device
if (strstr(srslte_rf_name(&rf_device), "uhd")) {
burst_preamble_sec = uhd_default_burst_preamble_sec;
continuous_tx = true;
} else if (strstr(srslte_rf_name(&rf_device), "bladerf")) {
burst_preamble_sec = blade_default_burst_preamble_sec;
} else {

@ -19,6 +19,7 @@ bool radio_multi::init_multi(uint32_t nof_rx_antennas, char* args, char* devname
// Suppress radio stdout
srslte_rf_suppress_stdout(&rf_device);
continuous_tx = true;
tx_adv_auto = true;
// Set default preamble length each known device
// We distinguish by device family, maybe we should calibrate per device

@ -168,6 +168,12 @@ void pdcp_entity::write_pdu(byte_buffer_t *pdu)
log->info_hex(pdu->msg, pdu->N_bytes, "RX %s PDU, do_integrity = %s, do_encryption = %s",
rrc->get_rb_name(lcid).c_str(), (do_integrity) ? "true" : "false", (do_encryption) ? "true" : "false");
// Sanity check
if(pdu->N_bytes <= sn_len_bytes) {
pool->deallocate(pdu);
return;
}
// Handle DRB messages
if (cfg.is_data) {
uint32_t sn;

@ -49,26 +49,27 @@ void* write_thread(void *a) {
int main(int argc, char **argv) {
bool result;
msg_queue q;
msg_queue *q = new msg_queue;
byte_buffer_t *b;
pthread_t thread;
args_t args;
u_int32_t r;
result = true;
args.q = &q;
args.q = q;
pthread_create(&thread, NULL, &write_thread, &args);
for(uint32_t i=0;i<NMSGS;i++)
{
q.read(&b);
q->read(&b);
memcpy(&r, b->msg, 4);
delete b;
if(r != i)
result = false;
}
delete q;
pthread_join(thread, NULL);
if(result) {

@ -242,13 +242,17 @@ void phch_worker::set_config_dedicated(uint16_t rnti,
pthread_mutex_lock(&mutex);
if (ue_db.count(rnti)) {
/* PUSCH UCI and scheduling configuration */
srslte_uci_cfg_t uci_cfg = {0};
srslte_uci_cfg_t uci_cfg;
ZERO_OBJECT(uci_cfg);
if (dedicated->pusch_cnfg_ded_present && dedicated->sched_request_cnfg_present) {
uci_cfg.I_offset_ack = dedicated->pusch_cnfg_ded.beta_offset_ack_idx;
uci_cfg.I_offset_cqi = dedicated->pusch_cnfg_ded.beta_offset_cqi_idx;
uci_cfg.I_offset_ri = dedicated->pusch_cnfg_ded.beta_offset_ri_idx;
srslte_pucch_sched_t pucch_sched = {false};
srslte_pucch_sched_t pucch_sched;
ZERO_OBJECT(pucch_sched);
pucch_sched.N_pucch_1 = phy->pucch_cfg.n1_pucch_an;
pucch_sched.n_pucch_2 = dedicated->cqi_report_cnfg.report_periodic.pucch_resource_idx;
pucch_sched.n_pucch_sr = dedicated->sched_request_cnfg.sr_pucch_resource_idx;
@ -452,7 +456,9 @@ unlock:
int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
{
srslte_uci_data_t uci_data = {0};
srslte_uci_data_t uci_data;
ZERO_OBJECT(uci_data);
uint32_t wideband_cqi_value = 0, wideband_pmi = 0;
bool wideband_pmi_present = false;
@ -478,7 +484,9 @@ int phch_worker::decode_pusch(srslte_enb_ul_pusch_t *grants, uint32_t nof_pusch)
}
// Configure PUSCH CQI channel
srslte_cqi_value_t cqi_value = {0};
srslte_cqi_value_t cqi_value;
ZERO_OBJECT(cqi_value);
bool cqi_enabled = false;
if (ue_db[rnti].cqi_en && ue_db[rnti].ri_en && srslte_ri_send(ue_db[rnti].pmi_idx, ue_db[rnti].ri_idx, tti_rx) ) {
@ -688,7 +696,9 @@ int phch_worker::decode_pucch()
uci_data.uci_ack_len++;
}
}
srslte_cqi_value_t cqi_value = {0};
srslte_cqi_value_t cqi_value;
ZERO_OBJECT(cqi_value);
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *dedicated = &ue_db[rnti].dedicated;
LIBLTE_RRC_TRANSMISSION_MODE_ENUM tx_mode = dedicated->antenna_info_explicit_value.tx_mode;

@ -958,7 +958,7 @@ void rrc::ue::set_security_capabilities(LIBLTE_S1AP_UESECURITYCAPABILITIES_STRUC
void rrc::ue::set_security_key(uint8_t* key, uint32_t length)
{
memcpy(k_enb, key, length);
parent->rrc_log->info_hex(k_enb, 32, "Key eNodeB (k_enb)");
// Select algos (TODO: use security capabilities and config preferences)
cipher_algo = srslte::CIPHERING_ALGORITHM_ID_EEA0;
integ_algo = srslte::INTEGRITY_ALGORITHM_ID_128_EIA1;

@ -47,6 +47,19 @@ public:
bool handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRANSPORT_STRUCT *ul_xport, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx, LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT *erab_ctxt, struct srslte::gtpc_pdn_address_allocation_ie *paa, srslte::byte_buffer_t *nas_buffer);
private:
s1ap_nas_transport();
virtual ~s1ap_nas_transport();
srslte::log *m_s1ap_log;
srslte::byte_buffer_pool *m_pool;
s1ap* m_s1ap;
hss_interface_s1ap* m_hss;
mme_gtpc* m_mme_gtpc;
//Initial UE messages
bool handle_nas_attach_request( uint32_t enb_ue_s1ap_id,
srslte::byte_buffer_t *nas_msg,
@ -107,7 +120,6 @@ public:
bool pack_security_mode_command(srslte::byte_buffer_t *reply_msg, ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx);
bool pack_esm_information_request(srslte::byte_buffer_t *reply_msg, ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx);
bool pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *ue_ecm_ctx, LIBLTE_S1AP_E_RABTOBESETUPITEMCTXTSUREQ_STRUCT *erab_ctxt, struct srslte::gtpc_pdn_address_allocation_ie *paa, srslte::byte_buffer_t *nas_buffer);
bool pack_identity_request(srslte::byte_buffer_t *reply_msg, uint32_t enb_ue_s1ap_id, uint32_t mme_ue_s1ap_id);
bool pack_emm_information(ue_ctx_t* ue_ctx, srslte::byte_buffer_t *reply_msg);
@ -116,18 +128,6 @@ public:
void log_unhandled_attach_request_ies(const LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT *attach_req);
void log_unhandled_pdn_con_request_ies(const LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT *pdn_con_req);
void log_unhandled_initial_ue_message_ies(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue);
private:
s1ap_nas_transport();
virtual ~s1ap_nas_transport();
srslte::log *m_s1ap_log;
srslte::byte_buffer_pool *m_pool;
s1ap* m_s1ap;
hss_interface_s1ap* m_hss;
mme_gtpc* m_mme_gtpc;
};
} //namespace srsepc
#endif // SRSEPC_S1AP_NAS_TRANSPORT_H

@ -159,7 +159,7 @@ s1ap_ctx_mngmt_proc::send_initial_context_setup_request(ue_emm_ctx_t *emm_ctx,
}
//Get K eNB
liblte_unpack(emm_ctx->security_ctxt.k_enb, 32, in_ctxt_req->SecurityKey.buffer);
m_s1ap_log->info_hex(emm_ctx->security_ctxt.k_enb, 32, "Initial Context Setup Request -- Key eNB\n");
m_s1ap_log->info_hex(emm_ctx->security_ctxt.k_enb, 32, "Initial Context Setup Request -- Key eNB (k_enb)\n");
srslte::byte_buffer_t *nas_buffer = m_pool->allocate();
if(emm_ctx->state == EMM_STATE_DEREGISTERED)

@ -241,6 +241,18 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA
m_s1ap_log->console("Uplink NAS: Received Authentication Response\n");
handle_nas_authentication_response(nas_msg, ue_ctx, reply_buffer, reply_flag);
break;
// Authentication failure with the option sync failure can be sent not integrity protected
case LIBLTE_MME_MSG_TYPE_AUTHENTICATION_FAILURE:
m_s1ap_log->info("Plain UL NAS: Authentication Failure\n");
m_s1ap_log->console("Plain UL NAS: Authentication Failure\n");
handle_authentication_failure(nas_msg, ue_ctx, reply_buffer, reply_flag);
break;
// Detach request can be sent not integrity protected when "power off" option is used
case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST:
m_s1ap_log->info("Plain Protected UL NAS: Detach Request\n");
m_s1ap_log->console("Plain Protected UL NAS: Detach Request\n");
handle_nas_detach_request(nas_msg, ue_ctx, reply_buffer, reply_flag);
break;
default:
m_s1ap_log->warning("Unhandled Plain NAS message 0x%x\n", msg_type );
m_s1ap_log->console("Unhandled Plain NAS message 0x%x\n", msg_type );
@ -662,9 +674,10 @@ s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id,
m_s1ap->add_ue_ctx_to_mme_ue_s1ap_id_map(ue_ctx);
//Re-generate K_eNB
liblte_security_generate_k_enb(emm_ctx->security_ctxt.k_asme, emm_ctx->security_ctxt.ul_nas_count, emm_ctx->security_ctxt.k_enb);
srslte::security_generate_k_enb(emm_ctx->security_ctxt.k_asme, emm_ctx->security_ctxt.ul_nas_count, emm_ctx->security_ctxt.k_enb);
m_s1ap_log->info("Generating KeNB with UL NAS COUNT: %d\n",emm_ctx->security_ctxt.ul_nas_count);
m_s1ap_log->console("Generating KeNB with UL NAS COUNT: %d\n",emm_ctx->security_ctxt.ul_nas_count);
m_s1ap_log->info_hex(emm_ctx->security_ctxt.k_enb, 32, "Key eNodeB (k_enb)\n");
m_s1ap_log->console("Attach request -- IMSI: %015lu\n", ecm_ctx->imsi);
m_s1ap_log->info("Attach request -- IMSI: %015lu\n", ecm_ctx->imsi);
@ -861,8 +874,10 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi,
m_s1ap_log->console("UE previously assigned IP: %s",inet_ntoa(emm_ctx->ue_ip));
//Re-generate K_eNB
liblte_security_generate_k_enb(emm_ctx->security_ctxt.k_asme, emm_ctx->security_ctxt.ul_nas_count, emm_ctx->security_ctxt.k_enb);
srslte::security_generate_k_enb(emm_ctx->security_ctxt.k_asme, emm_ctx->security_ctxt.ul_nas_count, emm_ctx->security_ctxt.k_enb);
m_s1ap_log->info("Generating KeNB with UL NAS COUNT: %d\n",emm_ctx->security_ctxt.ul_nas_count);
m_s1ap_log->console("Generating KeNB with UL NAS COUNT: %d\n",emm_ctx->security_ctxt.ul_nas_count);
m_s1ap_log->info_hex(emm_ctx->security_ctxt.k_enb, 32, "Key eNodeB (k_enb)\n");
m_s1ap_log->console("UE Ctr TEID %d\n", emm_ctx->sgw_ctrl_fteid.teid);
//Save UE ctx to MME UE S1AP id
@ -924,8 +939,8 @@ bool
s1ap_nas_transport::handle_nas_detach_request(srslte::byte_buffer_t *nas_msg, ue_ctx_t* ue_ctx, srslte::byte_buffer_t *reply_msg, bool *reply_flag)
{
m_s1ap_log->console("Detach request -- IMSI %015lu", ue_ctx->emm_ctx.imsi);
m_s1ap_log->info("Detach request -- IMSI %015lu", ue_ctx->emm_ctx.imsi);
m_s1ap_log->console("Detach request -- IMSI %015lu\n", ue_ctx->emm_ctx.imsi);
m_s1ap_log->info("Detach request -- IMSI %015lu\n", ue_ctx->emm_ctx.imsi);
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req;
LIBLTE_ERROR_ENUM err = liblte_mme_unpack_detach_request_msg((LIBLTE_BYTE_MSG_STRUCT*) nas_msg, &detach_req);
@ -1017,6 +1032,7 @@ s1ap_nas_transport::handle_nas_authentication_response(srslte::byte_buffer_t *na
m_s1ap_log->console("UE Authentication Accepted.\n");
m_s1ap_log->info("UE Authentication Accepted.\n");
//Send Security Mode Command
emm_ctx->security_ctxt.ul_nas_count = 0; // Reset the NAS uplink counter for the right key k_enb derivation
pack_security_mode_command(reply_buffer, emm_ctx, ecm_ctx);
*reply_flag = true;
m_s1ap_log->console("Downlink NAS: Sending NAS Security Mode Command.\n");
@ -1106,10 +1122,10 @@ s1ap_nas_transport::handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, u
//Attach requested from attach request
m_mme_gtpc->send_modify_bearer_request(emm_ctx->imsi, &ecm_ctx->erabs_ctx[act_bearer.eps_bearer_id]);
//Send reply to eNB
m_s1ap_log->console("Packing EMM infromationi\n");
m_s1ap_log->console("Packing EMM Information\n");
*reply_flag = pack_emm_information(ue_ctx, reply_msg);
m_s1ap_log->console("Sending EMM infromation, bytes %d\n",reply_msg->N_bytes);
m_s1ap_log->info("Sending EMM infromation\n");
m_s1ap_log->console("Sending EMM Information, bytes %d\n",reply_msg->N_bytes);
m_s1ap_log->info("Sending EMM Information\n");
}
emm_ctx->state = EMM_STATE_REGISTERED;
return true;
@ -1166,8 +1182,8 @@ s1ap_nas_transport::handle_identity_response(srslte::byte_buffer_t *nas_msg, ue_
ue_emm_ctx_t *emm_ctx = &ue_ctx->emm_ctx;
ue_ecm_ctx_t *ecm_ctx = &ue_ctx->ecm_ctx;
m_s1ap_log->info("Id Response -- IMSI: %015lu\n", imsi);
m_s1ap_log->console("Id Response -- IMSI: %015lu\n", imsi);
m_s1ap_log->info("ID response -- IMSI: %015lu\n", imsi);
m_s1ap_log->console("ID Response -- IMSI: %015lu\n", imsi);
//Set UE's context IMSI
emm_ctx->imsi=imsi;
@ -1605,15 +1621,15 @@ s1ap_nas_transport::pack_security_mode_command(srslte::byte_buffer_t *reply_msg,
ue_emm_ctx->security_ctxt.k_nas_enc,
ue_emm_ctx->security_ctxt.k_nas_int
);
srslte::security_generate_k_nas( ue_emm_ctx->security_ctxt.k_asme,
srslte::CIPHERING_ALGORITHM_ID_EEA0,
srslte::INTEGRITY_ALGORITHM_ID_128_EIA1,
ue_emm_ctx->security_ctxt.k_nas_enc,
ue_emm_ctx->security_ctxt.k_nas_int
);
m_s1ap_log->info_hex(ue_emm_ctx->security_ctxt.k_nas_enc, 32, "Key NAS Encryption (k_nas_enc)\n");
m_s1ap_log->info_hex(ue_emm_ctx->security_ctxt.k_nas_int, 32, "Key NAS Integrity (k_nas_int)\n");
uint8_t key_enb[32];
liblte_security_generate_k_enb(ue_emm_ctx->security_ctxt.k_asme, ue_emm_ctx->security_ctxt.ul_nas_count, ue_emm_ctx->security_ctxt.k_enb);
srslte::security_generate_k_enb(ue_emm_ctx->security_ctxt.k_asme, ue_emm_ctx->security_ctxt.ul_nas_count, ue_emm_ctx->security_ctxt.k_enb);
m_s1ap_log->info("Generating KeNB with UL NAS COUNT: %d\n", ue_emm_ctx->security_ctxt.ul_nas_count);
m_s1ap_log->console("Generating KeNB with UL NAS COUNT: %d\n", ue_emm_ctx->security_ctxt.ul_nas_count);
m_s1ap_log->info_hex(ue_emm_ctx->security_ctxt.k_enb, 32, "Key eNodeB (k_enb)\n");
//Generate MAC for integrity protection
//FIXME Write wrapper to support EIA1, EIA2, etc.
srslte::security_128_eia1 (&ue_emm_ctx->security_ctxt.k_nas_int[16],

@ -224,10 +224,13 @@ private:
}
}
void reset(void) {
void reset(bool lock = true) {
if (lock) {
pthread_mutex_lock(&mutex);
}
is_first_tb = true;
ack = false;
n_retx = 0;
if (payload_buffer_ptr) {
if (pid != HARQ_BCCH_PID) {
harq_entity->demux_unit->deallocate(payload_buffer_ptr);
@ -238,8 +241,10 @@ private:
if (is_initiated) {
srslte_softbuffer_rx_reset(&softbuffer);
}
if (lock) {
pthread_mutex_unlock(&mutex);
}
}
void new_grant_dl(Tgrant grant, Taction *action) {
@ -263,9 +268,7 @@ private:
Warning("DL PID %d: Size of grant changed during a retransmission %d!=%d\n", pid,
cur_grant.n_bytes[tid], grant.n_bytes[tid]);
}
ack = false;
srslte_softbuffer_rx_reset_tbs(&softbuffer, cur_grant.n_bytes[tid] * 8);
n_retx = 0;
reset(false);
}
// If data has not yet been successfully decoded
@ -305,9 +308,7 @@ private:
Warning("DL PID %d: Received duplicate TB. Discarting and retransmitting ACK (grant_tti=%d, ndi=%d, sz=%d, reset=%s)\n",
pid, cur_grant.tti, cur_grant.ndi[tid], cur_grant.n_bytes[tid], interval>RESET_DUPLICATE_TIMEOUT?"yes":"no");
if (interval > RESET_DUPLICATE_TIMEOUT) {
pthread_mutex_unlock(&mutex);
reset();
pthread_mutex_lock(&mutex);
reset(false);
}
}

@ -148,6 +148,8 @@ void demux::process_pdu(uint8_t *mac_pdu, uint32_t nof_bytes, srslte::pdu_queue:
process_sch_pdu(&mac_msg);
//srslte_vec_fprint_byte(stdout, mac_pdu, nof_bytes);
pdus.deallocate(mac_pdu);
break;
case srslte::pdu_queue::BCH:
rlc->write_pdu_bcch_dlsch(mac_pdu, nof_bytes);

@ -283,8 +283,8 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
"Selects the SSS estimation algorithm.")
("expert.pdsch_csi_enabled",
bpo::value<bool>(&args->expert.phy.pdsch_csi_enabled)->default_value(false),
"Stores the Channel State Information and uses it for weightening the softbits. It is only compatible with TM1.")
bpo::value<bool>(&args->expert.phy.pdsch_csi_enabled)->default_value(true),
"Stores the Channel State Information and uses it for weightening the softbits. It is only used in TM1.")
("rf_calibration.tx_corr_dc_gain", bpo::value<float>(&args->rf_cal.tx_corr_dc_gain)->default_value(0.0),
"TX DC offset gain correction")

@ -540,6 +540,7 @@ void phch_recv::run_thread()
if (phy_state.is_camping()) {
log_h->warning("Detected radio overflow while camping. Resynchronizing cell\n");
sfn_p.reset();
srslte_ue_sync_reset(&ue_sync);
phy_state.force_sfn_sync();
radio_overflow_return = true;
} else {
@ -628,9 +629,7 @@ void phch_recv::set_agc_enable(bool enable)
void phch_recv::set_time_adv_sec(float time_adv_sec)
{
// If transmitting earlier, transmit less samples to align time advance. If transmit later just delay next TX
if (time_adv_sec > this->time_adv_sec) {
next_offset = floor((this->time_adv_sec-time_adv_sec)*srslte_sampling_freq_hz(cell.nof_prb)+1);
}
next_offset = floor((this->time_adv_sec-time_adv_sec)*srslte_sampling_freq_hz(cell.nof_prb));
this->next_time_adv_sec = time_adv_sec;
Info("Applying time_adv_sec=%.1f us, next_offset=%d\n", time_adv_sec*1e6, next_offset);
}
@ -1047,29 +1046,33 @@ phch_recv::sfn_sync::ret_code phch_recv::sfn_sync::run_subframe(srslte_cell_t *c
}
int sfn_offset = 0;
Info("SYNC: Trying to decode MIB... SNR=%.1f dB\n", 10*log10(srslte_chest_dl_get_snr(&ue_mib.chest)));
int n = srslte_ue_mib_decode(&ue_mib, bch_payload, NULL, &sfn_offset);
if (n < 0) {
switch(n) {
default:
Error("SYNC: Error decoding MIB while synchronising SFN");
return ERROR;
} else if (n == SRSLTE_UE_MIB_FOUND) {
case SRSLTE_UE_MIB_FOUND:
uint32_t sfn;
srslte_pbch_mib_unpack(bch_payload, cell, &sfn);
sfn = (sfn+sfn_offset)%1024;
if (tti_cnt) {
*tti_cnt = 10*sfn;
Info("SYNC: DONE, TTI=%d, sfn_offset=%d\n", *tti_cnt, sfn_offset);
Info("SYNC: DONE, SNR=%.1f dB, TTI=%d, sfn_offset=%d\n",
10*log10(srslte_chest_dl_get_snr(&ue_mib.chest)), *tti_cnt, sfn_offset);
}
srslte_ue_sync_decode_sss_on_track(ue_sync, true);
reset();
return SFN_FOUND;
case SRSLTE_UE_MIB_NOTFOUND:
Info("SYNC: Found PSS but could not decode MIB. SNR=%.1f dB (%d/%d)\n",
10*log10(srslte_chest_dl_get_snr(&ue_mib.chest)), cnt, timeout);
break;
}
}
} else {
Info("SYNC: PSS/SSS not found...\n");
Info("SYNC: Waiting for PSS while trying to decode MIB (%d/%d)\n", cnt, timeout);
}
cnt++;
@ -1174,27 +1177,27 @@ phch_recv::measure::ret_code phch_recv::measure::run_multiple_subframes(cf_t *in
ret_code ret = IDLE;
offset = offset-sf_len/2;
while (offset < 0 && sf_idx < max_sf) {
Info("INTRA: offset=%d, sf_idx=%d\n", offset, sf_idx);
offset += sf_len;
int sf_start = offset-sf_len/2;
while (sf_start < 0 && sf_idx < max_sf) {
Info("INTRA: sf_start=%d, sf_idx=%d\n", sf_start, sf_idx);
sf_start += sf_len;
sf_idx ++;
}
#ifdef FINE_TUNE_OFFSET_WITH_RS
float max_rsrp = -200;
int best_test_offset = 0;
int test_offset = 0;
int best_test_sf_start = 0;
int test_sf_start = 0;
bool found_best = false;
// Fine-tune offset using RS
// Fine-tune sf_start using RS
for (uint32_t n=0;n<5;n++) {
test_offset = offset-2+n;
if (test_offset >= 0) {
test_sf_start = sf_start-2+n;
if (test_sf_start >= 0) {
cf_t *buf_m[SRSLTE_MAX_PORTS];
buf_m[0] = &input_buffer[test_offset];
buf_m[0] = &input_buffer[test_sf_start];
uint32_t cfi;
if (srslte_ue_dl_decode_fft_estimate_noguru(&ue_dl, buf_m, sf_idx, &cfi)) {
@ -1205,25 +1208,25 @@ phch_recv::measure::ret_code phch_recv::measure::run_multiple_subframes(cf_t *in
float rsrp = srslte_chest_dl_get_rsrp(&ue_dl.chest);
if (rsrp > max_rsrp) {
max_rsrp = rsrp;
best_test_offset = test_offset;
best_test_sf_start = test_sf_start;
found_best = true;
}
}
}
Debug("INTRA: fine-tuning offset: %d, found_best=%d, rem_sf=%d\n", offset, found_best, nof_sf);
Debug("INTRA: fine-tuning sf_start: %d, found_best=%d, rem_sf=%d\n", sf_start, found_best, nof_sf);
offset = found_best?best_test_offset:offset;
sf_start = found_best?best_test_sf_start:sf_start;
#endif
if (offset >= 0 && offset < (sf_len*max_sf)) {
if (sf_start >= 0 && sf_start < (int) (sf_len*max_sf)) {
uint32_t nof_sf = (sf_len*max_sf - offset)/sf_len;
uint32_t nof_sf = (sf_len*max_sf - sf_start)/sf_len;
final_offset = offset;
final_offset = sf_start;
for (uint32_t i=0;i<nof_sf;i++) {
memcpy(buffer[0], &input_buffer[offset+i*sf_len], sizeof(cf_t)*sf_len);
memcpy(buffer[0], &input_buffer[sf_start+i*sf_len], sizeof(cf_t)*sf_len);
ret = run_subframe((sf_idx+i)%10);
if (ret != IDLE) {
return ret;
@ -1233,7 +1236,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_multiple_subframes(cf_t *in
return MEASURE_OK;
}
} else {
Error("INTRA: not running because offset=%d, sf_len*max_sf=%d*%d\n", offset, sf_len, max_sf);
Error("INTRA: not running because sf_start=%d, offset=%d, sf_len*max_sf=%d*%d\n", sf_start, offset, sf_len, max_sf);
ret = ERROR;
}
return ret;

@ -579,8 +579,8 @@ bool phch_worker::decode_pdcch_dl(srsue::mac_interface_phy::mac_grant_t* grant)
if (log_h->get_level() >= srslte::LOG_LEVEL_INFO) {
srslte_vec_sprint_hex(hexstr, sizeof(hexstr), dci_msg.data, dci_msg.nof_bits);
}
Info("PDCCH: DL DCI %s cce_index=%2d, L=%d, n_data_bits=%d, hex=%s\n", srslte_dci_format_string(dci_msg.format),
last_dl_pdcch_ncce, (1<<ue_dl.last_location.L), dci_msg.nof_bits, hexstr);
Info("PDCCH: DL DCI %s cce_index=%2d, L=%d, n_data_bits=%d, tpc_pucch=%d, hex=%s\n", srslte_dci_format_string(dci_msg.format),
last_dl_pdcch_ncce, (1<<ue_dl.last_location.L), dci_msg.nof_bits, dci_unpacked.tpc_pucch, hexstr);
return true;
} else {
@ -818,8 +818,8 @@ bool phch_worker::decode_pdcch_ul(mac_interface_phy::mac_grant_t* grant)
srslte_vec_sprint_hex(hexstr, sizeof(hexstr), dci_msg.data, dci_msg.nof_bits);
}
// Change to last_location_ul
Info("PDCCH: UL DCI Format0 cce_index=%d, L=%d, n_data_bits=%d, hex=%s\n",
ue_dl.last_location_ul.ncce, (1<<ue_dl.last_location_ul.L), dci_msg.nof_bits, hexstr);
Info("PDCCH: UL DCI Format0 cce_index=%d, L=%d, n_data_bits=%d, tpc_pusch=%d, hex=%s\n",
ue_dl.last_location_ul.ncce, (1<<ue_dl.last_location_ul.L), dci_msg.nof_bits, dci_unpacked.tpc_pusch, hexstr);
if (grant->phy_grant.ul.mcs.tbs==0) {
Info("Received PUSCH grant with empty data\n");
@ -924,7 +924,9 @@ void phch_worker::set_uci_periodic_cqi()
compute_ri(NULL, NULL, NULL);
phy->last_pmi = (uint8_t) ue_dl.pmi[phy->last_ri % SRSLTE_MAX_LAYERS];
srslte_cqi_value_t cqi_report = {0};
srslte_cqi_value_t cqi_report;
ZERO_OBJECT(cqi_report);
if (period_cqi.format_is_subband) {
// TODO: Implement subband periodic reports
cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND;
@ -975,7 +977,9 @@ void phch_worker::set_uci_aperiodic_cqi()
reported RI. For other transmission modes they are reported conditioned on rank 1.
*/
if (rnti_is_set) {
srslte_cqi_value_t cqi_report = {0};
srslte_cqi_value_t cqi_report;
ZERO_OBJECT(cqi_report);
cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND_HL;
cqi_report.subband_hl.wideband_cqi_cw0 = srslte_cqi_from_snr(phy->avg_snr_db_cqi);
@ -1020,7 +1024,9 @@ void phch_worker::set_uci_aperiodic_cqi()
*/
if (rnti_is_set) {
/* Fill CQI Report */
srslte_cqi_value_t cqi_report = {0};
srslte_cqi_value_t cqi_report;
ZERO_OBJECT(cqi_report);
cqi_report.type = SRSLTE_CQI_TYPE_SUBBAND_HL;
cqi_report.subband_hl.wideband_cqi_cw0 = srslte_cqi_from_snr(sinr_db);

@ -161,6 +161,7 @@ bool ue::init(all_args_t *args_)
radio.set_burst_preamble(atof(args->rf.burst_preamble.c_str()));
}
if (args->rf.continuous_tx.compare("auto")) {
printf("set continuous %s\n", args->rf.continuous_tx.c_str());
radio.set_continuous_tx(args->rf.continuous_tx.compare("yes")?false:true);
}

@ -549,10 +549,14 @@ void nas::parse_attach_accept(uint32_t lcid, byte_buffer_t *pdu) {
return;
}
LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT attach_accept = {0};
LIBLTE_MME_ATTACH_COMPLETE_MSG_STRUCT attach_complete = {0};
LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT act_def_eps_bearer_context_req = {0};
LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT act_def_eps_bearer_context_accept = {0};
LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT attach_accept;
ZERO_OBJECT(attach_accept);
LIBLTE_MME_ATTACH_COMPLETE_MSG_STRUCT attach_complete;
ZERO_OBJECT(attach_complete);
LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT act_def_eps_bearer_context_req;
ZERO_OBJECT(act_def_eps_bearer_context_req);
LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MSG_STRUCT act_def_eps_bearer_context_accept;
ZERO_OBJECT(act_def_eps_bearer_context_accept);
nas_log->info("Received Attach Accept\n");
@ -677,7 +681,8 @@ void nas::parse_attach_accept(uint32_t lcid, byte_buffer_t *pdu) {
}
void nas::parse_attach_reject(uint32_t lcid, byte_buffer_t *pdu) {
LIBLTE_MME_ATTACH_REJECT_MSG_STRUCT attach_rej = {0};
LIBLTE_MME_ATTACH_REJECT_MSG_STRUCT attach_rej;
ZERO_OBJECT(attach_rej);
liblte_mme_unpack_attach_reject_msg((LIBLTE_BYTE_MSG_STRUCT *) pdu, &attach_rej);
nas_log->warning("Received Attach Reject. Cause= %02X\n", attach_rej.emm_cause);
@ -746,8 +751,10 @@ void nas::parse_authentication_reject(uint32_t lcid, byte_buffer_t *pdu) {
}
void nas::parse_identity_request(uint32_t lcid, byte_buffer_t *pdu) {
LIBLTE_MME_ID_REQUEST_MSG_STRUCT id_req = {0};
LIBLTE_MME_ID_RESPONSE_MSG_STRUCT id_resp = {0};
LIBLTE_MME_ID_REQUEST_MSG_STRUCT id_req;
ZERO_OBJECT(id_req);
LIBLTE_MME_ID_RESPONSE_MSG_STRUCT id_resp;
ZERO_OBJECT(id_resp);
liblte_mme_unpack_identity_request_msg((LIBLTE_BYTE_MSG_STRUCT *) pdu, &id_req);
nas_log->info("Received Identity Request. ID type: %d\n", id_req.id_type);
@ -1037,7 +1044,8 @@ void nas::gen_service_request(byte_buffer_t *msg) {
}
void nas::gen_pdn_connectivity_request(LIBLTE_BYTE_MSG_STRUCT *msg) {
LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT pdn_con_req = {0};
LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT pdn_con_req;
ZERO_OBJECT(pdn_con_req);
nas_log->info("Generating PDN Connectivity Request\n");

@ -1582,7 +1582,9 @@ void rrc::write_pdu_bcch_dlsch(byte_buffer_t *pdu) {
rrc_log->info_hex(pdu->msg, pdu->N_bytes, "BCCH DLSCH message received.");
rrc_log->info("BCCH DLSCH message Stack latency: %ld us\n", pdu->get_latency_us());
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg = {0};
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT dlsch_msg;
ZERO_OBJECT(dlsch_msg);
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
bit_buf.N_bits = pdu->N_bytes * 8;
pool->deallocate(pdu);
@ -1697,7 +1699,8 @@ void rrc::process_pcch(byte_buffer_t *pdu) {
rrc_log->info("PCCH message Stack latency: %ld us\n", pdu->get_latency_us());
rrc_log->console("PCCH message received %d bytes\n", pdu->N_bytes);
LIBLTE_RRC_PCCH_MSG_STRUCT pcch_msg = {0};
LIBLTE_RRC_PCCH_MSG_STRUCT pcch_msg;
ZERO_OBJECT(pcch_msg);
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
bit_buf.N_bits = pdu->N_bytes * 8;
pool->deallocate(pdu);

@ -51,8 +51,11 @@ void nas_test() {
uint8 msg_type;
LIBLTE_BYTE_MSG_STRUCT buf;
LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT attach_accept;
bzero(&attach_accept, sizeof(LIBLTE_MME_ATTACH_ACCEPT_MSG_STRUCT));
LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT act_def_eps_bearer_context_req;
bzero(&act_def_eps_bearer_context_req, sizeof(LIBLTE_MME_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT));
bzero(&buf, sizeof(LIBLTE_BYTE_MSG_STRUCT));
memcpy(buf.msg, nas_message, nas_message_len);
buf.N_bytes = nas_message_len;
liblte_mme_parse_msg_header(&buf, &pd, &msg_type);

@ -28,7 +28,7 @@
dl_earfcn = 3400
freq_offset = 0
tx_gain = 80
rx_gain = 40
#rx_gain = 40
#nof_rx_ant = 1
#device_name = auto
@ -190,7 +190,7 @@ enable = false
# RS adjustments are allowed.
#
# pdsch_csi_enabled: Stores the Channel State Information and uses it for weightening the softbits. It is only
# compatible with TM1. It is False by default.
# used in TM1. It is True by default.
#
#####################################################################
[expert]
@ -217,7 +217,7 @@ enable = false
#pregenerate_signals = false
#metrics_csv_enable = false
#metrics_csv_filename = /tmp/ue_metrics.csv
#pdsch_csi_enabled = true # Caution! Only TM1 supported!
#pdsch_csi_enabled = true
# CFO related values
#cfo_is_doppler = false

Loading…
Cancel
Save