mirror of https://github.com/PentHertz/srsLTE.git
removing mch handler in rlc, fixing embms autostart
This commit is contained in:
parent
463b138026
commit
65f2747a8e
|
@ -135,7 +135,6 @@ private:
|
|||
|
||||
int build_data_pdu(uint8_t *payload, uint32_t nof_bytes);
|
||||
void handle_data_pdu(uint8_t *payload, uint32_t nof_bytes);
|
||||
void handle_mch_data_pdu(uint8_t *payload, uint32_t nof_bytes);
|
||||
void reassemble_rx_sdus();
|
||||
bool inside_reordering_window(uint16_t sn);
|
||||
void debug_state();
|
||||
|
|
|
@ -231,11 +231,7 @@ int rlc_um::read_pdu(uint8_t *payload, uint32_t nof_bytes)
|
|||
void rlc_um::write_pdu(uint8_t *payload, uint32_t nof_bytes)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
if(cfg.is_mrb) {
|
||||
handle_mch_data_pdu(payload, nof_bytes);
|
||||
} else {
|
||||
handle_data_pdu(payload, nof_bytes);
|
||||
}
|
||||
handle_data_pdu(payload, nof_bytes);
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
|
@ -395,63 +391,6 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void rlc_um::handle_mch_data_pdu(uint8_t *payload, uint32_t nof_bytes)
|
||||
{
|
||||
if(!rx_sdu) {
|
||||
rx_sdu = pool_allocate;
|
||||
}
|
||||
|
||||
rlc_umd_pdu_header_t header;
|
||||
rlc_um_read_data_pdu_header(payload, nof_bytes, cfg.rx_sn_field_length, &header);
|
||||
|
||||
log->info_hex(payload, nof_bytes, "RX %s Rx data PDU SN: %d",
|
||||
rb_name().c_str(), header.sn);
|
||||
|
||||
//Strip header from PDU
|
||||
int header_len = rlc_um_packed_length(&header);
|
||||
payload += header_len;
|
||||
nof_bytes -= header_len;
|
||||
if(0 == header.sn) {
|
||||
vr_uh = 0;
|
||||
}
|
||||
|
||||
// Handle SDU segments
|
||||
for(uint32_t i=0; i<header.N_li; i++) {
|
||||
int len = header.li[i];
|
||||
if(vr_uh != header.sn) {
|
||||
rx_sdu->reset();
|
||||
vr_uh = header.sn;
|
||||
if(!rlc_um_start_aligned(header.fi)) {
|
||||
payload += len;
|
||||
nof_bytes -= len;
|
||||
}
|
||||
} else {
|
||||
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], payload, len);
|
||||
log->debug("Concatenating %d bytes in to current length %d.\n", len, rx_sdu->N_bytes);
|
||||
rx_sdu->N_bytes += len;
|
||||
payload += len;
|
||||
nof_bytes -= len;
|
||||
log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU i=%d", rb_name().c_str(), i);
|
||||
rx_sdu->set_timestamp();
|
||||
pdcp->write_pdu_mch(lcid, rx_sdu);
|
||||
rx_sdu = pool_allocate;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle last segment
|
||||
memcpy(&rx_sdu->msg[rx_sdu->N_bytes], payload, nof_bytes);
|
||||
rx_sdu->N_bytes += nof_bytes;
|
||||
log->debug("Writing last segment in SDU buffer. Buffer size=%d, segment size=%d\n",
|
||||
rx_sdu->N_bytes, nof_bytes);
|
||||
if(rlc_um_end_aligned(header.fi)) {
|
||||
log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU", rb_name().c_str());
|
||||
rx_sdu->set_timestamp();
|
||||
pdcp->write_pdu_mch(lcid, rx_sdu);
|
||||
rx_sdu = pool_allocate;
|
||||
}
|
||||
vr_uh = (header.sn + 1);
|
||||
}
|
||||
|
||||
void rlc_um::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes)
|
||||
{
|
||||
std::map<uint32_t, rlc_umd_pdu_t>::iterator it;
|
||||
|
@ -565,7 +504,11 @@ void rlc_um::reassemble_rx_sdus()
|
|||
} else {
|
||||
log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d, i=%d (lower edge middle segments)", rb_name().c_str(), vr_ur, i);
|
||||
rx_sdu->set_timestamp();
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
if(cfg.is_mrb){
|
||||
pdcp->write_pdu_mch(lcid, rx_sdu);
|
||||
} else {
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
}
|
||||
rx_sdu = pool_allocate;
|
||||
if (!rx_sdu) {
|
||||
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
|
||||
|
@ -592,7 +535,11 @@ void rlc_um::reassemble_rx_sdus()
|
|||
} else {
|
||||
log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d (lower edge last segments)", rrc->get_rb_name(lcid).c_str(), vr_ur);
|
||||
rx_sdu->set_timestamp();
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
if(cfg.is_mrb){
|
||||
pdcp->write_pdu_mch(lcid, rx_sdu);
|
||||
} else {
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
}
|
||||
rx_sdu = pool_allocate;
|
||||
if (!rx_sdu) {
|
||||
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
|
||||
|
@ -642,7 +589,11 @@ void rlc_um::reassemble_rx_sdus()
|
|||
} else {
|
||||
log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d, i=%d, (update vr_ur middle segments)", rb_name().c_str(), vr_ur, i);
|
||||
rx_sdu->set_timestamp();
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
if(cfg.is_mrb){
|
||||
pdcp->write_pdu_mch(lcid, rx_sdu);
|
||||
} else {
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
}
|
||||
rx_sdu = pool_allocate;
|
||||
if (!rx_sdu) {
|
||||
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
|
||||
|
@ -681,7 +632,11 @@ void rlc_um::reassemble_rx_sdus()
|
|||
} else {
|
||||
log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d (update vr_ur last segments)", rb_name().c_str(), vr_ur);
|
||||
rx_sdu->set_timestamp();
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
if(cfg.is_mrb){
|
||||
pdcp->write_pdu_mch(lcid, rx_sdu);
|
||||
} else {
|
||||
pdcp->write_pdu(lcid, rx_sdu);
|
||||
}
|
||||
rx_sdu = pool_allocate;
|
||||
if (!rx_sdu) {
|
||||
log->error("Fatal Error: Couldn't allocate buffer in rlc_um::reassemble_rx_sdus().\n");
|
||||
|
|
|
@ -184,7 +184,7 @@ private:
|
|||
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_2_STRUCT sib2;
|
||||
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_13_STRUCT sib13;
|
||||
|
||||
const static int mtch_payload_len = 1000;
|
||||
const static int mtch_payload_len = 10000;
|
||||
uint8_t mtch_payload_buffer[mtch_payload_len];
|
||||
|
||||
/* Functions for MAC Timers */
|
||||
|
|
|
@ -635,7 +635,7 @@ int mac::get_mch_sched(bool is_mcch, dl_sched_t *dl_sched_res)
|
|||
build_mch_sched(mcs_data.tbs);
|
||||
mch.mcch_payload = mcch_payload_buffer;
|
||||
mch.current_sf_allocation_num = 1;
|
||||
|
||||
Info("MCH Sched Info: LCID: %d, Stop: %d, tti is %d \n", mch.mtch_sched[0].lcid, mch.mtch_sched[0].stop, tti);
|
||||
for(uint32_t i = 0; i < mch.num_mtch_sched; i++) {
|
||||
mch.pdu[i].lcid = srslte::sch_subh::MCH_SCHED_INFO;
|
||||
// mch.mtch_sched[i].lcid = 1+i;
|
||||
|
@ -659,8 +659,8 @@ int mac::get_mch_sched(bool is_mcch, dl_sched_t *dl_sched_res)
|
|||
}
|
||||
}
|
||||
if(mch.current_sf_allocation_num <= mtch_stop) {
|
||||
int requested_bytes = (mcs_data.tbs/8 > mch.mtch_sched[mtch_index].lcid_buffer_size)?mch.mtch_sched[mtch_index].lcid_buffer_size:mcs_data.tbs/8;
|
||||
requested_bytes = requested_bytes - 2;
|
||||
int requested_bytes = (mcs_data.tbs/8 > mch.mtch_sched[mtch_index].lcid_buffer_size)?(mch.mtch_sched[mtch_index].lcid_buffer_size):((mcs_data.tbs/8) - 2);
|
||||
|
||||
int bytes_received = ue_db[SRSLTE_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes);
|
||||
mch.pdu[0].lcid = current_lcid;
|
||||
mch.pdu[0].nbytes = bytes_received;
|
||||
|
|
|
@ -545,7 +545,7 @@ int sched::dl_sched_bc(dl_sched_bc_t bc[MAX_BC_LIST])
|
|||
}
|
||||
uint32_t n_sf = (current_tti-pending_sibs[i].window_start);
|
||||
if ((i == 0 && (sfn%2) == 0 && sf_idx == 5) ||
|
||||
(i > 0 && n_sf >= (cfg.si_window_ms/nof_tx)*pending_sibs[i].n_tx && sf_idx==0))
|
||||
(i > 0 && n_sf >= (cfg.si_window_ms/nof_tx)*pending_sibs[i].n_tx && sf_idx==9))
|
||||
{
|
||||
uint32_t rv = get_rvidx(pending_sibs[i].n_tx);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
bool is_attached();
|
||||
void start_plot();
|
||||
void print_mbms();
|
||||
void mbms_service_start(uint32_t serv, uint32_t port);
|
||||
bool mbms_service_start(uint32_t serv, uint32_t port);
|
||||
|
||||
void print_pool();
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public:
|
|||
virtual void radio_overflow() = 0;
|
||||
|
||||
virtual void print_mbms() = 0;
|
||||
virtual void mbms_service_start(uint32_t serv, uint32_t port) = 0;
|
||||
virtual bool mbms_service_start(uint32_t serv, uint32_t port) = 0;
|
||||
|
||||
void handle_rf_msg(srslte_rf_error_t error);
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
void liblte_rrc_log(char *str);
|
||||
|
||||
void print_mbms();
|
||||
void mbms_service_start(uint32_t serv, uint32_t port);
|
||||
bool mbms_service_start(uint32_t serv, uint32_t port);
|
||||
|
||||
// NAS interface
|
||||
void write_sdu(uint32_t lcid, byte_buffer_t *sdu);
|
||||
|
|
|
@ -203,7 +203,6 @@ void demux::process_sch_pdu(srslte::sch_pdu *pdu_msg)
|
|||
}
|
||||
void demux::process_mch_pdu(srslte::mch_pdu *mch_msg){
|
||||
//disgarding headers that have already been processed
|
||||
//printf("in process cur idx, %d subheaders %d\n",mch_msg->cur_idx,mch_msg->nof_subheaders);
|
||||
while(mch_msg->next()){
|
||||
|
||||
if(srslte::mch_subh::MCH_SCHED_INFO == mch_msg->get()->ce_type()){
|
||||
|
@ -234,7 +233,7 @@ void demux::mch_start_rx(uint32_t lcid)
|
|||
Info("MCH Channel Setup: LCID=%d\n", lcid);
|
||||
mch_lcids[lcid] = 1;
|
||||
} else {
|
||||
Warning("MCH Channel Setup: invalid LCID=%d\n", lcid);
|
||||
Error("MCH Channel Setup: invalid LCID=%d\n", lcid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -522,14 +522,18 @@ int main(int argc, char *argv[])
|
|||
ue->start_plot();
|
||||
}
|
||||
if(args.expert.mbms_service > -1){
|
||||
ue->mbms_service_start(args.expert.mbms_service, 4321);
|
||||
//ue->mbms_service_start(args.expert.mbms_service, 4321);
|
||||
serv = args.expert.mbms_service;
|
||||
port = 4321;
|
||||
mbms_service_start = true;
|
||||
}
|
||||
}
|
||||
int cnt=0;
|
||||
while (running) {
|
||||
if(mbms_service_start) {
|
||||
mbms_service_start = false;
|
||||
ue->mbms_service_start(serv, port);
|
||||
if(ue->mbms_service_start(serv, port)){
|
||||
mbms_service_start = false;
|
||||
}
|
||||
}
|
||||
if(show_mbms) {
|
||||
show_mbms = false;
|
||||
|
|
|
@ -330,9 +330,9 @@ void ue::print_mbms()
|
|||
rrc.print_mbms();
|
||||
}
|
||||
|
||||
void ue::mbms_service_start(uint32_t serv, uint32_t port)
|
||||
bool ue::mbms_service_start(uint32_t serv, uint32_t port)
|
||||
{
|
||||
rrc.mbms_service_start(serv, port);
|
||||
return rrc.mbms_service_start(serv, port);
|
||||
}
|
||||
|
||||
void ue::rf_msg(srslte_rf_error_t error)
|
||||
|
|
|
@ -119,9 +119,10 @@ void rrc::print_mbms()
|
|||
}
|
||||
}
|
||||
|
||||
void rrc::mbms_service_start(uint32_t serv, uint32_t port)
|
||||
bool rrc::mbms_service_start(uint32_t serv, uint32_t port)
|
||||
{
|
||||
rrc_log->console("MBMS service start requested. Service id:%d, port: %d\n", serv, port);
|
||||
bool ret = false;
|
||||
|
||||
if(serving_cell->has_mcch) {
|
||||
LIBLTE_RRC_MCCH_MSG_STRUCT msg;
|
||||
memcpy(&msg, &serving_cell->mcch, sizeof(LIBLTE_RRC_MCCH_MSG_STRUCT));
|
||||
|
@ -130,11 +131,14 @@ void rrc::mbms_service_start(uint32_t serv, uint32_t port)
|
|||
for(uint32_t j=0;j<pmch->mbms_sessioninfolist_r9_size; j++) {
|
||||
LIBLTE_RRC_MBMS_SESSION_INFO_R9_STRUCT *sess = &pmch->mbms_sessioninfolist_r9[j];
|
||||
if(serv == sess->tmgi_r9.serviceid_r9) {
|
||||
rrc_log->console("MBMS service started. Service id:%d, port: %d\n", serv, port);
|
||||
ret = true;
|
||||
add_mrb(sess->logicalchannelid_r9, port);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue