review comments
This commit is contained in:
@@ -313,14 +313,12 @@ void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f)
|
|||||||
switch(Qm) {
|
switch(Qm) {
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
AssertFatal(E%4==0,"");
|
AssertFatal(E%2==0,"");
|
||||||
int16_t *e1=e+(E/2);
|
int16_t *e1=e+(E/2);
|
||||||
int16_t *end=f+E-3;
|
int16_t *end=f+E-1;
|
||||||
while( f<end ){
|
while( f<end ){
|
||||||
*e++ = *f++;
|
*e++ = *f++;
|
||||||
*e1++ = *f++;
|
*e1++ = *f++;
|
||||||
*e++ = *f++;
|
|
||||||
*e1++ = *f++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -360,7 +358,7 @@ void nr_deinterleaving_ldpc(uint32_t E, uint8_t Qm, int16_t *e,int16_t *f)
|
|||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
AssertFatal(E%8==0,"zob");
|
AssertFatal(E%8==0,"");
|
||||||
int16_t *e1=e+(E/8);
|
int16_t *e1=e+(E/8);
|
||||||
int16_t *e2=e1+(E/8);
|
int16_t *e2=e1+(E/8);
|
||||||
int16_t *e3=e2+(E/8);
|
int16_t *e3=e2+(E/8);
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ void nr_processDLSegment(void* arg) {
|
|||||||
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
|
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
|
||||||
(int8_t *)&pl[0],
|
(int8_t *)&pl[0],
|
||||||
llrProcBuf,
|
llrProcBuf,
|
||||||
p_procTime);
|
&procTime);
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT);
|
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
|
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
|
||||||
|
|||||||
@@ -118,9 +118,13 @@ typedef struct {
|
|||||||
uint8_t R: 2; // octet 1 [7:6]
|
uint8_t R: 2; // octet 1 [7:6]
|
||||||
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
|
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
|
||||||
|
|
||||||
static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) {
|
static inline int get_mac_len(uint8_t* pdu, int pdu_len, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) {
|
||||||
|
if ( pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
||||||
|
return false;
|
||||||
NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu;
|
NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu;
|
||||||
NR_MAC_SUBHEADER_LONG *l = (NR_MAC_SUBHEADER_LONG*) pdu;
|
NR_MAC_SUBHEADER_LONG *l = (NR_MAC_SUBHEADER_LONG*) pdu;
|
||||||
|
if (s->F && pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
||||||
|
return false;
|
||||||
if (s->F) {
|
if (s->F) {
|
||||||
*mac_subheader_len = sizeof(*l);
|
*mac_subheader_len = sizeof(*l);
|
||||||
*mac_ce_len = ntohs(l->L);
|
*mac_ce_len = ntohs(l->L);
|
||||||
@@ -128,6 +132,7 @@ static inline void getMacLen(uint8_t* pdu, uint16_t *mac_ce_len, uint16_t *mac_s
|
|||||||
*mac_subheader_len = sizeof(*s);
|
*mac_subheader_len = sizeof(*s);
|
||||||
*mac_ce_len = s->L;
|
*mac_ce_len = s->L;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BSR MAC CEs
|
// BSR MAC CEs
|
||||||
|
|||||||
@@ -3364,13 +3364,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
|||||||
uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
|
uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
|
||||||
|
|
||||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
|
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
|
||||||
|
bool ret;
|
||||||
switch(rx_lcid){
|
switch(rx_lcid){
|
||||||
// MAC CE
|
// MAC CE
|
||||||
case DL_SCH_LCID_CCCH:
|
case DL_SCH_LCID_CCCH:
|
||||||
// MSG4 RRC Setup 38.331
|
// MSG4 RRC Setup 38.331
|
||||||
// variable length
|
// variable length
|
||||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
ret=get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len);
|
||||||
AssertFatal(pdu_len > mac_len, "The mac_len (%d) has an invalid size. PDU len = %d! \n",
|
AssertFatal(ret, "The mac_len (%d) has an invalid size. PDU len = %d! \n",
|
||||||
mac_len, pdu_len);
|
mac_len, pdu_len);
|
||||||
|
|
||||||
// Check if it is a valid CCCH message, we get all 00's messages very often
|
// Check if it is a valid CCCH message, we get all 00's messages very often
|
||||||
@@ -3404,7 +3405,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
|||||||
|
|
||||||
// 38.321 Ch6.1.3.14
|
// 38.321 Ch6.1.3.14
|
||||||
// varialbe length
|
// varialbe length
|
||||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DL_SCH_LCID_RECOMMENDED_BITRATE:
|
case DL_SCH_LCID_RECOMMENDED_BITRATE:
|
||||||
@@ -3508,10 +3509,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
|||||||
// check if LCID is valid at current time.
|
// check if LCID is valid at current time.
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// check if LCID is valid at current time.
|
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
return;
|
||||||
return;
|
|
||||||
getMacLen(pduP, &mac_len, &mac_subheader_len);
|
|
||||||
LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len);
|
LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len);
|
||||||
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||||
|
|||||||
@@ -1426,7 +1426,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
|||||||
/* limit requested number of bytes to what preprocessor specified, or
|
/* limit requested number of bytes to what preprocessor specified, or
|
||||||
* such that TBS is full */
|
* such that TBS is full */
|
||||||
const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer,
|
const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer,
|
||||||
bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG));
|
bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG));
|
||||||
tbs_size_t len = mac_rlc_data_req(module_id,
|
tbs_size_t len = mac_rlc_data_req(module_id,
|
||||||
rnti,
|
rnti,
|
||||||
module_id,
|
module_id,
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
|||||||
int pdu_len)
|
int pdu_len)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
uint8_t done = 0;
|
uint8_t done = 0;
|
||||||
|
|
||||||
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
|
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
|
||||||
@@ -279,16 +280,8 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
|||||||
to be a partial PDU at the end of this buffer, so here
|
to be a partial PDU at the end of this buffer, so here
|
||||||
we gracefully ignore that by returning 0. See:
|
we gracefully ignore that by returning 0. See:
|
||||||
https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */
|
https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||||
return 0;
|
return 0;
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
|
||||||
return 0;
|
|
||||||
mac_ce_len= ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract long BSR value */
|
/* Extract long BSR value */
|
||||||
ce_ptr = &pduP[mac_subheader_len];
|
ce_ptr = &pduP[mac_subheader_len];
|
||||||
NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr;
|
NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr;
|
||||||
@@ -362,32 +355,16 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
|||||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
|
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
|
||||||
//38.321 section 6.1.3.9
|
//38.321 section 6.1.3.9
|
||||||
// varialbe length
|
// varialbe length
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||||
return 0;
|
return 0;
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
|
||||||
return 0;
|
|
||||||
mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
||||||
//38.321 section 6.1.3.9
|
//38.321 section 6.1.3.9
|
||||||
// varialbe length
|
// varialbe length
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||||
return 0;
|
return 0;
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
|
||||||
return 0;
|
|
||||||
mac_ce_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
|
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -398,18 +375,8 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
|||||||
|
|
||||||
case UL_SCH_LCID_SRB1:
|
case UL_SCH_LCID_SRB1:
|
||||||
case UL_SCH_LCID_SRB2:
|
case UL_SCH_LCID_SRB2:
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||||
return 0;
|
return 0;
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
|
|
||||||
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
|
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
|
||||||
return 0;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
mac_sdu_len = ntohs(NR_MAC_SUBHEADER_LONG *) pduP)->L);
|
|
||||||
} else {
|
|
||||||
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
rnti_t crnti = UE_info->rnti[UE_id];
|
rnti_t crnti = UE_info->rnti[UE_id];
|
||||||
int UE_idx = UE_id;
|
int UE_idx = UE_id;
|
||||||
@@ -486,19 +453,8 @@ int nr_process_mac_pdu(module_id_t module_idP,
|
|||||||
|
|
||||||
case UL_SCH_LCID_DTCH:
|
case UL_SCH_LCID_DTCH:
|
||||||
// check if LCID is valid at current time.
|
// check if LCID is valid at current time.
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
|
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||||
return 0;
|
return 0;
|
||||||
if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) {
|
|
||||||
// mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
|
|
||||||
if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
|
|
||||||
return 0;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
mac_sdu_len = ntohs((NR_MAC_SUBHEADER_LONG *)pduP)->L);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
mac_sdu_len = (NR_MAC_SUBHEADER_SHORT *)pduP)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n",
|
LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n",
|
||||||
__func__,
|
__func__,
|
||||||
|
|||||||
@@ -52,7 +52,8 @@
|
|||||||
either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes
|
either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes
|
||||||
legacy: we regenerate each sub frame in UL, and each frame only in DL
|
legacy: we regenerate each sub frame in UL, and each frame only in DL
|
||||||
*/
|
*/
|
||||||
void rxAddInput( c16_t *input_sig, c16_t *after_channel_sig,
|
void rxAddInput( const c16_t *input_sig,
|
||||||
|
c16_t *after_channel_sig,
|
||||||
int rxAnt,
|
int rxAnt,
|
||||||
channel_desc_t *channelDesc,
|
channel_desc_t *channelDesc,
|
||||||
int nbSamples,
|
int nbSamples,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#define __RFSIMULATOR_H
|
#define __RFSIMULATOR_H
|
||||||
double gaussZiggurat(double mean, double variance);
|
double gaussZiggurat(double mean, double variance);
|
||||||
void tableNor(unsigned long seed);
|
void tableNor(unsigned long seed);
|
||||||
void rxAddInput( c16_t *input_sig,
|
void rxAddInput( const c16_t *input_sig,
|
||||||
c16_t *after_channel_sig,
|
c16_t *after_channel_sig,
|
||||||
int rxAnt,
|
int rxAnt,
|
||||||
channel_desc_t *channelDesc,
|
channel_desc_t *channelDesc,
|
||||||
|
|||||||
Reference in New Issue
Block a user