Commit a53090e5 authored by sriharsha's avatar sriharsha Committed by korada sriharsha

Add implementation of logical channel prioritization at UE

Reorder the logical channels based on priority

Handling of mac_LogicalChannelConfig for channel prioritization in sa

Fixes in lcp algorithm when data req to rlc result in no bytes

Add changes in the implementation of lcp procedure for equal priority logical channels

Further code cleanup
parent 6022fe5a
...@@ -533,19 +533,49 @@ void configure_ss_coreset(NR_UE_MAC_INST_t *mac, ...@@ -533,19 +533,49 @@ void configure_ss_coreset(NR_UE_MAC_INST_t *mac,
} }
} }
// todo handle mac_LogicalChannelConfig
int nr_rrc_mac_config_req_ue_logicalChannelBearer( //(Added)handling of mac_LogicalChannelConfig
module_id_t module_id, int nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
int cc_idP, int cc_idP,
uint8_t gNB_index, uint8_t gNB_index,
long logicalChannelIdentity, long logicalChannelIdentity,
bool status){ NR_LogicalChannelConfig_t *logicalChannelConfig,
bool status){
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
mac->logicalChannelBearer_exist[logicalChannelIdentity] = status;
if(logicalChannelConfig != NULL){
LOG_I(NR_MAC, "[Config][UE %d]Applying RRC Logical Channel Config from gNB %d\n", module_id, gNB_index);
mac->logicalChannelBearer_exist[logicalChannelIdentity] = status;
mac->logicalChannelConfig[logicalChannelIdentity] = logicalChannelConfig;
// initialize the variable Bj for every LCID
mac->scheduling_info.Bj[logicalChannelIdentity] = 0;
AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL, "[UE %d]LCID %ld -> NULL ul_SpecificParameters\n", module_id, logicalChannelIdentity);
// store the bucket size
if(logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate == NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity){
mac->scheduling_info.bucket_size[logicalChannelIdentity] = nr_get_pbr(logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate);
}
else{
int pbr = nr_get_pbr(logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate);
int bsd = nr_get_ms_bucketsizeduration(logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration);
mac->scheduling_info.bucket_size[logicalChannelIdentity] = pbr * bsd;
}
if(logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup != NULL){
mac->scheduling_info.LCGID[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
LOG_D(NR_MAC, "[Config][UE %d]logical channel %d is attached to logical channel group %d\n", logicalChannelIdentity, mac->scheduling_info.LCGID[logicalChannelIdentity]);
}
else{
LOG_D(NR_MAC, "[Config][UE %d]logical channel group is NULL for the logical channel %d\n", mac->scheduling_info.LCGID[logicalChannelIdentity], logicalChannelIdentity);
}
}
return 0; return 0;
} }
void configure_current_BWP(NR_UE_MAC_INST_t *mac, void configure_current_BWP(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfigCommonSIB_t *scc, NR_ServingCellConfigCommonSIB_t *scc,
NR_CellGroupConfig_t *cell_group_config) NR_CellGroupConfig_t *cell_group_config)
......
...@@ -228,9 +228,9 @@ typedef struct { ...@@ -228,9 +228,9 @@ typedef struct {
uint16_t extendedPHR_r10; uint16_t extendedPHR_r10;
//Bj bucket usage per lcid //Bj bucket usage per lcid
int16_t Bj[NR_MAX_NUM_LCID]; int32_t Bj[NR_MAX_NUM_LCID];
// Bucket size per lcid // Bucket size per lcid
int16_t bucket_size[NR_MAX_NUM_LCID]; int32_t bucket_size[NR_MAX_NUM_LCID];
} NR_UE_SCHEDULING_INFO; } NR_UE_SCHEDULING_INFO;
typedef enum { typedef enum {
...@@ -461,8 +461,13 @@ typedef struct { ...@@ -461,8 +461,13 @@ typedef struct {
/// BSR report flag management /// BSR report flag management
uint8_t BSR_reporting_active; uint8_t BSR_reporting_active;
/// LogicalChannelConfig has bearer. // If LogicalChannelConfig has bearer.
bool logicalChannelBearer_exist[NR_MAX_NUM_LCID]; bool logicalChannelBearer_exist[NR_MAX_NUM_LCID];
// Logical Channel Configuration if bearer exists
// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive.
NR_LogicalChannelConfig_t *logicalChannelConfig[NR_MAX_NUM_LCID];
NR_UE_SCHEDULING_INFO scheduling_info; NR_UE_SCHEDULING_INFO scheduling_info;
/// PHR /// PHR
......
...@@ -79,6 +79,8 @@ extern void mac_rlc_data_ind(const module_id_t module_idP, ...@@ -79,6 +79,8 @@ extern void mac_rlc_data_ind(const module_id_t module_idP,
const tb_size_t tb_sizeP, const tb_size_t tb_sizeP,
num_tb_t num_tbP, num_tb_t num_tbP,
crc_t *crcs_pP); crc_t *crcs_pP);
extern uint16_t nr_get_ms_bucketsizeduration(uint8_t bucketsizeduration);
extern uint32_t nr_get_pbr(uint8_t prioritizedbitrate);
extern const char *rnti_types[]; extern const char *rnti_types[];
extern const char *dci_formats[]; extern const char *dci_formats[];
...@@ -84,11 +84,13 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, ...@@ -84,11 +84,13 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
\param cc_id component carrier id \param cc_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param long logicalChannelIdentity \param long logicalChannelIdentity
\param NR_LogicalChannelConfig_t *logicalChannelConfig
\param bool status*/ \param bool status*/
int nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, int nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
int cc_idP, int cc_idP,
uint8_t gNB_index, uint8_t gNB_index,
long logicalChannelIdentity, long logicalChannelIdentity,
NR_LogicalChannelConfig_t *logicalChannelConfig,
bool status); bool status);
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) /**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
...@@ -170,6 +172,21 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t ...@@ -170,6 +172,21 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t
uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size, uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size,
int value); int value);
/*! \fn int nr_get_pbr(uint8_t prioritizedbitrate)
\brief get the rate in kbps from the rate configured by the higher layer
\param[in] prioritizedbitrate
\return the rate in kbps
*/
uint32_t nr_get_pbr(uint8_t prioritizedbitrate);
/*! \fn int nr_get_ms_bucketsizeduration(uint8_t bucketSizeduration)
\brief get the time in ms from the bucket size duration configured by the higher layer
\param[in] bucketSize the bucket size duration
\return the time in ms
*/
uint16_t nr_get_ms_bucketsizeduration(uint8_t bucketsizeduration);
/*! \fn int nr_get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) /*! \fn int nr_get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer)
\brief get the number of subframe from the periodic BSR timer configured by the higher layers \brief get the number of subframe from the periodic BSR timer configured by the higher layers
\param[in] periodicBSR_Timer timer for periodic BSR \param[in] periodicBSR_Timer timer for periodic BSR
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment