Commit ee1cd79b authored by lfq's avatar lfq

iper_shm

parent 617a9798
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#include "gnb_config.h" #include "gnb_config.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
uint8_t *pdcp_ctxt;
typedef struct { typedef struct {
int shm_offset; int shm_offset;
int size; int size;
...@@ -718,9 +718,9 @@ static void deliver_pdu_drb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, ...@@ -718,9 +718,9 @@ static void deliver_pdu_drb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id,
// LOG_I(PDCP, "%s() (drb %d) sending message to gtp size %d\n", // LOG_I(PDCP, "%s() (drb %d) sending message to gtp size %d\n",
// __func__, rb_id, size); // __func__, rb_id, size);
extern instance_t CUuniqInstance; extern instance_t CUuniqInstance;
for(int i=0;i<30;i++){ // for(int i=0;i<30;i++){
printf("value : --%x ------#\n",*(buf + i)); // printf("value : --%x ------#\n",*(buf + i));
} // }
msgbuf_pdcp writeBuf; msgbuf_pdcp writeBuf;
writeBuf.mytype = 2; writeBuf.mytype = 2;
...@@ -862,14 +862,16 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, ue_id_t reestablish_ue_id, st ...@@ -862,14 +862,16 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, ue_id_t reestablish_ue_id, st
int has_integrity; int has_integrity;
int has_ciphering; int has_ciphering;
int shmid_pdcp_ctxt; int shmid_pdcp_ctxt;
uint8_t *pdcp_ctxt;
if ((shmid_pdcp_ctxt = shmget((key_t)3, SHM_SIZE, IPC_CREAT | 0666)) < 0) { if ((shmid_pdcp_ctxt = shmget((key_t)3, SHM_SIZE, IPC_CREAT | 0666)) < 0) {
perror("shmget"); perror("shmget");
exit(1); exit(1);
} }
if ((pdcp_ctxt = (uint8_t *) shmat(shmid_pdcp_ctxt, NULL, 0)) == (uint8_t *) -1) { if(pdcp_ctxt == NULL)
perror("shmat"); {
if ((pdcp_ctxt = (uint8_t *) shmat(shmid_pdcp_ctxt, NULL, 0)) == (uint8_t *) -1) {
perror("shmat");}
} }
/* if pdcp_Config->t_Reordering is not present, it means infinity (-1) */ /* if pdcp_Config->t_Reordering is not present, it means infinity (-1) */
...@@ -971,9 +973,7 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, ue_id_t reestablish_ue_id, st ...@@ -971,9 +973,7 @@ void add_drb_am(int is_gnb, ue_id_t rntiMaybeUEid, ue_id_t reestablish_ue_id, st
memcpy(pdcp_shm,pdcp_drb,sizeof(nr_pdcp_entity_t)); memcpy(pdcp_shm,pdcp_drb,sizeof(nr_pdcp_entity_t));
*(pdcp_num) = *(pdcp_num) + 1; *(pdcp_num) = *(pdcp_num) + 1;
memcpy(pdcp_ctxt,pdcp_num,sizeof(int64_t)); memcpy(pdcp_ctxt,pdcp_num,sizeof(int64_t));
if(shmdt(pdcp_ctxt) == -1){
perror("detach error");
}
LOG_D(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid); LOG_D(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid);
...@@ -1190,7 +1190,6 @@ bool nr_pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP, ...@@ -1190,7 +1190,6 @@ bool nr_pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP,
nr_pdcp_entity_t *rb; nr_pdcp_entity_t *rb;
ue_id_t ue_id = ctxt_pP->rntiMaybeUEid; ue_id_t ue_id = ctxt_pP->rntiMaybeUEid;
int shmid_pdcp_ctxt; int shmid_pdcp_ctxt;
uint8_t *pdcp_ctxt;
if (ctxt_pP->module_id != 0 || if (ctxt_pP->module_id != 0 ||
//ctxt_pP->enb_flag != 1 || //ctxt_pP->enb_flag != 1 ||
...@@ -1205,10 +1204,13 @@ bool nr_pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP, ...@@ -1205,10 +1204,13 @@ bool nr_pdcp_data_req_drb(protocol_ctxt_t *ctxt_pP,
perror("shmget"); perror("shmget");
exit(1); exit(1);
} }
if ((pdcp_ctxt = (uint8_t *) shmat(shmid_pdcp_ctxt, NULL, 0)) == (uint8_t *) -1) { if(pdcp_ctxt == NULL)
{
if ((pdcp_ctxt = (uint8_t *) shmat(shmid_pdcp_ctxt, NULL, 0)) == (uint8_t *) -1) {
perror("shmat"); perror("shmat");
} }
}
//nr_pdcp_manager_lock(nr_pdcp_ue_manager); //nr_pdcp_manager_lock(nr_pdcp_ue_manager);
......
...@@ -49,6 +49,8 @@ uint8_t nas_pduid; ...@@ -49,6 +49,8 @@ uint8_t nas_pduid;
#define SHMDATE_SIZE 65536 #define SHMDATE_SIZE 65536
#define hdr_sdap 100 #define hdr_sdap 100
#define SHM_SIZE 10000000 #define SHM_SIZE 10000000
uint8_t *shm = NULL;
uint8_t *shm_t = NULL;
typedef struct { typedef struct {
protocol_ctxt_t *ctxt_p; protocol_ctxt_t *ctxt_p;
ue_id_t ue_id; ue_id_t ue_id;
...@@ -198,7 +200,7 @@ void set_qfi_pduid(uint8_t qfi, uint8_t pduid){ ...@@ -198,7 +200,7 @@ void set_qfi_pduid(uint8_t qfi, uint8_t pduid){
void *SP_task(void *arg){ void *SP_task(void *arg){
msgbuf readBuf; msgbuf readBuf;
while(1) { while(1) {
int msgId = msgget(0x1234, 0777); int msgId = msgget(0x1234, 0777);
...@@ -213,14 +215,18 @@ void *SP_task(void *arg){ ...@@ -213,14 +215,18 @@ void *SP_task(void *arg){
}else{ }else{
int shmid_data; int shmid_data;
uint8_t *shm;
if ((shmid_data = shmget((key_t)1, SHM_SIZE,0666)) < 0) { if ((shmid_data = shmget((key_t)1, SHM_SIZE,0666)) < 0) {
perror("shmget"); perror("shmget");
exit(1);} exit(1);}
if ((shm = (uint8_t *) shmat(shmid_data, NULL, 0)) == (uint8_t *) -1) { if(shm == NULL)
{
if ((shm = (uint8_t *) shmat(shmid_data, NULL, 0)) == (uint8_t *) -1) {
perror("shmat"); perror("shmat");
} }
shm_t = shm;
}
shm = shm_t;
shm = shm + readBuf.sq.shm_offset*SHMDATE_SIZE + readBuf.sq.offset + hdr_sdap; shm = shm + readBuf.sq.shm_offset*SHMDATE_SIZE + readBuf.sq.offset + hdr_sdap;
protocol_ctxt_t ctxtS; protocol_ctxt_t ctxtS;
ctxtS.module_id = 0; ctxtS.module_id = 0;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define Ue_SIZE 10000 #define Ue_SIZE 10000
int num = 0; int num = 0;
#define SHM_SIZE 10000000 #define SHM_SIZE 10000000
uint8_t *cshm;
typedef struct { typedef struct {
nr_sdap_entity_t sdap_entity_llist[Ue_SIZE]; nr_sdap_entity_t sdap_entity_llist[Ue_SIZE];
} nr_sdap_entity_info; } nr_sdap_entity_info;
...@@ -438,14 +439,15 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap ...@@ -438,14 +439,15 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap
exit(1); exit(1);
} }
int shmid_cxtx; int shmid_cxtx;
uint8_t *cshm;
if ((shmid_cxtx = shmget((key_t)2, SHM_SIZE,0666 | IPC_CREAT )) < 0) { if ((shmid_cxtx = shmget((key_t)2, SHM_SIZE,0666 | IPC_CREAT )) < 0) {
perror("shmget"); perror("shmget");
exit(1); exit(1);
} }
if ((cshm = (uint8_t *) shmat(shmid_cxtx, NULL, 0)) == (uint8_t *) -1) { if(cshm == NULL)
{
if ((cshm = (uint8_t *) shmat(shmid_cxtx, NULL, 0)) == (uint8_t *) -1) {
perror("shmat"); perror("shmat");
}
} }
sdap_entity->status = 1; sdap_entity->status = 1;
sdap_entity->ue_id = ue_id; sdap_entity->ue_id = ue_id;
...@@ -476,9 +478,9 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap ...@@ -476,9 +478,9 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap
*(sdap_num) = *(sdap_num) + 1; *(sdap_num) = *(sdap_num) + 1;
memcpy(cshm,sdap_num,sizeof(int64_t)); memcpy(cshm,sdap_num,sizeof(int64_t));
nr_sdap_entity_t *stu = (struct nr_sdap_entity_t*)cshm_t; nr_sdap_entity_t *stu = (struct nr_sdap_entity_t*)cshm_t;
if(shmdt(cshm) == -1){ // if(shmdt(cshm) == -1){
perror("detach error"); // perror("detach error");
} // }
return sdap_entity; return sdap_entity;
} }
...@@ -486,14 +488,17 @@ nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id) ...@@ -486,14 +488,17 @@ nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id)
{ {
nr_sdap_entity_t *sdap_entity; nr_sdap_entity_t *sdap_entity;
int shmid_cxtx; int shmid_cxtx;
uint8_t *cshm;
if ((shmid_cxtx = shmget((key_t)2, SHM_SIZE,0666 | IPC_CREAT )) < 0) { if ((shmid_cxtx = shmget((key_t)2, SHM_SIZE,0666 | IPC_CREAT )) < 0) {
perror("shmget"); perror("shmget");
exit(1); exit(1);
} }
if ((cshm = (uint8_t *) shmat(shmid_cxtx, NULL, 0)) == (uint8_t *) -1) { if(cshm == NULL)
{
if ((cshm = (uint8_t *) shmat(shmid_cxtx, NULL, 0)) == (uint8_t *) -1) {
perror("shmat"); perror("shmat");
}
} }
int sdpa_num = *(cshm); int sdpa_num = *(cshm);
...@@ -513,9 +518,9 @@ nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id) ...@@ -513,9 +518,9 @@ nr_sdap_entity_t *nr_sdap_get_entity(ue_id_t ue_id, int pdusession_id)
return sdap_entity; return sdap_entity;
} }
} }
if(shmdt(cshm) == -1){ // if(shmdt(cshm) == -1){
perror("detach error"); // perror("detach error");
} // }
return NULL; return NULL;
} }
......
...@@ -33,6 +33,9 @@ extern "C" { ...@@ -33,6 +33,9 @@ extern "C" {
#define SHMDATE_SIZE 65536 #define SHMDATE_SIZE 65536
#define hdr_sdap 100 #define hdr_sdap 100
int shm_offset = 0; int shm_offset = 0;
uint8_t *shm_pdcp;
uint8_t *shm_pdcp_t;
struct sdap_context{ struct sdap_context{
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
srb_flag_t srb_flag; srb_flag_t srb_flag;
...@@ -1709,19 +1712,24 @@ void *pdcp_gtp_Task(void *args) { ...@@ -1709,19 +1712,24 @@ void *pdcp_gtp_Task(void *args) {
exit(1); exit(1);
}else{ }else{
int shmid_data_pdcp; int shmid_data_pdcp;
uint8_t *shm_pdcp;
if ((shmid_data_pdcp = shmget((key_t)1, SHM_SIZE,0666)) < 0) { if ((shmid_data_pdcp = shmget((key_t)1, SHM_SIZE,0666)) < 0) {
perror("shmget"); perror("shmget");
exit(1);} exit(1);}
if(shm_pdcp == NULL)
{
if ((shm_pdcp = (uint8_t *) shmat(shmid_data_pdcp, NULL, 0)) == (uint8_t *) -1) { if ((shm_pdcp = (uint8_t *) shmat(shmid_data_pdcp, NULL, 0)) == (uint8_t *) -1) {
perror("shmat"); perror("shmat");
exit(1);
} }
shm_pdcp = readBuf.q.shm_offset * SHMDATE_SIZE + shm_pdcp + hdr_sdap - 4 + 17; shm_pdcp_t = shm_pdcp;
}
shm_pdcp = shm_pdcp_t;
shm_pdcp = readBuf.q.shm_offset * SHMDATE_SIZE + shm_pdcp + hdr_sdap - 4 + 17;
// for(int i=0;i<30;i++){
// printf("value : --%x -------\n",*(shm_pdcp + i));
// }
for(int i=0;i<30;i++){
printf("value : --%x -------\n",*(shm_pdcp + i));
}
MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_GTP, 0, MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_GTP, 0,
GTPV1U_TUNNEL_DATA_REQ, GTPV1U_TUNNEL_DATA_REQ,
sizeof(gtpv1u_tunnel_data_req_t) sizeof(gtpv1u_tunnel_data_req_t)
......
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