reworking configuration of LogicalChannelConfig at MAC UE
This commit is contained in:
@@ -648,25 +648,16 @@ static void configure_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_Config_t *pdcch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lcid_cmp(const void *lc1, const void *lc2, void *mac_inst)
|
static int lcid_cmp(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
uint8_t id1 = ((nr_lcordered_info_t *)lc1)->lcids_ordered;
|
long pa, pb;
|
||||||
uint8_t id2 = ((nr_lcordered_info_t *)lc2)->lcids_ordered;
|
memcpy(&pa, &((nr_lcordered_info_t*)a)->logicalChannelConfig->ul_SpecificParameters->priority, sizeof(pa));
|
||||||
NR_UE_MAC_INST_t *mac = (NR_UE_MAC_INST_t *)mac_inst;
|
memcpy(&pb, &((nr_lcordered_info_t*)b)->logicalChannelConfig->ul_SpecificParameters->priority, sizeof(pb));
|
||||||
|
if (pa < pb)
|
||||||
NR_LogicalChannelConfig_t **lc_config = &mac->logicalChannelConfig[0];
|
return -1;
|
||||||
|
else if (pa > pb)
|
||||||
AssertFatal(id1 > 0 && id2 > 0, "undefined logical channel identity\n");
|
return 1;
|
||||||
AssertFatal(lc_config[id1 - 1] != NULL || lc_config[id2 - 1] != NULL, "logical channel configuration should be available\n");
|
return 0;
|
||||||
|
|
||||||
return (lc_config[id1 - 1]->ul_SpecificParameters->priority - lc_config[id2 - 1]->ul_SpecificParameters->priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity)
|
|
||||||
{
|
|
||||||
if (mac->logicalChannelConfig[channel_identity - 1] != NULL) {
|
|
||||||
asn1cFreeStruc(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nr_get_ms_bucketsizeduration(long bucketsizeduration)
|
static int nr_get_ms_bucketsizeduration(long bucketsizeduration)
|
||||||
@@ -695,14 +686,9 @@ static int nr_get_ms_bucketsizeduration(long bucketsizeduration)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_configure_mac_config_logicalChannelBearer(module_id_t module_id,
|
void nr_configure_sched_info(NR_UE_MAC_INST_t *mac, long channel_identity, NR_LogicalChannelConfig_t *lc_config)
|
||||||
long channel_identity,
|
|
||||||
NR_LogicalChannelConfig_t *lc_config)
|
|
||||||
{
|
{
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
LOG_D(NR_MAC, "Applying RRC Logical Channel Config to lcid %li\n", channel_identity);
|
||||||
|
|
||||||
LOG_I(NR_MAC, "[MACLogicalChannelConfig]Applying RRC Logical Channel Config %d to lcid %li\n", module_id, channel_identity);
|
|
||||||
mac->logicalChannelConfig[channel_identity - 1] = lc_config;
|
|
||||||
|
|
||||||
// initialize the variable Bj for every LCID
|
// initialize the variable Bj for every LCID
|
||||||
mac->scheduling_info.lc_sched_info[channel_identity - 1].Bj = 0;
|
mac->scheduling_info.lc_sched_info[channel_identity - 1].Bj = 0;
|
||||||
@@ -729,59 +715,82 @@ static void configure_logicalChannelBearer(module_id_t module_id,
|
|||||||
struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_torelease_list)
|
struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_torelease_list)
|
||||||
{
|
{
|
||||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||||
|
|
||||||
if (rlc_torelease_list) {
|
if (rlc_torelease_list) {
|
||||||
for (int i = 0; i < rlc_torelease_list->list.count; i++) {
|
for (int i = 0; i < rlc_torelease_list->list.count; i++) {
|
||||||
if (rlc_torelease_list->list.array[i]) {
|
long id = *rlc_torelease_list->list.array[i];
|
||||||
int lc_identity = *rlc_torelease_list->list.array[i];
|
int j;
|
||||||
nr_release_mac_config_logicalChannelBearer(mac, lc_identity);
|
for (j = 0; j < mac->lc_ordered_list.count; j++) {
|
||||||
|
if (id == mac->lc_ordered_list.array[j]->lcid)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (j < mac->lc_ordered_list.count) {
|
||||||
|
nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[j];
|
||||||
|
free(lc_info->logicalChannelConfig);
|
||||||
|
asn_sequence_del(&mac->lc_ordered_list, j, 0);
|
||||||
|
free(lc_info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LOG_E(NR_MAC, "Element not present in the list, impossible to release\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rlc_toadd_list) {
|
if (rlc_toadd_list) {
|
||||||
for (int i = 0; i < rlc_toadd_list->list.count; i++) {
|
for (int i = 0; i < rlc_toadd_list->list.count; i++) {
|
||||||
NR_RLC_BearerConfig_t *rlc_bearer = rlc_toadd_list->list.array[i];
|
NR_RLC_BearerConfig_t *rlc_bearer = rlc_toadd_list->list.array[i];
|
||||||
int lc_identity = rlc_bearer->logicalChannelIdentity;
|
int lc_identity = rlc_bearer->logicalChannelIdentity;
|
||||||
mac->lc_ordered_info[i].lcids_ordered = lc_identity;
|
NR_LogicalChannelConfig_t *mac_lc_config = rlc_bearer->mac_LogicalChannelConfig;
|
||||||
NR_LogicalChannelConfig_t *mac_lc_config = NULL;
|
int j;
|
||||||
if (mac->logicalChannelConfig[lc_identity - 1] == NULL) {
|
for (j = 0; j < mac->lc_ordered_list.count; j++) {
|
||||||
|
if (lc_identity == mac->lc_ordered_list.array[j]->lcid)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (j < mac->lc_ordered_list.count) {
|
||||||
|
LOG_D(NR_MAC, "Logical channel %d is already established, Reconfiguring now\n", lc_identity);
|
||||||
|
if (mac_lc_config != NULL) {
|
||||||
|
nr_configure_sched_info(mac, lc_identity, mac_lc_config);
|
||||||
|
UPDATE_MAC_IE(mac->lc_ordered_list.array[j]->logicalChannelConfig,
|
||||||
|
rlc_bearer->mac_LogicalChannelConfig,
|
||||||
|
NR_LogicalChannelConfig_t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
/* setup of new LCID*/
|
/* setup of new LCID*/
|
||||||
|
nr_lcordered_info_t *lc_info = calloc(1, sizeof(*lc_info));
|
||||||
|
lc_info->lcid = lc_identity;
|
||||||
LOG_D(NR_MAC, "Establishing the logical channel %d\n", lc_identity);
|
LOG_D(NR_MAC, "Establishing the logical channel %d\n", lc_identity);
|
||||||
AssertFatal(rlc_bearer->servedRadioBearer, "servedRadioBearer should be present for LCID establishment\n");
|
AssertFatal(rlc_bearer->servedRadioBearer, "servedRadioBearer should be present for LCID establishment\n");
|
||||||
if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) { /* SRB */
|
if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) { /* SRB */
|
||||||
NR_SRB_Identity_t srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity;
|
NR_SRB_Identity_t srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity;
|
||||||
if (rlc_bearer->mac_LogicalChannelConfig != NULL) {
|
if (mac_lc_config != NULL) {
|
||||||
UPDATE_MAC_IE(mac_lc_config, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t);
|
UPDATE_MAC_IE(lc_info->logicalChannelConfig, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t);
|
||||||
} else {
|
} else {
|
||||||
LOG_I(NR_RRC, "Applying the default logicalChannelConfig for SRB\n");
|
LOG_D(NR_RRC, "Applying the default logicalChannelConfig for SRB\n");
|
||||||
if (srb_id == 1)
|
switch (srb_id) {
|
||||||
mac_lc_config = (NR_LogicalChannelConfig_t *)&NR_SRB1_logicalChannelConfig_defaultValue;
|
case 1 :
|
||||||
else if (srb_id == 2)
|
lc_info->logicalChannelConfig = (NR_LogicalChannelConfig_t *)&NR_SRB1_logicalChannelConfig_defaultValue;
|
||||||
mac_lc_config = (NR_LogicalChannelConfig_t *)&NR_SRB2_logicalChannelConfig_defaultValue;
|
break;
|
||||||
else if (srb_id == 3)
|
case 2 :
|
||||||
mac_lc_config = (NR_LogicalChannelConfig_t *)&NR_SRB3_logicalChannelConfig_defaultValue;
|
lc_info->logicalChannelConfig = (NR_LogicalChannelConfig_t *)&NR_SRB2_logicalChannelConfig_defaultValue;
|
||||||
else
|
break;
|
||||||
AssertFatal(1 == 0, "The logical id %d is not a valid SRB id %li\n", lc_identity, srb_id);
|
case 3 :
|
||||||
|
lc_info->logicalChannelConfig = (NR_LogicalChannelConfig_t *)&NR_SRB3_logicalChannelConfig_defaultValue;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
AssertFatal(false, "The logical id %d is not a valid SRB id %li\n", lc_identity, srb_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { /* DRB */
|
} else { /* DRB */
|
||||||
AssertFatal(rlc_bearer->mac_LogicalChannelConfig,
|
AssertFatal(mac_lc_config, "When establishing a DRB, LogicalChannelConfig should be mandatorily present\n");
|
||||||
"When establishing a DRB, LogicalChannelConfig should be mandatorily present\n");
|
UPDATE_MAC_IE(lc_info->logicalChannelConfig, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t);
|
||||||
UPDATE_MAC_IE(mac_lc_config, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t);
|
|
||||||
}
|
}
|
||||||
} else {
|
nr_configure_sched_info(mac, lc_identity, lc_info->logicalChannelConfig);
|
||||||
/* LC is already established, reconfiguring the LC */
|
ASN_SEQUENCE_ADD(&mac->lc_ordered_list, lc_info);
|
||||||
LOG_D(NR_MAC, "Logical channel %d is already established, Reconfiguring now\n", lc_identity);
|
|
||||||
if (rlc_bearer->mac_LogicalChannelConfig != NULL) {
|
|
||||||
UPDATE_MAC_IE(mac_lc_config, rlc_bearer->mac_LogicalChannelConfig, NR_LogicalChannelConfig_t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mac_lc_config) {
|
|
||||||
mac->lc_ordered_info[i].logicalChannelConfig_ordered = mac_lc_config;
|
|
||||||
nr_configure_mac_config_logicalChannelBearer(module_id, lc_identity, mac_lc_config);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reorder the logical channels as per its priority
|
// reorder the logical channels as per its priority
|
||||||
qsort_r(mac->lc_ordered_info, rlc_toadd_list->list.count, sizeof(nr_lcordered_info_t), lcid_cmp, mac);
|
qsort(mac->lc_ordered_list.array, mac->lc_ordered_list.count, sizeof(nr_lcordered_info_t*), lcid_cmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -434,10 +434,9 @@ typedef struct ssb_list_info {
|
|||||||
|
|
||||||
typedef struct nr_lcordered_info_s {
|
typedef struct nr_lcordered_info_s {
|
||||||
// logical channels ids ordered as per priority
|
// logical channels ids ordered as per priority
|
||||||
int lcids_ordered;
|
NR_LogicalChannelIdentity_t lcid;
|
||||||
|
|
||||||
// logical channel configurations reordered as per priority
|
// logical channel configurations reordered as per priority
|
||||||
NR_LogicalChannelConfig_t *logicalChannelConfig_ordered;
|
NR_LogicalChannelConfig_t *logicalChannelConfig;
|
||||||
} nr_lcordered_info_t;
|
} nr_lcordered_info_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -513,11 +512,9 @@ typedef struct NR_UE_MAC_INST_s {
|
|||||||
/// BSR report flag management
|
/// BSR report flag management
|
||||||
uint8_t BSR_reporting_active;
|
uint8_t BSR_reporting_active;
|
||||||
|
|
||||||
// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive.
|
|
||||||
NR_LogicalChannelConfig_t *logicalChannelConfig[NR_MAX_NUM_LCID];
|
|
||||||
|
|
||||||
// order lc info
|
// order lc info
|
||||||
nr_lcordered_info_t lc_ordered_info[NR_MAX_NUM_LCID];
|
A_SEQUENCE_OF(nr_lcordered_info_t) lc_ordered_list;
|
||||||
|
|
||||||
NR_UE_SCHEDULING_INFO scheduling_info;
|
NR_UE_SCHEDULING_INFO scheduling_info;
|
||||||
|
|
||||||
/// PHR
|
/// PHR
|
||||||
|
|||||||
@@ -221,9 +221,11 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac)
|
|||||||
for (int i = 0; i < mac->ul_BWPs.count; i++)
|
for (int i = 0; i < mac->ul_BWPs.count; i++)
|
||||||
release_ul_BWP(mac, i);
|
release_ul_BWP(mac, i);
|
||||||
|
|
||||||
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
|
for (int i = 0; i < mac->lc_ordered_list.count; i++) {
|
||||||
nr_release_mac_config_logicalChannelBearer(mac, i + 1);
|
nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i];
|
||||||
memset(&mac->lc_ordered_info[i], 0, sizeof(nr_lcordered_info_t));
|
free(lc_info->logicalChannelConfig);
|
||||||
|
asn_sequence_del(&mac->lc_ordered_list, i, 0);
|
||||||
|
free(lc_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
|
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
|
||||||
|
|||||||
@@ -1109,9 +1109,9 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
|
|||||||
|
|
||||||
// update Bj for all active lcids before LCP procedure
|
// update Bj for all active lcids before LCP procedure
|
||||||
LOG_D(NR_MAC, "====================[Frame %d][Slot %d]Logical Channel Prioritization===========\n", frame_tx, slot_tx);
|
LOG_D(NR_MAC, "====================[Frame %d][Slot %d]Logical Channel Prioritization===========\n", frame_tx, slot_tx);
|
||||||
for (nr_lcordered_info_t *lc_bearer = mac->lc_ordered_info; lc_bearer->logicalChannelConfig_ordered != NULL; lc_bearer++) {
|
for (int i = 0; i < mac->lc_ordered_list.count; i++) {
|
||||||
int lcid = lc_bearer->lcids_ordered;
|
int lcid = mac->lc_ordered_list.array[i]->lcid;
|
||||||
NR_LogicalChannelConfig_t *lcconfig = mac->logicalChannelConfig[lcid - 1];
|
NR_LogicalChannelConfig_t *lcconfig = mac->lc_ordered_list.array[i]->logicalChannelConfig;
|
||||||
NR_LC_SCHEDULING_INFO *sched_lc = &mac->scheduling_info.lc_sched_info[lcid - 1];
|
NR_LC_SCHEDULING_INFO *sched_lc = &mac->scheduling_info.lc_sched_info[lcid - 1];
|
||||||
// max amount of data that can be buffered/accumulated in a logical channel buffer
|
// max amount of data that can be buffered/accumulated in a logical channel buffer
|
||||||
int32_t bucketSize_max = sched_lc->bucket_size;
|
int32_t bucketSize_max = sched_lc->bucket_size;
|
||||||
@@ -1196,56 +1196,55 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get Buffer Occupancy and fill lcid_reordered_array
|
//Get Buffer Occupancy and fill lcid_reordered_array
|
||||||
for (int lcid = 1; lcid <= NR_MAX_NUM_LCID; lcid++) {
|
for (int i = 0; i < mac->lc_ordered_list.count; i++) {
|
||||||
if (mac->logicalChannelConfig[lcid - 1] != NULL) { // todo
|
int lcid = mac->lc_ordered_list.array[i]->lcid;
|
||||||
int lcgid = mac->scheduling_info.lc_sched_info[lcid - 1].LCGID;
|
int lcgid = mac->scheduling_info.lc_sched_info[lcid - 1].LCGID;
|
||||||
|
|
||||||
// Store already available data to transmit per Group
|
// Store already available data to transmit per Group
|
||||||
|
if (lcgid < NR_MAX_NUM_LCGID) {
|
||||||
|
lcgid_buffer_remain[lcgid] += mac->scheduling_info.lc_sched_info[lcid - 1].LCID_buffer_remain;
|
||||||
|
}
|
||||||
|
|
||||||
|
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(module_idP,
|
||||||
|
mac->ue_id,
|
||||||
|
gNB_index,
|
||||||
|
frameP,
|
||||||
|
slotP,
|
||||||
|
ENB_FLAG_NO,
|
||||||
|
MBMS_FLAG_NO,
|
||||||
|
lcid,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
|
lcid_bytes_in_buffer[lcid - 1] = rlc_status.bytes_in_buffer;
|
||||||
|
|
||||||
|
if (rlc_status.bytes_in_buffer > 0) {
|
||||||
|
LOG_D(NR_MAC,"[UE %d] PDCCH Tick : LCID%d LCGID%d has data to transmit =%d bytes at frame %d slot %d\n",
|
||||||
|
module_idP, lcid, lcgid, rlc_status.bytes_in_buffer, frameP, slotP);
|
||||||
|
mac->scheduling_info.lc_sched_info[lcid - 1].LCID_status = LCID_NOT_EMPTY;
|
||||||
|
|
||||||
|
//Update BSR_bytes and position in lcid_reordered_array only if Group is defined
|
||||||
if (lcgid < NR_MAX_NUM_LCGID) {
|
if (lcgid < NR_MAX_NUM_LCGID) {
|
||||||
lcgid_buffer_remain[lcgid] += mac->scheduling_info.lc_sched_info[lcid - 1].LCID_buffer_remain;
|
num_lcid_with_data ++;
|
||||||
}
|
// sum lcid buffer which has same lcgid
|
||||||
|
mac->scheduling_info.lcg_sched_info[lcgid].BSR_bytes += rlc_status.bytes_in_buffer;
|
||||||
|
//Fill in the array
|
||||||
|
array_index = 0;
|
||||||
|
|
||||||
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(module_idP,
|
do {
|
||||||
mac->ue_id,
|
//if (mac->logicalChannelConfig[lcid]->ul_SpecificParameters->priority <= highest_priority) {
|
||||||
gNB_index,
|
if (1) { // todo
|
||||||
frameP,
|
//Insert if priority is higher or equal (lower or equal in value)
|
||||||
slotP,
|
for (pos_next = num_lcid_with_data - 1; pos_next > array_index; pos_next--) {
|
||||||
ENB_FLAG_NO,
|
lcid_reordered_array[pos_next] = lcid_reordered_array[pos_next - 1];
|
||||||
MBMS_FLAG_NO,
|
|
||||||
lcid,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
lcid_bytes_in_buffer[lcid - 1] = rlc_status.bytes_in_buffer;
|
|
||||||
|
|
||||||
if (rlc_status.bytes_in_buffer > 0) {
|
|
||||||
LOG_D(NR_MAC,"[UE %d] PDCCH Tick : LCID%d LCGID%d has data to transmit =%d bytes at frame %d slot %d\n",
|
|
||||||
module_idP, lcid,lcgid,rlc_status.bytes_in_buffer,frameP,slotP);
|
|
||||||
mac->scheduling_info.lc_sched_info[lcid - 1].LCID_status = LCID_NOT_EMPTY;
|
|
||||||
|
|
||||||
//Update BSR_bytes and position in lcid_reordered_array only if Group is defined
|
|
||||||
if (lcgid < NR_MAX_NUM_LCGID) {
|
|
||||||
num_lcid_with_data ++;
|
|
||||||
// sum lcid buffer which has same lcgid
|
|
||||||
mac->scheduling_info.lcg_sched_info[lcgid].BSR_bytes += rlc_status.bytes_in_buffer;
|
|
||||||
//Fill in the array
|
|
||||||
array_index = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
//if (mac->logicalChannelConfig[lcid]->ul_SpecificParameters->priority <= highest_priority) {
|
|
||||||
if (1) { // todo
|
|
||||||
//Insert if priority is higher or equal (lower or equal in value)
|
|
||||||
for (pos_next = num_lcid_with_data - 1; pos_next > array_index; pos_next--) {
|
|
||||||
lcid_reordered_array[pos_next] = lcid_reordered_array[pos_next - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
lcid_reordered_array[array_index] = lcid;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array_index ++;
|
lcid_reordered_array[array_index] = lcid;
|
||||||
} while ((array_index < num_lcid_with_data) && (array_index <= NR_MAX_NUM_LCID));
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
array_index ++;
|
||||||
|
} while ((array_index < num_lcid_with_data) && (array_index <= NR_MAX_NUM_LCID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2909,16 +2908,14 @@ void nr_ue_get_sdu_mac_ce_post(module_id_t module_idP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_count_lcids_same_priority(NR_UE_MAC_INST_t *mac, uint8_t start, uint8_t total_active_lcids, int *lcid_ordered_array)
|
uint32_t get_count_lcids_same_priority(uint8_t start, uint8_t total_active_lcids, nr_lcordered_info_t *lcid_ordered_array)
|
||||||
{
|
{
|
||||||
// count number of logical channels with same priority as curr_lcid
|
// count number of logical channels with same priority as curr_lcid
|
||||||
uint8_t same_priority_count = 0;
|
uint8_t same_priority_count = 0;
|
||||||
uint8_t curr_lcid = lcid_ordered_array[start];
|
uint8_t curr_lcid = lcid_ordered_array[start].lcid;
|
||||||
NR_LogicalChannelConfig_t *lc_config_curr = mac->logicalChannelConfig[curr_lcid - 1];
|
|
||||||
for (uint8_t index = start; index < total_active_lcids; index++) {
|
for (uint8_t index = start; index < total_active_lcids; index++) {
|
||||||
uint8_t next_lcid = lcid_ordered_array[index];
|
if (lcid_ordered_array[start].logicalChannelConfig->ul_SpecificParameters->priority ==
|
||||||
NR_LogicalChannelConfig_t *lc_config_next = mac->logicalChannelConfig[next_lcid - 1];
|
lcid_ordered_array[index].logicalChannelConfig->ul_SpecificParameters->priority) {
|
||||||
if (lc_config_curr->ul_SpecificParameters->priority == lc_config_next->ul_SpecificParameters->priority) {
|
|
||||||
same_priority_count++;
|
same_priority_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2936,7 +2933,14 @@ long get_num_bytes_to_reqlc(NR_UE_MAC_INST_t *mac,
|
|||||||
long *target)
|
long *target)
|
||||||
{
|
{
|
||||||
/* Calculates the number of bytes the logical channel should request from the correcponding RLC buffer*/
|
/* Calculates the number of bytes the logical channel should request from the correcponding RLC buffer*/
|
||||||
NR_LogicalChannelConfig_t *lc_config = mac->logicalChannelConfig[lc_num - 1];
|
NR_LogicalChannelConfig_t *lc_config = NULL;
|
||||||
|
for (int i = 0; i < mac->lc_ordered_list.count; i++) {
|
||||||
|
if (mac->lc_ordered_list.array[i]->lcid == lc_num) {
|
||||||
|
lc_config = mac->lc_ordered_list.array[i]->logicalChannelConfig;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AssertFatal(lc_config, "Couldn't find LC config for ID %d\n", lc_num);
|
||||||
long pbr = nr_get_pbr(lc_config->ul_SpecificParameters->prioritisedBitRate);
|
long pbr = nr_get_pbr(lc_config->ul_SpecificParameters->prioritisedBitRate);
|
||||||
int32_t lcid_remain_buffer = mac->scheduling_info.lc_sched_info[lc_num - 1].LCID_buffer_remain;
|
int32_t lcid_remain_buffer = mac->scheduling_info.lc_sched_info[lc_num - 1].LCID_buffer_remain;
|
||||||
*target = (same_priority_count > 1) ? min(buflen_remain_ep, pbr) : pbr;
|
*target = (same_priority_count > 1) ? min(buflen_remain_ep, pbr) : pbr;
|
||||||
@@ -2963,11 +2967,11 @@ long get_num_bytes_to_reqlc(NR_UE_MAC_INST_t *mac,
|
|||||||
return num_bytes_requested;
|
return num_bytes_requested;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_dataavailability_buffers(uint8_t total_active_lcids, int *lcid_ordered_array, bool *data_status_lcbuffers)
|
bool get_dataavailability_buffers(uint8_t total_active_lcids, nr_lcordered_info_t *lcid_ordered_array, bool *data_status_lcbuffers)
|
||||||
{
|
{
|
||||||
// check whether there is any data in the rlc buffer corresponding to active lcs
|
// check whether there is any data in the rlc buffer corresponding to active lcs
|
||||||
for (uint8_t id = 0; id < total_active_lcids; id++) {
|
for (uint8_t id = 0; id < total_active_lcids; id++) {
|
||||||
int lcid = lcid_ordered_array[id];
|
int lcid = lcid_ordered_array[id].lcid;
|
||||||
if (data_status_lcbuffers[lcid - 1]) {
|
if (data_status_lcbuffers[lcid - 1]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2975,21 +2979,22 @@ bool get_dataavailability_buffers(uint8_t total_active_lcids, int *lcid_ordered_
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t select_logical_channels(NR_UE_MAC_INST_t *mac, uint8_t *num_active_lcids, int *active_lcids)
|
static void select_logical_channels(NR_UE_MAC_INST_t *mac, int *num_active_lcids, nr_lcordered_info_t *active_lcids)
|
||||||
{
|
{
|
||||||
// (TODO: selection of logical channels for logical channel prioritization procedure as per 5.4.3.1.2 Selection of logical
|
// (TODO: selection of logical channels for logical channel prioritization procedure as per 5.4.3.1.2 Selection of logical
|
||||||
// channels, TS38.321)
|
// channels, TS38.321)
|
||||||
|
|
||||||
// selection of logical channels with Bj > 0
|
// selection of logical channels with Bj > 0
|
||||||
for (nr_lcordered_info_t *lc_bearer = mac->lc_ordered_info; lc_bearer->logicalChannelConfig_ordered != NULL; lc_bearer++) {
|
for (int i = 0; i < mac->lc_ordered_list.count; i++) {
|
||||||
uint8_t lcid = lc_bearer->lcids_ordered;
|
int lcid = mac->lc_ordered_list.array[i]->lcid;
|
||||||
|
NR_LogicalChannelConfig_t *logicalChannelConfig = mac->lc_ordered_list.array[i]->logicalChannelConfig;
|
||||||
if (mac->scheduling_info.lc_sched_info[lcid - 1].Bj > 0) {
|
if (mac->scheduling_info.lc_sched_info[lcid - 1].Bj > 0) {
|
||||||
active_lcids[*num_active_lcids] = lcid;
|
active_lcids[*num_active_lcids].lcid = lcid;
|
||||||
|
active_lcids[*num_active_lcids].logicalChannelConfig = logicalChannelConfig;
|
||||||
(*num_active_lcids)++;
|
(*num_active_lcids)++;
|
||||||
LOG_D(NR_MAC, "The available lcid is %d with total active channels count = %d\n", lcid, *num_active_lcids);
|
LOG_D(NR_MAC, "The available lcid is %d with total active channels count = %d\n", lcid, *num_active_lcids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool fill_mac_sdu(module_id_t module_idP,
|
static bool fill_mac_sdu(module_id_t module_idP,
|
||||||
@@ -3188,10 +3193,6 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
|
|||||||
// Pointer used to build the MAC PDU by placing the RLC SDUs in the ULSCH buffer
|
// Pointer used to build the MAC PDU by placing the RLC SDUs in the ULSCH buffer
|
||||||
uint8_t *pdu = ulsch_buffer;
|
uint8_t *pdu = ulsch_buffer;
|
||||||
|
|
||||||
// variable used to build the lcids with positive Bj
|
|
||||||
int lcids_bj_pos[NR_MAX_NUM_LCID] = {0};
|
|
||||||
uint8_t avail_lcids_count = 0;
|
|
||||||
|
|
||||||
// variable used to store the lcid data status during lcp
|
// variable used to store the lcid data status during lcp
|
||||||
bool lcids_data_status[NR_MAX_NUM_LCID] = {0};
|
bool lcids_data_status[NR_MAX_NUM_LCID] = {0};
|
||||||
memset(lcids_data_status, 1, NR_MAX_NUM_LCID);
|
memset(lcids_data_status, 1, NR_MAX_NUM_LCID);
|
||||||
@@ -3209,6 +3210,9 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
|
|||||||
LOG_D(NR_MAC, "In %s: [UE %d] [%d.%d] process UL transport block at with size TBS = %d bytes \n", __FUNCTION__, module_idP, frameP, subframe, buflen);
|
LOG_D(NR_MAC, "In %s: [UE %d] [%d.%d] process UL transport block at with size TBS = %d bytes \n", __FUNCTION__, module_idP, frameP, subframe, buflen);
|
||||||
|
|
||||||
// selection of logical channels
|
// selection of logical channels
|
||||||
|
int avail_lcids_count = 0;
|
||||||
|
// variable used to build the lcids with positive Bj
|
||||||
|
nr_lcordered_info_t lcids_bj_pos[mac->lc_ordered_list.count];
|
||||||
select_logical_channels(mac, &avail_lcids_count, lcids_bj_pos);
|
select_logical_channels(mac, &avail_lcids_count, lcids_bj_pos);
|
||||||
|
|
||||||
// multiplex in the order of highest priority
|
// multiplex in the order of highest priority
|
||||||
@@ -3229,7 +3233,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
|
|||||||
still space availble in the MAC PDU, then from the next run all the remaining data from the higher priority logical channel
|
still space availble in the MAC PDU, then from the next run all the remaining data from the higher priority logical channel
|
||||||
is placed in the MAC PDU before going on to next high priority logical channel
|
is placed in the MAC PDU before going on to next high priority logical channel
|
||||||
*/
|
*/
|
||||||
int lcid = lcids_bj_pos[id];
|
int lcid = lcids_bj_pos[id].lcid;
|
||||||
|
|
||||||
// skip the logical channel if no data in the buffer initially or the data in the buffer was zero because it was written in to
|
// skip the logical channel if no data in the buffer initially or the data in the buffer was zero because it was written in to
|
||||||
// MAC PDU
|
// MAC PDU
|
||||||
@@ -3241,7 +3245,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
|
|||||||
// count number of lc with same priority as lcid
|
// count number of lc with same priority as lcid
|
||||||
if (!num_lcids_same_priority) {
|
if (!num_lcids_same_priority) {
|
||||||
num_lcids_same_priority = count_same_priority_lcids =
|
num_lcids_same_priority = count_same_priority_lcids =
|
||||||
get_count_lcids_same_priority(mac, id, avail_lcids_count, lcids_bj_pos);
|
get_count_lcids_same_priority(id, avail_lcids_count, lcids_bj_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
buflen_remain = buflen - (mac_ce_p->total_mac_pdu_header_len + mac_ce_p->sdu_length_total + sh_size);
|
buflen_remain = buflen - (mac_ce_p->total_mac_pdu_header_len + mac_ce_p->sdu_length_total + sh_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user