sched,nr: provide allocated byte_buffer in DL sched output + changes in RA procedure + added sched nr in default nr_phy_tests

master
Francisco Paisana 3 years ago
parent 04ef6e120d
commit 8e174c96ed

@ -56,11 +56,12 @@ public:
bool new_retx(slot_point slot_tx, slot_point slot_ack, const prb_grant& grant);
bool new_retx(slot_point slot_tx, slot_point slot_ack);
const uint32_t pid;
protected:
// NOTE: Has to be used before first tx is dispatched
bool set_tbs(uint32_t tbs);
const uint32_t pid;
private:
struct tb_t {
bool active = false;
@ -81,11 +82,10 @@ private:
class dl_harq_proc : public harq_proc
{
public:
dl_harq_proc(uint32_t id_, uint32_t nprb) :
harq_proc(id_), softbuffer(harq_softbuffer_pool::get_instance().get_tx(nprb))
{}
dl_harq_proc(uint32_t id_, uint32_t nprb);
tx_harq_softbuffer& get_softbuffer() { return *softbuffer; }
uint8_t* get_tx_pdu() { return pdu->msg; }
bool set_tbs(uint32_t tbs)
{
@ -95,6 +95,7 @@ public:
private:
srsran::unique_pool_ptr<tx_harq_softbuffer> softbuffer;
srsran::unique_byte_buffer_t pdu;
};
class ul_harq_proc : public harq_proc

@ -82,10 +82,12 @@ public:
struct dl_sched_rar_info_t {
uint32_t preamble_idx;
uint32_t ofdm_symbol_idx;
uint32_t freq_idx;
uint32_t ta_cmd;
uint16_t temp_crnti;
uint32_t msg3_size;
uint32_t prach_slot;
slot_point prach_slot;
};
///// Sched Result /////

@ -57,7 +57,8 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
static const uint32_t PRACH_RAR_OFFSET = 3;
slot_point pdcch_slot = slot_grid.get_pdcch_tti();
slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay;
if (not slot_grid.res_grid()[msg3_slot].is_ul) {
if (not slot_grid.res_grid()[pdcch_slot].is_dl or not slot_grid.res_grid()[msg3_slot].is_ul) {
// RAR only allowed if respective Msg3 slot is available for UL
return;
}
@ -113,24 +114,27 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
}
}
/// See TS 38.321, 5.1.3 - RAP transmission
int ra_sched::dl_rach_info(const dl_sched_rar_info_t& rar_info)
{
logger.info("SCHED: New PRACH tti=%d, preamble=%d, temp_crnti=0x%x, ta_cmd=%d, msg3_size=%d",
rar_info.prach_slot,
logger.info("SCHED: New PRACH slot=%d, preamble=%d, temp_crnti=0x%x, ta_cmd=%d, msg3_size=%d",
rar_info.prach_slot.to_uint(),
rar_info.preamble_idx,
rar_info.temp_crnti,
rar_info.ta_cmd,
rar_info.msg3_size);
// RA-RNTI = 1 + t_id + f_id
// t_id = index of first subframe specified by PRACH (0<=t_id<10)
// f_id = index of the PRACH within subframe, in ascending order of freq domain (0<=f_id<6) (for FDD, f_id=0)
uint16_t ra_rnti = 1 + (uint16_t)(rar_info.prach_slot % 10u);
// RA-RNTI = 1 + s_id + 14 × t_id + 14 × 80 × f_id + 14 × 80 × 8 × ul_carrier_id
// s_id = index of the first OFDM symbol (0 <= s_id < 14)
// t_id = index of first slot of the PRACH (0 <= t_id < 80)
// f_id = index of the PRACH in the freq domain (0 <= f_id < 8) (for FDD, f_id=0)
// ul_carrier_id = 0 for NUL and 1 for SUL carrier
uint16_t ra_rnti = 1 + rar_info.ofdm_symbol_idx + 14 * rar_info.prach_slot.slot_idx() + 14 * 80 * rar_info.freq_idx;
// find pending rar with same RA-RNTI
for (pending_rar_t& r : pending_rars) {
if (r.prach_slot.to_uint() == rar_info.prach_slot and ra_rnti == r.ra_rnti) {
if (r.msg3_grant.size() >= sched_interface::MAX_RAR_LIST) {
if (r.prach_slot == rar_info.prach_slot and ra_rnti == r.ra_rnti) {
if (r.msg3_grant.full()) {
logger.warning("PRACH ignored, as the the maximum number of RAR grants per tti has been reached");
return SRSRAN_ERROR;
}
@ -142,7 +146,7 @@ int ra_sched::dl_rach_info(const dl_sched_rar_info_t& rar_info)
// create new RAR
pending_rar_t p;
p.ra_rnti = ra_rnti;
p.prach_slot = slot_point{0, rar_info.prach_slot};
p.prach_slot = rar_info.prach_slot;
p.msg3_grant.push_back(rar_info);
pending_rars.push_back(p);

@ -11,6 +11,7 @@
*/
#include "srsenb/hdr/stack/mac/nr/sched_nr_harq.h"
#include "srsran/common/buffer_pool.h"
namespace srsenb {
namespace sched_nr_impl {
@ -100,6 +101,10 @@ bool harq_proc::new_retx(slot_point slot_tx_, slot_point slot_ack_)
return true;
}
dl_harq_proc::dl_harq_proc(uint32_t id_, uint32_t nprb) :
harq_proc(id_), softbuffer(harq_softbuffer_pool::get_instance().get_tx(nprb)), pdu(srsran::make_byte_buffer())
{}
harq_entity::harq_entity(uint32_t nprb, uint32_t nof_harq_procs)
{
// Create HARQs

@ -234,6 +234,7 @@ alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, const prb_grant& dl_gr
bool ret = ue.cfg->phy().get_pdsch_cfg(slot_cfg, pdcch.dci, pdsch.sch);
srsran_assert(ret, "Error converting DCI to grant");
pdsch.sch.grant.tb[0].softbuffer.tx = ue.h_dl->get_softbuffer().get();
pdsch.data[0] = ue.h_dl->get_tx_pdu();
if (ue.h_dl->nof_retx() == 0) {
ue.h_dl->set_tbs(pdsch.sch.grant.tb[0].tbs); // update HARQ with correct TBS
} else {

@ -60,6 +60,21 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB)
--ue.phy.nof_threads=${NR_PHY_TEST_UE_NOF_THREADS}
)
add_nr_test(nr_phy_test_10MHz_bidir_sched nr_phy_test
--duration=100 # 100 slots
--gnb.stack.pdsch.slots=0,1,2,3,4,5 # All possible DL slots
--gnb.stack.pdsch.start=0 # Start at RB 0
--gnb.stack.pdsch.length=52 # Full 10 MHz BW
--gnb.stack.pdsch.mcs=28 # Maximum MCS
--gnb.stack.pusch.slots=6,7,8,9 # All possible UL slots
--gnb.stack.pusch.start=0 # Start at RB 0
--gnb.stack.pusch.length=52 # Full 10 MHz BW
--gnb.stack.pusch.mcs=28 # Maximum MCS
--gnb.stack.use_dummy_sched=false # Use real NR scheduler
--gnb.phy.nof_threads=${NR_PHY_TEST_GNB_NOF_THREADS}
--ue.phy.nof_threads=${NR_PHY_TEST_UE_NOF_THREADS}
)
add_nr_test(nr_phy_test_10MHz_prach nr_phy_test
--duration=1000 # 100 slots
--gnb.stack.pdsch.slots=none # No PDSCH

Loading…
Cancel
Save