Commit 45be0a56 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/fix-ulsch-bsr' into integration_2024_w46 (!2991)

fix BSR report malformed, add SHORT BSR when it can (instead of LONG BSR)...

fix BSR report malformed, add SHORT BSR when it can (instead of LONG BSR)
simplify the code and make the code more explicit, but the may structure
remain (nr_write_ce_ulsch_pdu interface is complex, merging it into the
called would make simpler and more interstandable code), fix some asserts
related to this part of code
parents ca119de0 2348b3c0
...@@ -122,6 +122,11 @@ static inline int get_mac_len(uint8_t *pdu, uint32_t pdu_len, uint16_t *mac_ce_l ...@@ -122,6 +122,11 @@ static inline int get_mac_len(uint8_t *pdu, uint32_t pdu_len, uint16_t *mac_ce_l
*mac_subheader_len = sizeof(*s); *mac_subheader_len = sizeof(*s);
*mac_ce_len = s->L; *mac_ce_len = s->L;
} }
if (*mac_ce_len > pdu_len) {
LOG_E(NR_MAC, "MAC sdu len impossible (%d)\n", *mac_ce_len);
return false;
}
return true; return true;
} }
...@@ -133,8 +138,6 @@ typedef struct { ...@@ -133,8 +138,6 @@ typedef struct {
uint8_t LcgID: 3; // octet 1 MSB uint8_t LcgID: 3; // octet 1 MSB
} __attribute__ ((__packed__)) NR_BSR_SHORT; } __attribute__ ((__packed__)) NR_BSR_SHORT;
typedef NR_BSR_SHORT NR_BSR_SHORT_TRUNCATED;
// Long BSR for all logical channel group ID // Long BSR for all logical channel group ID
typedef struct { typedef struct {
uint8_t LcgID0: 1; // octet 1 [0] uint8_t LcgID0: 1; // octet 1 [0]
...@@ -144,19 +147,9 @@ typedef struct { ...@@ -144,19 +147,9 @@ typedef struct {
uint8_t LcgID4: 1; // octet 1 [4] uint8_t LcgID4: 1; // octet 1 [4]
uint8_t LcgID5: 1; // octet 1 [5] uint8_t LcgID5: 1; // octet 1 [5]
uint8_t LcgID6: 1; // octet 1 [6] uint8_t LcgID6: 1; // octet 1 [6]
uint8_t LcgID7: 1; // octet 1 [7] uint8_t LcgID7: 1; // octet 1 [7]
uint8_t Buffer_size0: 8; // octet 2 [7:0]
uint8_t Buffer_size1: 8; // octet 3 [7:0]
uint8_t Buffer_size2: 8; // octet 4 [7:0]
uint8_t Buffer_size3: 8; // octet 5 [7:0]
uint8_t Buffer_size4: 8; // octet 6 [7:0]
uint8_t Buffer_size5: 8; // octet 7 [7:0]
uint8_t Buffer_size6: 8; // octet 8 [7:0]
uint8_t Buffer_size7: 8; // octet 9 [7:0]
} __attribute__ ((__packed__)) NR_BSR_LONG; } __attribute__ ((__packed__)) NR_BSR_LONG;
typedef NR_BSR_LONG NR_BSR_LONG_TRUNCATED;
// 38.321 ch. 6.1.3.4 // 38.321 ch. 6.1.3.4
typedef struct { typedef struct {
uint8_t TA_COMMAND: 6; // octet 1 [5:0] uint8_t TA_COMMAND: 6; // octet 1 [5:0]
......
...@@ -70,8 +70,7 @@ ...@@ -70,8 +70,7 @@
#define NR_BSR_TRIGGER_NONE (0) /* No BSR Trigger */ #define NR_BSR_TRIGGER_NONE (0) /* No BSR Trigger */
#define NR_BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */ #define NR_BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */
#define NR_BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */ #define NR_BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */
#define NR_BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */
#define NR_INVALID_LCGID (NR_MAX_NUM_LCGID) #define NR_INVALID_LCGID (NR_MAX_NUM_LCGID)
...@@ -194,8 +193,6 @@ typedef enum { ...@@ -194,8 +193,6 @@ typedef enum {
typedef struct { typedef struct {
// after multiplexing buffer remain for each lcid // after multiplexing buffer remain for each lcid
int32_t LCID_buffer_remain; int32_t LCID_buffer_remain;
// buffer status for each lcid
bool LCID_buffer_with_data;
// logical channel group id of this LCID // logical channel group id of this LCID
long LCGID; long LCGID;
// Bj bucket usage per lcid // Bj bucket usage per lcid
...@@ -203,13 +200,6 @@ typedef struct { ...@@ -203,13 +200,6 @@ typedef struct {
NR_timer_t Bj_timer; NR_timer_t Bj_timer;
} NR_LC_SCHEDULING_INFO; } NR_LC_SCHEDULING_INFO;
typedef struct {
// buffer status for each lcgid
uint8_t BSR; // should be more for mesh topology
// keep the number of bytes in rlc buffer for each lcgid
int32_t BSR_bytes;
} NR_LCG_SCHEDULING_INFO;
typedef struct { typedef struct {
bool active_SR_ID; bool active_SR_ID;
/// SR pending as defined in 38.321 /// SR pending as defined in 38.321
...@@ -244,8 +234,6 @@ typedef struct { ...@@ -244,8 +234,6 @@ typedef struct {
typedef struct { typedef struct {
// lcs scheduling info // lcs scheduling info
NR_LC_SCHEDULING_INFO lc_sched_info[NR_MAX_NUM_LCID]; NR_LC_SCHEDULING_INFO lc_sched_info[NR_MAX_NUM_LCID];
// lcg scheduling info
NR_LCG_SCHEDULING_INFO lcg_sched_info[NR_MAX_NUM_LCGID];
// SR INFO // SR INFO
nr_sr_info_t sr_info[NR_MAX_SR_ID]; nr_sr_info_t sr_info[NR_MAX_SR_ID];
/// BSR report flag management /// BSR report flag management
......
...@@ -172,13 +172,22 @@ void nr_ue_send_sdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, in ...@@ -172,13 +172,22 @@ void nr_ue_send_sdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, in
void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac,nr_downlink_indication_t *dl_info, int pdu_id); void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac,nr_downlink_indication_t *dl_info, int pdu_id);
typedef struct {
union {
NR_BSR_SHORT s;
NR_BSR_LONG l;
uint8_t lcg_bsr[8];
} bsr;
enum { b_none, b_long, b_short, b_short_trunc, b_long_trunc } type_bsr;
} type_bsr_t;
int nr_write_ce_msg3_pdu(uint8_t *mac_ce, NR_UE_MAC_INST_t *mac, rnti_t crnti, uint8_t *mac_ce_end);
int nr_write_ce_ulsch_pdu(uint8_t *mac_ce, int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
NR_UE_MAC_INST_t *mac, NR_UE_MAC_INST_t *mac,
NR_SINGLE_ENTRY_PHR_MAC_CE *power_headroom, NR_SINGLE_ENTRY_PHR_MAC_CE *power_headroom,
uint16_t *crnti, const type_bsr_t *bsr,
NR_BSR_SHORT *truncated_bsr, uint8_t *mac_ce_end);
NR_BSR_SHORT *short_bsr,
NR_BSR_LONG *long_bsr);
void config_dci_pdu(NR_UE_MAC_INST_t *mac, void config_dci_pdu(NR_UE_MAC_INST_t *mac,
fapi_nr_dl_config_request_t *dl_config, fapi_nr_dl_config_request_t *dl_config,
...@@ -188,16 +197,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, ...@@ -188,16 +197,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, const frame_t frame, const int slot); void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, const frame_t frame, const int slot);
uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
int cc_id,
frame_t frameP,
sub_frame_t subframe,
uint8_t gNB_index,
uint8_t *ulsch_buffer,
uint32_t buflen,
int16_t tx_power,
int16_t P_CMAX);
void set_harq_status(NR_UE_MAC_INST_t *mac, void set_harq_status(NR_UE_MAC_INST_t *mac,
uint8_t pucch_id, uint8_t pucch_id,
uint8_t harq_id, uint8_t harq_id,
......
...@@ -192,7 +192,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) ...@@ -192,7 +192,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
for (int i = 0; i < NR_MAX_NUM_LCID; i++) { for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
LOG_D(NR_MAC, "Applying default logical channel config for LCID %d\n", i); LOG_D(NR_MAC, "Applying default logical channel config for LCID %d\n", i);
nr_mac->scheduling_info.lc_sched_info[i].Bj = 0; nr_mac->scheduling_info.lc_sched_info[i].Bj = 0;
nr_mac->scheduling_info.lc_sched_info[i].LCID_buffer_with_data = false;
nr_mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; nr_mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0;
} }
......
...@@ -785,7 +785,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB ...@@ -785,7 +785,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB
} else if (!IS_SA_MODE(get_softmodem_params())) { } else if (!IS_SA_MODE(get_softmodem_params())) {
uint8_t temp_pdu[16] = {0}; uint8_t temp_pdu[16] = {0};
size_sdu = nr_write_ce_ulsch_pdu(temp_pdu, mac, 0, &(mac->crnti), NULL, NULL, NULL); size_sdu = nr_write_ce_msg3_pdu(temp_pdu, mac, mac->crnti, temp_pdu + sizeof(temp_pdu));
ra->Msg3_size = size_sdu; ra->Msg3_size = size_sdu;
} }
} else if (ra->RA_window_cnt != -1) { // RACH is active } else if (ra->RA_window_cnt != -1) { // RACH is active
......
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