Removed pid from demux

This commit is contained in:
Ismael Gomez 2017-10-17 12:10:31 -04:00
parent 5509262f54
commit 2b0b57176f
4 changed files with 37 additions and 39 deletions

View File

@ -41,14 +41,16 @@ namespace srsue {
class demux : public srslte::pdu_queue::process_callback class demux : public srslte::pdu_queue::process_callback
{ {
public: public:
demux(uint8_t nof_harq_proc_); demux();
void init(phy_interface_mac_common* phy_h_, rlc_interface_mac *rlc, srslte::log* log_h_, srslte::timers::timer* time_alignment_timer); void init(phy_interface_mac_common* phy_h_, rlc_interface_mac *rlc, srslte::log* log_h_, srslte::timers::timer* time_alignment_timer);
bool process_pdus(); bool process_pdus();
uint8_t* request_buffer(uint32_t pid, uint32_t len); uint8_t* request_buffer(uint32_t len);
uint8_t* request_buffer_bcch(uint32_t len);
void deallocate(uint8_t* payload_buffer_ptr); void deallocate(uint8_t* payload_buffer_ptr);
void push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp); void push_pdu(uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp);
void push_pdu_bcch(uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp);
void push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes); void push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes);
void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg); void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg);
@ -59,7 +61,8 @@ public:
private: private:
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 const static int MAX_BCCH_PDU_LEN = 1024;
uint8_t bcch_buffer[MAX_BCCH_PDU_LEN]; // BCCH PID has a dedicated buffer
bool (*uecrid_callback) (void*, uint64_t); bool (*uecrid_callback) (void*, uint64_t);
void *uecrid_callback_arg; void *uecrid_callback_arg;
@ -76,8 +79,7 @@ private:
srslte::log *log_h; srslte::log *log_h;
srslte::timers::timer *time_alignment_timer; srslte::timers::timer *time_alignment_timer;
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;
}; };

View File

@ -262,8 +262,11 @@ private:
if (!ack) { if (!ack) {
// Instruct the PHY To combine the received data and attempt to decode it // Instruct the PHY To combine the received data and attempt to decode it
payload_buffer_ptr = harq_entity->demux_unit->request_buffer(pid * SRSLTE_MAX_TB + tid, if (pid == HARQ_BCCH_PID) {
cur_grant.n_bytes[tid]); payload_buffer_ptr = harq_entity->demux_unit->request_buffer_bcch(cur_grant.n_bytes[tid]);
} else {
payload_buffer_ptr = harq_entity->demux_unit->request_buffer(cur_grant.n_bytes[tid]);
}
action->payload_ptr[tid] = payload_buffer_ptr; action->payload_ptr[tid] = payload_buffer_ptr;
if (!action->payload_ptr) { if (!action->payload_ptr) {
action->decode_enabled[tid] = false; action->decode_enabled[tid] = false;
@ -305,8 +308,7 @@ private:
harq_entity->pcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.n_bytes[tid], ack, cur_grant.tti); harq_entity->pcap->write_dl_sirnti(payload_buffer_ptr, cur_grant.n_bytes[tid], ack, cur_grant.tti);
} }
Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.n_bytes[tid]); Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit (BCCH)\n", cur_grant.n_bytes[tid]);
harq_entity->demux_unit->push_pdu(pid * SRSLTE_MAX_TB + tid, payload_buffer_ptr, cur_grant.n_bytes[tid], harq_entity->demux_unit->push_pdu_bcch(payload_buffer_ptr, cur_grant.n_bytes[tid], cur_grant.tti);
cur_grant.tti);
} else { } else {
if (harq_entity->pcap) { if (harq_entity->pcap) {
harq_entity->pcap->write_dl_crnti(payload_buffer_ptr, cur_grant.n_bytes[tid], cur_grant.rnti, ack, harq_entity->pcap->write_dl_crnti(payload_buffer_ptr, cur_grant.n_bytes[tid], cur_grant.rnti, ack,
@ -318,8 +320,7 @@ private:
harq_entity->demux_unit->push_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes[tid]); harq_entity->demux_unit->push_pdu_temp_crnti(payload_buffer_ptr, cur_grant.n_bytes[tid]);
} else { } else {
Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.n_bytes[tid]); Debug("Delivering PDU=%d bytes to Dissassemble and Demux unit\n", cur_grant.n_bytes[tid]);
harq_entity->demux_unit->push_pdu(pid * SRSLTE_MAX_TB + tid, payload_buffer_ptr, cur_grant.n_bytes[tid], harq_entity->demux_unit->push_pdu(payload_buffer_ptr, cur_grant.n_bytes[tid], cur_grant.tti);
cur_grant.tti);
// Compute average number of retransmissions per packet // Compute average number of retransmissions per packet
harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx, harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx,

View File

@ -36,7 +36,7 @@
namespace srsue { namespace srsue {
demux::demux(uint8_t nof_harq_proc_) : mac_msg(20), pending_mac_msg(20), nof_harq_proc(nof_harq_proc_) demux::demux() : mac_msg(20), pending_mac_msg(20)
{ {
} }
@ -64,18 +64,18 @@ void demux::deallocate(uint8_t* payload_buffer_ptr)
pdus.deallocate(payload_buffer_ptr); pdus.deallocate(payload_buffer_ptr);
} }
} }
uint8_t* demux::request_buffer_bcch(uint32_t len)
uint8_t* demux::request_buffer(uint32_t pid, uint32_t len) {
{ if (len < MAX_BCCH_PDU_LEN) {
uint8_t *buff = NULL; return bcch_buffer;
if (pid < nof_harq_proc) {
return pdus.request(len);
} else if (pid == nof_harq_proc) {
buff = bcch_buffer;
} else { } else {
Error("Requested buffer for invalid PID=%d\n", pid); return NULL;
} }
return buff; }
uint8_t* demux::request_buffer(uint32_t len)
{
return pdus.request(len);
} }
/* Demultiplexing of MAC PDU associated with a Temporal C-RNTI. The PDU will /* Demultiplexing of MAC PDU associated with a Temporal C-RNTI. The PDU will
@ -117,21 +117,17 @@ void demux::push_pdu_temp_crnti(uint8_t *buff, uint32_t nof_bytes)
* This function enqueues the packet and returns quicly because ACK * This function enqueues the packet and returns quicly because ACK
* deadline is important here. * deadline is important here.
*/ */
void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp) void demux::push_pdu(uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp) {
{ return pdus.push(buff, nof_bytes, tstamp);
if (pid < nof_harq_proc) { }
return pdus.push(buff, nof_bytes, tstamp);
} 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 * require ACK feedback to be transmitted quickly.
* require ACK feedback to be transmitted quickly. */
*/ void demux::push_pdu_bcch(uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp) {
Debug("Pushed BCCH MAC PDU in transparent mode\n"); rlc->write_pdu_bcch_dlsch(buff, nof_bytes);
rlc->write_pdu_bcch_dlsch(buff, nof_bytes);
} else {
Error("Pushed buffer for invalid PID=%d\n", pid);
}
} }
bool demux::process_pdus() bool demux::process_pdus()

View File

@ -44,7 +44,6 @@ namespace srsue {
mac::mac() : ttisync(10240), mac::mac() : ttisync(10240),
timers(64), timers(64),
mux_unit(MAC_NOF_HARQ_PROC), mux_unit(MAC_NOF_HARQ_PROC),
demux_unit(SRSLTE_MAX_TB*MAC_NOF_HARQ_PROC),
pdu_process_thread(&demux_unit) pdu_process_thread(&demux_unit)
{ {
started = false; started = false;