make number of HARQ processes a parameter for mux/demux objects

master
Andre Puschmann 7 years ago
parent 4bc7b19595
commit 9398e0eff9

@ -41,7 +41,7 @@ namespace srsue {
class demux : public srslte::pdu_queue::process_callback class demux : public srslte::pdu_queue::process_callback
{ {
public: 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_); void init(phy_interface_mac_common* phy_h_, rlc_interface_mac *rlc, srslte::log* log_h_, srslte::timers* timers_db_);
bool process_pdus(); bool process_pdus();
@ -57,7 +57,6 @@ public:
void process_pdu(uint8_t *pdu, uint32_t nof_bytes, uint32_t tstamp); void process_pdu(uint8_t *pdu, uint32_t nof_bytes, uint32_t tstamp);
private: private:
const static int NOF_HARQ_PID = 8;
const static int MAX_PDU_LEN = 150*1024/8; // ~ 150 Mbps 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 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 uint8_t bcch_buffer[1024]; // BCCH PID has a dedicated buffer
@ -77,6 +76,7 @@ private:
srslte::log *log_h; srslte::log *log_h;
srslte::timers *timers_db; srslte::timers *timers_db;
rlc_interface_mac *rlc; rlc_interface_mac *rlc;
uint8_t nof_harq_proc;
// Buffer of PDUs // Buffer of PDUs
srslte::pdu_queue pdus; srslte::pdu_queue pdus;

@ -55,7 +55,7 @@ namespace srsue {
class mux class mux
{ {
public: public:
mux(); mux(uint8_t nof_harq_proc_);
void reset(); void reset();
void init(rlc_interface_mac *rlc, srslte::log *log_h, bsr_interface_mux *bsr_procedure, phr_proc *phr_procedure_); 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<lchid_t> lch; std::vector<lchid_t> lch;
// Keep track of the PIDs that transmitted BSR reports // Keep track of the PIDs that transmitted BSR reports
bool pid_has_bsr[MAX_HARQ_PROC]; std::vector<bool> pid_has_bsr;
// Mutex for exclusive access // Mutex for exclusive access
pthread_mutex_t mutex; pthread_mutex_t mutex;
@ -97,6 +97,7 @@ private:
bsr_interface_mux *bsr_procedure; bsr_interface_mux *bsr_procedure;
phr_proc *phr_procedure; phr_proc *phr_procedure;
uint16_t pending_crnti_ce; uint16_t pending_crnti_ce;
uint8_t nof_harq_proc;
/* Msg3 Buffer */ /* Msg3 Buffer */
static const uint32_t MSG3_BUFF_SZ = 128; static const uint32_t MSG3_BUFF_SZ = 128;
@ -105,9 +106,6 @@ private:
/* PDU Buffer */ /* PDU Buffer */
srslte::sch_pdu pdu_msg; srslte::sch_pdu pdu_msg;
bool msg3_has_been_transmitted; bool msg3_has_been_transmitted;
}; };
} // namespace srsue } // namespace srsue

@ -36,7 +36,7 @@
namespace srsue { 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* demux::request_buffer(uint32_t pid, uint32_t len)
{ {
uint8_t *buff = NULL; uint8_t *buff = NULL;
if (pid < NOF_HARQ_PID) { if (pid < nof_harq_proc) {
return pdus.request(len); return pdus.request(len);
} else if (pid == NOF_HARQ_PID) { } else if (pid == nof_harq_proc) {
buff = bcch_buffer; buff = bcch_buffer;
} else { } else {
Error("Requested buffer for invalid PID=%d\n", pid); 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) 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); 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 /* Demultiplexing of MAC PDU associated with SI-RNTI. The PDU passes through
* the MAC in transparent mode. * the MAC in transparent mode.
* Warning: In this case function sends the message to RLC now, since SI blocks do not * Warning: In this case function sends the message to RLC now, since SI blocks do not

@ -42,7 +42,9 @@
namespace srsue { namespace srsue {
mac::mac() : ttisync(10240), 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) pdu_process_thread(&demux_unit)
{ {
started = false; started = false;

@ -37,7 +37,7 @@
namespace srsue { 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); 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) 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); 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 */ /* Generate MAC PDU and save to buffer */
uint8_t *ret = pdu_msg.write_packet(log_h); 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) { if (bsr_is_inserted) {
bsr_procedure->set_tx_tti(tx_tti); bsr_procedure->set_tx_tti(tx_tti);
} }

Loading…
Cancel
Save