Improved stability when UE reattaches

master
Ismael Gomez 7 years ago
parent ea0f6f2e2a
commit f0d9b333b2

@ -61,6 +61,7 @@ typedef struct SRSLTE_API {
uint32_t max_re;
uint16_t ue_rnti;
bool is_ue;
/* buffers */

@ -71,6 +71,7 @@ typedef struct SRSLTE_API {
srslte_cell_t cell;
bool is_ue;
uint16_t ue_rnti;
uint32_t max_re;
srslte_dft_precoding_t dft_precoding;

@ -74,6 +74,8 @@ private:
bool if_up;
uint32_t lcid;
uint32_t current_ip_addr;
long ul_tput_bytes;
long dl_tput_bytes;
struct timeval metrics_time[3];

@ -381,6 +381,7 @@ int srslte_pdsch_set_rnti(srslte_pdsch_t *q, uint16_t rnti) {
}
}
}
q->ue_rnti = rnti;
q->users[rnti_idx]->cell_id = q->cell.id;
q->users[rnti_idx]->sequence_generated = true;
} else {
@ -400,6 +401,7 @@ void srslte_pdsch_free_rnti(srslte_pdsch_t* q, uint16_t rnti)
}
free(q->users[rnti_idx]);
q->users[rnti_idx] = NULL;
q->ue_rnti = 0;
}
}
@ -527,7 +529,8 @@ static srslte_sequence_t *get_user_sequence(srslte_pdsch_t *q, uint16_t rnti,
// The scrambling sequence is pregenerated for all RNTIs in the eNodeB but only for C-RNTI in the UE
if (q->users[rnti_idx] && q->users[rnti_idx]->sequence_generated &&
q->users[rnti_idx]->cell_id == q->cell.id &&
q->users[rnti_idx]->cell_id == q->cell.id &&
q->ue_rnti == rnti &&
((rnti >= SRSLTE_CRNTI_START && rnti < SRSLTE_CRNTI_END) || !q->is_ue))
{
return &q->users[rnti_idx]->seq[codeword_idx][sf_idx];

@ -453,6 +453,7 @@ int srslte_pusch_set_rnti(srslte_pusch_t *q, uint16_t rnti) {
return SRSLTE_ERROR;
}
}
q->ue_rnti = rnti;
q->users[rnti_idx]->cell_id = q->cell.id;
q->users[rnti_idx]->sequence_generated = true;
} else {
@ -471,17 +472,18 @@ void srslte_pusch_free_rnti(srslte_pusch_t *q, uint16_t rnti) {
}
free(q->users[rnti_idx]);
q->users[rnti_idx] = NULL;
q->ue_rnti = 0;
}
}
static srslte_sequence_t *get_user_sequence(srslte_pusch_t *q, uint16_t rnti, uint32_t sf_idx, uint32_t len)
{
uint32_t rnti_idx = q->is_ue?0:rnti;
// The scrambling sequence is pregenerated for all RNTIs in the eNodeB but only for C-RNTI in the UE
if (q->users[rnti_idx] && q->users[rnti_idx]->sequence_generated &&
q->users[rnti_idx]->cell_id == q->cell.id &&
q->users[rnti_idx]->cell_id == q->cell.id &&
q->ue_rnti == rnti &&
((rnti >= SRSLTE_CRNTI_START && rnti < SRSLTE_CRNTI_END) || !q->is_ue))
{
return &q->users[rnti_idx]->seq[sf_idx];

@ -42,7 +42,9 @@ namespace srslte {
gw::gw()
:if_up(false)
{}
{
current_ip_addr = 0;
}
void gw::init(srsue::pdcp_interface_gw *pdcp_, srsue::ue_interface *ue_, log *gw_log_, uint32_t lcid_)
{
@ -77,6 +79,8 @@ void gw::stop()
thread_cancel();
}
wait_thread_finish();
current_ip_addr = 0;
}
// TODO: tear down TUN device?
@ -126,38 +130,42 @@ void gw::write_pdu(uint32_t lcid, byte_buffer_t *pdu)
*******************************************************************************/
error_t gw::setup_if_addr(uint32_t ip_addr, char *err_str)
{
if(!if_up)
{
if (ip_addr != current_ip_addr) {
if(!if_up)
{
if(init_if(err_str))
{
gw_log->error("init_if failed\n");
return(ERROR_CANT_START);
}
}
}
// Setup the IP address
sock = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr = htonl(ip_addr);
if(0 > ioctl(sock, SIOCSIFADDR, &ifr))
{
// Setup the IP address
sock = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr = htonl(ip_addr);
if(0 > ioctl(sock, SIOCSIFADDR, &ifr))
{
err_str = strerror(errno);
gw_log->debug("Failed to set socket address: %s\n", err_str);
close(tun_fd);
return(ERROR_CANT_START);
}
ifr.ifr_netmask.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr("255.255.255.0");
if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr))
{
}
ifr.ifr_netmask.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr("255.255.255.0");
if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr))
{
err_str = strerror(errno);
gw_log->debug("Failed to set socket netmask: %s\n", err_str);
close(tun_fd);
return(ERROR_CANT_START);
}
}
// Setup a thread to receive packets from the TUN device
start(GW_THREAD_PRIO);
current_ip_addr = ip_addr;
// Setup a thread to receive packets from the TUN device
start(GW_THREAD_PRIO);
}
return(ERROR_NONE);
}

