C-RNTI precomputation executed in a detachable MAC thread. C-RNTI is set in ue_ul/ue_dl after computing scrambling sequences

master
ismagom 10 years ago
parent 25ebb0ac80
commit 5143af5e00

@ -155,6 +155,7 @@ private:
bool tr_enabled;
void tr_log_start(uint32_t tti);
void tr_log_end(uint32_t tti);
void set_phy_crnti(uint16_t phy_rnti);
};

@ -250,20 +250,43 @@ void mac::main_radio_loop() {
}
if (ra_procedure.is_successful() && phy_rnti != params_db.get_param(mac_params::RNTI_C) && params_db.get_param(mac_params::RNTI_C) > 0) {
phy_rnti = params_db.get_param(mac_params::RNTI_C);
// This operation takes a while, do nothing for the rest 100 slots to re-align with PHY
for (int i=0;i<10;i++) {
tti = ttisync->wait();
}
Info("Setting PHY RNTI=%d\n", phy_rnti);
phy_h->set_crnti(phy_rnti);
for (int i=0;i<100;i++) {
tti = ttisync->wait();
}
set_phy_crnti(phy_rnti);
}
}
}
}
struct phy_crnti {
phy *phy_ptr;
log *log_h;
uint16_t crnti;
};
void *set_phy_crnti_thread(void *arg) {
struct phy_crnti *a = (struct phy_crnti*) arg;
a->log_h->info("Setting PHY RNTI=%d\n", a->crnti);
a->phy_ptr->set_crnti(a->crnti);
a->log_h->info("Done Setting PHY RNTI\n");
free(a);
return NULL;
}
void mac::set_phy_crnti(uint16_t phy_rnti)
{
pthread_t rnti_thread;
struct phy_crnti *arg = (struct phy_crnti*) malloc(sizeof(struct phy_crnti));
arg->crnti = phy_rnti;
arg->phy_ptr = phy_h;
arg->log_h = log_h;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (pthread_create(&rnti_thread, &attr, set_phy_crnti_thread, arg)) {
perror("pthread_create");
}
}
void mac::add_sdu_handler(sdu_handler *handler) {
demux_unit.add_sdu_handler(handler);
}

@ -143,8 +143,8 @@ void srslte_ue_dl_free(srslte_ue_dl_t *q) {
* For the connection procedure, use srslte_pusch_encode_rnti() or srslte_pusch_decode_rnti() functions
*/
void srslte_ue_dl_set_rnti(srslte_ue_dl_t *q, uint16_t rnti) {
q->current_rnti = rnti;
srslte_pdsch_set_rnti(&q->pdsch, rnti);
q->current_rnti = rnti;
}
void srslte_ue_dl_reset(srslte_ue_dl_t *q) {

@ -145,9 +145,9 @@ void srslte_ue_ul_set_normalization(srslte_ue_ul_t *q, bool enabled)
* For the connection procedure, use srslte_pusch_encode_rnti() or srslte_pusch_decode_rnti() functions
*/
void srslte_ue_ul_set_rnti(srslte_ue_ul_t *q, uint16_t rnti) {
q->current_rnti = rnti;
srslte_pusch_set_rnti(&q->pusch, rnti);
srslte_pucch_set_crnti(&q->pucch, rnti);
q->current_rnti = rnti;
}
void srslte_ue_ul_reset(srslte_ue_ul_t *q) {

Loading…
Cancel
Save