Merge branch 'next' into next_novolk

This commit is contained in:
Ismael Gomez 2017-10-18 11:21:31 -04:00
commit ed7856ea57
6 changed files with 49 additions and 49 deletions

View File

@ -31,11 +31,13 @@ template<typename metrics_t>
class metrics_hub : public periodic_thread
{
public:
metrics_hub() {
m = NULL;
}
bool init(metrics_interface<metrics_t> *m_, float report_period_secs=1.0) {
m = m_;
metrics_hub()
:m(NULL)
,report_period_secs(1)
{}
bool init(metrics_interface<metrics_t> *m_, float report_period_secs_=1.0) {
m = m_;
report_period_secs = report_period_secs_;
start_periodic(report_period_secs*1e6);
return true;
}
@ -55,13 +57,13 @@ private:
bzero(&metric, sizeof(metrics_t));
m->get_metrics(metric);
for (uint32_t i=0;i<listeners.size();i++) {
listeners[i]->set_metrics(metric);
listeners[i]->set_metrics(metric, report_period_secs);
}
}
}
metrics_interface<metrics_t> *m;
std::vector<metrics_listener<metrics_t>*> listeners;
std::vector<metrics_listener<metrics_t>*> listeners;
float report_period_secs;
};
} // namespace srslte

View File

@ -605,7 +605,7 @@ int srslte_band_get_fd_region(enum band_geographical_area region, srslte_earfcn_
/* Returns the interval tti1-tti2 mod 10240 */
uint32_t srslte_tti_interval(uint32_t tti1, uint32_t tti2) {
if (tti1 > tti2) {
if (tti1 >= tti2) {
return tti1-tti2;
} else {
return 10240-tti2+tti1;

View File

@ -41,14 +41,16 @@ namespace srsue {
class demux : public srslte::pdu_queue::process_callback
{
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);
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 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 set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg);
@ -59,7 +61,8 @@ public:
private:
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
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);
void *uecrid_callback_arg;
@ -76,8 +79,7 @@ private:
srslte::log *log_h;
srslte::timers::timer *time_alignment_timer;
rlc_interface_mac *rlc;
uint8_t nof_harq_proc;
// Buffer of PDUs
srslte::pdu_queue pdus;
};

View File

@ -262,10 +262,13 @@ private:
if (!ack) {
// 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,
cur_grant.n_bytes[tid]);
if (pid == HARQ_BCCH_PID) {
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;
if (!action->payload_ptr) {
if (!action->payload_ptr[tid]) {
action->decode_enabled[tid] = false;
Error("Can't get a buffer for TBS=%d\n", cur_grant.n_bytes[tid]);
return;
@ -305,8 +308,7 @@ private:
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]);
harq_entity->demux_unit->push_pdu(pid * SRSLTE_MAX_TB + tid, payload_buffer_ptr, cur_grant.n_bytes[tid],
cur_grant.tti);
harq_entity->demux_unit->push_pdu_bcch(payload_buffer_ptr, cur_grant.n_bytes[tid], cur_grant.tti);
} else {
if (harq_entity->pcap) {
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]);
} else {
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],
cur_grant.tti);
harq_entity->demux_unit->push_pdu(payload_buffer_ptr, cur_grant.n_bytes[tid], cur_grant.tti);
// Compute average number of retransmissions per packet
harq_entity->average_retx = SRSLTE_VEC_CMA((float) n_retx, harq_entity->average_retx,

View File

@ -36,7 +36,7 @@
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);
}
}
uint8_t* demux::request_buffer(uint32_t pid, uint32_t len)
{
uint8_t *buff = NULL;
if (pid < nof_harq_proc) {
return pdus.request(len);
} else if (pid == nof_harq_proc) {
buff = bcch_buffer;
uint8_t* demux::request_buffer_bcch(uint32_t len)
{
if (len < MAX_BCCH_PDU_LEN) {
return bcch_buffer;
} 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
@ -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
* deadline is important here.
*/
void demux::push_pdu(uint32_t pid, uint8_t *buff, uint32_t nof_bytes, uint32_t 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
* the MAC in transparent mode.
* Warning: In this case function sends the message to RLC now, since SI blocks do not
* require ACK feedback to be transmitted quickly.
*/
Debug("Pushed BCCH MAC PDU in transparent mode\n");
rlc->write_pdu_bcch_dlsch(buff, nof_bytes);
} else {
Error("Pushed buffer for invalid PID=%d\n", pid);
}
void demux::push_pdu(uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp) {
return pdus.push(buff, nof_bytes, tstamp);
}
/* 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
* require ACK feedback to be transmitted quickly.
*/
void demux::push_pdu_bcch(uint8_t *buff, uint32_t nof_bytes, uint32_t tstamp) {
rlc->write_pdu_bcch_dlsch(buff, nof_bytes);
}
bool demux::process_pdus()

View File

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