@ -369,7 +369,8 @@ private:
current_irv = 0;
is_msg3 = is_msg3_;
Info("UL %d: New TX%s, RV=%d, TBS=%d, RNTI=%d\n",
pid, is_msg3?" for Msg3":"", get_rv(), cur_grant.n_bytes[0], cur_grant.rnti);
pid, is_msg3?" for Msg3":"", get_rv(), cur_grant.n_bytes[0],
is_msg3?harq_entity->rntis->temp_rnti:cur_grant.rnti);
generate_tx(tti_tx, action);
}
}

@ -681,22 +681,22 @@ void phch_worker::reset_uci()
bzero(&uci_data, sizeof(srslte_uci_data_t));
}
void phch_worker::set_uci_ack(bool ack[SRSLTE_MAX_CODEWORDS], uint32_t nof_tb) {
if (nof_tb > 0) {
uci_data.uci_ack = (uint8_t) ((ack[0]) ? 1 : 0);
}
void phch_worker::set_uci_ack(bool ack[SRSLTE_MAX_CODEWORDS], uint32_t nof_tb) {
if (nof_tb > 0) {
uci_data.uci_ack = (uint8_t) ((ack[0]) ? 1 : 0);
}
if (nof_tb > 1) {
uci_data.uci_ack_2 = (uint8_t) ((ack[1]) ? 1 : 0);
}
if (nof_tb > 1) {
uci_data.uci_ack_2 = (uint8_t) ((ack[1]) ? 1 : 0);
}
if (nof_tb > 2) {
Error("Number of transport blocks is not supported");
}
if (nof_tb > 2) {
Error("Number of transport blocks is not supported");
}
uci_data.uci_ack_len = nof_tb;
uci_data.uci_ack_len = nof_tb;
}
}
void phch_worker::set_uci_sr()
{
@ -1075,7 +1075,7 @@ int phch_worker::read_ce_abs(float *ce_abs) {
int phch_worker::read_pdsch_d(cf_t* pdsch_d)
{
memcpy(pdsch_d, ue_dl.pdsch.d, ue_dl.pdsch_cfg.nbits[0].nof_re*sizeof(cf_t));
memcpy(pdsch_d, ue_dl.pdsch.d[0], ue_dl.pdsch_cfg.nbits[0].nof_re*sizeof(cf_t));
return ue_dl.pdsch_cfg.nbits[0].nof_re;
}

Loading…
Cancel
Save