nr,gnb,mac: prioritize CRNTI CE handling over remaining SDUs and CEs in gNB mac receiver

This commit is contained in:
Francisco 2021-11-02 10:32:23 +00:00 committed by Francisco Paisana
parent 4286ab81d9
commit c615df9d1d
4 changed files with 26 additions and 23 deletions

View File

@ -29,7 +29,7 @@ class mac_sch_subpdu_nr
{
public:
// 3GPP 38.321 v15.3.0 Combined Tables 6.2.1-1, 6.2.1-2
typedef enum {
enum nr_lcid_sch_t {
// Values for DL-SCH
CCCH = 0b000000,
DRX_CMD = 0b111100,
@ -44,12 +44,14 @@ public:
CCCH_SIZE_64 = 0b000000,
SE_PHR = 0b111001, // Single Entry PHR
MIN_LCID = 0b000001,
MAX_LCID = 0b100000,
SHORT_BSR = 0b111101,
LONG_BSR = 0b111110,
// Common
PADDING = 0b111111,
} nr_lcid_sch_t;
};
// SDUs up to 256 B can use the short 8-bit L field
static const int32_t MAC_SUBHEADER_LEN_THRESHOLD = 256;
@ -188,7 +190,7 @@ public:
void pack();
int unpack(const uint8_t* payload, const uint32_t& len);
uint32_t get_num_subpdus();
uint32_t get_num_subpdus() const { return subpdus.size(); }
const mac_sch_subpdu_nr& get_subpdu(const uint32_t& index) const;
mac_sch_subpdu_nr& get_subpdu(uint32_t index);
bool is_ulsch();

View File

@ -444,11 +444,6 @@ int mac_sch_pdu_nr::unpack(const uint8_t* payload, const uint32_t& len)
return SRSRAN_SUCCESS;
}
uint32_t mac_sch_pdu_nr::get_num_subpdus()
{
return subpdus.size();
}
const mac_sch_subpdu_nr& mac_sch_pdu_nr::get_subpdu(const uint32_t& index) const
{
return subpdus.at(index);

View File

@ -71,7 +71,7 @@ public:
private:
// helper methods
uint32_t buff_size_field_to_bytes(uint32_t buff_size_index, const srsran::bsr_format_nr_t& format);
int process_ce_subpdu(srsran::mac_sch_subpdu_nr& subpdu);
int process_ce_subpdu(const srsran::mac_sch_subpdu_nr& subpdu);
rlc_interface_mac* rlc = nullptr;
rrc_interface_mac_nr* rrc = nullptr;

View File

@ -74,29 +74,35 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu)
logger.info("Rx PDU: rnti=0x%x, %s", rnti, srsran::to_c_str(str_buffer));
}
// First, process MAC CEs in reverse order (CE like C-RNTI get handled first)
for (uint32_t n = mac_pdu_ul.get_num_subpdus(), i = mac_pdu_ul.get_num_subpdus() - 1; n > 0; --n, i = n - 1) {
srsran::mac_sch_subpdu_nr subpdu = mac_pdu_ul.get_subpdu(i);
if (not subpdu.is_sdu()) {
// Process MAC CRNTI CE first, if it exists
uint32_t crnti_ce_pos = mac_pdu_ul.get_num_subpdus();
for (uint32_t n = mac_pdu_ul.get_num_subpdus(); n > 0; --n) {
srsran::mac_sch_subpdu_nr& subpdu = mac_pdu_ul.get_subpdu(n - 1);
if (subpdu.is_sdu() and subpdu.get_lcid() == srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::CRNTI) {
if (process_ce_subpdu(subpdu) != SRSRAN_SUCCESS) {
return SRSRAN_ERROR;
}
crnti_ce_pos = n - 1;
}
}
// Process SDUs and remaining MAC CEs
for (uint32_t n = 0; n < mac_pdu_ul.get_num_subpdus(); ++n) {
srsran::mac_sch_subpdu_nr& subpdu = mac_pdu_ul.get_subpdu(n);
if (subpdu.is_sdu()) {
rrc->set_activity_user(rnti);
rlc->write_pdu(rnti, subpdu.get_lcid(), subpdu.get_sdu(), subpdu.get_sdu_length());
} else if (n != crnti_ce_pos) {
if (process_ce_subpdu(subpdu) != SRSRAN_SUCCESS) {
return SRSRAN_ERROR;
}
}
}
// Second, handle all SDUs in order to avoid unnecessary reordering at higher layers
for (uint32_t i = 0; i < mac_pdu_ul.get_num_subpdus(); ++i) {
srsran::mac_sch_subpdu_nr subpdu = mac_pdu_ul.get_subpdu(i);
if (subpdu.is_sdu()) {
rrc->set_activity_user(rnti);
rlc->write_pdu(rnti, subpdu.get_lcid(), subpdu.get_sdu(), subpdu.get_sdu_length());
}
}
return SRSRAN_SUCCESS;
}
int ue_nr::process_ce_subpdu(srsran::mac_sch_subpdu_nr& subpdu)
int ue_nr::process_ce_subpdu(const srsran::mac_sch_subpdu_nr& subpdu)
{
// Handle MAC CEs
switch (subpdu.get_lcid()) {