Commit 745241bd authored by Melissa Elkadi's avatar Melissa Elkadi

Merge branch 'episys/nsa_epc_gnb_updates' into episys/david/multiUE_with_crnti_checking

Also, lots of debugging logs added
parents c6198334 d95e35df
...@@ -172,7 +172,7 @@ eNBs = ...@@ -172,7 +172,7 @@ eNBs =
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.61.3"; mme_ip_address = ( { ipv4 = "192.168.61.195";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
port = 36412 ; port = 36412 ;
active = "yes"; active = "yes";
...@@ -180,7 +180,7 @@ eNBs = ...@@ -180,7 +180,7 @@ eNBs =
} }
); );
enable_measurement_reports = "no"; enable_measurement_reports = "yes";
///X2 ///X2
enable_x2 = "yes"; enable_x2 = "yes";
...@@ -191,9 +191,9 @@ eNBs = ...@@ -191,9 +191,9 @@ eNBs =
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "ctrl"; ENB_INTERFACE_NAME_FOR_S1_MME = "ctrl0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "172.16.0.1"; ENB_IPV4_ADDRESS_FOR_S1_MME = "172.16.0.1";
ENB_INTERFACE_NAME_FOR_S1U = "ctrl"; ENB_INTERFACE_NAME_FOR_S1U = "ctrl0";
ENB_IPV4_ADDRESS_FOR_S1U = "172.16.0.1"; ENB_IPV4_ADDRESS_FOR_S1U = "172.16.0.1";
ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_PORT_FOR_S1U = 2152; # Spec 2152
ENB_IPV4_ADDRESS_FOR_X2C = "172.16.0.1"; ENB_IPV4_ADDRESS_FOR_X2C = "172.16.0.1";
......
...@@ -22,6 +22,32 @@ void *malloc_or_fail(size_t size) { ...@@ -22,6 +22,32 @@ void *malloc_or_fail(size_t size) {
return ptr; return ptr;
} }
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
char *endp = out + out_len;
const uint8_t *q = data;
snprintf(p, endp - p, "[%zu]", data_len);
p += strlen(p);
for (size_t i = 0; i < data_len; ++i)
{
if (p >= endp)
{
static const char ellipses[] = "...";
char *s = endp - sizeof(ellipses);
if (s >= p)
{
strcpy(s, ellipses);
}
break;
}
snprintf(p, endp - p, " %02X", *q++);
p += strlen(p);
}
return out;
}
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: hex_char_to_hex_value() ** ** Name: hex_char_to_hex_value() **
......
...@@ -9,6 +9,7 @@ extern "C" { ...@@ -9,6 +9,7 @@ extern "C" {
void *calloc_or_fail(size_t size); void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size); void *malloc_or_fail(size_t size);
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len);
// Converts an hexadecimal ASCII coded digit into its value. ** // Converts an hexadecimal ASCII coded digit into its value. **
int hex_char_to_hex_value (char c); int hex_char_to_hex_value (char c);
......
...@@ -672,6 +672,8 @@ int main( int argc, char **argv ) ...@@ -672,6 +672,8 @@ int main( int argc, char **argv )
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); get_options ();
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n"); fprintf(stderr,"Getting configuration failed\n");
exit(-1); exit(-1);
...@@ -708,7 +710,7 @@ int main( int argc, char **argv ) ...@@ -708,7 +710,7 @@ int main( int argc, char **argv )
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
if(!IS_SOFTMODEM_NOS1) if(IS_SOFTMODEM_NOS1)
netlink_init(); netlink_init();
#if defined(PDCP_USE_NETLINK_QUEUES) #if defined(PDCP_USE_NETLINK_QUEUES)
pdcp_netlink_init(); pdcp_netlink_init();
...@@ -720,7 +722,7 @@ if(!IS_SOFTMODEM_NOS1) ...@@ -720,7 +722,7 @@ if(!IS_SOFTMODEM_NOS1)
#endif #endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
if(IS_SOFTMODEM_NOS1) if(!IS_SOFTMODEM_NOS1)
init_pdcp(); init_pdcp();
if (RC.nb_nr_L1_inst > 0) if (RC.nb_nr_L1_inst > 0)
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "SCHED_NR_UE/phy_frame_config_nr.h" #include "SCHED_NR_UE/phy_frame_config_nr.h"
#include "SCHED_NR_UE/defs.h" #include "SCHED_NR_UE/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
/* /*
* NR SLOT PROCESSING SEQUENCE * NR SLOT PROCESSING SEQUENCE
...@@ -317,6 +318,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -317,6 +318,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
else if (nr_prach == 2) else if (nr_prach == 2)
{ {
LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id); LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
nr_DRB_preconfiguration(mac->crnti);
} }
else if(nr_prach == 3) else if(nr_prach == 3)
{ {
......
...@@ -465,12 +465,12 @@ void init_pdcp(int ue_id) { ...@@ -465,12 +465,12 @@ void init_pdcp(int ue_id) {
if (IS_SOFTMODEM_NOKRNMOD) if (IS_SOFTMODEM_NOKRNMOD)
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
if(!IS_SOFTMODEM_NOS1) {
/*if (rlc_module_init() != 0) { if (rlc_module_init(0) != 0) {
LOG_I(RLC, "Problem at RLC initiation \n"); LOG_I(RLC, "Problem at RLC initiation \n");
}
} }
pdcp_layer_init(); pdcp_layer_init();
nr_DRB_preconfiguration();*/
nr_pdcp_module_init(pdcp_initmask, ue_id); nr_pdcp_module_init(pdcp_initmask, ue_id);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
...@@ -531,16 +531,13 @@ int main( int argc, char **argv ) { ...@@ -531,16 +531,13 @@ int main( int argc, char **argv ) {
ue_id_g = (node_number == 0) ? 0 : node_number - 2; ue_id_g = (node_number == 0) ? 0 : node_number - 2;
AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n"); AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n");
if(IS_SOFTMODEM_NOS1) if(node_number == 0)
{ {
if(node_number == 0) init_pdcp(0);
{ }
init_pdcp(0); else
} {
else init_pdcp(mode_offset + node_number - 1);
{
init_pdcp(mode_offset + node_number - 1);
}
} }
NB_UE_INST=1; NB_UE_INST=1;
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
{"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \ {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \ {"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \ {"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0}, \
{"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0} \
} }
......
...@@ -1294,7 +1294,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1294,7 +1294,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id); NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
if(vnf_p7->_public.sync_indication) if(vnf_p7->_public.sync_indication)
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1); (vnf_p7->_public.sync_indication)(&(vnf_p7->_public), phy->in_sync);
} }
phy->in_sync = 1; phy->in_sync = 1;
...@@ -1803,7 +1803,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7 ...@@ -1803,7 +1803,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id); NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
if(vnf_p7->_public.sync_indication) if(vnf_p7->_public.sync_indication)
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1); (vnf_p7->_public.sync_indication)(&(vnf_p7->_public), phy->in_sync);
} }
phy->in_sync = 1; phy->in_sync = 1;
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "PHY/impl_defs_nr.h" #include "PHY/impl_defs_nr.h"
#include "utils.h"
extern PHY_VARS_NR_UE ***PHY_vars_UE_g; extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
...@@ -91,6 +92,10 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response ...@@ -91,6 +92,10 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti; rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti;
rx_ind->pdu_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance; rx_ind->pdu_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance;
rx_ind->pdu_list[j].ul_cqi = scheduled_response->tx_request->tx_config.ul_cqi; rx_ind->pdu_list[j].ul_cqi = scheduled_response->tx_request->tx_config.ul_cqi;
char buffer[1024];
hexdump(rx_ind->pdu_list[j].pdu, rx_ind->pdu_list[j].pdu_length, buffer, sizeof(buffer));
LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s before queuing rx_ind\n",
buffer);
} }
crc_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION; crc_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION;
......
...@@ -219,6 +219,10 @@ typedef struct kenb_refresh_req_s { ...@@ -219,6 +219,10 @@ typedef struct kenb_refresh_req_s {
Byte_t kenb[32]; Byte_t kenb[32];
} kenb_refresh_req_t; } kenb_refresh_req_t;
typedef struct nsa_oai_tun_nsa_s {
uint8_t buffer[500]; //Melissa TODO
} nas_oai_tun_nsa_t;
/* /*
* NAS->AS - Cell Information request * NAS->AS - Cell Information request
* NAS request AS to search for a suitable cell belonging to the selected * NAS request AS to search for a suitable cell belonging to the selected
......
...@@ -65,6 +65,8 @@ MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq ...@@ -65,6 +65,8 @@ MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq
MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, NasRabEstRsp, nas_rab_est_rsp) MESSAGE_DEF(NAS_RAB_ESTABLI_RSP, MESSAGE_PRIORITY_MED, NasRabEstRsp, nas_rab_est_rsp)
MESSAGE_DEF(NAS_OAI_TUN_NSA, MESSAGE_PRIORITY_MED, NasOaiTunNsa, nas_oai_tun_nsa)
// UE: RRC -> NAS messages // UE: RRC -> NAS messages
MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, NasCellSelectionCnf, nas_cell_selection_cnf) MESSAGE_DEF(NAS_CELL_SELECTION_CNF, MESSAGE_PRIORITY_MED, NasCellSelectionCnf, nas_cell_selection_cnf)
MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, NasCellSelectionInd, nas_cell_selection_ind) MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, NasCellSelectionInd, nas_cell_selection_ind)
......
...@@ -89,6 +89,8 @@ ...@@ -89,6 +89,8 @@
#define RLC_SDU_INDICATION(mSGpTR) (mSGpTR)->ittiMsg.rlc_sdu_indication #define RLC_SDU_INDICATION(mSGpTR) (mSGpTR)->ittiMsg.rlc_sdu_indication
#define NAS_OAI_TUN_NSA(mSGpTR) (mSGpTR)->ittiMsg.nas_oai_tun_nsa
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
typedef struct RrcStateInd_s { typedef struct RrcStateInd_s {
Rrc_State_t state; Rrc_State_t state;
...@@ -420,6 +422,8 @@ typedef ul_info_transfer_req_t NasUlDataReq; ...@@ -420,6 +422,8 @@ typedef ul_info_transfer_req_t NasUlDataReq;
typedef rab_establish_rsp_t NasRabEstRsp; typedef rab_establish_rsp_t NasRabEstRsp;
typedef nas_oai_tun_nsa_t NasOaiTunNsa;
// UE: RRC -> NAS messages // UE: RRC -> NAS messages
typedef cell_info_cnf_t NasCellSelectionCnf; typedef cell_info_cnf_t NasCellSelectionCnf;
typedef cell_info_ind_t NasCellSelectionInd; typedef cell_info_ind_t NasCellSelectionInd;
......
...@@ -1934,7 +1934,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -1934,7 +1934,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
mac_subheader_len = 2; 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, gNB_index, mac_sdu_len); LOG_I(MAC, "Melissa Elkadi [UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG) #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
...@@ -1945,7 +1945,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, ...@@ -1945,7 +1945,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
LOG_T(MAC, "\n"); LOG_T(MAC, "\n");
#endif #endif
if (IS_SOFTMODEM_NOS1){ if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->nsa){
if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DTCH) { if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DTCH) {
mac_rlc_data_ind(module_idP, mac_rlc_data_ind(module_idP,
...@@ -1991,22 +1991,19 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -1991,22 +1991,19 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
uint16_t buflen) { uint16_t buflen) {
NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) pdu; NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) pdu;
unsigned char last_size = 0, i, mac_header_control_elements[16], *ce_ptr, bsr = 0;
int mac_ce_size;
uint16_t offset = 0;
LOG_D(MAC, "[UE] Generating ULSCH PDU : num_sdus %d\n", num_sdus); LOG_D(MAC, "[UE] Generating ULSCH PDU : num_sdus %d\n", num_sdus);
#ifdef DEBUG_HEADER_PARSING #ifdef DEBUG_HEADER_PARSING
for (i = 0; i < num_sdus; i++) for (int i = 0; i < num_sdus; i++)
LOG_D(MAC, "[UE] MAC subPDU %d (lcid %d length %d bytes \n", i, sdu_lcids[i], sdu_lengths[i]); LOG_D(MAC, "[UE] MAC subPDU %d (lcid %d length %d bytes \n", i, sdu_lcids[i], sdu_lengths[i]);
#endif #endif
// Generating UL MAC subPDUs including MAC SDU and subheader // Generating UL MAC subPDUs including MAC SDU and subheader
for (i = 0; i < num_sdus; i++) { for (int i = 0; i < num_sdus; i++) {
LOG_D(MAC, "[UE] Generating UL MAC subPDUs for SDU with lenght %d ( num_sdus %d )\n", sdu_lengths[i], num_sdus); LOG_D(MAC, "[UE] Generating UL MAC subPDUs for SDU with lenght %d ( num_sdus %d )\n", sdu_lengths[i], num_sdus);
if (sdu_lcids[i] != UL_SCH_LCID_CCCH){ if (sdu_lcids[i] != UL_SCH_LCID_CCCH){
...@@ -2015,22 +2012,21 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2015,22 +2012,21 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0;
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = sdu_lcids[i]; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = sdu_lcids[i];
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i]; ((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i];
last_size = 2; mac_pdu_ptr += sizeof(NR_MAC_SUBHEADER_SHORT);
} else { } else {
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->R = 0; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->R = 0;
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->F = 1; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->F = 1;
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->LCID = sdu_lcids[i]; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->LCID = sdu_lcids[i];
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L1 = ((unsigned short) sdu_lengths[i] >> 8) & 0x7f; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L1 = ((unsigned short) sdu_lengths[i] >> 8) & 0x7f;
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L2 = (unsigned short) sdu_lengths[i] & 0xff; ((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L2 = (unsigned short) sdu_lengths[i] & 0xff;
last_size = 3; mac_pdu_ptr += sizeof(NR_MAC_SUBHEADER_LONG);
} }
} else { // UL CCCH SDU } else { // UL CCCH SDU
mac_pdu_ptr->R = 0; mac_pdu_ptr->R = 0;
mac_pdu_ptr->LCID = sdu_lcids[i]; mac_pdu_ptr->LCID = sdu_lcids[i];
mac_pdu_ptr ++;
} }
mac_pdu_ptr += last_size;
// cycle through SDUs, compute each relevant and place ulsch_buffer in // cycle through SDUs, compute each relevant and place ulsch_buffer in
memcpy((void *) mac_pdu_ptr, (void *) sdus_payload, sdu_lengths[i]); memcpy((void *) mac_pdu_ptr, (void *) sdus_payload, sdu_lengths[i]);
sdus_payload += sdu_lengths[i]; sdus_payload += sdu_lengths[i];
...@@ -2039,8 +2035,6 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2039,8 +2035,6 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
// Generating UL MAC subPDUs including MAC CEs (MAC CE and subheader) // Generating UL MAC subPDUs including MAC CEs (MAC CE and subheader)
ce_ptr = &mac_header_control_elements[0];
if (power_headroom) { if (power_headroom) {
// MAC CE fixed subheader // MAC CE fixed subheader
mac_pdu_ptr->R = 0; mac_pdu_ptr->R = 0;
...@@ -2048,17 +2042,11 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2048,17 +2042,11 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
mac_pdu_ptr++; mac_pdu_ptr++;
// PHR MAC CE (1 octet) // PHR MAC CE (1 octet)
((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->PH = power_headroom; ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->PH = power_headroom;
((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->R1 = 0; ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->R1 = 0;
((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->PCMAX = 0; // todo ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->PCMAX = 0; // todo
((NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr)->R2 = 0; ((NR_SINGLE_ENTRY_PHR_MAC_CE *) mac_pdu_ptr)->R2 = 0;
mac_pdu_ptr += sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE);
mac_ce_size = sizeof(NR_SINGLE_ENTRY_PHR_MAC_CE);
// Copying bytes for PHR MAC CEs to the mac pdu pointer
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
ce_ptr += mac_ce_size;
mac_pdu_ptr += (unsigned char) mac_ce_size;
} }
if (crnti) { if (crnti) {
...@@ -2068,13 +2056,8 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2068,13 +2056,8 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
mac_pdu_ptr++; mac_pdu_ptr++;
// C-RNTI MAC CE (2 octets) // C-RNTI MAC CE (2 octets)
* (uint16_t *) ce_ptr = crnti; * (uint16_t *) mac_pdu_ptr = crnti;
mac_ce_size = sizeof(uint16_t); mac_pdu_ptr += sizeof(uint16_t);
// Copying bytes for CRNTI MAC CE to the mac pdu pointer
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
ce_ptr += mac_ce_size;
mac_pdu_ptr += (unsigned char) mac_ce_size;
} }
if (truncated_bsr) { if (truncated_bsr) {
...@@ -2084,11 +2067,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2084,11 +2067,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
mac_pdu_ptr++; mac_pdu_ptr++;
// Short truncated BSR MAC CE (1 octet) // Short truncated BSR MAC CE (1 octet)
((NR_BSR_SHORT_TRUNCATED *) ce_ptr)-> Buffer_size = truncated_bsr; ((NR_BSR_SHORT_TRUNCATED *) mac_pdu_ptr)-> Buffer_size = truncated_bsr;
((NR_BSR_SHORT_TRUNCATED *) ce_ptr)-> LcgID = 0; // todo ((NR_BSR_SHORT_TRUNCATED *) mac_pdu_ptr)-> LcgID = 0; // todo
mac_ce_size = sizeof(NR_BSR_SHORT_TRUNCATED); mac_pdu_ptr+= sizeof(NR_BSR_SHORT_TRUNCATED);
bsr = 1 ;
} else if (short_bsr) { } else if (short_bsr) {
// MAC CE fixed subheader // MAC CE fixed subheader
mac_pdu_ptr->R = 0; mac_pdu_ptr->R = 0;
...@@ -2096,11 +2077,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2096,11 +2077,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
mac_pdu_ptr++; mac_pdu_ptr++;
// Short truncated BSR MAC CE (1 octet) // Short truncated BSR MAC CE (1 octet)
((NR_BSR_SHORT *) ce_ptr)->Buffer_size = short_bsr; ((NR_BSR_SHORT *) mac_pdu_ptr)->Buffer_size = short_bsr;
((NR_BSR_SHORT *) ce_ptr)->LcgID = 0; // todo ((NR_BSR_SHORT *) mac_pdu_ptr)->LcgID = 0; // todo
mac_ce_size = sizeof(NR_BSR_SHORT); mac_pdu_ptr+= sizeof(NR_BSR_SHORT);
bsr = 1 ;
} else if (long_bsr) { } else if (long_bsr) {
// MAC CE variable subheader // MAC CE variable subheader
// todo ch 6.1.3.1. TS 38.321 // todo ch 6.1.3.1. TS 38.321
...@@ -2116,36 +2095,21 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, ...@@ -2116,36 +2095,21 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
// ((NR_BSR_LONG *) ce_ptr)->LCGID0 = 0; // ((NR_BSR_LONG *) ce_ptr)->LCGID0 = 0;
// mac_ce_size = sizeof(NR_BSR_LONG); // size is variable // mac_ce_size = sizeof(NR_BSR_LONG); // size is variable
} }
// compute offset before adding padding (if necessary)
if (bsr){ int padding_bytes = 0;
// Copying bytes for BSR MAC CE to the mac pdu pointer
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
ce_ptr += mac_ce_size;
mac_pdu_ptr += (unsigned char) mac_ce_size;
}
// compute offset before adding padding (if necessary)
offset = ((unsigned char *) mac_pdu_ptr - pdu);
uint16_t padding_bytes = 0;
if(buflen > 0) // If the buflen is provided if(buflen > 0) // If the buflen is provided
padding_bytes = buflen - offset; padding_bytes = buflen + pdu - (unsigned char *) mac_pdu_ptr;
AssertFatal(padding_bytes>=0,"");
// Compute final offset for padding // Compute final offset for padding
if (post_padding > 0 || padding_bytes>0) { if (post_padding || padding_bytes>0) {
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0;
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = UL_SCH_LCID_PADDING; ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = UL_SCH_LCID_PADDING;
mac_pdu_ptr++; mac_pdu_ptr++;
} else { }
// no MAC subPDU with padding return (uint8_t *)mac_pdu_ptr-pdu;
}
// compute final offset
offset = ((unsigned char *) mac_pdu_ptr - pdu);
//printf("Offset %d \n", ((unsigned char *) mac_pdu_ptr - pdu));
return offset;
} }
///////////////////////////////////// /////////////////////////////////////
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "assertions.h" #include "assertions.h"
#include "asn1_conversions.h" #include "asn1_conversions.h"
#include "SIMULATION/TOOLS/sim.h" // for taus #include "SIMULATION/TOOLS/sim.h" // for taus
#include "utils.h"
static prach_association_pattern_t prach_assoc_pattern; static prach_association_pattern_t prach_assoc_pattern;
static ssb_list_info_t ssb_list; static ssb_list_info_t ssb_list;
...@@ -897,7 +898,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -897,7 +898,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size; uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size;
// Push data from MAC to PHY only when NDI toggles // Push data from MAC to PHY only when NDI toggles
if (IS_SOFTMODEM_NOS1 && (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator)){ if (mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator){
// Getting IP traffic to be transmitted // Getting IP traffic to be transmitted
data_existing = nr_ue_get_sdu(mod_id, data_existing = nr_ue_get_sdu(mod_id,
cc_id, cc_id,
...@@ -911,7 +912,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -911,7 +912,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator; mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator;
//Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity //Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
if (!IS_SOFTMODEM_NOS1 || !data_existing) { if (IS_SOFTMODEM_NOS1 || !data_existing) {
//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
LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes); LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes);
...@@ -944,6 +945,11 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -944,6 +945,11 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
tx_req.tx_request_body[0].pdu_index = j; tx_req.tx_request_body[0].pdu_index = j;
tx_req.tx_request_body[0].pdu = ulsch_input_buffer; tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
char buffer[1024];
hexdump(tx_req.tx_request_body[0].pdu, tx_req.tx_request_body[0].pdu_length, buffer, sizeof(buffer));
LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s in the tx_req with num pdus %d\n",
buffer, tx_req.number_of_pdus);
if ((ra->ra_state != RA_SUCCEEDED && !ra->cfra) || if ((ra->ra_state != RA_SUCCEEDED && !ra->cfra) ||
(ra->ra_state == RA_SUCCEEDED && ra->cfra && get_softmodem_params()->nsa)) { (ra->ra_state == RA_SUCCEEDED && ra->cfra && get_softmodem_params()->nsa)) {
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index);
...@@ -1816,8 +1822,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -1816,8 +1822,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
buflen_remain = buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
LOG_D(MAC, LOG_I(MAC,
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to " "Melissa Elkadi [UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d "send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
module_idP, frameP, lcid, lcid_buffer_occupancy_new, module_idP, frameP, lcid, lcid_buffer_occupancy_new,
buflen, sdu_length_total, buflen, sdu_length_total,
...@@ -1832,7 +1838,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -1832,7 +1838,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
ENB_FLAG_NO, ENB_FLAG_NO,
MBMS_FLAG_NO, MBMS_FLAG_NO,
lcid, lcid,
buflen_remain, buflen_remain-MAX_RLC_SDU_SUBHEADER_SIZE,
(char *)&ulsch_sdus[sdu_length_total],0, (char *)&ulsch_sdus[sdu_length_total],0,
0); 0);
...@@ -1861,6 +1867,9 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -1861,6 +1867,9 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
buflen_remain = buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
} }
char buffer[1024];
hexdump(&ulsch_sdus[sdu_length_total], lcid_buffer_occupancy_new, buffer, sizeof(buffer));
LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s \n", buffer);
} }
} }
......
...@@ -1038,8 +1038,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1038,8 +1038,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
0, 0,
0); 0);
LOG_D(MAC, LOG_I(MAC,
"%4d.%2d RNTI %04x: %d bytes from DTCH %d (ndata %d, remaining size %d)\n", "Melissa Elkadi %4d.%2d RNTI %04x: %d bytes from DTCH %d (ndata %d, remaining size %d)\n",
frame, frame,
slot, slot,
rnti, rnti,
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
#include "utils.h"
//38.321 Table 6.1.3.1-1 //38.321 Table 6.1.3.1-1
const uint32_t NR_SHORT_BSR_TABLE[32] = { const uint32_t NR_SHORT_BSR_TABLE[32] = {
...@@ -259,14 +260,17 @@ void nr_process_mac_pdu( ...@@ -259,14 +260,17 @@ void nr_process_mac_pdu(
mac_subheader_len = 2; mac_subheader_len = 2;
} }
LOG_D(MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len); LOG_I(MAC, "Melissa Elkadi [UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes, header_len %d)\n",
module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, mac_subheader_len);
int UE_id = find_nr_UE_id(module_idP, rnti); int UE_id = find_nr_UE_id(module_idP, rnti);
RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
#if defined(ENABLE_MAC_PAYLOAD_DEBUG) #if defined(ENABLE_MAC_PAYLOAD_DEBUG)
log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n");
#endif #endif
char buffer[1024];
hexdump(pdu_ptr, mac_sdu_len, buffer, sizeof(buffer));
LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s \n", buffer);
mac_rlc_data_ind(module_idP, mac_rlc_data_ind(module_idP,
rnti, rnti,
module_idP, module_idP,
...@@ -278,7 +282,9 @@ void nr_process_mac_pdu( ...@@ -278,7 +282,9 @@ void nr_process_mac_pdu(
mac_sdu_len, mac_sdu_len,
1, 1,
NULL); NULL);
char buf[1024];
hexdump((char *) (pdu_ptr + mac_subheader_len), mac_sdu_len, buff, sizeof(buf));
LOG_I(MAC, "Melissa Elkadi, after passing to rlc this is hexdump of pdu %s \n", buf);
/* Updated estimated buffer when receiving data */ /* Updated estimated buffer when receiving data */
if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len) if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len)
sched_ctrl->estimated_ul_buffer -= mac_sdu_len; sched_ctrl->estimated_ul_buffer -= mac_sdu_len;
......
...@@ -1196,7 +1196,7 @@ pdcp_run ( ...@@ -1196,7 +1196,7 @@ pdcp_run (
// IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
// if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) { // if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) {
if (!EPC_MODE_ENABLED || ctxt_pP->enb_flag == ENB_FLAG_NO ) { if (!get_softmodem_params()->nsa) {
pdcp_fifo_read_input_sdus(ctxt_pP); pdcp_fifo_read_input_sdus(ctxt_pP);
} }
...@@ -1206,8 +1206,9 @@ pdcp_run ( ...@@ -1206,8 +1206,9 @@ pdcp_run (
} else { } else {
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].pdcp_ip); start_meas(&UE_pdcp_stats[ctxt_pP->module_id].pdcp_ip);
} }
if(!get_softmodem_params()->nsa) {
pdcp_fifo_flush_sdus(ctxt_pP); pdcp_fifo_flush_sdus(ctxt_pP);
}
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_ip); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_ip);
......
...@@ -25,13 +25,17 @@ ...@@ -25,13 +25,17 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "assertions.h"
void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size) void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size)
{ {
nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity; nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity;
int sn; int sn;
if (size < 3) abort(); if (size < 3) {
LOG_I(PDCP, "Size < 3. Size = %d. No data, so discarding.", size);
return;
}
if (!(buffer[0] & 0x80)) if (!(buffer[0] & 0x80))
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
...@@ -43,7 +47,7 @@ void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int ...@@ -43,7 +47,7 @@ void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int
if (entity->common.has_ciphering) if (entity->common.has_ciphering)
entity->common.cipher(entity->common.security_context, (unsigned char *)buffer+3, size-3, entity->common.cipher(entity->common.security_context, (unsigned char *)buffer+3, size-3,
entity->rb_id, sn, entity->common.is_gnb ? 0 : 1); entity->rb_id, sn, entity->common.is_gnb ? 0 : 1);
LOG_I(RLC, "Melissa Elkadi, calling deliver SDU to send to PDCP from RLC %s\n", __FUNCTION__);
entity->common.deliver_sdu(entity->common.deliver_sdu_data, entity->common.deliver_sdu(entity->common.deliver_sdu_data,
(nr_pdcp_entity_t *)entity, buffer+3, size-3); (nr_pdcp_entity_t *)entity, buffer+3, size-3);
} }
......
...@@ -377,10 +377,10 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id) ...@@ -377,10 +377,10 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id)
nas_getparams(); nas_getparams();
if(UE_NAS_USE_TUN) { if(UE_NAS_USE_TUN) {
/* TODO: Brute force changes made below to allow nr-UE to have unique tunnel interfaces. /* Melissa TODO: Brute force changes made below to allow nr-UE to have unique tunnel interfaces.
When the NODE_NUMBER param is not used to determine functionality and LTE tunnel When the NODE_NUMBER param is not used to determine functionality and LTE tunnel
interfaces, we should update the netlink_init_tun() and nas_config() calls below as well. */ interfaces, we should update the netlink_init_tun() and nas_config() calls below as well. */
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 )? MAX_MOBILES_PER_ENB : 1; int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1;
netlink_init_tun("nrue", num_if, id); netlink_init_tun("nrue", num_if, id);
//Add --nr-ip-over-lte option check for next line //Add --nr-ip-over-lte option check for next line
if (IS_SOFTMODEM_NOS1) if (IS_SOFTMODEM_NOS1)
...@@ -411,9 +411,11 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -411,9 +411,11 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
uint8_t *gtpu_buffer_p; uint8_t *gtpu_buffer_p;
int rb_id; int rb_id;
int i; int i;
LOG_I(PDCP, "Melissa Elkadi we got here %s\n", __FUNCTION__);
if(IS_SOFTMODEM_NOS1){ if (IS_SOFTMODEM_NOS1) {
len = write(nas_sock_fd[0], buf, size); len = write(nas_sock_fd[0], buf, size);
LOG_D(PDCP, "Writing %d bytes to tunnel interface\n", len);
if (len != size) { if (len != size) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
} }
...@@ -442,7 +444,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -442,7 +444,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); LOG_I(PDCP, "Melissa Elkadi %s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
//printf("\n"); //printf("\n");
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
...@@ -625,9 +627,11 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -625,9 +627,11 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti);
if (ue->drb[drb_id-1] != NULL) { if (ue->drb[drb_id-1] != NULL) {
LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", LOG_I(PDCP, "Melissa Elkadi %s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti); __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
} else { } else {
LOG_I(PDCP, "%s:%d:%s: Melissa Elkadi, we will call deliver_sdu_drb\n", __FILE__, __LINE__, __FUNCTION__);
pdcp_drb = new_nr_pdcp_entity_drb_am(is_gnb, drb_id, pdcp_drb = new_nr_pdcp_entity_drb_am(is_gnb, drb_id,
deliver_sdu_drb, ue, deliver_pdu_drb, ue, deliver_sdu_drb, ue, deliver_pdu_drb, ue,
sn_size_dl, t_reordering, discard_timer, sn_size_dl, t_reordering, discard_timer,
......
...@@ -204,6 +204,7 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) ...@@ -204,6 +204,7 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn)
int so = 0; int so = 0;
int bad_sdu = 0; int bad_sdu = 0;
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
/* go to first segment of sn */ /* go to first segment of sn */
pdu = entity->rx_list; pdu = entity->rx_list;
while (pdu->sn != sn) while (pdu->sn != sn)
...@@ -231,6 +232,7 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) ...@@ -231,6 +232,7 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn)
return; return;
/* deliver */ /* deliver */
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
entity->common.deliver_sdu(entity->common.deliver_sdu_data, entity->common.deliver_sdu(entity->common.deliver_sdu_data,
(nr_rlc_entity_t *)entity, (nr_rlc_entity_t *)entity,
sdu, so); sdu, so);
...@@ -244,13 +246,16 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) ...@@ -244,13 +246,16 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu)
entity->rx_next_highest = (x + 1) % entity->sn_modulus; entity->rx_next_highest = (x + 1) % entity->sn_modulus;
/* todo: room for optimization: we can run through rx_list only once */ /* todo: room for optimization: we can run through rx_list only once */
LOG_I(RLC, "Melissa Elkadi, checking if sdu_full is true %s()\n", __FUNCTION__);
if (sdu_full(entity, x)) { if (sdu_full(entity, x)) {
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
reassemble_and_deliver(entity, x); reassemble_and_deliver(entity, x);
if (x == entity->rx_highest_status) { if (x == entity->rx_highest_status) {
int rx_highest_status = entity->rx_highest_status; int rx_highest_status = entity->rx_highest_status;
while (sdu_delivered(entity, rx_highest_status)) while (sdu_delivered(entity, rx_highest_status))
rx_highest_status = (rx_highest_status + 1) % entity->sn_modulus; rx_highest_status = (rx_highest_status + 1) % entity->sn_modulus;
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
entity->rx_highest_status = rx_highest_status; entity->rx_highest_status = rx_highest_status;
} }
...@@ -273,8 +278,10 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) ...@@ -273,8 +278,10 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu)
entity->rx_next = rx_next; entity->rx_next = rx_next;
} }
} }
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
if (entity->t_reassembly_start) { if (entity->t_reassembly_start) {
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
if (entity->rx_next_status_trigger == entity->rx_next || if (entity->rx_next_status_trigger == entity->rx_next ||
(entity->rx_next_status_trigger == (entity->rx_next + 1) (entity->rx_next_status_trigger == (entity->rx_next + 1)
% entity->sn_modulus && % entity->sn_modulus &&
...@@ -287,6 +294,7 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) ...@@ -287,6 +294,7 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu)
} }
if (entity->t_reassembly_start == 0) { if (entity->t_reassembly_start == 0) {
LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__);
if (sn_compare_rx(entity, entity->rx_next_highest, if (sn_compare_rx(entity, entity->rx_next_highest,
(entity->rx_next + 1) % entity->sn_modulus) > 0 || (entity->rx_next + 1) % entity->sn_modulus) > 0 ||
(entity->rx_next_highest == (entity->rx_next + 1) (entity->rx_next_highest == (entity->rx_next + 1)
...@@ -547,6 +555,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, ...@@ -547,6 +555,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
nr_rlc_pdu_decoder_init(&decoder, buffer, size); nr_rlc_pdu_decoder_init(&decoder, buffer, size);
dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
LOG_I(RLC, "Melissa Elkadi, we are here %s(): %d. dc = %d\n", __FUNCTION__, __LINE__, dc);
if (dc == 0) goto control; if (dc == 0) goto control;
/* data PDU */ /* data PDU */
...@@ -610,6 +619,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, ...@@ -610,6 +619,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
entity->rx_list, pdu); entity->rx_list, pdu);
/* do reception actions (38.322 5.2.3.2.3) */ /* do reception actions (38.322 5.2.3.2.3) */
LOG_I(RLC, "Melissa Elkadi, we are calling reception_actions from %s()\n", __FUNCTION__);
reception_actions(entity, pdu); reception_actions(entity, pdu);
if (p) { if (p) {
......
...@@ -461,7 +461,7 @@ rb_found: ...@@ -461,7 +461,7 @@ rb_found:
T_INT(0 /*ctxt_pP->module_id*/), T_INT(0 /*ctxt_pP->module_id*/),
T_INT(ue->rnti), T_INT(rb_id), T_INT(size)); T_INT(ue->rnti), T_INT(rb_id), T_INT(size));
} }
LOG_I(PDCP, "Melissa Elkadi we are calling PDCP layer from RLC in %s\n", __FUNCTION__);
if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) { if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) {
LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__);
/* what to do in case of failure? for the moment: nothing */ /* what to do in case of failure? for the moment: nothing */
......
...@@ -106,11 +106,16 @@ void nr_rlc_pdu_decoder_init(nr_rlc_pdu_decoder_t *decoder, ...@@ -106,11 +106,16 @@ void nr_rlc_pdu_decoder_init(nr_rlc_pdu_decoder_t *decoder,
static int get_bit(nr_rlc_pdu_decoder_t *decoder) static int get_bit(nr_rlc_pdu_decoder_t *decoder)
{ {
int ret; int ret;
LOG_I(RLC, "Melissa Elkadi, in %s():. bytes = %d size = %d, bit %d, shifted bit %d \n",
__FUNCTION__, decoder->byte, decoder->size, decoder->bit, (7-decoder->bit));
if (decoder->byte >= decoder->size) { if (decoder->byte >= decoder->size) {
decoder->error = 1; decoder->error = 1;
return 0; return 0;
} }
LOG_I(RLC, "Melissa Elkadi, in %s():. (%d >> (7 - decoder->bit)) & 1 = %d (returned val) \n",
__FUNCTION__,
decoder->buffer[decoder->byte],
((decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1));
ret = (decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1; ret = (decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1;
......
...@@ -282,25 +282,31 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -282,25 +282,31 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
{ {
nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i]; nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i];
AssertFatal(pdu_list->num_TLV < sizeof(pdu_list->TLVs) / sizeof(pdu_list->TLVs[0]), "Num TLVs exceeds TLV array size"); AssertFatal(pdu_list->num_TLV < sizeof(pdu_list->TLVs) / sizeof(pdu_list->TLVs[0]), "Num TLVs exceeds TLV array size");
int length = 0;
if (tx_data_request->Slot == 7) { //Melissa this means we have an RAR, sorta hacky though for (int j = 0; j < pdu_list->num_TLV; j++)
if( get_mac_inst(dl_info->module_id)->crnti == get_mac_inst(dl_info->module_id)->ra.t_crnti ) {
{ LOG_D(MAC, "Discarding tx_data_requested since it includes useless RAR.\n"); length += pdu_list->TLVs[j].length;
continue;
}
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
}
else if (tx_data_request->Slot != 7 && get_softmodem_params()->nsa) {
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
} }
LOG_I(NR_PHY, "%s: num_tlv %d and length %d, pdu index %d\n",
__FUNCTION__, pdu_list->num_TLV, length, i);
uint8_t *pdu = malloc(length);
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu = pdu;
for (int j = 0; j < pdu_list->num_TLV; j++) for (int j = 0; j < pdu_list->num_TLV; j++)
{ {
const uint32_t *ptr;
if (pdu_list->TLVs[j].tag) if (pdu_list->TLVs[j].tag)
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu = (void*) pdu_list->TLVs[j].value.ptr; // Melissa, fix me! ptr = pdu_list->TLVs[j].value.ptr;
else if (!pdu_list->TLVs[j].tag) else
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu = (void*) pdu_list->TLVs[j].value.direct; // Melissa, fix me! ptr = pdu_list->TLVs[j].value.direct;
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length = pdu_list->TLVs[j].length; memcpy(pdu, ptr, pdu_list->TLVs[j].length);
pdu += pdu_list->TLVs[j].length;
}
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length = length;
if (tx_data_request->Slot == 7) { //Melissa this means we have an RAR, sorta hacky though
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
}
else {
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
} }
} }
dl_info->slot = tx_data_request->Slot; dl_info->slot = tx_data_request->Slot;
...@@ -343,7 +349,7 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n ...@@ -343,7 +349,7 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
int num_bytes = (dci_pdu_list->PayloadSizeBits + 7) / 8; int num_bytes = (dci_pdu_list->PayloadSizeBits + 7) / 8;
uint64_t *dci_pdu_payload = (uint64_t *)dci_pdu_list->Payload; uint64_t *dci_pdu_payload = (uint64_t *)dci_pdu_list->Payload;
int harq_pid = (*dci_pdu_payload >> 11) & 0xf; int harq_pid = (*dci_pdu_payload >> 11) & 0xf;
LOG_I(NR_PHY, "[%d, %d] ul_dci_req PDCCH DCI for rnti %x with PayloadSizeBits %d and num_bytes %d harq_id %lu\n", LOG_I(NR_PHY, "[%d, %d] ul_dci_req PDCCH DCI for rnti %x with PayloadSizeBits %d and num_bytes %d harq_id %d\n",
ul_dci_req->SFN, ul_dci_req->Slot, ul_dci_req->SFN, ul_dci_req->Slot,
dci_pdu_list->RNTI, dci_pdu_list->RNTI,
dci_pdu_list->PayloadSizeBits, num_bytes, dci_pdu_list->PayloadSizeBits, num_bytes,
...@@ -572,7 +578,9 @@ void *nrue_standalone_pnf_task(void *context) ...@@ -572,7 +578,9 @@ void *nrue_standalone_pnf_task(void *context)
struct sockaddr_in server_address; struct sockaddr_in server_address;
socklen_t addr_len = sizeof(server_address); socklen_t addr_len = sizeof(server_address);
char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE]; char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
int sfn, slot, delta; int sfn = 0;
int slot = 0;
int delta = 0;
int sd = ue_rx_sock_descriptor; int sd = ue_rx_sock_descriptor;
assert(sd > 0); assert(sd > 0);
LOG_I(NR_RRC, "Sucessfully started %s.\n", __FUNCTION__); LOG_I(NR_RRC, "Sucessfully started %s.\n", __FUNCTION__);
...@@ -640,7 +648,9 @@ void *nrue_standalone_pnf_task(void *context) ...@@ -640,7 +648,9 @@ void *nrue_standalone_pnf_task(void *context)
LOG_E(MAC, "sem_post() error\n"); LOG_E(MAC, "sem_post() error\n");
abort(); abort();
} }
LOG_I(MAC, "Received_SINR = %f\n", ch_info.sinr); sfn = NFAPI_SFNSLOT2SFN(ch_info.sfn_slot);
slot = NFAPI_SFNSLOT2SLOT(ch_info.sfn_slot);
LOG_I(MAC, "Received_SINR = %f, sfn:slot %d:%d\n", ch_info.sinr, sfn, slot);
} }
else else
{ {
...@@ -695,9 +705,10 @@ void *nrue_standalone_pnf_task(void *context) ...@@ -695,9 +705,10 @@ void *nrue_standalone_pnf_task(void *context)
{ {
delta += NFAPI_SFNSLOT2DEC(1024, 0); delta += NFAPI_SFNSLOT2DEC(1024, 0);
} }
AssertFatal(delta < 6, "Slot delta %d < 6 is required. sfn slot %u %u vs ul_dci_request sfn slot %u %u\n", if (delta < 6)
delta, sfn, slot, ul_dci_request.SFN, ul_dci_request.Slot); {
check_and_process_dci(NULL, NULL, &ul_dci_request, NULL); check_and_process_dci(NULL, NULL, &ul_dci_request, NULL);
}
break; break;
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
if (nfapi_nr_p7_message_unpack((void *)buffer, len, &ul_tti_request, if (nfapi_nr_p7_message_unpack((void *)buffer, len, &ul_tti_request,
......
...@@ -2057,6 +2057,7 @@ rrc_ue_process_rrcConnectionReconfiguration( ...@@ -2057,6 +2057,7 @@ rrc_ue_process_rrcConnectionReconfiguration(
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
} }
LOG_I(RRC, "Melissa Elkadi, we have sent NAS_CONN_ESTABLI_CNF to NAS layer via itti!\n");
free (r_r8->dedicatedInfoNASList); free (r_r8->dedicatedInfoNASList);
} }
...@@ -2513,7 +2514,8 @@ rrc_ue_decode_dcch( ...@@ -2513,7 +2514,8 @@ rrc_ue_decode_dcch(
// Save ueCapabilityEnquiry so we can use in nsa mode after nrUE response is received // Save ueCapabilityEnquiry so we can use in nsa mode after nrUE response is received
UE_RRC_INFO *info = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP]; UE_RRC_INFO *info = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP];
if (info->dl_dcch_msg != NULL) { if (info->dl_dcch_msg != NULL) {
SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, info->dl_dcch_msg, ASFM_FREE_EVERYTHING); info->dl_dcch_msg = NULL;
//SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, info->dl_dcch_msg, ASFM_FREE_EVERYTHING); Melissa
} }
info->dl_dcch_msg = dl_dcch_msg; info->dl_dcch_msg = dl_dcch_msg;
dl_dcch_msg = NULL; dl_dcch_msg = NULL;
...@@ -2528,7 +2530,8 @@ rrc_ue_decode_dcch( ...@@ -2528,7 +2530,8 @@ rrc_ue_decode_dcch(
// Save ueCapabilityEnquiry so we can use in nsa mode after nrUE response is received // Save ueCapabilityEnquiry so we can use in nsa mode after nrUE response is received
UE_RRC_INFO *info = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP]; UE_RRC_INFO *info = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP];
if (info->dl_dcch_msg != NULL) { if (info->dl_dcch_msg != NULL) {
SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, info->dl_dcch_msg, ASFM_FREE_EVERYTHING); info->dl_dcch_msg = NULL;
//SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, info->dl_dcch_msg, ASFM_FREE_EVERYTHING); Melissa
} }
info->dl_dcch_msg = dl_dcch_msg; info->dl_dcch_msg = dl_dcch_msg;
dl_dcch_msg = NULL; dl_dcch_msg = NULL;
...@@ -4621,7 +4624,7 @@ void ue_measurement_report_triggering(protocol_ctxt_t *const ctxt_pP, const uint ...@@ -4621,7 +4624,7 @@ void ue_measurement_report_triggering(protocol_ctxt_t *const ctxt_pP, const uint
if (is_state_connected && is_t304_inactive && have_meas_flag) { if (is_state_connected && is_t304_inactive && have_meas_flag) {
LOG_I(RRC,"[UE %d] Frame %d: Triggering generation of Meas Report for NR_r15. count = %d\n", LOG_I(RRC,"[UE %d] Frame %d: Triggering generation of Meas Report for NR_r15. count = %d\n",
ctxt_pP->module_id, ctxt_pP->frame, ue->subframeCount); ctxt_pP->module_id, ctxt_pP->frame, ue->subframeCount);
usleep(200000);
if (ue->measReportList[i][j] == NULL) { if (ue->measReportList[i][j] == NULL) {
ue->measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST)); ue->measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST));
} }
...@@ -5060,6 +5063,16 @@ void *rrc_ue_task( void *args_p ) { ...@@ -5060,6 +5063,16 @@ void *rrc_ue_task( void *args_p ) {
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
break; break;
} }
case NAS_OAI_TUN_NSA:
{
LOG_I(NAS, "Melissa Elkadi Received %s: length %lu. About to send this to the NR UE\n", ITTI_MSG_NAME (msg_p),
sizeof(NAS_OAI_TUN_NSA (msg_p).buffer));
char buffer[RRC_BUF_SIZE];
memcpy(buffer, NAS_OAI_TUN_NSA(msg_p).buffer, sizeof(buffer));
nsa_sendmsg_to_nrue(buffer, sizeof(buffer), OAI_TUN_IFACE_NSA);
break;
}
case NAS_KENB_REFRESH_REQ: case NAS_KENB_REFRESH_REQ:
memcpy((void *)UE_rrc_inst[ue_mod_id].kenb, (void *)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb)); memcpy((void *)UE_rrc_inst[ue_mod_id].kenb, (void *)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb));
......
...@@ -4606,10 +4606,10 @@ rrc_eNB_process_MeasurementReport( ...@@ -4606,10 +4606,10 @@ rrc_eNB_process_MeasurementReport(
memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer,enc_buf,enc_size); memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer,enc_buf,enc_size);
X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = enc_size; X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = enc_size;
#if 0 //Melissa: We hacked this:
X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId
= measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId; = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId;
#endif
X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId = 0; X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId = 0;
//For the moment we have a single E-RAB which will be the one to be added to the gNB //For the moment we have a single E-RAB which will be the one to be added to the gNB
//Not sure how to select bearers to be added if there are multiple. //Not sure how to select bearers to be added if there are multiple.
...@@ -7703,7 +7703,7 @@ rrc_eNB_decode_dcch( ...@@ -7703,7 +7703,7 @@ rrc_eNB_decode_dcch(
/*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/ /*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/
int flexran_agent_handover = 0; int flexran_agent_handover = 0;
if (1) { //Melissa: This is a hack. We are bypassing EPC mode here. if (1) { //Melissa: This is a hack. We are bypassing EPC mode here. if(EPC_MODE_ENABLED)
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) {
dedicated_DRB = 1; dedicated_DRB = 1;
LOG_I(RRC, LOG_I(RRC,
......
...@@ -592,14 +592,20 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( ...@@ -592,14 +592,20 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) {
if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE || ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_TOMODIFY) {
e_rabs_done++; e_rabs_done++;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id;
// TODO add other information from S1-U when it will be integrated // TODO add other information from S1-U when it will be integrated
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab]; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab];
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab]; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab];
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length = 4; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length = 4;
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed;
itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
}
} else { } else {
e_rabs_failed++; e_rabs_failed++;
ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED;
...@@ -618,9 +624,6 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( ...@@ -618,9 +624,6 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(
ue_context_pP->ue_id_rnti, ue_context_pP->ue_id_rnti,
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id, S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id,
e_rabs_done, e_rabs_failed); e_rabs_done, e_rabs_failed);
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done;
S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed;
itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -70,7 +70,8 @@ typedef enum Rrc_Msg_Type_e { ...@@ -70,7 +70,8 @@ typedef enum Rrc_Msg_Type_e {
RRC_MEASUREMENT_PROCEDURE, RRC_MEASUREMENT_PROCEDURE,
NR_UE_RRC_MEASUREMENT, NR_UE_RRC_MEASUREMENT,
RRC_CONFIG_COMPLETE_REQ, RRC_CONFIG_COMPLETE_REQ,
NR_RRC_CONFIG_COMPLETE_REQ NR_RRC_CONFIG_COMPLETE_REQ,
OAI_TUN_IFACE_NSA
} Rrc_Msg_Type_t; } Rrc_Msg_Type_t;
......
...@@ -280,18 +280,18 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ...@@ -280,18 +280,18 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
create_tunnel_req.num_tunnels = m->nb_e_rabs_tobeadded; create_tunnel_req.num_tunnels = m->nb_e_rabs_tobeadded;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p); RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[rrc->module_id]->rrc_ue_head, ue_context_p);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id);
#if 1 //Melissa this is a hack: we are bypassing the EPC functionality.
memset(&create_tunnel_resp, 0, sizeof(create_tunnel_resp)); memset(&create_tunnel_resp, 0, sizeof(create_tunnel_resp));
#else if (!IS_SOFTMODEM_NOS1) {
gtpv1u_create_s1u_tunnel( LOG_I(RRC, "Melissa Elkadi calling gtpv1u_create_s1u_tunnel()\n");
ctxt.instance, gtpv1u_create_s1u_tunnel(
&create_tunnel_req, ctxt.instance,
&create_tunnel_resp); &create_tunnel_req,
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( &create_tunnel_resp);
&ctxt, rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
&create_tunnel_resp, &ctxt,
&inde_list[0]); &create_tunnel_resp,
#endif &inde_list[0]);
}
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded; X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).nb_e_rabs_admitted_tobeadded = m->nb_e_rabs_tobeadded;
X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id; X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).target_assoc_id = m->target_assoc_id;
......
...@@ -3132,6 +3132,19 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) ...@@ -3132,6 +3132,19 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len)
break; break;
} }
case OAI_TUN_IFACE_NSA:
{
LOG_I(NR_RRC, "We got an OAI_TUN_IFACE_NSA!!\n");
char cmd_line[RRC_BUF_SIZE];
memcpy(cmd_line, msg_buffer, sizeof(cmd_line));
LOG_I(NR_RRC, "Melissa Elkadi, this is the command line we got: %s\n", cmd_line);
if (background_system(cmd_line) != 0)
{
LOG_E(NR_RRC, "ESM-PROC - failed command '%s'", cmd_line);
}
break;
}
default: default:
LOG_E(NR_RRC, "No NSA Message Found\n"); LOG_E(NR_RRC, "No NSA Message Found\n");
} }
......
...@@ -51,6 +51,7 @@ Description Defines functions used to handle EPS bearer contexts. ...@@ -51,6 +51,7 @@ Description Defines functions used to handle EPS bearer contexts.
#include "assertions.h" #include "assertions.h"
#include "pdcp.h" #include "pdcp.h"
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
#include "executables/softmodem-common.h"
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
...@@ -262,8 +263,7 @@ int esm_ebr_context_create( ...@@ -262,8 +263,7 @@ int esm_ebr_context_create(
netmask = 32; netmask = 32;
strcpy(broadcast, ipv4_addr); strcpy(broadcast, ipv4_addr);
} }
LOG_I(NAS, "Melissa Elkadi setting commandline string: "
res = sprintf(command_line,
"ip address add %s/%d broadcast %s dev %s%d && " "ip address add %s/%d broadcast %s dev %s%d && "
"ip link set %s%d up && " "ip link set %s%d up && "
"ip rule add from %s/32 table %d && " "ip rule add from %s/32 table %d && "
...@@ -276,26 +276,67 @@ int esm_ebr_context_create( ...@@ -276,26 +276,67 @@ int esm_ebr_context_create(
ipv4_addr, ueid + 10000, ipv4_addr, ueid + 10000,
UE_NAS_USE_TUN ? "oaitun_ue" : "oip", UE_NAS_USE_TUN ? "oaitun_ue" : "oip",
ueid + 1, ueid + 10000); ueid + 1, ueid + 10000);
if (get_softmodem_params()->nsa == 0)
if ( res<0 ) { {
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string"); res = sprintf(command_line,
} "ip address add %s/%d broadcast %s dev %s%d && "
"ip link set %s%d up && "
LOG_TRACE(INFO, "ESM-PROC - executing %s ", "ip rule add from %s/32 table %d && "
"ip rule add to %s/32 table %d && "
"ip route add default dev %s%d table %d",
ipv4_addr, netmask, broadcast,
UE_NAS_USE_TUN ? "oaitun_ue" : "oip", ueid + 1,
UE_NAS_USE_TUN ? "oaitun_ue" : "oip", ueid + 1,
ipv4_addr, ueid + 10000,
ipv4_addr, ueid + 10000,
UE_NAS_USE_TUN ? "oaitun_ue" : "oip",
ueid + 1, ueid + 10000);
if ( res<0 ) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
}
/* Calling system() here disrupts UE's realtime processing in some cases.
* This may be because of the call to fork(), which, for some
* unidentified reason, interacts badly with other (realtime) threads.
* background_system() is a replacement mechanism relying on a
* background process that does the system() and reports result to
* the parent process (lte-softmodem, oaisim, ...). The background
* process is created very early in the life of the parent process.
* The processes interact through standard pipes. See
* common/utils/system.c for details.
*/
LOG_TRACE(INFO, "Melissa Elkadi ESM-PROC - executing %s ",
command_line); command_line);
if (background_system(command_line) != 0)
/* Calling system() here disrupts UE's realtime processing in some cases. {
* This may be because of the call to fork(), which, for some LOG_TRACE(ERROR, "ESM-PROC - failed command '%s'", command_line);
* unidentified reason, interacts badly with other (realtime) threads. }
* background_system() is a replacement mechanism relying on a }
* background process that does the system() and reports result to else if (get_softmodem_params()->nsa) {
* the parent process (lte-softmodem, oaisim, ...). The background res = sprintf(command_line,
* process is created very early in the life of the parent process. "ip address add %s/%d broadcast %s dev %s%d && "
* The processes interact through standard pipes. See "ip link set %s%d up && "
* common/utils/system.c for details. "ip rule add from %s/32 table %d && "
*/ "ip rule add to %s/32 table %d && "
if (background_system(command_line) != 0) "ip route add default dev %s%d table %d",
LOG_TRACE(ERROR, "ESM-PROC - failed command '%s'", command_line); ipv4_addr, netmask, broadcast,
UE_NAS_USE_TUN ? "oaitun_nru" : "oip", ueid + 1,
UE_NAS_USE_TUN ? "oaitun_nru" : "oip", ueid + 1,
ipv4_addr, ueid + 10000,
ipv4_addr, ueid + 10000,
UE_NAS_USE_TUN ? "oaitun_nru" : "oip",
ueid + 1, ueid + 10000);
if ( res<0 ) {
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
}
LOG_I(NAS, "Melissa Elkadi, sending NAS_OAI_TUN_NSA msg to LTE UE via itti\n");
MessageDef *msg_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_OAI_TUN_NSA);
memcpy(NAS_OAI_TUN_NSA(msg_p).buffer, command_line, sizeof(NAS_OAI_TUN_NSA(msg_p).buffer));
itti_send_msg_to_task(TASK_RRC_UE, 0, msg_p);
}
break; break;
......
...@@ -251,7 +251,7 @@ void *nas_ue_task(void *args_p) ...@@ -251,7 +251,7 @@ void *nas_ue_task(void *args_p)
break; break;
case NAS_CONN_ESTABLI_CNF: case NAS_CONN_ESTABLI_CNF:
LOG_I(NAS, "[UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p), LOG_I(NAS, "Melissa Elkadi [UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length);
if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS) if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS)
......
...@@ -225,7 +225,7 @@ gNBs = ...@@ -225,7 +225,7 @@ gNBs =
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.61.3"; mme_ip_address = ( { ipv4 = "192.168.61.195";
ipv6 = "192:168:30::17"; ipv6 = "192:168:30::17";
active = "yes"; active = "yes";
preference = "ipv4"; preference = "ipv4";
...@@ -248,9 +248,9 @@ gNBs = ...@@ -248,9 +248,9 @@ gNBs =
{ # All of these have to be IP addr of gNB { # All of these have to be IP addr of gNB
# if in CORE container, make it 172.16.0.X # if in CORE container, make it 172.16.0.X
# if not launched in CORE, can set to lo (127.0.0.2) # if not launched in CORE, can set to lo (127.0.0.2)
GNB_INTERFACE_NAME_FOR_S1_MME = "ctrl"; GNB_INTERFACE_NAME_FOR_S1_MME = "ctrl0";
GNB_IPV4_ADDRESS_FOR_S1_MME = "172.16.0.2"; GNB_IPV4_ADDRESS_FOR_S1_MME = "172.16.0.2";
GNB_INTERFACE_NAME_FOR_S1U = "ctrl"; GNB_INTERFACE_NAME_FOR_S1U = "ctrl0";
GNB_IPV4_ADDRESS_FOR_S1U = "172.16.0.2"; GNB_IPV4_ADDRESS_FOR_S1U = "172.16.0.2";
GNB_PORT_FOR_S1U = 2152; # Spec 2152 GNB_PORT_FOR_S1U = 2152; # Spec 2152
GNB_IPV4_ADDRESS_FOR_X2C = "172.16.0.2"; GNB_IPV4_ADDRESS_FOR_X2C = "172.16.0.2";
......
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