Commit 66ebd35f authored by witcomm's avatar witcomm

ping ok

parent 06a04449
...@@ -2022,6 +2022,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2022,6 +2022,8 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
AssertFatal(buflen_remain >= sdu_lengths[num_sdus], AssertFatal(buflen_remain >= sdu_lengths[num_sdus],
"LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
lcid, sdu_lengths[num_sdus], buflen_remain); lcid, sdu_lengths[num_sdus], buflen_remain);
LOG_I(MAC,"LCID=%d RLC has segmented %d bytes, MAC has max=%d, num_sdus %d. \n",
lcid, sdu_lengths[num_sdus], buflen_remain, num_sdus);
if (sdu_lengths[num_sdus]) { if (sdu_lengths[num_sdus]) {
sdu_length_total += sdu_lengths[num_sdus]; sdu_length_total += sdu_lengths[num_sdus];
...@@ -2066,13 +2068,16 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2066,13 +2068,16 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
else else
return 0; return 0;
LOG_I(MAC,"nr_generate_ulsch_pdu num_sdus=%d sdu_lengths[0] %d, sdu_lcids[0] %d, buflen=%d\n",
num_sdus, sdu_lengths[0], sdu_lcids[0],buflen);
// Padding: fill remainder of ULSCH with 0 // Padding: fill remainder of ULSCH with 0
if (buflen - payload_offset > 0){ if (buflen - payload_offset > 0){
for (int j = payload_offset; j < buflen; j++) for (int j = payload_offset; j < buflen; j++)
ulsch_buffer[j] = 0; ulsch_buffer[j] = 0;
} }
#if defined(ENABLE_MAC_PAYLOAD_DEBUG) //#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_I(NR_MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset); LOG_I(NR_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();
...@@ -2080,7 +2085,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2080,7 +2085,7 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
printf("%02x ",(unsigned char)ulsch_buffer[i]); printf("%02x ",(unsigned char)ulsch_buffer[i]);
} }
printf("\n"); printf("\n");
#endif //#endif
return 1; return 1;
} }
...@@ -72,6 +72,12 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, ...@@ -72,6 +72,12 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
integrity_size = 0; integrity_size = 0;
} }
if (entity->type != NR_PDCP_SRB)
{
LOG_I(PDCP, "rb_id %d, entity->type %d, old integrity_size =%d, new integrity_size = 0. \n",entity->rb_id, entity->type, integrity_size);
integrity_size = 0;
}
if (size < header_size + integrity_size + 1) { if (size < header_size + integrity_size + 1) {
LOG_E(PDCP, "bad PDU received (size = %d)\n", size); LOG_E(PDCP, "bad PDU received (size = %d)\n", size);
return; return;
...@@ -187,6 +193,12 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, ...@@ -187,6 +193,12 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
integrity_size = 0; integrity_size = 0;
} }
if (entity->type != NR_PDCP_SRB)
{
LOG_I(PDCP, "rb_id %d, entity->type %d, old integrity_size =%d, new integrity_size = 0. \n",entity->rb_id, entity->type, integrity_size);
integrity_size = 0;
}
memcpy(buf + header_size, buffer, size); memcpy(buf + header_size, buffer, size);
if (entity->has_integrity) if (entity->has_integrity)
......
...@@ -313,6 +313,7 @@ static void *ue_tun_read_thread(void *_) ...@@ -313,6 +313,7 @@ static void *ue_tun_read_thread(void *_)
ctxt.brOption = 0; ctxt.brOption = 0;
ctxt.rnti = rnti; ctxt.rnti = rnti;
log_dump(PDCP, rx_buf, len , LOG_DUMP_CHAR," ue_tun_read_thread Received bytes(%d):\n", len );
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
...@@ -445,6 +446,8 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -445,6 +446,8 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
int rb_id; int rb_id;
int i; int i;
log_dump(PDCP, buf, 100 , LOG_DUMP_CHAR," deliver_sdu_drb Received bytes:\n" );
if(UE_NAS_USE_TUN){ if(UE_NAS_USE_TUN){
LOG_D(PDCP, "IP packet received, to be sent to UE TUN interface"); LOG_D(PDCP, "IP packet received, to be sent to UE TUN interface");
len = write(nas_sock_fd[0], buf, size); len = write(nas_sock_fd[0], buf, size);
...@@ -839,7 +842,8 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -839,7 +842,8 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
ciphering_key, integrity_key); ciphering_key, integrity_key);
nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb); nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb);
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x. ciphering_algorithm 0x%02X, integrity_algorithm 0x%02X.\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti,
ciphering_algorithm, integrity_algorithm);
} }
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
} }
...@@ -1198,7 +1202,7 @@ static boolean_t pdcp_data_req_drb( ...@@ -1198,7 +1202,7 @@ static boolean_t pdcp_data_req_drb(
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
return 0; return 0;
} }
log_dump(PDCP, sdu_buffer, sdu_buffer_size , LOG_DUMP_CHAR," recv_sdu Received bytes(%d):\n",sdu_buffer_size );
rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP); rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
......
...@@ -837,6 +837,8 @@ static int serialize_sdu(nr_rlc_entity_am_t *entity, ...@@ -837,6 +837,8 @@ static int serialize_sdu(nr_rlc_entity_am_t *entity,
if (p) if (p)
include_poll(entity, buffer); include_poll(entity, buffer);
LOG_I(RLC, "serialize_sdu encoder.byte %d, sdu->size %d. ",encoder.byte,sdu->size);
return encoder.byte + sdu->size; return encoder.byte + sdu->size;
} }
...@@ -1516,6 +1518,7 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) ...@@ -1516,6 +1518,7 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size)
p = 1; p = 1;
entity->force_poll = 0; entity->force_poll = 0;
} }
LOG_I(RLC, "generate_tx_pdu buffer buffer %p, size %d, sdu->size %d. ",buffer,size,sdu->size);
return serialize_sdu(entity, sdu, buffer, size, p); return serialize_sdu(entity, sdu, buffer, size, p);
} }
...@@ -1566,12 +1569,14 @@ int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity, ...@@ -1566,12 +1569,14 @@ int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity,
if (ret != 0) if (ret != 0)
return ret; return ret;
} }
LOG_I(RLC, "nr_rlc_entity_am_generate_pdu status_to_report bufer %p, ret %d, size %d",buffer,ret,size);
if (entity->retransmit_list != NULL) { if (entity->retransmit_list != NULL) {
ret = generate_retx_pdu(entity, buffer, size); ret = generate_retx_pdu(entity, buffer, size);
if (ret != 0) if (ret != 0)
return ret; return ret;
} }
LOG_I(RLC, "nr_rlc_entity_am_generate_pdu generate_retx_pdu bufer %p, ret %d, size %d",buffer,ret,size);
return generate_tx_pdu(entity, buffer, size); return generate_tx_pdu(entity, buffer, size);
} }
......
...@@ -76,16 +76,10 @@ ...@@ -76,16 +76,10 @@
NR_UE_RRC_INST_t *NR_UE_rrc_inst; NR_UE_RRC_INST_t *NR_UE_rrc_inst;
/* NAS Attach request with IMSI */ /* NAS Attach request with IMSI */
static const char nr_nas_attach_req_imsi[] = { static const char nr_nas_attach_req_imsi[] = {
0x07, 0x41, 0x7e, 0x00, 0x41, 0x79, 0x00, 0x0d, 0x01,
/* EPS Mobile identity = IMSI */ 0x64, 0xf0, 0x11, 0xf0, 0xff, 0x00, 0x00,
0x71, 0x08, 0x29, 0x80, 0x43, 0x21, 0x43, 0x65, 0x87, 0x89, 0x67, 0x45, 0x23, 0x01,
0xF9, 0x2e, 0x02, 0xf0, 0x70
/* End of EPS Mobile Identity */
0x02, 0xE0, 0xE0, 0x00, 0x20, 0x02, 0x03,
0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00,
0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2,
0x01, 0x27, 0x11,
}; };
extern void pdcp_config_set_security( extern void pdcp_config_set_security(
...@@ -1354,6 +1348,9 @@ static void rrc_ue_generate_RRCSetupComplete( ...@@ -1354,6 +1348,9 @@ static void rrc_ue_generate_RRCSetupComplete(
generateRegistrationRequest(&initialNasMsg); generateRegistrationRequest(&initialNasMsg);
nas_msg = (char*)initialNasMsg.data; nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length; nas_msg_length = initialNasMsg.length;
nas_msg = nr_nas_attach_req_imsi;
nas_msg_length = sizeof(nr_nas_attach_req_imsi);
printf("RFSIM_NAS nas_msg_length %d. \n",nas_msg_length);
#else #else
nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
......
...@@ -639,8 +639,9 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ ...@@ -639,8 +639,9 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
MM_msg *mm_msg; MM_msg *mm_msg;
nas_stream_cipher_t stream_cipher; nas_stream_cipher_t stream_cipher;
uint8_t mac[4]; uint8_t mac[4];
uint8_t nssai[]={1,0,0,1}; //Corresponding to SST:1, SD:1 uint8_t nssai[]={1,0,0,0}; //Corresponding to SST:1, SD:1
uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai" // uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai"
uint8_t dnn[9]={0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74}; //Corresponding to dnn:"oai"
nas_msg.header.protocol_discriminator = FGS_MOBILITY_MANAGEMENT_MESSAGE; nas_msg.header.protocol_discriminator = FGS_MOBILITY_MANAGEMENT_MESSAGE;
nas_msg.header.security_header_type = INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX; nas_msg.header.security_header_type = INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX;
size += 7; size += 7;
...@@ -672,7 +673,7 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ ...@@ -672,7 +673,7 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
mm_msg->uplink_nas_transport.snssai.length = 4; mm_msg->uplink_nas_transport.snssai.length = 4;
mm_msg->uplink_nas_transport.snssai.value = nssai; mm_msg->uplink_nas_transport.snssai.value = nssai;
size += (1+1+4); size += (1+1+4);
mm_msg->uplink_nas_transport.dnn.length = 4; mm_msg->uplink_nas_transport.dnn.length = 9;
mm_msg->uplink_nas_transport.dnn.value = dnn; mm_msg->uplink_nas_transport.dnn.value = dnn;
size += (1+1+4); size += (1+1+4);
......
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