Commit 93ac6bd4 authored by matzakos's avatar matzakos

nr-ip-UL-nos1: Substitute LTE macros in new NR functions and data structures + logs cleanup

parent bb7a7888
...@@ -192,7 +192,7 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -192,7 +192,7 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
//Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
//and block this traffic from being forwarded to the upper layers at the gNB //and block this traffic from being forwarded to the upper layers at the gNB
uint16_t payload_offset = 5; uint16_t payload_offset = 5;
LOG_E(PHY, "Random data to be tranmsitted: \n"); LOG_D(PHY, "Random data to be tranmsitted: \n");
//Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver //Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver
for (i = 0; i<payload_offset; i++) for (i = 0; i<payload_offset; i++)
harq_process_ul_ue->a[i] = 0; harq_process_ul_ue->a[i] = 0;
...@@ -426,7 +426,7 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -426,7 +426,7 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
LOG_I(PHY, "Is data existing ?: %d \n", data_existing); LOG_D(PHY, "Is data existing ?: %d \n", data_existing);
return data_existing; return data_existing;
} }
......
...@@ -288,7 +288,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id ...@@ -288,7 +288,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id
LOG_I(PHY, "ULSCH in error\n"); LOG_I(PHY, "ULSCH in error\n");
//gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b //gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b
else if(gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->b!=NULL){ else if(gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->b!=NULL){
LOG_D(PHY, "ULSCH received ok \n"); LOG_I(PHY, "ULSCH received ok \n");
if(IS_SOFTMODEM_NOS1){ //&& gNB->ulsch[UE_id][0]->rnti == 0x1234 if(IS_SOFTMODEM_NOS1){ //&& gNB->ulsch[UE_id][0]->rnti == 0x1234
nr_fill_crc_indication (gNB, UE_id, frame_rx, slot_rx, 0); nr_fill_crc_indication (gNB, UE_id, frame_rx, slot_rx, 0);
nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid); nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid);
......
...@@ -2502,7 +2502,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, ...@@ -2502,7 +2502,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
} // UE_mode==PUSCH } // UE_mode==PUSCH
*/ */
LOG_I(PHY, "Sending data \n"); LOG_D(PHY, "Sending data \n");
nr_ue_pusch_common_procedures(ue, nr_ue_pusch_common_procedures(ue,
harq_pid, harq_pid,
slot_tx, slot_tx,
......
...@@ -133,6 +133,9 @@ typedef struct { ...@@ -133,6 +133,9 @@ typedef struct {
#define UL_SCH_LCID_L_BSR 0x3E #define UL_SCH_LCID_L_BSR 0x3E
#define UL_SCH_LCID_PADDING 0x3F #define UL_SCH_LCID_PADDING 0x3F
#define NR_MAX_NUM_LCID 32
#define NR_MAX_NUM_LCGID 8
#endif /*__LAYER2_MAC_H__ */ #endif /*__LAYER2_MAC_H__ */
...@@ -49,65 +49,4 @@ typedef enum { ...@@ -49,65 +49,4 @@ typedef enum {
UE_PHY_HO_PRACH UE_PHY_HO_PRACH
} NR_UE_L2_STATE_t; } NR_UE_L2_STATE_t;
typedef struct {
uint8_t LCID:6; // octet 1 [5:0]
uint8_t F:1; // octet 1 [6]
uint8_t R:1; // octet 1 [7]
uint8_t L:8; // octet 2 [7:0]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT;
typedef struct {
uint8_t LCID:6; // octet 1 [5:0]
uint8_t F:1; // octet 1 [6]
uint8_t R:1; // octet 1 [7]
uint8_t L1:8; // octet 2 [7:0]
uint8_t L2:8; // octet 3 [7:0]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG;
typedef struct {
uint8_t LCID:6; // octet 1 [5:0]
uint8_t R:2; // octet 1 [7:6]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
// 38.321 ch6.2.1, 38.331
#define DL_SCH_LCID_CCCH 0x00
#define DL_SCH_LCID_SRB1 0x01
#define DL_SCH_LCID_SRB2 0x02
#define DL_SCH_LCID_SRB3 0x03
#define DL_SCH_LCID_RECOMMENDED_BITRATE 0x2F
#define DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT 0x30
#define DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT 0x31
#define DL_SCH_LCID_SP_SRS_ACTIVATION 0x32
#define DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT 0x33
#define DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH 0x34
#define DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH 0x35
#define DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL 0x36
#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT 0X37
#define DL_SCH_LCID_DUPLICATION_ACT 0X38
#define DL_SCH_LCID_SCell_ACT_4_OCT 0X39
#define DL_SCH_LCID_SCell_ACT_1_OCT 0X3A
#define DL_SCH_LCID_L_DRX 0x3B
#define DL_SCH_LCID_DRX 0x3C
#define DL_SCH_LCID_TA_COMMAND 0x3D
#define DL_SCH_LCID_CON_RES_ID 0x3E
#define DL_SCH_LCID_PADDING 0x3F
#define UL_SCH_LCID_CCCH 0x00
#define UL_SCH_LCID_SRB1 0x01
#define UL_SCH_LCID_SRB2 0x02
#define UL_SCH_LCID_SRB3 0x03
#define UL_SCH_LCID_CCCH_MSG3 0x21
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
#define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37
#define UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT 0x38
#define UL_SCH_LCID_SINGLE_ENTRY_PHR 0x39
#define UL_SCH_LCID_C_RNTI 0x3A
#define UL_SCH_LCID_S_TRUNCATED_BSR 0x3B
#define UL_SCH_LCID_L_TRUNCATED_BSR 0x3C
#define UL_SCH_LCID_S_BSR 0x3D
#define UL_SCH_LCID_L_BSR 0x3E
#define UL_SCH_LCID_PADDING 0x3F
#endif /*__LAYER2_MAC_DEFS_H__ */ #endif /*__LAYER2_MAC_DEFS_H__ */
...@@ -51,12 +51,11 @@ ...@@ -51,12 +51,11 @@
#include "fapi_nr_ue_interface.h" #include "fapi_nr_ue_interface.h"
#include "NR_IF_Module.h" #include "NR_IF_Module.h"
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
#define NB_NR_UE_MAC_INST 1 #define NB_NR_UE_MAC_INST 1
/*!\brief Maximum number of logical channl group IDs */ /*!\brief Maximum number of logical channl group IDs */
#define MAX_NUM_LCGID 4
/*!\brief Maximum number of logical chanels */
#define MAX_NUM_LCID 11
/*!\brief value for indicating BSR Timer is not running */ /*!\brief value for indicating BSR Timer is not running */
#define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) #define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
...@@ -67,42 +66,24 @@ typedef enum { ...@@ -67,42 +66,24 @@ typedef enum {
SFN_C_IMPOSSIBLE SFN_C_IMPOSSIBLE
} SFN_C_TYPE; } SFN_C_TYPE;
#define UL_SCH_LCID_CCCH 0x00
#define UL_SCH_LCID_SRB1 0x01
#define UL_SCH_LCID_SRB2 0x02
#define UL_SCH_LCID_DTCH 0x03
#define UL_SCH_LCID_SRB3 0x04
#define UL_SCH_LCID_CCCH_MSG3 0x21
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
#define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37
#define UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT 0x38
#define UL_SCH_LCID_SINGLE_ENTRY_PHR 0x39
#define UL_SCH_LCID_C_RNTI 0x3A
#define UL_SCH_LCID_S_TRUNCATED_BSR 0x3B
#define UL_SCH_LCID_L_TRUNCATED_BSR 0x3C
#define UL_SCH_LCID_S_BSR 0x3D
#define UL_SCH_LCID_L_BSR 0x3E
#define UL_SCH_LCID_PADDING 0x3F
// LTE structure, might need to be adapted for NR // LTE structure, might need to be adapted for NR
typedef struct { typedef struct {
/// buffer status for each lcgid /// buffer status for each lcgid
uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology uint8_t BSR[NR_MAX_NUM_LCGID]; // should be more for mesh topology
/// keep the number of bytes in rlc buffer for each lcgid /// keep the number of bytes in rlc buffer for each lcgid
int32_t BSR_bytes[MAX_NUM_LCGID]; int32_t BSR_bytes[NR_MAX_NUM_LCGID];
/// after multiplexing buffer remain for each lcid /// after multiplexing buffer remain for each lcid
int32_t LCID_buffer_remain[MAX_NUM_LCID]; int32_t LCID_buffer_remain[NR_MAX_NUM_LCID];
/// sum of all lcid buffer size /// sum of all lcid buffer size
uint16_t All_lcid_buffer_size_lastTTI; uint16_t All_lcid_buffer_size_lastTTI;
/// buffer status for each lcid /// buffer status for each lcid
uint8_t LCID_status[MAX_NUM_LCID]; uint8_t LCID_status[NR_MAX_NUM_LCID];
/// SR pending as defined in 36.321 /// SR pending as defined in 36.321
uint8_t SR_pending; uint8_t SR_pending;
/// SR_COUNTER as defined in 36.321 /// SR_COUNTER as defined in 36.321
uint16_t SR_COUNTER; uint16_t SR_COUNTER;
/// logical channel group ide for each LCID /// logical channel group ide for each LCID
uint8_t LCGID[MAX_NUM_LCID]; uint8_t LCGID[NR_MAX_NUM_LCID];
/// retxBSR-Timer, default value is sf2560 /// retxBSR-Timer, default value is sf2560
uint16_t retxBSR_Timer; uint16_t retxBSR_Timer;
/// retxBSR_SF, number of subframe before triggering a regular BSR /// retxBSR_SF, number of subframe before triggering a regular BSR
...@@ -142,9 +123,9 @@ typedef struct { ...@@ -142,9 +123,9 @@ typedef struct {
uint16_t extendedPHR_r10; uint16_t extendedPHR_r10;
//Bj bucket usage per lcid //Bj bucket usage per lcid
int16_t Bj[MAX_NUM_LCID]; int16_t Bj[NR_MAX_NUM_LCID];
// Bucket size per lcid // Bucket size per lcid
int16_t bucket_size[MAX_NUM_LCID]; int16_t bucket_size[NR_MAX_NUM_LCID];
} NR_UE_SCHEDULING_INFO; } NR_UE_SCHEDULING_INFO;
......
...@@ -36,9 +36,10 @@ ...@@ -36,9 +36,10 @@
#include "assertions.h" #include "assertions.h"
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "openair2/LAYER2/MAC/mac.h" //#include "openair2/LAYER2/MAC/mac.h"
#include "openair2/LAYER2/RLC/rlc.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 <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
...@@ -2184,7 +2185,7 @@ void nr_ue_process_mac_pdu( ...@@ -2184,7 +2185,7 @@ void nr_ue_process_mac_pdu(
break; break;
// MAC SDU // MAC SDU
case DL_SCH_LCID_SRB1: case DL_SCH_LCID_DCCH:
// check if LCID is valid at current time. // check if LCID is valid at current time.
case UL_SCH_LCID_SRB2: case UL_SCH_LCID_SRB2:
// check if LCID is valid at current time. // check if LCID is valid at current time.
...@@ -2506,8 +2507,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2506,8 +2507,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
// Check for DCCH first // Check for DCCH first
// TO DO: Multiplex in the order defined by the logical channel prioritization // TO DO: Multiplex in the order defined by the logical channel prioritization
for (lcid = DCCH; for (lcid = UL_SCH_LCID_SRB1;
lcid < MAX_NUM_LCID; lcid++) { lcid < NR_MAX_NUM_LCID; lcid++) {
lcid_buffer_occupancy_old = lcid_buffer_occupancy_old =
//TODO: Replace static value with CRNTI //TODO: Replace static value with CRNTI
......
...@@ -565,9 +565,6 @@ void nr_process_mac_pdu( ...@@ -565,9 +565,6 @@ void nr_process_mac_pdu(
int pdu_len = mac_pdu_len; int pdu_len = mac_pdu_len;
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len; uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
LOG_I(MAC, "LCID received at gNB side: %d \n", rx_lcid);
// For both DL/UL-SCH // For both DL/UL-SCH
// Except: // Except:
...@@ -600,7 +597,7 @@ void nr_process_mac_pdu( ...@@ -600,7 +597,7 @@ void nr_process_mac_pdu(
mac_sdu_len = 0; mac_sdu_len = 0;
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID; rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
LOG_I(MAC, "LCID received at gNB side: %d \n", rx_lcid); LOG_D(MAC, "LCID received at gNB side: %d \n", rx_lcid);
switch(rx_lcid){ switch(rx_lcid){
// MAC CE // MAC CE
...@@ -681,49 +678,17 @@ void nr_rx_sdu(module_id_t module_idP, ...@@ -681,49 +678,17 @@ void nr_rx_sdu(module_id_t module_idP,
const uint8_t ul_cqi) const uint8_t ul_cqi)
{ {
LOG_I(MAC, "Handling PDU frame %d slot %d pdu_len: %d \n", frameP, ttiP, pdu_len); LOG_D(MAC, "Handling PDU frame %d slot %d pdu_len: %d \n", frameP, ttiP, pdu_len);
uint8_t * pduP = pdu; uint8_t * pduP = pdu;
/*if (opt_enabled) {
trace_pdu(DIRECTION_DOWNLINK, pduP, pdu_len, module_idP, WS_C_RNTI,
UE_mac_inst[module_idP].cs_RNTI, frameP, ttiP, 0, 0); //subframeP
LOG_D(OPT, "[UE %d][DLSCH] Frame %d trace pdu for rnti %x with size %d\n",
module_idP, frameP, UE_mac_inst[module_idP].cs_RNTI, pdu_len);
}*/
/*
#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC, "[UE %d] ue_send_sdu : Frame %d gNB_index %d : num_ce %d num_sdu %d\n",
module_idP, frameP, gNB_index, num_ce, num_sdu);
#endif
*/
/*
#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.", sdu[i]);
}
LOG_T(MAC, "\n");
#endif
*/
// Processing MAC PDU // Processing MAC PDU
// it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs // it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs
if (pduP != NULL){ if (pduP != NULL){
LOG_I(MAC, "Received PDU at MAC gNB \n"); LOG_D(MAC, "Received PDU at MAC gNB \n");
nr_process_mac_pdu(module_idP, CC_id, frameP, pduP, pdu_len); nr_process_mac_pdu(module_idP, CC_id, frameP, pduP, pdu_len);
} }
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
/*
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
#endif
*/
} }
......
...@@ -78,7 +78,7 @@ void mac_rlc_data_ind ( ...@@ -78,7 +78,7 @@ void mac_rlc_data_ind (
} }
if (rb != NULL) { if (rb != NULL) {
LOG_W(RLC, "RB found! (channel ID %d) \n", channel_idP); LOG_D(RLC, "RB found! (channel ID %d) \n", channel_idP);
rb->set_time(rb, nr_rlc_current_time); rb->set_time(rb, nr_rlc_current_time);
rb->recv_pdu(rb, buffer_pP, tb_sizeP); rb->recv_pdu(rb, buffer_pP, tb_sizeP);
} else { } else {
......
...@@ -192,7 +192,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) { ...@@ -192,7 +192,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,
......
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