2020-11-26 01:25:22 -08:00
|
|
|
/**
|
2020-11-20 04:08:22 -08:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* \section COPYRIGHT
|
2020-11-20 04:08:22 -08:00
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* Copyright 2013-2021 Software Radio Systems Limited
|
2020-11-20 04:08:22 -08:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* By using this file, you agree to the terms and conditions set
|
|
|
|
* forth in the LICENSE file which can be found at the top level of
|
|
|
|
* the distribution.
|
2020-11-20 04:08:22 -08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#ifndef SRSRAN_SCHED_LCH_H
|
|
|
|
#define SRSRAN_SCHED_LCH_H
|
2020-11-20 04:08:22 -08:00
|
|
|
|
2021-09-01 02:02:36 -07:00
|
|
|
#include "srsenb/hdr/stack/mac/common/ue_buffer_manager.h"
|
|
|
|
#include "srsenb/hdr/stack/mac/sched_interface.h"
|
2021-05-05 12:57:52 -07:00
|
|
|
#include "srsran/adt/pool/cached_alloc.h"
|
2021-03-19 03:45:56 -07:00
|
|
|
#include "srsran/mac/pdu.h"
|
|
|
|
#include "srsran/srslog/srslog.h"
|
2020-11-20 04:08:22 -08:00
|
|
|
|
|
|
|
namespace srsenb {
|
|
|
|
|
2021-09-01 02:02:36 -07:00
|
|
|
class lch_ue_manager : private ue_buffer_manager<false>
|
2020-11-20 04:08:22 -08:00
|
|
|
{
|
2021-09-01 02:02:36 -07:00
|
|
|
using base_type = ue_buffer_manager<false>;
|
2020-11-20 04:08:22 -08:00
|
|
|
|
|
|
|
public:
|
2021-09-01 02:02:36 -07:00
|
|
|
lch_ue_manager() : ue_buffer_manager(srslog::fetch_basic_logger("MAC")) {}
|
2020-11-20 04:08:22 -08:00
|
|
|
void set_cfg(const sched_interface::ue_cfg_t& cfg_);
|
|
|
|
void new_tti();
|
|
|
|
|
2021-09-01 02:02:36 -07:00
|
|
|
// Inherited methods from ue_buffer_manager base class
|
|
|
|
using base_type::config_lcid;
|
|
|
|
using base_type::dl_buffer_state;
|
|
|
|
using base_type::get_bsr;
|
|
|
|
using base_type::get_bsr_state;
|
|
|
|
using base_type::get_dl_retx;
|
|
|
|
using base_type::get_dl_tx;
|
|
|
|
using base_type::get_dl_tx_total;
|
|
|
|
using base_type::is_bearer_active;
|
|
|
|
using base_type::is_bearer_dl;
|
|
|
|
using base_type::is_bearer_ul;
|
|
|
|
using base_type::is_lcg_active;
|
|
|
|
using base_type::ul_bsr;
|
|
|
|
|
2020-11-20 04:08:22 -08:00
|
|
|
void ul_buffer_add(uint8_t lcid, uint32_t bytes);
|
|
|
|
|
|
|
|
int alloc_rlc_pdu(sched_interface::dl_sched_pdu_t* lcid, int rem_bytes);
|
|
|
|
|
2020-11-20 08:34:37 -08:00
|
|
|
bool has_pending_dl_txs() const;
|
2020-11-20 08:45:41 -08:00
|
|
|
int get_dl_tx_total_with_overhead(uint32_t lcid) const;
|
|
|
|
int get_dl_tx_with_overhead(uint32_t lcid) const;
|
|
|
|
int get_dl_retx_with_overhead(uint32_t lcid) const;
|
2020-11-20 12:09:41 -08:00
|
|
|
|
2021-09-01 02:02:36 -07:00
|
|
|
int get_bsr_with_overhead(uint32_t lcid) const;
|
|
|
|
int get_max_prio_lcid() const;
|
2020-11-20 04:08:22 -08:00
|
|
|
|
|
|
|
// Control Element Command queue
|
2021-03-19 03:45:56 -07:00
|
|
|
using ce_cmd = srsran::dl_sch_lcid;
|
2021-05-05 12:57:52 -07:00
|
|
|
srsran::deque<ce_cmd> pending_ces;
|
2020-11-20 04:08:22 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
int alloc_retx_bytes(uint8_t lcid, int rem_bytes);
|
|
|
|
int alloc_tx_bytes(uint8_t lcid, int rem_bytes);
|
|
|
|
|
2021-09-01 02:02:36 -07:00
|
|
|
size_t prio_idx = 0;
|
2020-11-20 04:08:22 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate space for multiple MAC SDUs (i.e. RLC PDUs) and corresponding MAC SDU subheaders
|
|
|
|
* @param data struct where the rlc pdu allocations are stored
|
|
|
|
* @param total_tbs available TB size for allocations for a single UE
|
|
|
|
* @param tbidx index of TB
|
|
|
|
* @return allocated bytes, which is always equal or lower than total_tbs
|
|
|
|
*/
|
2020-11-20 08:45:41 -08:00
|
|
|
uint32_t allocate_mac_sdus(sched_interface::dl_sched_data_t* data,
|
|
|
|
lch_ue_manager& lch_handler,
|
|
|
|
uint32_t total_tbs,
|
|
|
|
uint32_t tbidx);
|
2020-11-20 04:08:22 -08:00
|
|
|
|
2020-11-20 07:17:03 -08:00
|
|
|
/**
|
|
|
|
* Allocate space for pending MAC CEs
|
|
|
|
* @param data struct where the MAC CEs allocations are stored
|
|
|
|
* @param total_tbs available space in bytes for allocations
|
|
|
|
* @return number of bytes allocated
|
|
|
|
*/
|
2021-01-15 09:31:58 -08:00
|
|
|
uint32_t allocate_mac_ces(sched_interface::dl_sched_data_t* data, lch_ue_manager& lch_handler, uint32_t total_tbs);
|
2020-11-20 07:17:03 -08:00
|
|
|
|
2020-11-20 04:08:22 -08:00
|
|
|
} // namespace srsenb
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#endif // SRSRAN_SCHED_LCH_H
|