Commit 45e5ddc8 authored by Chenyu's avatar Chenyu

messg3\4\5 is ok

parent 9c6f7122
...@@ -224,7 +224,21 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) { ...@@ -224,7 +224,21 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) {
void print_difftimes(void) { void print_difftimes(void) {
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
} }
int create_tasks_nrue(uint32_t ue_nb) {
LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
itti_wait_ready(1);
if (ue_nb > 0) {
LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
}
itti_wait_ready(0);
return 0;
}
void exit_function(const char *file, const char *function, const int line, const char *s) { void exit_function(const char *file, const char *function, const int line, const char *s) {
int CC_id; int CC_id;
...@@ -781,6 +795,10 @@ int main( int argc, char **argv ) { ...@@ -781,6 +795,10 @@ int main( int argc, char **argv ) {
ctxt_pP.enb_flag = ENB_FLAG_NO; ctxt_pP.enb_flag = ENB_FLAG_NO;
ctxt_pP.rnti = 0x1234; ctxt_pP.rnti = 0x1234;
rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0); rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0);
if (create_tasks_nrue(1) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
while(true) while(true)
sleep(3600); sleep(3600);
......
...@@ -55,7 +55,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) ...@@ -55,7 +55,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
if (rrc_inst) { if (rrc_inst) {
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config); nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config);
if (IS_SOFTMODEM_NOS1){ // if (IS_SOFTMODEM_NOS1){
if (1) {
if (rlc_module_init(0) != 0) { if (rlc_module_init(0) != 0) {
LOG_I(RLC, "Problem at RLC initiation \n"); LOG_I(RLC, "Problem at RLC initiation \n");
} }
......
...@@ -761,7 +761,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -761,7 +761,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
TBS); TBS);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_id, sdu_lengths[num_sdus] = mac_rlc_data_req(module_id,
rnti, 0x1234,
module_id, module_id,
frame, frame,
ENB_FLAG_YES, ENB_FLAG_YES,
......
...@@ -232,7 +232,7 @@ void nr_process_mac_pdu( ...@@ -232,7 +232,7 @@ void nr_process_mac_pdu(
} }
else{ else{
mac_rlc_data_ind(module_idP, mac_rlc_data_ind(module_idP,
rnti, 0x1234,
module_idP, module_idP,
frameP, frameP,
ENB_FLAG_YES, ENB_FLAG_YES,
......
...@@ -94,7 +94,7 @@ void mac_top_init_gNB(void) ...@@ -94,7 +94,7 @@ void mac_top_init_gNB(void)
// These should be out of here later // These should be out of here later
pdcp_layer_init(); pdcp_layer_init();
if(IS_SOFTMODEM_NOS1) // if(IS_SOFTMODEM_NOS1)
nr_DRB_preconfiguration(); nr_DRB_preconfiguration();
rrc_init_nr_global_param(); rrc_init_nr_global_param();
......
...@@ -21,17 +21,18 @@ ...@@ -21,17 +21,18 @@
#ifndef _NR_PDCP_ENTITY_H_ #ifndef _NR_PDCP_ENTITY_H_
#define _NR_PDCP_ENTITY_H_ #define _NR_PDCP_ENTITY_H_
#include "platform_types.h"
typedef struct nr_pdcp_entity_t { typedef struct nr_pdcp_entity_t {
/* functions provided by the PDCP module */ /* functions provided by the PDCP module */
void (*recv_pdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size); void (*recv_pdu)(protocol_ctxt_t *ctxt_pP,struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size, void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id); int sdu_id);
void (*delete)(struct nr_pdcp_entity_t *entity); void (*delete)(struct nr_pdcp_entity_t *entity);
void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key); void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key);
/* callbacks provided to the PDCP module */ /* callbacks provided to the PDCP module */
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, void (*deliver_sdu)(protocol_ctxt_t *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size); char *buf, int size);
void *deliver_sdu_data; void *deliver_sdu_data;
void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity, void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity,
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.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( protocol_ctxt_t *ctxt_pP , 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;
if (size < 3) abort(); if (size < 3) abort();
if (!(buffer[0] & 0x80)) { printf("%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } if (!(buffer[0] & 0x80)) { printf("%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); }
entity->common.deliver_sdu(entity->common.deliver_sdu_data, entity->common.deliver_sdu(ctxt_pP, entity->common.deliver_sdu_data,
(nr_pdcp_entity_t *)entity, buffer+3, size-3); (nr_pdcp_entity_t *)entity, buffer+3, size-3);
} }
......
...@@ -23,13 +23,14 @@ ...@@ -23,13 +23,14 @@
#define _NR_PDCP_ENTITY_DRB_AM_H_ #define _NR_PDCP_ENTITY_DRB_AM_H_
#include "nr_pdcp_entity.h" #include "nr_pdcp_entity.h"
#include "platform_types.h"
typedef struct { typedef struct {
nr_pdcp_entity_t common; nr_pdcp_entity_t common;
int rb_id; int rb_id;
} nr_pdcp_entity_drb_am_t; } nr_pdcp_entity_drb_am_t;
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(protocol_ctxt_t *ctxt_pP,nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size, void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id); int sdu_id);
void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key); void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key);
......
...@@ -109,17 +109,17 @@ nr_rrc_data_ind( ...@@ -109,17 +109,17 @@ nr_rrc_data_ind(
MessageDef *message_p; MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, sdu_sizeP); message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, NR_RRC_DCCH_DATA_IND);
RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame; NR_RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; NR_RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; NR_RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer; NR_RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti; NR_RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti;
RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id; NR_RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id;
RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index; NR_RRC_DCCH_DATA_IND (message_p).gNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, ctxt_pP->instance, message_p); itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, ctxt_pP->instance, message_p);
} }
} }
...@@ -139,14 +139,15 @@ nr_rrc_data_ind_ccch( ...@@ -139,14 +139,15 @@ nr_rrc_data_ind_ccch(
{ {
MessageDef *message_p; MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, NR_RRC_MAC_CCCH_DATA_IND); message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, NR_RRC_MAC_CCCH_DATA_IND);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = ctxt_pP->frame; NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = 0; NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = 0; NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = 0x1234;
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu,buffer_pP,sdu_sizeP); memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu,buffer_pP,sdu_sizeP);
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_UE, ctxt_pP->instance, message_p); itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, ctxt_pP->instance, message_p);
} }
} }
...@@ -294,9 +295,9 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len); ...@@ -294,9 +295,9 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len);
ctxt.rnti = rnti; ctxt.rnti = rnti;
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,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL); // PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
} }
return NULL; return NULL;
...@@ -338,9 +339,9 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len); ...@@ -338,9 +339,9 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len);
ctxt.rnti = rnti; ctxt.rnti = rnti;
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,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL); // PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
} }
return NULL; return NULL;
...@@ -452,8 +453,8 @@ uint64_t pdcp_module_init(uint64_t _pdcp_optmask) ...@@ -452,8 +453,8 @@ uint64_t pdcp_module_init(uint64_t _pdcp_optmask)
} }
return pdcp_optmask ; return pdcp_optmask ;
} }
static int liuyu=0;
static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t *entity,
char *buf, int size) char *buf, int size)
{ {
extern int nas_sock_fd[]; extern int nas_sock_fd[];
...@@ -464,19 +465,26 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, ...@@ -464,19 +465,26 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
int rb_id; int rb_id;
int i; int i;
if(IS_SOFTMODEM_NOS1){ if (1) { //(IS_SOFTMODEM_NOS1){
#if 1 #if 1
log_dump(PDCP,buf,size,LOG_DUMP_CHAR," PDCP Received SDU:\n"); log_dump(PDCP,buf,size,LOG_DUMP_CHAR," PDCP Received SDU:\n");
if (size > 47) if (size > 4700)
{ {
LOG_I(PDCP,"maybe ip data \n"); LOG_I(PDCP,"maybe ip data \n");
} }
else else
{ {
LOG_I(PDCP,"send to gNB RRC \n"); LOG_I(PDCP,"send to gNB RRC \n");
protocol_ctxt_t ctxt_pP = {0};
ctxt_pP.enb_flag = ENB_FLAG_YES; if(liuyu==2)
nr_rrc_data_ind_ccch( &ctxt_pP, 1, size, buf); liuyu=1;
if(liuyu==0)
nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf);
if(liuyu==1)
nr_rrc_data_ind( ctxt_pP, 1, size, buf);
liuyu++;
} }
#else #else
len = write(nas_sock_fd[0], buf, size); len = write(nas_sock_fd[0], buf, size);
...@@ -601,7 +609,7 @@ boolean_t pdcp_data_ind( ...@@ -601,7 +609,7 @@ boolean_t pdcp_data_ind(
} }
if (rb != NULL) { if (rb != NULL) {
rb->recv_pdu(rb, (char *)sdu_buffer->data, sdu_buffer_size); rb->recv_pdu(ctxt_pP,rb, (char *)sdu_buffer->data, sdu_buffer_size);
} else { } else {
LOG_E(PDCP, "%s:%d:%s: fatal: no RB found (rb_id %ld, srb_flag %d)\n", LOG_E(PDCP, "%s:%d:%s: fatal: no RB found (rb_id %ld, srb_flag %d)\n",
__FILE__, __LINE__, __FUNCTION__, rb_id, srb_flagP); __FILE__, __LINE__, __FUNCTION__, rb_id, srb_flagP);
...@@ -1043,7 +1051,7 @@ boolean_t pdcp_data_req( ...@@ -1043,7 +1051,7 @@ boolean_t pdcp_data_req(
#endif #endif
) )
{ {
if (srb_flagP) { TODO; } //if (srb_flagP) { TODO; }
return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size, return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size,
sdu_buffer); sdu_buffer);
} }
......
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