Commit 7106aa92 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

fix errors related to multiple flows

parent b60f1122
...@@ -1391,17 +1391,18 @@ rrc_mac_config_req_ue( ...@@ -1391,17 +1391,18 @@ rrc_mac_config_req_ue(
LOG_I(MAC,"[UE %d] Configure group L2Id 0x%08x\n", Mod_idP, *groupL2Id ); LOG_I(MAC,"[UE %d] Configure group L2Id 0x%08x\n", Mod_idP, *groupL2Id );
j = 0; j = 0;
k = 0; k = 0;
for (k=0; k< MAX_NUM_LCID_DATA; k++) { for (k = 0; k< MAX_NUM_LCID_DATA; k++) {
if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == 0) && (j == 0)) j = k+1; if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == 0) && (j == 0)) j = k+1;
if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) && (UE_mac_inst[Mod_idP].sl_info[k].groupL2Id == *groupL2Id)) break; //(LCID, G) already exists! if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) && (UE_mac_inst[Mod_idP].sl_info[k].groupL2Id == *groupL2Id)) break; //(LCID, G) already exists!
} }
if ((k == MAX_NUM_LCID_DATA) && (j > 0)) { if ((k == MAX_NUM_LCID_DATA) && (j > 0)) {
UE_mac_inst[Mod_idP].sl_info[j-1].LCID = logicalChannelIdentity; UE_mac_inst[Mod_idP].sl_info[j-1].LCID = logicalChannelIdentity;
UE_mac_inst[Mod_idP].sl_info[j-1].groupL2Id = *groupL2Id; UE_mac_inst[Mod_idP].sl_info[j-1].groupL2Id = *groupL2Id;
UE_mac_inst[Mod_idP].sl_info[j-1].sourceL2Id = *sourceL2Id;
UE_mac_inst[Mod_idP].numCommFlows++; UE_mac_inst[Mod_idP].numCommFlows++;
} }
for (k=0; k< MAX_NUM_LCID_DATA; k++) { for (k = 0; k < MAX_NUM_LCID_DATA; k++) {
LOG_I(MAC,"[UE %d] logical channel %d channel id %d, groupL2Id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].groupL2Id ); LOG_I(MAC,"[UE %d] logical channel %d channel id %d, groupL2Id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].groupL2Id );
} }
} }
...@@ -1409,39 +1410,42 @@ rrc_mac_config_req_ue( ...@@ -1409,39 +1410,42 @@ rrc_mac_config_req_ue(
LOG_I(MAC,"[UE %d] Configure destination L2Id 0x%08x\n", Mod_idP, *destinationL2Id ); LOG_I(MAC,"[UE %d] Configure destination L2Id 0x%08x\n", Mod_idP, *destinationL2Id );
j = 0; j = 0;
k = 0; k = 0;
for (k=0; k< MAX_NUM_LCID_DATA; k++) { for (k = 0; k< MAX_NUM_LCID_DATA; k++) {
if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == 0) && (j == 0)) j = k+1; if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == 0) && (j == 0)) j = k+1;
if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) && (UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id == *destinationL2Id)) break; //(LCID, D) already exists! if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) && (UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id == *destinationL2Id)) break; //(LCID, D) already exists!
} }
if ((k == MAX_NUM_LCID_DATA) && (j > 0)) { if ((k == MAX_NUM_LCID_DATA) && (j > 0)) {
UE_mac_inst[Mod_idP].sl_info[j-1].LCID = logicalChannelIdentity; UE_mac_inst[Mod_idP].sl_info[j-1].LCID = logicalChannelIdentity;
UE_mac_inst[Mod_idP].sl_info[j-1].destinationL2Id = *destinationL2Id; UE_mac_inst[Mod_idP].sl_info[j-1].destinationL2Id = *destinationL2Id;
UE_mac_inst[Mod_idP].sl_info[j-1].sourceL2Id = *sourceL2Id;
UE_mac_inst[Mod_idP].numCommFlows++; UE_mac_inst[Mod_idP].numCommFlows++;
} }
for (k=0; k< MAX_NUM_LCID_DATA; k++) { for (k = 0; k < MAX_NUM_LCID_DATA; k++) {
LOG_I(MAC,"[UE %d] logical channel %d channel id %d, destinationL2Id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id); LOG_I(MAC,"[UE %d] logical channel %d channel id %d, destinationL2Id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id);
} }
} }
} else if ((logicalChannelIdentity >= MAX_NUM_LCID_DATA) && (logicalChannelIdentity < MAX_NUM_LCID)) { } else if ((logicalChannelIdentity >= MAX_NUM_LCID_DATA) && (logicalChannelIdentity < MAX_NUM_LCID)) {
if (destinationL2Id){ // if (destinationL2Id){
LOG_I(MAC,"[UE %d] Configure destination L2Id 0x%08x for PC5S\n", Mod_idP, *destinationL2Id ); LOG_I(MAC,"[UE %d] Configure destination L2Id 0x%08x for PC5S\n", Mod_idP, *destinationL2Id );
j = 0; j = 0;
k = 0; k = 0;
for (k=MAX_NUM_LCID_DATA; k< MAX_NUM_LCID; k++) { for (k=MAX_NUM_LCID_DATA; k< MAX_NUM_LCID; k++) {
if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == 0) && (j == 0)) j = k+1; if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == 0) && (j == 0)) j = k+1;
if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) && (UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id == *destinationL2Id)) break; //(LCID, D) already exists! if ((UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity)) break;
} //&& (UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id == *destinationL2Id)) break; //(LCID, D) already exists!
if ((k == MAX_NUM_LCID) && (j > 0)) { }
UE_mac_inst[Mod_idP].sl_info[j-1].LCID = logicalChannelIdentity; if ((k == MAX_NUM_LCID) && (j > 0)) {
UE_mac_inst[Mod_idP].sl_info[j-1].destinationL2Id = *destinationL2Id; UE_mac_inst[Mod_idP].sl_info[j-1].LCID = logicalChannelIdentity;
UE_mac_inst[Mod_idP].numCommFlows++; if (destinationL2Id) UE_mac_inst[Mod_idP].sl_info[j-1].destinationL2Id = *destinationL2Id;
UE_mac_inst[Mod_idP].sl_info[j-1].sourceL2Id = *sourceL2Id;
} UE_mac_inst[Mod_idP].numCommFlows++;
for (k=MAX_NUM_LCID_DATA; k< MAX_NUM_LCID; k++) {
LOG_I(MAC,"[UE %d] logical channel %d channel id %d, destinationL2Id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id); }
} for (k = MAX_NUM_LCID_DATA; k < MAX_NUM_LCID; k++) {
} LOG_I(MAC,"[UE %d] logical channel %d channel id %d, destinationL2Id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id);
}
// }
} }
...@@ -1450,23 +1454,38 @@ rrc_mac_config_req_ue( ...@@ -1450,23 +1454,38 @@ rrc_mac_config_req_ue(
// OK for the moment since LCID is unique per flow // OK for the moment since LCID is unique per flow
if ((logicalChannelIdentity > 0) && (logicalChannelIdentity < MAX_NUM_LCID_DATA)) { if ((logicalChannelIdentity > 0) && (logicalChannelIdentity < MAX_NUM_LCID_DATA)) {
LOG_I(MAC,"[UE %d] Remove (logicalChannelIdentity %d)\n", Mod_idP, logicalChannelIdentity ); LOG_I(MAC,"[UE %d] Remove (logicalChannelIdentity %d)\n", Mod_idP, logicalChannelIdentity );
k = 0; k = 0;
for (k = 0; k < MAX_NUM_LCID_DATA; k++) { for (k = 0; k < MAX_NUM_LCID_DATA; k++) {
if (UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) { if (UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) {
UE_mac_inst[Mod_idP].sl_info[k].LCID = 0; UE_mac_inst[Mod_idP].sl_info[k].LCID = 0;
UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id = 0; UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id = 0;
UE_mac_inst[Mod_idP].sl_info[k].groupL2Id = 0; UE_mac_inst[Mod_idP].sl_info[k].groupL2Id = 0;
UE_mac_inst[Mod_idP].numCommFlows--; UE_mac_inst[Mod_idP].numCommFlows--;
break; break;
} }
} }
for (k = 0; k < MAX_NUM_LCID_DATA; k++) { for (k = 0; k < MAX_NUM_LCID_DATA; k++) {
LOG_I(MAC,"[UE %d] channel id %d, destinationL2Id %d, groupL2Id %d\n", Mod_idP, UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id, UE_mac_inst[Mod_idP].sl_info[k].groupL2Id); LOG_I(MAC,"[UE %d] channel id %d, destinationL2Id %d, groupL2Id %d\n", Mod_idP, UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id, UE_mac_inst[Mod_idP].sl_info[k].groupL2Id);
} }
} else if ((logicalChannelIdentity >= MAX_NUM_LCID_DATA) && (logicalChannelIdentity < MAX_NUM_LCID)) { } else if ((logicalChannelIdentity >= MAX_NUM_LCID_DATA) && (logicalChannelIdentity < MAX_NUM_LCID)) {
//Todo - remove RBID for PCS5 //Todo - remove RBID for PCS5
} LOG_I(MAC,"[UE %d] Remove (logicalChannelIdentity %d)\n", Mod_idP, logicalChannelIdentity );
k = 0;
for (k = MAX_NUM_LCID_DATA; k < MAX_NUM_LCID; k++) {
if (UE_mac_inst[Mod_idP].sl_info[k].LCID == logicalChannelIdentity) {
UE_mac_inst[Mod_idP].sl_info[k].LCID = 0;
UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id = 0;
UE_mac_inst[Mod_idP].sl_info[k].groupL2Id = 0;
UE_mac_inst[Mod_idP].numCommFlows--;
break;
}
}
for (k = MAX_NUM_LCID_DATA; k < MAX_NUM_LCID; k++) {
LOG_I(MAC,"[UE %d] channel id %d, destinationL2Id %d, groupL2Id %d\n", Mod_idP, UE_mac_inst[Mod_idP].sl_info[k].LCID, UE_mac_inst[Mod_idP].sl_info[k].destinationL2Id, UE_mac_inst[Mod_idP].sl_info[k].groupL2Id);
}
}
break; break;
......
...@@ -1297,6 +1297,8 @@ typedef struct { ...@@ -1297,6 +1297,8 @@ typedef struct {
} UE_SCHEDULING_INFO; } UE_SCHEDULING_INFO;
typedef struct { typedef struct {
//SL source L2Id
uint32_t sourceL2Id;
//SL groupL2Id //SL groupL2Id
uint32_t groupL2Id; uint32_t groupL2Id;
//SL destinationL2Id //SL destinationL2Id
......
...@@ -755,6 +755,7 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -755,6 +755,7 @@ void ue_send_sl_sdu(module_id_t module_idP,
int rlc_sdu_len; int rlc_sdu_len;
char *rlc_sdu; char *rlc_sdu;
int lcid;
uint32_t destinationL2Id =0x00000000; uint32_t destinationL2Id =0x00000000;
uint32_t sourceL2Id = 0x00000000; uint32_t sourceL2Id = 0x00000000;
...@@ -766,18 +767,40 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -766,18 +767,40 @@ void ue_send_sl_sdu(module_id_t module_idP,
// extract header // extract header
SLSCH_SUBHEADER_24_Bit_DST_LONG *longh = (SLSCH_SUBHEADER_24_Bit_DST_LONG *)sdu; SLSCH_SUBHEADER_24_Bit_DST_LONG *longh = (SLSCH_SUBHEADER_24_Bit_DST_LONG *)sdu;
AssertFatal(longh->E==0,"E is non-zero\n"); AssertFatal(longh->E==0,"E is non-zero\n");
AssertFatal(((longh->LCID==3)|(longh->LCID==10)|(longh->LCID==4)),"LCID is %d (not 3, 4 or 10)\n",longh->LCID); //AssertFatal(((longh->LCID==3)|(longh->LCID==10)|(longh->LCID==4)),"LCID is %d (not 3, 4 or 10)\n",longh->LCID);
//filter incoming packet based on destination address //filter incoming packet based on destination address
destinationL2Id = (longh->DST07<<16) | (longh->DST815 <<8) | (longh->DST1623); destinationL2Id = (longh->DST07<<16) | (longh->DST815 <<8) | (longh->DST1623);
sourceL2Id = (longh->SRC07<<16) | (longh->SRC815 <<8) | (longh->SRC1623); sourceL2Id = (longh->SRC07<<16) | (longh->SRC815 <<8) | (longh->SRC1623);
LOG_D( MAC, "[DestinationL2Id: 0x%08x] \n", destinationL2Id ); LOG_D( MAC, "[DestinationL2Id: 0x%08x] \n", destinationL2Id );
//in case of 1-n communication, verify that UE belongs to that group //in case of 1-n communication, verify that UE belongs to that group
int i = 0; int i = 0;
int j = 0;
for (i=0; i< MAX_NUM_LCID; i++) for (i=0; i< MAX_NUM_LCID; i++)
if (UE_mac_inst[module_idP].sl_info[i].groupL2Id == destinationL2Id) break; if (UE_mac_inst[module_idP].sl_info[i].groupL2Id == destinationL2Id) {
lcid = UE_mac_inst[module_idP].sl_info[i].LCID;
break;
}
for (j = 0; j< MAX_NUM_LCID; j++){
if ((longh->LCID < MAX_NUM_LCID_DATA) && (j < MAX_NUM_LCID_DATA)){
if (UE_mac_inst[module_idP].sl_info[j].destinationL2Id == sourceL2Id) {
lcid = UE_mac_inst[module_idP].sl_info[j].LCID;
break;
}
}
if ((longh->LCID >= MAX_NUM_LCID_DATA) && (j >= MAX_NUM_LCID_DATA)){
if (UE_mac_inst[module_idP].sl_info[j].sourceL2Id == destinationL2Id) {
lcid = UE_mac_inst[module_idP].sl_info[j].LCID;
break;
}
}
// if (UE_mac_inst[module_idP].sl_info[i].groupL2Id == destinationL2Id) break;
}
/*
int j = 0; int j = 0;
for (j=0; j< MAX_NUM_LCID; j++) for (j=0; j< MAX_NUM_LCID; j++)
if (UE_mac_inst[module_idP].sl_info[j].destinationL2Id == sourceL2Id) break; if (UE_mac_inst[module_idP].sl_info[j].destinationL2Id == sourceL2Id) break;
*/
//match the destinationL2Id with UE L2Id or groupL2ID //match the destinationL2Id with UE L2Id or groupL2ID
if (!(((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) && (j < MAX_NUM_LCID)) | ((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) && (longh->LCID >= MAX_NUM_LCID_DATA)) | (i < MAX_NUM_LCID))){ if (!(((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) && (j < MAX_NUM_LCID)) | ((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) && (longh->LCID >= MAX_NUM_LCID_DATA)) | (i < MAX_NUM_LCID))){
......
...@@ -209,7 +209,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -209,7 +209,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
char send_buf[BUFSIZE]; char send_buf[BUFSIZE];
int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id; int rb_id = ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id;
if (rb_id == 10) { //hardcoded for PC5-Signaling if (rb_id >= MAX_NUM_LCID_DATA) { //hardcoded for PC5-Signaling
//if ((rb_id == 28) | (rb_id == 29) | (rb_id == 30)) //if ((rb_id == 28) | (rb_id == 29) | (rb_id == 30))
#ifdef PDCP_DEBUG #ifdef PDCP_DEBUG
......
...@@ -5831,10 +5831,9 @@ void *rrc_control_socket_thread_fct(void *arg) ...@@ -5831,10 +5831,9 @@ void *rrc_control_socket_thread_fct(void *arg)
UE_rrc_inst[module_id].sourceL2Id = sourceL2Id; UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
i = 0; i = 0;
j = 0; j = 0;
//get available rbid for this communication and store (LCID, D) //get available rbid for this communication and store (LCID, D)
if (destinationL2Id >0){ if (destinationL2Id > 0){
for (i=0; i< MAX_NUM_LCID_DATA; i++) { for (i = 0; i < MAX_NUM_LCID_DATA; i++) {
if ((UE_rrc_inst[module_id].sl_info[i].LCID == 0) && (j == 0)) j = i+1; if ((UE_rrc_inst[module_id].sl_info[i].LCID == 0) && (j == 0)) j = i+1;
if (UE_rrc_inst[module_id].sl_info[i].destinationL2Id == destinationL2Id) { if (UE_rrc_inst[module_id].sl_info[i].destinationL2Id == destinationL2Id) {
direct_comm_rbid = UE_rrc_inst[module_id].sl_info[i].LCID; direct_comm_rbid = UE_rrc_inst[module_id].sl_info[i].LCID;
...@@ -6123,6 +6122,7 @@ void *rrc_control_socket_thread_fct(void *arg) ...@@ -6123,6 +6122,7 @@ void *rrc_control_socket_thread_fct(void *arg)
UE_rrc_inst[module_id].sl_info[j-1].LCID = (j-1); UE_rrc_inst[module_id].sl_info[j-1].LCID = (j-1);
pc5s_rbid = UE_rrc_inst[module_id].sl_info[j-1].LCID; pc5s_rbid = UE_rrc_inst[module_id].sl_info[j-1].LCID;
UE_rrc_inst[module_id].sl_info[j-1].destinationL2Id = destinationL2Id; UE_rrc_inst[module_id].sl_info[j-1].destinationL2Id = destinationL2Id;
UE_rrc_inst[module_id].sl_info[j-1].sourceL2Id = sourceL2Id;
LOG_I(RRC,"[PC5EstablishReq] establish rbid %d for destinationL2Id Id: 0x%08x\n",pc5s_rbid, UE_rrc_inst[module_id].sl_info[j-1].destinationL2Id ); LOG_I(RRC,"[PC5EstablishReq] establish rbid %d for destinationL2Id Id: 0x%08x\n",pc5s_rbid, UE_rrc_inst[module_id].sl_info[j-1].destinationL2Id );
} }
} }
......
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