mirror of https://github.com/pvnis/srsRAN_4G.git
Merge branch 'next' into agpl_next
# Conflicts: # srsenb/hdr/phy/nr/cc_worker.h # srsenb/hdr/phy/nr/sf_worker.h # srsenb/src/phy/nr/cc_worker.cc # srsenb/src/phy/nr/sf_worker.cc # test/phy/nr_phy_test.ccmaster
commit
585e3c51c1
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(SOURCES gtpu.cc)
|
||||
|
||||
add_library(srsran_gtpu STATIC ${SOURCES})
|
||||
target_link_libraries(srsran_gtpu srsran_common srsran_asn1 ${ATOMIC_LIBS})
|
||||
INSTALL(TARGETS srsran_gtpu DESTINATION ${LIBRARY_DIR})
|
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(SOURCES pdcp.cc
|
||||
pdcp_entity_base.cc
|
||||
pdcp_entity_lte.cc
|
||||
pdcp_entity_nr.cc)
|
||||
|
||||
add_library(srsran_pdcp STATIC ${SOURCES})
|
||||
target_link_libraries(srsran_pdcp srsran_common srsran_asn1 ${ATOMIC_LIBS})
|
||||
INSTALL(TARGETS srsran_pdcp DESTINATION ${LIBRARY_DIR})
|
@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(CTEST_LABELS "lib;pdcp")
|
||||
|
||||
add_executable(pdcp_nr_test_tx pdcp_nr_test_tx.cc)
|
||||
target_link_libraries(pdcp_nr_test_tx srsran_pdcp srsran_common)
|
||||
add_nr_test(pdcp_nr_test_tx pdcp_nr_test_tx)
|
||||
|
||||
add_executable(pdcp_nr_test_rx pdcp_nr_test_rx.cc)
|
||||
target_link_libraries(pdcp_nr_test_rx srsran_pdcp srsran_common)
|
||||
add_nr_test(pdcp_nr_test_rx pdcp_nr_test_rx)
|
||||
|
||||
add_executable(pdcp_nr_test_discard_sdu pdcp_nr_test_discard_sdu.cc)
|
||||
target_link_libraries(pdcp_nr_test_discard_sdu srsran_pdcp srsran_common ${ATOMIC_LIBS})
|
||||
add_nr_test(pdcp_nr_test_discard_sdu pdcp_nr_test_discard_sdu)
|
||||
|
||||
add_executable(pdcp_lte_test_rx pdcp_lte_test_rx.cc)
|
||||
target_link_libraries(pdcp_lte_test_rx srsran_pdcp srsran_common)
|
||||
add_test(pdcp_lte_test_rx pdcp_lte_test_rx)
|
||||
|
||||
add_executable(pdcp_lte_test_discard_sdu pdcp_lte_test_discard_sdu.cc)
|
||||
target_link_libraries(pdcp_lte_test_discard_sdu srsran_pdcp srsran_common)
|
||||
add_test(pdcp_lte_test_discard_sdu pdcp_lte_test_discard_sdu)
|
||||
|
||||
add_executable(pdcp_lte_test_status_report pdcp_lte_test_status_report.cc)
|
||||
target_link_libraries(pdcp_lte_test_status_report srsran_pdcp srsran_common)
|
||||
add_test(pdcp_lte_test_status_report pdcp_lte_test_status_report)
|
||||
|
||||
########################################################################
|
||||
# Option to run command after build (useful for remote builds)
|
||||
########################################################################
|
||||
if (NOT ${BUILD_CMD} STREQUAL "")
|
||||
message(STATUS "Added custom post-build command: ${BUILD_CMD}")
|
||||
add_custom_command(TARGET ip_test POST_BUILD COMMAND ${BUILD_CMD})
|
||||
else(NOT ${BUILD_CMD} STREQUAL "")
|
||||
message(STATUS "No post-build command defined")
|
||||
endif (NOT ${BUILD_CMD} STREQUAL "")
|
@ -1,93 +0,0 @@
|
||||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
* srsRAN is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsRAN is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSENB_NR_CC_WORKER_H
|
||||
#define SRSENB_NR_CC_WORKER_H
|
||||
|
||||
#include "srsenb/hdr/phy/phy_interfaces.h"
|
||||
#include "srsran/interfaces/gnb_interfaces.h"
|
||||
#include "srsran/interfaces/rrc_nr_interface_types.h"
|
||||
#include "srsran/phy/enb/enb_dl_nr.h"
|
||||
#include "srsran/srslog/srslog.h"
|
||||
#include "srsran/srsran.h"
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace srsenb {
|
||||
namespace nr {
|
||||
|
||||
struct phy_nr_args_t {
|
||||
uint32_t nof_carriers = 1;
|
||||
uint32_t nof_ports = 1;
|
||||
srsran_enb_dl_nr_args_t dl = {};
|
||||
};
|
||||
|
||||
class phy_nr_state
|
||||
{
|
||||
public:
|
||||
phy_cell_cfg_list_nr_t cell_list = {};
|
||||
phy_nr_args_t args;
|
||||
srsran::phy_cfg_nr_t cfg;
|
||||
|
||||
phy_nr_state()
|
||||
{
|
||||
args.nof_carriers = 1;
|
||||
args.dl.nof_max_prb = 100;
|
||||
args.dl.nof_tx_antennas = 1;
|
||||
args.dl.pdsch.measure_evm = true;
|
||||
args.dl.pdsch.measure_time = true;
|
||||
args.dl.pdsch.sch.disable_simd = false;
|
||||
}
|
||||
};
|
||||
|
||||
class cc_worker
|
||||
{
|
||||
public:
|
||||
cc_worker(uint32_t cc_idx, srslog::basic_logger& logger, phy_nr_state& phy_state_);
|
||||
~cc_worker();
|
||||
|
||||
bool set_carrier(const srsran_carrier_nr_t* carrier);
|
||||
void set_tti(uint32_t tti);
|
||||
|
||||
cf_t* get_tx_buffer(uint32_t antenna_idx);
|
||||
cf_t* get_rx_buffer(uint32_t antenna_idx);
|
||||
uint32_t get_buffer_len();
|
||||
|
||||
bool work_dl(const srsran_slot_cfg_t& dl_slot_cfg, stack_interface_phy_nr::dl_sched_t& dl_grants);
|
||||
|
||||
private:
|
||||
int encode_pdsch(stack_interface_phy_nr::dl_sched_grant_t* grants, uint32_t nof_grants);
|
||||
int encode_pdcch_dl(stack_interface_phy_nr::dl_sched_grant_t* grants, uint32_t nof_grants);
|
||||
|
||||
srsran_slot_cfg_t dl_slot_cfg = {};
|
||||
uint32_t cc_idx = 0;
|
||||
std::array<cf_t*, SRSRAN_MAX_PORTS> tx_buffer = {};
|
||||
std::array<cf_t*, SRSRAN_MAX_PORTS> rx_buffer = {};
|
||||
uint32_t buffer_sz = 0;
|
||||
phy_nr_state& phy_state;
|
||||
srsran_enb_dl_nr_t enb_dl = {};
|
||||
srslog::basic_logger& logger;
|
||||
};
|
||||
|
||||
} // namespace nr
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSENB_NR_CC_WORKER_H
|
@ -1,73 +0,0 @@
|
||||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
* srsRAN is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsRAN is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSENB_NR_PHCH_WORKER_H
|
||||
#define SRSENB_NR_PHCH_WORKER_H
|
||||
|
||||
#include "cc_worker.h"
|
||||
#include "srsran/common/thread_pool.h"
|
||||
#include "srsran/interfaces/phy_common_interface.h"
|
||||
#include "srsran/srslog/srslog.h"
|
||||
|
||||
namespace srsenb {
|
||||
namespace nr {
|
||||
|
||||
/**
|
||||
* The sf_worker class handles the PHY processing, UL and DL procedures associated with 1 subframe.
|
||||
* It contains multiple cc_worker objects, one for each component carrier which may be executed in
|
||||
* one or multiple threads.
|
||||
*
|
||||
* A sf_worker object is executed by a thread within the thread_pool.
|
||||
*/
|
||||
|
||||
class sf_worker final : public srsran::thread_pool::worker
|
||||
{
|
||||
public:
|
||||
sf_worker(srsran::phy_common_interface& common_, phy_nr_state& phy_state_, srslog::basic_logger& logger);
|
||||
~sf_worker();
|
||||
|
||||
bool set_carrier_unlocked(uint32_t cc_idx, const srsran_carrier_nr_t* carrier_);
|
||||
|
||||
/* Functions used by main PHY thread */
|
||||
cf_t* get_buffer_rx(uint32_t cc_idx, uint32_t antenna_idx);
|
||||
cf_t* get_buffer_tx(uint32_t cc_idx, uint32_t antenna_idx);
|
||||
uint32_t get_buffer_len();
|
||||
void set_tti(uint32_t tti);
|
||||
|
||||
private:
|
||||
/* Inherited from thread_pool::worker. Function called every subframe to run the DL/UL processing */
|
||||
void work_imp() override;
|
||||
|
||||
std::vector<std::unique_ptr<cc_worker> > cc_workers;
|
||||
|
||||
srsran::phy_common_interface& common;
|
||||
phy_nr_state& phy_state;
|
||||
srslog::basic_logger& logger;
|
||||
|
||||
// Temporal attributes
|
||||
srsran_softbuffer_tx_t softbuffer_tx = {};
|
||||
std::vector<uint8_t> data;
|
||||
};
|
||||
|
||||
} // namespace nr
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSENB_NR_PHCH_WORKER_H
|
@ -0,0 +1,90 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSENB_NR_SLOT_WORKER_H
|
||||
#define SRSENB_NR_SLOT_WORKER_H
|
||||
|
||||
#include "srsran/common/thread_pool.h"
|
||||
#include "srsran/interfaces/gnb_interfaces.h"
|
||||
#include "srsran/interfaces/phy_common_interface.h"
|
||||
#include "srsran/srslog/srslog.h"
|
||||
#include "srsran/srsran.h"
|
||||
|
||||
namespace srsenb {
|
||||
namespace nr {
|
||||
|
||||
/**
|
||||
* The slot_worker class handles the PHY processing, UL and DL procedures associated with 1 slot.
|
||||
*
|
||||
* A slot_worker object is executed by a thread within the thread_pool.
|
||||
*/
|
||||
|
||||
class slot_worker final : public srsran::thread_pool::worker
|
||||
{
|
||||
public:
|
||||
struct args_t {
|
||||
uint32_t cell_index = 0;
|
||||
srsran_carrier_nr_t carrier = {};
|
||||
uint32_t nof_tx_ports = 1;
|
||||
uint32_t nof_rx_ports = 1;
|
||||
uint32_t pusch_max_nof_iter = 10;
|
||||
srsran_pdcch_cfg_nr_t pdcch_cfg = {}; ///< PDCCH configuration
|
||||
};
|
||||
|
||||
slot_worker(srsran::phy_common_interface& common_, stack_interface_phy_nr& stack_, srslog::basic_logger& logger);
|
||||
~slot_worker();
|
||||
|
||||
bool init(const args_t& args);
|
||||
|
||||
/* Functions used by main PHY thread */
|
||||
cf_t* get_buffer_rx(uint32_t antenna_idx);
|
||||
cf_t* get_buffer_tx(uint32_t antenna_idx);
|
||||
uint32_t get_buffer_len();
|
||||
void set_time(const uint32_t& tti, const srsran::rf_timestamp_t& timestamp);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Inherited from thread_pool::worker. Function called every slot to run the DL/UL processing
|
||||
*/
|
||||
void work_imp() override;
|
||||
|
||||
/**
|
||||
* @brief Retrieves the scheduling results for the UL processing and performs reception
|
||||
* @return True if no error occurs, false otherwise
|
||||
*/
|
||||
bool work_ul();
|
||||
|
||||
/**
|
||||
* @brief Retrieves the scheduling results for the DL processing and performs transmission
|
||||
* @return True if no error occurs, false otherwise
|
||||
*/
|
||||
bool work_dl();
|
||||
|
||||
srsran::phy_common_interface& common;
|
||||
stack_interface_phy_nr& stack;
|
||||
srslog::basic_logger& logger;
|
||||
|
||||
uint32_t sf_len = 0;
|
||||
uint32_t cell_index = 0;
|
||||
srsran_slot_cfg_t dl_slot_cfg = {};
|
||||
srsran_slot_cfg_t ul_slot_cfg = {};
|
||||
srsran_pdcch_cfg_nr_t pdcch_cfg = {};
|
||||
srsran::rf_timestamp_t tx_time = {};
|
||||
srsran_enb_dl_nr_t gnb_dl = {};
|
||||
std::vector<cf_t*> tx_buffer; ///< Baseband transmit buffers
|
||||
std::vector<cf_t*> rx_buffer; ///< Baseband receive buffers
|
||||
};
|
||||
|
||||
} // namespace nr
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSENB_NR_PHCH_WORKER_H
|
@ -0,0 +1,67 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_SCHED_NR_H
|
||||
#define SRSRAN_SCHED_NR_H
|
||||
|
||||
#include "sched_nr_common.h"
|
||||
#include "sched_nr_interface.h"
|
||||
#include "sched_nr_ue.h"
|
||||
#include "srsran/adt/pool/cached_alloc.h"
|
||||
#include "srsran/common/tti_point.h"
|
||||
#include <array>
|
||||
extern "C" {
|
||||
#include "srsran/config.h"
|
||||
}
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
namespace sched_nr_impl {
|
||||
class sched_worker_manager;
|
||||
}
|
||||
|
||||
class ue_event_manager;
|
||||
|
||||
class sched_nr final : public sched_nr_interface
|
||||
{
|
||||
public:
|
||||
explicit sched_nr(const sched_cfg_t& sched_cfg);
|
||||
~sched_nr() override;
|
||||
int cell_cfg(srsran::const_span<cell_cfg_t> cell_list) override;
|
||||
void ue_cfg(uint16_t rnti, const ue_cfg_t& cfg) override;
|
||||
|
||||
void slot_indication(tti_point tti_rx) override;
|
||||
int generate_sched_result(tti_point tti_rx, uint32_t cc, tti_request_t& tti_req) override;
|
||||
|
||||
void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) override;
|
||||
void ul_sr_info(tti_point tti_rx, uint16_t rnti) override;
|
||||
|
||||
private:
|
||||
void ue_cfg_impl(uint16_t rnti, const ue_cfg_t& cfg);
|
||||
|
||||
// args
|
||||
sched_nr_impl::sched_params cfg;
|
||||
|
||||
using sched_worker_manager = sched_nr_impl::sched_worker_manager;
|
||||
std::unique_ptr<sched_worker_manager> sched_workers;
|
||||
|
||||
using ue_map_t = sched_nr_impl::ue_map_t;
|
||||
std::mutex ue_db_mutex;
|
||||
ue_map_t ue_db;
|
||||
|
||||
// management of PHY UE feedback
|
||||
std::unique_ptr<ue_event_manager> pending_events;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_SCHED_NR_H
|
@ -0,0 +1,102 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_SCHED_NR_COMMON_H
|
||||
#define SRSRAN_SCHED_NR_COMMON_H
|
||||
|
||||
#include "sched_nr_interface.h"
|
||||
#include "srsran/adt/bounded_bitset.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
const static size_t SCHED_NR_MAX_USERS = 4;
|
||||
const static size_t SCHED_NR_NOF_SUBFRAMES = 10;
|
||||
const static size_t SCHED_NR_NOF_HARQS = 16;
|
||||
static const size_t MAX_NOF_AGGR_LEVELS = 5;
|
||||
|
||||
namespace sched_nr_impl {
|
||||
|
||||
const static size_t MAX_GRANTS = sched_nr_interface::MAX_GRANTS;
|
||||
|
||||
using sched_cfg_t = sched_nr_interface::sched_cfg_t;
|
||||
using cell_cfg_t = sched_nr_interface::cell_cfg_t;
|
||||
|
||||
struct sched_cell_params {
|
||||
const uint32_t cc;
|
||||
const cell_cfg_t cell_cfg;
|
||||
const sched_cfg_t& sched_cfg;
|
||||
|
||||
sched_cell_params(uint32_t cc_, const cell_cfg_t& cell, const sched_cfg_t& sched_cfg_);
|
||||
};
|
||||
|
||||
struct sched_params {
|
||||
const sched_cfg_t sched_cfg;
|
||||
std::vector<sched_cell_params> cells;
|
||||
|
||||
explicit sched_params(const sched_cfg_t& sched_cfg_);
|
||||
};
|
||||
|
||||
using pdcchmask_t = srsran::bounded_bitset<SCHED_NR_MAX_NOF_RBGS, true>;
|
||||
using rbgmask_t = srsran::bounded_bitset<SCHED_NR_MAX_NOF_RBGS, true>;
|
||||
|
||||
struct resource_guard {
|
||||
public:
|
||||
resource_guard() = default;
|
||||
resource_guard(const resource_guard& other) = delete;
|
||||
resource_guard(resource_guard&& other) = delete;
|
||||
resource_guard& operator=(const resource_guard& other) = delete;
|
||||
resource_guard& operator=(resource_guard&& other) = delete;
|
||||
bool busy() const { return flag; }
|
||||
|
||||
struct token {
|
||||
token() = default;
|
||||
token(resource_guard& parent) : flag(parent.busy() ? nullptr : &parent.flag)
|
||||
{
|
||||
if (flag != nullptr) {
|
||||
*flag = true;
|
||||
}
|
||||
}
|
||||
token(token&&) noexcept = default;
|
||||
token& operator=(token&&) noexcept = default;
|
||||
void release() { flag.reset(); }
|
||||
bool owns_token() const { return flag != nullptr; }
|
||||
bool empty() const { return flag == nullptr; }
|
||||
|
||||
private:
|
||||
struct release_deleter {
|
||||
void operator()(bool* ptr)
|
||||
{
|
||||
if (ptr != nullptr) {
|
||||
srsran_assert(*ptr == true, "resource token: detected inconsistency token state");
|
||||
*ptr = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
std::unique_ptr<bool, release_deleter> flag;
|
||||
};
|
||||
|
||||
private:
|
||||
bool flag = false;
|
||||
};
|
||||
|
||||
using pdcch_cce_pos_list = srsran::bounded_vector<uint32_t, SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR>;
|
||||
using bwp_cce_pos_list = std::array<std::array<pdcch_cce_pos_list, MAX_NOF_AGGR_LEVELS>, SRSRAN_NOF_SF_X_FRAME>;
|
||||
void get_dci_locs(const srsran_coreset_t& coreset,
|
||||
const srsran_search_space_t& search_space,
|
||||
uint16_t rnti,
|
||||
bwp_cce_pos_list& cce_locs);
|
||||
|
||||
} // namespace sched_nr_impl
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_SCHED_NR_COMMON_H
|
@ -0,0 +1,114 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_SCHED_NR_HARQ_H
|
||||
#define SRSRAN_SCHED_NR_HARQ_H
|
||||
|
||||
#include "sched_nr_common.h"
|
||||
#include "srsran/common/tti_point.h"
|
||||
#include <array>
|
||||
|
||||
namespace srsenb {
|
||||
namespace sched_nr_impl {
|
||||
|
||||
class harq_proc
|
||||
{
|
||||
public:
|
||||
explicit harq_proc(uint32_t id_) : pid(id_) {}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return std::all_of(tb.begin(), tb.end(), [](const tb_t& t) { return not t.active; });
|
||||
}
|
||||
bool empty(uint32_t tb_idx) const { return not tb[tb_idx].active; }
|
||||
bool has_pending_retx(tti_point tti_rx) const { return not empty() and not tb[0].ack_state and tti_ack <= tti_rx; }
|
||||
uint32_t nof_retx() const { return tb[0].n_rtx; }
|
||||
uint32_t max_nof_retx() const { return max_retx; }
|
||||
uint32_t tbs() const { return tb[0].tbs; }
|
||||
uint32_t ndi() const { return tb[0].ndi; }
|
||||
uint32_t mcs() const { return tb[0].mcs; }
|
||||
|
||||
bool ack_info(uint32_t tb_idx, bool ack);
|
||||
|
||||
void new_tti(tti_point tti_rx);
|
||||
void reset();
|
||||
bool
|
||||
new_tx(tti_point tti_tx, tti_point tti_ack, const rbgmask_t& rbgmask, uint32_t mcs, uint32_t tbs, uint32_t max_retx);
|
||||
bool new_retx(tti_point tti_tx, tti_point tti_ack, const rbgmask_t& rbgmask, int* mcs, int* tbs);
|
||||
|
||||
const uint32_t pid;
|
||||
|
||||
private:
|
||||
struct tb_t {
|
||||
bool active = false;
|
||||
bool ack_state = false;
|
||||
bool ndi = false;
|
||||
uint32_t n_rtx = 0;
|
||||
uint32_t mcs = 0;
|
||||
uint32_t tbs = 0;
|
||||
};
|
||||
|
||||
uint32_t max_retx = 1;
|
||||
tti_point tti_tx;
|
||||
tti_point tti_ack;
|
||||
rbgmask_t rbgmask;
|
||||
std::array<tb_t, SCHED_NR_MAX_TB> tb;
|
||||
};
|
||||
|
||||
class harq_entity
|
||||
{
|
||||
public:
|
||||
explicit harq_entity(uint32_t nof_harq_procs = SCHED_NR_MAX_HARQ);
|
||||
void new_tti(tti_point tti_rx_);
|
||||
|
||||
void dl_ack_info(uint32_t pid, uint32_t tb_idx, bool ack) { dl_harqs[pid].ack_info(tb_idx, ack); }
|
||||
|
||||
harq_proc* find_pending_dl_retx()
|
||||
{
|
||||
return find_dl([this](const harq_proc& h) { return h.has_pending_retx(tti_rx); });
|
||||
}
|
||||
harq_proc* find_pending_ul_retx()
|
||||
{
|
||||
return find_ul([this](const harq_proc& h) { return h.has_pending_retx(tti_rx); });
|
||||
}
|
||||
harq_proc* find_empty_dl_harq()
|
||||
{
|
||||
return find_dl([](const harq_proc& h) { return h.empty(); });
|
||||
}
|
||||
harq_proc* find_empty_ul_harq()
|
||||
{
|
||||
return find_ul([](const harq_proc& h) { return h.empty(); });
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Predicate>
|
||||
harq_proc* find_dl(Predicate p)
|
||||
{
|
||||
auto it = std::find_if(dl_harqs.begin(), dl_harqs.end(), p);
|
||||
return (it == dl_harqs.end()) ? nullptr : &(*it);
|
||||
}
|
||||
template <typename Predicate>
|
||||
harq_proc* find_ul(Predicate p)
|
||||
{
|
||||
auto it = std::find_if(ul_harqs.begin(), ul_harqs.end(), p);
|
||||
return (it == ul_harqs.end()) ? nullptr : &(*it);
|
||||
}
|
||||
|
||||
tti_point tti_rx;
|
||||
std::vector<harq_proc> dl_harqs;
|
||||
std::vector<harq_proc> ul_harqs;
|
||||
};
|
||||
|
||||
} // namespace sched_nr_impl
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_SCHED_NR_HARQ_H
|
@ -0,0 +1,128 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_SCHED_NR_INTERFACE_H
|
||||
#define SRSRAN_SCHED_NR_INTERFACE_H
|
||||
|
||||
#include "srsran/adt/bounded_bitset.h"
|
||||
#include "srsran/adt/bounded_vector.h"
|
||||
#include "srsran/adt/span.h"
|
||||
#include "srsran/common/tti_point.h"
|
||||
#include "srsran/interfaces/gnb_interfaces.h"
|
||||
#include "srsran/interfaces/rrc_nr_interface_types.h"
|
||||
#include "srsran/phy/phch/dci_nr.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
const static size_t SCHED_NR_MAX_CARRIERS = 4;
|
||||
const static uint16_t SCHED_NR_INVALID_RNTI = 0;
|
||||
const static size_t SCHED_NR_MAX_PDSCH_DATA = 16;
|
||||
const static size_t SCHED_NR_MAX_NOF_RBGS = 25;
|
||||
const static size_t SCHED_NR_MAX_UL_ALLOCS = 16;
|
||||
const static size_t SCHED_NR_MAX_TB = 1;
|
||||
const static size_t SCHED_NR_MAX_HARQ = 16;
|
||||
const static size_t SCHED_NR_MAX_BWP_PER_CELL = 1;
|
||||
|
||||
class sched_nr_interface
|
||||
{
|
||||
public:
|
||||
using pdcch_bitmap = srsran::bounded_bitset<SCHED_NR_MAX_NOF_RBGS, true>;
|
||||
using rbg_bitmap = srsran::bounded_bitset<SCHED_NR_MAX_NOF_RBGS, true>;
|
||||
|
||||
///// Configuration /////
|
||||
|
||||
struct pdsch_td_res_alloc {
|
||||
uint8_t k0 = 0; // 0..32
|
||||
uint8_t k1 = 4; // 0..32
|
||||
};
|
||||
using pdsch_td_res_alloc_list = srsran::bounded_vector<pdsch_td_res_alloc, SCHED_NR_MAX_UL_ALLOCS>;
|
||||
struct pusch_td_res_alloc {
|
||||
uint8_t k2 = 4; // 0..32
|
||||
};
|
||||
using pusch_td_res_alloc_list = srsran::bounded_vector<pusch_td_res_alloc, SCHED_NR_MAX_UL_ALLOCS>;
|
||||
|
||||
struct bwp_cfg_t {
|
||||
uint32_t start_rb = 0;
|
||||
uint32_t rb_width = 100;
|
||||
};
|
||||
|
||||
struct cell_cfg_t {
|
||||
uint32_t nof_prb = 100;
|
||||
uint32_t nof_rbg = 25;
|
||||
srsran::bounded_vector<bwp_cfg_t, SCHED_NR_MAX_BWP_PER_CELL> bwps{1};
|
||||
};
|
||||
|
||||
struct sched_cfg_t {
|
||||
uint32_t nof_concurrent_subframes = 1;
|
||||
};
|
||||
|
||||
struct ue_cc_cfg_t {
|
||||
bool active = false;
|
||||
pdsch_td_res_alloc_list pdsch_res_list{1};
|
||||
pusch_td_res_alloc_list pusch_res_list{1};
|
||||
};
|
||||
|
||||
struct ue_cfg_t {
|
||||
uint32_t maxharq_tx = 4;
|
||||
srsran::bounded_vector<ue_cc_cfg_t, SCHED_NR_MAX_CARRIERS> carriers;
|
||||
srsran::phy_cfg_nr_t phy_cfg = {};
|
||||
};
|
||||
|
||||
///// Sched Result /////
|
||||
|
||||
const static int MAX_GRANTS = 64;
|
||||
|
||||
using pdcch_dl_t = mac_interface_phy_nr::pdcch_dl_t;
|
||||
using pdcch_ul_t = mac_interface_phy_nr::pdcch_ul_t;
|
||||
using pdcch_dl_list_t = srsran::bounded_vector<pdcch_dl_t, MAX_GRANTS>;
|
||||
using pdcch_ul_list_t = srsran::bounded_vector<pdcch_ul_t, MAX_GRANTS>;
|
||||
|
||||
struct pdsch_t {
|
||||
srsran_sch_cfg_nr_t sch = {}; ///< PDSCH configuration
|
||||
};
|
||||
using pdsch_list_t = srsran::bounded_vector<pdsch_t, SCHED_NR_MAX_PDSCH_DATA>;
|
||||
|
||||
struct dl_tti_request_t {
|
||||
tti_point pdsch_tti;
|
||||
pdcch_dl_list_t pdcchs;
|
||||
pdsch_list_t pdschs;
|
||||
};
|
||||
|
||||
struct pusch_grant {
|
||||
srsran_dci_ul_nr_t dci;
|
||||
rbg_bitmap bitmap;
|
||||
};
|
||||
using pusch_list = srsran::bounded_vector<pusch_grant, SCHED_NR_MAX_PDSCH_DATA>;
|
||||
|
||||
struct ul_tti_request_t {
|
||||
tti_point pusch_tti;
|
||||
srsran::bounded_vector<pusch_grant, SCHED_NR_MAX_UL_ALLOCS> pusch;
|
||||
};
|
||||
|
||||
struct tti_request_t {
|
||||
dl_tti_request_t dl_res;
|
||||
ul_tti_request_t ul_res;
|
||||
};
|
||||
|
||||
virtual ~sched_nr_interface() = default;
|
||||
virtual int cell_cfg(srsran::const_span<sched_nr_interface::cell_cfg_t> ue_cfg) = 0;
|
||||
virtual void ue_cfg(uint16_t rnti, const ue_cfg_t& ue_cfg) = 0;
|
||||
virtual void slot_indication(tti_point tti_rx) = 0;
|
||||
virtual int generate_sched_result(tti_point tti_rx, uint32_t cc, tti_request_t& result) = 0;
|
||||
|
||||
virtual void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) = 0;
|
||||
virtual void ul_sr_info(tti_point, uint16_t rnti) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_SCHED_NR_INTERFACE_H
|
@ -0,0 +1,101 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_SCHED_NR_PDCCH_H
|
||||
#define SRSRAN_SCHED_NR_PDCCH_H
|
||||
|
||||
#include "srsenb/hdr/stack/mac/nr/sched_nr_common.h"
|
||||
#include "srsran/adt/bounded_bitset.h"
|
||||
#include "srsran/adt/bounded_vector.h"
|
||||
#include "srsran/phy/common/phy_common_nr.h"
|
||||
#include "srsran/phy/phch/dci.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
namespace sched_nr_impl {
|
||||
|
||||
using coreset_bitmap = srsran::bounded_bitset<SRSRAN_CORESET_FREQ_DOMAIN_RES_SIZE * SRSRAN_CORESET_DURATION_MAX, true>;
|
||||
|
||||
enum class pdcch_grant_type_t { sib, dl_data, ul_data };
|
||||
|
||||
class slot_ue;
|
||||
|
||||
using pdcch_dl_t = sched_nr_interface::pdcch_dl_t;
|
||||
using pdcch_dl_list_t = sched_nr_interface::pdcch_dl_list_t;
|
||||
using pdcch_ul_t = sched_nr_interface::pdcch_ul_t;
|
||||
using pdcch_ul_list_t = sched_nr_interface::pdcch_ul_list_t;
|
||||
|
||||
class coreset_region
|
||||
{
|
||||
public:
|
||||
coreset_region(uint32_t bwp_id_,
|
||||
uint32_t slot_idx,
|
||||
uint32_t nof_td_symbols,
|
||||
uint32_t nof_freq_resources,
|
||||
pdcch_dl_list_t& pdcch_list);
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* Allocates DCI space in PDCCH, avoiding in the process collisions with other users
|
||||
* @param pdcch_grant_type_t allocation type (e.g. DL data, UL data, SIB)
|
||||
* @param aggr_idx Aggregation level index (0..4)
|
||||
* @param user UE object or null in case of broadcast/RAR/paging allocation
|
||||
* @return if the allocation was successful
|
||||
*/
|
||||
bool alloc_dci(pdcch_grant_type_t alloc_type, uint32_t aggr_idx, uint32_t coreset_id, slot_ue* user = nullptr);
|
||||
|
||||
void rem_last_dci();
|
||||
|
||||
uint32_t get_td_symbols() const { return nof_symbols; }
|
||||
uint32_t get_freq_resources() const { return nof_freq_res; }
|
||||
uint32_t nof_cces() const { return nof_freq_res * nof_symbols; }
|
||||
size_t nof_allocs() const { return dfs_tree.size(); }
|
||||
|
||||
private:
|
||||
uint32_t bwp_id;
|
||||
uint32_t slot_idx;
|
||||
uint32_t nof_symbols;
|
||||
uint32_t nof_freq_res;
|
||||
|
||||
// List of PDCCH grants
|
||||
struct alloc_record {
|
||||
uint32_t coreset_id;
|
||||
uint32_t aggr_idx;
|
||||
uint32_t idx;
|
||||
pdcch_grant_type_t alloc_type;
|
||||
slot_ue* ue;
|
||||
};
|
||||
srsran::bounded_vector<alloc_record, MAX_GRANTS> dci_list;
|
||||
pdcch_dl_list_t& pdcch_dl_list;
|
||||
|
||||
// DFS decision tree of PDCCH grants
|
||||
struct tree_node {
|
||||
uint16_t rnti = SRSRAN_INVALID_RNTI;
|
||||
uint32_t record_idx = 0;
|
||||
uint32_t dci_pos_idx = 0;
|
||||
srsran_dci_location_t dci_pos = {0, 0};
|
||||
/// Accumulation of all PDCCH masks for the current solution (DFS path)
|
||||
coreset_bitmap total_mask, current_mask;
|
||||
};
|
||||
using alloc_tree_dfs_t = srsran::bounded_vector<tree_node, MAX_GRANTS>;
|
||||
alloc_tree_dfs_t dfs_tree, saved_dfs_tree;
|
||||
|
||||
srsran::span<const uint32_t> get_cce_loc_table(const alloc_record& record) const;
|
||||
bool alloc_dfs_node(const alloc_record& record, uint32_t dci_idx);
|
||||
bool get_next_dfs();
|
||||
};
|
||||
|
||||
} // namespace sched_nr_impl
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_SCHED_NR_PDCCH_H
|
@ -0,0 +1,33 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_SCHED_NR_PHY_HELPERS_H
|
||||
#define SRSRAN_SCHED_NR_PHY_HELPERS_H
|
||||
|
||||
#include "sched_nr_common.h"
|
||||
|
||||
namespace srsenb {
|
||||
namespace sched_nr_impl {
|
||||
|
||||
uint32_t get_P(uint32_t bwp_nof_prb, bool config_1_or_2);
|
||||
uint32_t get_nof_rbgs(uint32_t bwp_nof_prb, uint32_t bwp_start, bool config1_or_2);
|
||||
|
||||
void bitmap_to_prb_array(const rbgmask_t& bitmap, uint32_t bwp_nof_prb, srsran_sch_grant_nr_t& grant);
|
||||
|
||||
class slot_ue;
|
||||
void fill_dci_ue_cfg(const slot_ue& ue, srsran_dci_dl_nr_t& dci);
|
||||
void fill_dci_ue_cfg(const slot_ue& ue, srsran_dci_ul_nr_t& dci);
|
||||
|
||||
} // namespace sched_nr_impl
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_SCHED_NR_PHY_HELPERS_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue