nr-ip-ul-nos1: Logs cleanup and some code rearrangement
This commit is contained in:
@@ -51,8 +51,6 @@
|
|||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
/* log utils */
|
/* log utils */
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
//#include "openair2/LAYER2/MAC/mac.h"
|
|
||||||
//#include "openair2/LAYER2/RLC/rlc.h"
|
|
||||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
@@ -2426,7 +2424,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
|||||||
uint16_t payload_offset = 0, num_sdus = 0;
|
uint16_t payload_offset = 0, num_sdus = 0;
|
||||||
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
|
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
|
||||||
uint16_t sdu_length_total = 0;
|
uint16_t sdu_length_total = 0;
|
||||||
unsigned short post_padding = 0;
|
//unsigned short post_padding = 0;
|
||||||
|
|
||||||
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
|
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
|
||||||
0, lcid_buffer_occupancy_new = 0;
|
0, lcid_buffer_occupancy_new = 0;
|
||||||
@@ -2527,11 +2525,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
LOG_D(MAC,
|
|
||||||
"[UE %d] Generate header :bufflen %d sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d, total_rlc_pdu_header_len %d, post_padding %d, remainder %d \n",
|
|
||||||
module_idP, buflen, sdu_length_total, num_sdus, sdu_lengths[0],
|
|
||||||
sdu_lcids[0], payload_offset, total_rlc_pdu_header_len,
|
|
||||||
post_padding, buflen - sdu_length_total - payload_offset);
|
|
||||||
|
|
||||||
// Padding: fill remainder of ULSCH with 0
|
// Padding: fill remainder of ULSCH with 0
|
||||||
if (buflen - payload_offset > 0){
|
if (buflen - payload_offset > 0){
|
||||||
@@ -2540,7 +2533,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||||
LOG_I(MAC, "Printing UL MAC payload without the header UE side, payload_offset: %d \n", payload_offset);
|
LOG_I(MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset);
|
||||||
for (int i = 0; i < buflen ; i++) {
|
for (int i = 0; i < buflen ; i++) {
|
||||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
||||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
||||||
|
|||||||
@@ -532,232 +532,3 @@ void nr_schedule_uss_ulsch_phytest(nfapi_nr_ul_tti_request_t *UL_tti_req,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_process_mac_pdu(
|
|
||||||
module_id_t module_idP,
|
|
||||||
uint8_t CC_id,
|
|
||||||
frame_t frameP,
|
|
||||||
uint8_t *pduP,
|
|
||||||
uint16_t mac_pdu_len)
|
|
||||||
{
|
|
||||||
|
|
||||||
// This function is adapting code from the old
|
|
||||||
// parse_header(...) and ue_send_sdu(...) functions of OAI LTE
|
|
||||||
|
|
||||||
uint8_t *pdu_ptr = pduP, rx_lcid, done = 0;
|
|
||||||
int pdu_len = mac_pdu_len;
|
|
||||||
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
|
|
||||||
|
|
||||||
|
|
||||||
// For both DL/UL-SCH
|
|
||||||
// Except:
|
|
||||||
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
|
||||||
// - UL/DL-SCH: padding
|
|
||||||
// - UL-SCH: MSG3 48-bits
|
|
||||||
// |0|1|2|3|4|5|6|7| bit-wise
|
|
||||||
// |R|F| LCID |
|
|
||||||
// | L |
|
|
||||||
// |0|1|2|3|4|5|6|7| bit-wise
|
|
||||||
// |R|F| LCID |
|
|
||||||
// | L |
|
|
||||||
// | L |
|
|
||||||
|
|
||||||
// For both DL/UL-SCH
|
|
||||||
// For:
|
|
||||||
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
|
||||||
// - UL/DL-SCH: padding, for single/multiple 1-oct padding CE(s)
|
|
||||||
// - UL-SCH: MSG3 48-bits
|
|
||||||
// |0|1|2|3|4|5|6|7| bit-wise
|
|
||||||
// |R|R| LCID |
|
|
||||||
// LCID: The Logical Channel ID field identifies the logical channel instance of the corresponding MAC SDU or the type of the corresponding MAC CE or padding as described in Tables 6.2.1-1 and 6.2.1-2 for the DL-SCH and UL-SCH respectively. There is one LCID field per MAC subheader. The LCID field size is 6 bits;
|
|
||||||
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
|
|
||||||
// F: lenght of L is 0:8 or 1:16 bits wide
|
|
||||||
// R: Reserved bit, set to zero.
|
|
||||||
|
|
||||||
while (!done && pdu_len > 0){
|
|
||||||
mac_ce_len = 0;
|
|
||||||
mac_subheader_len = 1; // default to fixed-length subheader = 1-oct
|
|
||||||
mac_sdu_len = 0;
|
|
||||||
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
|
|
||||||
|
|
||||||
LOG_D(MAC, "LCID received at gNB side: %d \n", rx_lcid);
|
|
||||||
|
|
||||||
switch(rx_lcid){
|
|
||||||
// MAC CE
|
|
||||||
|
|
||||||
/*#ifdef DEBUG_HEADER_PARSING
|
|
||||||
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
|
||||||
#endif*/
|
|
||||||
|
|
||||||
case UL_SCH_LCID_S_BSR:
|
|
||||||
//38.321 section 6.1.3.1
|
|
||||||
//fixed length
|
|
||||||
mac_ce_len =1;
|
|
||||||
/* Extract short BSR value */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_S_TRUNCATED_BSR:
|
|
||||||
//38.321 section 6.1.3.1
|
|
||||||
//fixed length
|
|
||||||
mac_ce_len =1;
|
|
||||||
/* Extract short truncated BSR value */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_L_BSR:
|
|
||||||
//38.321 section 6.1.3.1
|
|
||||||
//variable length
|
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
|
||||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract long BSR value */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_L_TRUNCATED_BSR:
|
|
||||||
//38.321 section 6.1.3.1
|
|
||||||
//variable length
|
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
|
||||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract long truncated BSR value */
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case UL_SCH_LCID_C_RNTI:
|
|
||||||
//38.321 section 6.1.3.2
|
|
||||||
//fixed length
|
|
||||||
mac_ce_len = 2;
|
|
||||||
/* Extract CRNTI value */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_SINGLE_ENTRY_PHR:
|
|
||||||
//38.321 section 6.1.3.8
|
|
||||||
//fixed length
|
|
||||||
mac_ce_len = 2;
|
|
||||||
/* Extract SINGLE ENTRY PHR elements for PHR calculation */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
|
|
||||||
//38.321 section 6.1.3.9
|
|
||||||
// varialbe length
|
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
|
||||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
|
||||||
//38.321 section 6.1.3.9
|
|
||||||
// varialbe length
|
|
||||||
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
|
||||||
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
}
|
|
||||||
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_PADDING:
|
|
||||||
done = 1;
|
|
||||||
// end of MAC PDU, can ignore the rest.
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UL_SCH_LCID_DTCH:
|
|
||||||
// check if LCID is valid at current time.
|
|
||||||
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
|
||||||
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
|
||||||
mac_subheader_len = 3;
|
|
||||||
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8)
|
|
||||||
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
|
||||||
mac_subheader_len = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_D(MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
|
|
||||||
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
|
||||||
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
|
||||||
|
|
||||||
for (i = 0; i < 32; i++)
|
|
||||||
LOG_T(MAC, "%x.", (pdu_ptr + mac_subheader_len)[i]);
|
|
||||||
|
|
||||||
LOG_T(MAC, "\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (IS_SOFTMODEM_NOS1){
|
|
||||||
if (rx_lcid < NB_RB_MAX && rx_lcid >= UL_SCH_LCID_DTCH) {
|
|
||||||
|
|
||||||
mac_rlc_data_ind(module_idP,
|
|
||||||
0x1234,
|
|
||||||
module_idP,
|
|
||||||
frameP,
|
|
||||||
ENB_FLAG_YES,
|
|
||||||
MBMS_FLAG_NO,
|
|
||||||
rx_lcid,
|
|
||||||
(char *) (pdu_ptr + mac_subheader_len),
|
|
||||||
mac_sdu_len,
|
|
||||||
1,
|
|
||||||
NULL);
|
|
||||||
} else {
|
|
||||||
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, module_idP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
|
||||||
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
|
||||||
|
|
||||||
AssertFatal(pdu_len >= 0, "[MAC] nr_process_mac_pdu, residual mac pdu length < 0!\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*void nr_rx_sdu(module_id_t module_idP,
|
|
||||||
uint8_t CC_id,
|
|
||||||
frame_t frameP,
|
|
||||||
uint8_t ttiP,
|
|
||||||
const rnti_t rntiP,
|
|
||||||
uint8_t * pdu,
|
|
||||||
const uint16_t pdu_len,
|
|
||||||
const uint16_t timing_advance,
|
|
||||||
const uint8_t ul_cqi)
|
|
||||||
{
|
|
||||||
|
|
||||||
LOG_D(MAC, "Handling PDU frame %d slot %d pdu_len: %d \n", frameP, ttiP, pdu_len);
|
|
||||||
|
|
||||||
uint8_t * pduP = pdu;
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
|
||||||
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
|
|
||||||
for (int i = 0; i < pdu_len ; i++) {
|
|
||||||
//harq_process_ul_ue->a[i] = (unsigned char) rand();
|
|
||||||
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
|
|
||||||
printf("%02x ",(unsigned char)pduP[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Processing MAC PDU
|
|
||||||
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
|
|
||||||
if (pduP != NULL){
|
|
||||||
LOG_D(MAC, "Received PDU at MAC gNB \n");
|
|
||||||
nr_process_mac_pdu(module_idP, CC_id, frameP, pduP, pdu_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,202 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||||
|
#include "executables/softmodem-common.h"
|
||||||
|
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||||
|
|
||||||
|
void nr_process_mac_pdu(
|
||||||
|
module_id_t module_idP,
|
||||||
|
uint8_t CC_id,
|
||||||
|
frame_t frameP,
|
||||||
|
uint8_t *pduP,
|
||||||
|
uint16_t mac_pdu_len)
|
||||||
|
{
|
||||||
|
|
||||||
|
// This function is adapting code from the old
|
||||||
|
// parse_header(...) and ue_send_sdu(...) functions of OAI LTE
|
||||||
|
|
||||||
|
uint8_t *pdu_ptr = pduP, rx_lcid, done = 0;
|
||||||
|
int pdu_len = mac_pdu_len;
|
||||||
|
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
|
||||||
|
|
||||||
|
|
||||||
|
// For both DL/UL-SCH
|
||||||
|
// Except:
|
||||||
|
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
||||||
|
// - UL/DL-SCH: padding
|
||||||
|
// - UL-SCH: MSG3 48-bits
|
||||||
|
// |0|1|2|3|4|5|6|7| bit-wise
|
||||||
|
// |R|F| LCID |
|
||||||
|
// | L |
|
||||||
|
// |0|1|2|3|4|5|6|7| bit-wise
|
||||||
|
// |R|F| LCID |
|
||||||
|
// | L |
|
||||||
|
// | L |
|
||||||
|
|
||||||
|
// For both DL/UL-SCH
|
||||||
|
// For:
|
||||||
|
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
|
||||||
|
// - UL/DL-SCH: padding, for single/multiple 1-oct padding CE(s)
|
||||||
|
// - UL-SCH: MSG3 48-bits
|
||||||
|
// |0|1|2|3|4|5|6|7| bit-wise
|
||||||
|
// |R|R| LCID |
|
||||||
|
// LCID: The Logical Channel ID field identifies the logical channel instance of the corresponding MAC SDU or the type of the corresponding MAC CE or padding as described in Tables 6.2.1-1 and 6.2.1-2 for the DL-SCH and UL-SCH respectively. There is one LCID field per MAC subheader. The LCID field size is 6 bits;
|
||||||
|
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
|
||||||
|
// F: lenght of L is 0:8 or 1:16 bits wide
|
||||||
|
// R: Reserved bit, set to zero.
|
||||||
|
|
||||||
|
while (!done && pdu_len > 0){
|
||||||
|
mac_ce_len = 0;
|
||||||
|
mac_subheader_len = 1; // default to fixed-length subheader = 1-oct
|
||||||
|
mac_sdu_len = 0;
|
||||||
|
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
|
||||||
|
|
||||||
|
LOG_D(MAC, "LCID received at gNB side: %d \n", rx_lcid);
|
||||||
|
|
||||||
|
switch(rx_lcid){
|
||||||
|
// MAC CE
|
||||||
|
|
||||||
|
/*#ifdef DEBUG_HEADER_PARSING
|
||||||
|
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
|
||||||
|
#endif*/
|
||||||
|
|
||||||
|
case UL_SCH_LCID_S_BSR:
|
||||||
|
//38.321 section 6.1.3.1
|
||||||
|
//fixed length
|
||||||
|
mac_ce_len =1;
|
||||||
|
/* Extract short BSR value */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_S_TRUNCATED_BSR:
|
||||||
|
//38.321 section 6.1.3.1
|
||||||
|
//fixed length
|
||||||
|
mac_ce_len =1;
|
||||||
|
/* Extract short truncated BSR value */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_L_BSR:
|
||||||
|
//38.321 section 6.1.3.1
|
||||||
|
//variable length
|
||||||
|
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||||
|
mac_subheader_len = 2;
|
||||||
|
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||||
|
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||||
|
mac_subheader_len = 3;
|
||||||
|
}
|
||||||
|
/* Extract long BSR value */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_L_TRUNCATED_BSR:
|
||||||
|
//38.321 section 6.1.3.1
|
||||||
|
//variable length
|
||||||
|
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||||
|
mac_subheader_len = 2;
|
||||||
|
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||||
|
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||||
|
mac_subheader_len = 3;
|
||||||
|
}
|
||||||
|
/* Extract long truncated BSR value */
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case UL_SCH_LCID_C_RNTI:
|
||||||
|
//38.321 section 6.1.3.2
|
||||||
|
//fixed length
|
||||||
|
mac_ce_len = 2;
|
||||||
|
/* Extract CRNTI value */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_SINGLE_ENTRY_PHR:
|
||||||
|
//38.321 section 6.1.3.8
|
||||||
|
//fixed length
|
||||||
|
mac_ce_len = 2;
|
||||||
|
/* Extract SINGLE ENTRY PHR elements for PHR calculation */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
|
||||||
|
//38.321 section 6.1.3.9
|
||||||
|
// varialbe length
|
||||||
|
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||||
|
mac_subheader_len = 2;
|
||||||
|
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||||
|
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||||
|
mac_subheader_len = 3;
|
||||||
|
}
|
||||||
|
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
||||||
|
//38.321 section 6.1.3.9
|
||||||
|
// varialbe length
|
||||||
|
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||||
|
mac_subheader_len = 2;
|
||||||
|
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||||
|
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||||
|
mac_subheader_len = 3;
|
||||||
|
}
|
||||||
|
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_PADDING:
|
||||||
|
done = 1;
|
||||||
|
// end of MAC PDU, can ignore the rest.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UL_SCH_LCID_DTCH:
|
||||||
|
// check if LCID is valid at current time.
|
||||||
|
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
|
||||||
|
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
|
||||||
|
mac_subheader_len = 3;
|
||||||
|
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8)
|
||||||
|
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
|
||||||
|
mac_subheader_len = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_D(MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
|
||||||
|
|
||||||
|
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
|
||||||
|
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
LOG_T(MAC, "%x.", (pdu_ptr + mac_subheader_len)[i]);
|
||||||
|
|
||||||
|
LOG_T(MAC, "\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (IS_SOFTMODEM_NOS1){
|
||||||
|
if (rx_lcid < NB_RB_MAX && rx_lcid >= UL_SCH_LCID_DTCH) {
|
||||||
|
|
||||||
|
mac_rlc_data_ind(module_idP,
|
||||||
|
0x1234,
|
||||||
|
module_idP,
|
||||||
|
frameP,
|
||||||
|
ENB_FLAG_YES,
|
||||||
|
MBMS_FLAG_NO,
|
||||||
|
rx_lcid,
|
||||||
|
(char *) (pdu_ptr + mac_subheader_len),
|
||||||
|
mac_sdu_len,
|
||||||
|
1,
|
||||||
|
NULL);
|
||||||
|
} else {
|
||||||
|
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, module_idP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||||
|
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
|
||||||
|
|
||||||
|
AssertFatal(pdu_len >= 0, "[MAC] nr_process_mac_pdu, residual mac pdu length < 0!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
|
|||||||
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
|
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
|
||||||
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
|
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
|
||||||
} else {
|
} else {
|
||||||
LOG_I(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok), received length: %d \n",UL_info->frame,UL_info->slot, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length);
|
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok), received length: %d \n",UL_info->frame,UL_info->slot, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length);
|
||||||
nr_rx_sdu(UL_info->module_id,
|
nr_rx_sdu(UL_info->module_id,
|
||||||
UL_info->CC_id,
|
UL_info->CC_id,
|
||||||
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
|
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
|
||||||
|
|||||||
Reference in New Issue
Block a user