diff --git a/srsue/hdr/mac/demux.h b/srsue/hdr/mac/demux.h index 8c9fb3a02..2f38a4dfc 100644 --- a/srsue/hdr/mac/demux.h +++ b/srsue/hdr/mac/demux.h @@ -41,7 +41,7 @@ namespace srsue { class demux : public srslte::pdu_queue::process_callback { public: - demux(); + demux(uint8_t nof_harq_proc_); void init(phy_interface_mac_common* phy_h_, rlc_interface_mac *rlc, srslte::log* log_h_, srslte::timers* timers_db_); bool process_pdus(); @@ -57,7 +57,6 @@ public: void process_pdu(uint8_t *pdu, uint32_t nof_bytes, uint32_t tstamp); private: - const static int NOF_HARQ_PID = 8; const static int MAX_PDU_LEN = 150*1024/8; // ~ 150 Mbps const static int NOF_BUFFER_PDUS = 64; // Number of PDU buffers per HARQ pid uint8_t bcch_buffer[1024]; // BCCH PID has a dedicated buffer @@ -77,6 +76,7 @@ private: srslte::log *log_h; srslte::timers *timers_db; rlc_interface_mac *rlc; + uint8_t nof_harq_proc; // Buffer of PDUs srslte::pdu_queue pdus; diff --git a/srsue/hdr/mac/mux.h b/srsue/hdr/mac/mux.h index b33cf0d19..1167af752 100644 --- a/srsue/hdr/mac/mux.h +++ b/srsue/hdr/mac/mux.h @@ -55,7 +55,7 @@ namespace srsue { class mux { public: - mux(); + mux(uint8_t nof_harq_proc_); void reset(); void init(rlc_interface_mac *rlc, srslte::log *log_h, bsr_interface_mux *bsr_procedure, phr_proc *phr_procedure_); @@ -87,7 +87,7 @@ private: std::vector lch; // Keep track of the PIDs that transmitted BSR reports - bool pid_has_bsr[MAX_HARQ_PROC]; + std::vector pid_has_bsr; // Mutex for exclusive access pthread_mutex_t mutex; @@ -97,6 +97,7 @@ private: bsr_interface_mux *bsr_procedure; phr_proc *phr_procedure; uint16_t pending_crnti_ce; + uint8_t nof_harq_proc; /* Msg3 Buffer */ static const uint32_t MSG3_BUFF_SZ = 128; @@ -105,9 +106,6 @@ private: /* PDU Buffer */ srslte::sch_pdu pdu_msg; bool msg3_has_been_transmitted; - - - }; } // namespace srsue diff --git a/srsue/src/mac/demux.cc b/srsue/src/mac/demux.cc index 227bcc364..4fcb402fc 100644 --- a/srsue/src/mac/demux.cc +++ b/srsue/src/mac/demux.cc @@ -36,7 +36,7 @@ namespace srsue { -demux::demux() : mac_msg(20), pending_mac_msg(20) +demux::demux(uint8_t nof_harq_proc_) : mac_msg(20), pending_mac_msg(20), nof_harq_proc(nof_harq_proc_) { } @@ -68,9 +68,9 @@ void demux::deallocate(uint8_t* payload_buffer_ptr) uint8_t* demux::request_buffer(uint32_t pid, uint32_t len) { uint8_t *buff = NULL; - if (pid < NOF_HARQ_PID) { + if (pid < nof_harq_proc) { return pdus.request(len); - } else if (pid == NOF_HARQ_PID) { + } else if (pid == nof_harq_proc) { buff = bcch_buffer; } else { Error("Requested buffer for invalid PID=%d\n", pid); @@ -119,9 +119,9 @@ void demux::push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes) */ void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp) { - if (pid < NOF_HARQ_PID) { + if (pid < nof_harq_proc) { return pdus.push(buff, nof_bytes, tstamp); - } else if (pid == NOF_HARQ_PID) { + } else if (pid == nof_harq_proc) { /* Demultiplexing of MAC PDU associated with SI-RNTI. The PDU passes through * the MAC in transparent mode. * Warning: In this case function sends the message to RLC now, since SI blocks do not diff --git a/srsue/src/mac/mac.cc b/srsue/src/mac/mac.cc index 9fe08166f..e1426780e 100644 --- a/srsue/src/mac/mac.cc +++ b/srsue/src/mac/mac.cc @@ -42,7 +42,9 @@ namespace srsue { mac::mac() : ttisync(10240), - timers_db((uint32_t) NOF_MAC_TIMERS), + timers_db((uint32_t) NOF_MAC_TIMERS), + mux_unit(MAC_NOF_HARQ_PROC), + demux_unit(MAC_NOF_HARQ_PROC), pdu_process_thread(&demux_unit) { started = false; diff --git a/srsue/src/mac/mux.cc b/srsue/src/mac/mux.cc index f81bcdfd2..5ab58fb50 100644 --- a/srsue/src/mac/mux.cc +++ b/srsue/src/mac/mux.cc @@ -37,7 +37,7 @@ namespace srsue { -mux::mux() : pdu_msg(MAX_NOF_SUBHEADERS) +mux::mux(uint8_t nof_harq_proc_) : pdu_msg(MAX_NOF_SUBHEADERS), pid_has_bsr(nof_harq_proc_), nof_harq_proc(nof_harq_proc_) { pthread_mutex_init(&mutex, NULL); @@ -141,7 +141,7 @@ srslte::sch_subh::cetype bsr_format_convert(bsr_proc::bsr_format_t format) { void mux::pusch_retx(uint32_t tx_tti, uint32_t pid) { - if (pid_has_bsr[pid%MAX_HARQ_PROC]) { + if (pid_has_bsr[pid%nof_harq_proc]) { bsr_procedure->set_tx_tti(tx_tti); } } @@ -256,7 +256,7 @@ uint8_t* mux::pdu_get(uint8_t *payload, uint32_t pdu_sz, uint32_t tx_tti, uint32 /* Generate MAC PDU and save to buffer */ uint8_t *ret = pdu_msg.write_packet(log_h); - pid_has_bsr[pid%MAX_HARQ_PROC] = bsr_is_inserted; + pid_has_bsr[pid%nof_harq_proc] = bsr_is_inserted; if (bsr_is_inserted) { bsr_procedure->set_tx_tti(tx_tti); }