From dd9889e07c1073c9ff3fa103d7f2b9efeb0dceb5 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 22 Apr 2021 16:04:05 +0200 Subject: [PATCH] Add carrier index to uplink PCAP captures --- lib/include/srsran/mac/pdu_queue.h | 5 +++-- lib/src/mac/pdu_queue.cc | 7 ++++--- srsenb/hdr/stack/mac/ue.h | 2 +- srsenb/src/stack/mac/mac.cc | 4 ++-- srsenb/src/stack/mac/ue.cc | 6 +++--- srsue/hdr/stack/mac/demux.h | 2 +- srsue/src/stack/mac/demux.cc | 4 ++-- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/include/srsran/mac/pdu_queue.h b/lib/include/srsran/mac/pdu_queue.h index 424c505b0..00aa3cde7 100644 --- a/lib/include/srsran/mac/pdu_queue.h +++ b/lib/include/srsran/mac/pdu_queue.h @@ -30,7 +30,7 @@ public: class process_callback { public: - virtual void process_pdu(uint8_t* buff, uint32_t len, channel_t channel, int ul_nof_prbs = -1) = 0; + virtual void process_pdu(uint8_t* buff, uint32_t len, uint32_t ue_cc_idx, channel_t channel, int ul_nof_prbs = -1) = 0; }; pdu_queue(srslog::basic_logger& logger) : pool(DEFAULT_POOL_SIZE), callback(NULL), logger(logger) {} @@ -38,7 +38,7 @@ public: uint8_t* request(uint32_t len); void deallocate(const uint8_t* pdu); - void push(const uint8_t* ptr, uint32_t len, channel_t channel = DCH, int ul_nof_prbs = -1); + void push(const uint8_t* ptr, uint32_t len, uint32_t ue_cc_idx, channel_t channel = DCH, int ul_nof_prbs = -1); bool process_pdus(); @@ -51,6 +51,7 @@ private: typedef struct { uint8_t ptr[MAX_PDU_LEN]; uint32_t len; + uint32_t ue_cc_idx; channel_t channel; int grant_nof_prbs; #ifdef SRSRAN_BUFFER_POOL_LOG_ENABLED diff --git a/lib/src/mac/pdu_queue.cc b/lib/src/mac/pdu_queue.cc index cc4481234..e80b0b89e 100644 --- a/lib/src/mac/pdu_queue.cc +++ b/lib/src/mac/pdu_queue.cc @@ -50,15 +50,16 @@ void pdu_queue::deallocate(const uint8_t* pdu) } /* Demultiplexing of logical channels and dissassemble of MAC CE - * This function enqueues the packet and returns quicly because ACK + * This function enqueues the packet and returns quickly because ACK * deadline is important here. */ -void pdu_queue::push(const uint8_t* ptr, uint32_t len, channel_t channel, int grant_nof_prbs) +void pdu_queue::push(const uint8_t* ptr, uint32_t len, uint32_t ue_cc_idx, channel_t channel, int grant_nof_prbs) { if (ptr) { pdu_t* pdu = (pdu_t*)ptr; pdu->len = len; pdu->channel = channel; + pdu->ue_cc_idx = ue_cc_idx; pdu->grant_nof_prbs = grant_nof_prbs; if (!pdu_q.try_push(pdu)) { logger.warning("Error pushing pdu: queue is full"); @@ -75,7 +76,7 @@ bool pdu_queue::process_pdus() pdu_t* pdu; while (pdu_q.try_pop(pdu)) { if (callback) { - callback->process_pdu(pdu->ptr, pdu->len, pdu->channel, pdu->grant_nof_prbs); + callback->process_pdu(pdu->ptr, pdu->len, pdu->ue_cc_idx, pdu->channel, pdu->grant_nof_prbs); } cnt++; have_data = true; diff --git a/srsenb/hdr/stack/mac/ue.h b/srsenb/hdr/stack/mac/ue.h index 77d7354a5..cb7a21164 100644 --- a/srsenb/hdr/stack/mac/ue.h +++ b/srsenb/hdr/stack/mac/ue.h @@ -160,7 +160,7 @@ public: srsran_softbuffer_rx_t* get_rx_softbuffer(uint32_t enb_cc_idx, uint32_t tti); uint8_t* request_buffer(uint32_t tti, uint32_t enb_cc_idx, uint32_t len); - void process_pdu(srsran::unique_byte_buffer_t pdu, uint32_t grant_nof_prbs); + void process_pdu(srsran::unique_byte_buffer_t pdu, uint32_t ue_cc_idx, uint32_t grant_nof_prbs); srsran::unique_byte_buffer_t release_pdu(uint32_t tti, uint32_t enb_cc_idx); void clear_old_buffers(uint32_t tti); diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 144e2dd5b..430f7e493 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -331,10 +331,10 @@ int mac::push_pdu(uint32_t tti_rx, tti_rx, nof_bytes, (int)pdu->size()); - auto process_pdu_task = [this, rnti, ul_nof_prbs](srsran::unique_byte_buffer_t& pdu) { + auto process_pdu_task = [this, rnti, enb_cc_idx, ul_nof_prbs](srsran::unique_byte_buffer_t& pdu) { srsran::rwlock_read_guard lock(rwlock); if (check_ue_active(rnti)) { - ue_db[rnti]->process_pdu(std::move(pdu), ul_nof_prbs); + ue_db[rnti]->process_pdu(std::move(pdu), enb_cc_idx, ul_nof_prbs); } else { logger.debug("Discarding PDU rnti=0x%x", rnti); } diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index 0772a1491..4a54a7294 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -287,7 +287,7 @@ uint32_t ue::set_ta(int ta_) return nof_cmd; } -void ue::process_pdu(srsran::unique_byte_buffer_t pdu, uint32_t grant_nof_prbs) +void ue::process_pdu(srsran::unique_byte_buffer_t pdu, uint32_t ue_cc_idx, uint32_t grant_nof_prbs) { // Unpack ULSCH MAC PDU mac_msg_ul.init_rx(pdu->size(), true); @@ -300,11 +300,11 @@ void ue::process_pdu(srsran::unique_byte_buffer_t pdu, uint32_t grant_nof_prbs) } if (pcap != nullptr) { - pcap->write_ul_crnti(pdu->data(), pdu->size(), rnti, true, last_tti, UL_CC_IDX); + pcap->write_ul_crnti(pdu->data(), pdu->size(), rnti, true, last_tti, ue_cc_idx); } if (pcap_net != nullptr) { - pcap_net->write_ul_crnti(pdu->data(), pdu->size(), rnti, true, last_tti, UL_CC_IDX); + pcap_net->write_ul_crnti(pdu->data(), pdu->size(), rnti, true, last_tti, ue_cc_idx); } uint32_t lcid_most_data = 0; diff --git a/srsue/hdr/stack/mac/demux.h b/srsue/hdr/stack/mac/demux.h index b010252c9..cf30a4c32 100644 --- a/srsue/hdr/stack/mac/demux.h +++ b/srsue/hdr/stack/mac/demux.h @@ -56,7 +56,7 @@ public: bool get_uecrid_successful(); - void process_pdu(uint8_t* pdu, uint32_t nof_bytes, srsran::pdu_queue::channel_t channel, int ul_nof_prbs); + void process_pdu(uint8_t* pdu, uint32_t nof_bytes, uint32_t cc_idx, srsran::pdu_queue::channel_t channel, int ul_nof_prbs); void mch_start_rx(uint32_t lcid); private: diff --git a/srsue/src/stack/mac/demux.cc b/srsue/src/stack/mac/demux.cc index eeff692b0..3a2d74a65 100644 --- a/srsue/src/stack/mac/demux.cc +++ b/srsue/src/stack/mac/demux.cc @@ -123,7 +123,7 @@ void demux::push_pdu(uint8_t* buff, uint32_t nof_bytes, uint32_t tti) // Process Real-Time PDUs process_sch_pdu_rt(buff, nof_bytes, tti); - return pdus.push(buff, nof_bytes, srsran::pdu_queue::DCH); + return pdus.push(buff, nof_bytes, 0, srsran::pdu_queue::DCH); } /* Demultiplexing of MAC PDU associated with SI-RNTI. The PDU passes through @@ -147,7 +147,7 @@ bool demux::process_pdus() return pdus.process_pdus(); } -void demux::process_pdu(uint8_t* mac_pdu, uint32_t nof_bytes, srsran::pdu_queue::channel_t channel, int ul_nof_prbs) +void demux::process_pdu(uint8_t* mac_pdu, uint32_t nof_bytes, uint32_t cc_idx, srsran::pdu_queue::channel_t channel, int ul_nof_prbs) { Debug("Processing MAC PDU channel %d", channel); switch (channel) {