Commit 153af28d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

first version for supporting PC5-S

parent d5d6ecab
...@@ -33,8 +33,8 @@ OAI build/execute ...@@ -33,8 +33,8 @@ OAI build/execute
- cp ../../../targets/bin/.ue* . - cp ../../../targets/bin/.ue* .
- cp ../../../targets/bin/.usim* . - cp ../../../targets/bin/.usim* .
- sudo insmod ../../../targets/bin/ue_ip.ko - sudo insmod ../../../targets/bin/ue_ip.ko
UE1: UE1:
- sudo ifconfig oip0 10.0.0.1 - sudo ifconfig oip0 10.0.0.1
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 224.0.0.1 -j MARK --set-mark 3 - sudo iptables -A POSTROUTING -t mangle -o oip0 -d 224.0.0.1 -j MARK --set-mark 3
- (if necessary) sudo route add default gw 10.10.10.1 eth0 - (if necessary) sudo route add default gw 10.10.10.1 eth0
...@@ -42,8 +42,11 @@ UE2: ...@@ -42,8 +42,11 @@ UE2:
- sudo ifconfig oip1 10.0.0.2 - sudo ifconfig oip1 10.0.0.2
- sudo iptables -A POSTROUTING -t mangle -o oip1 -d 224.0.0.1 -j MARK --set-mark 3 - sudo iptables -A POSTROUTING -t mangle -o oip1 -d 224.0.0.1 -j MARK --set-mark 3
- (if necessary) sudo route add default gw 10.10.10.1 eth0 - (if necessary) sudo route add default gw 10.10.10.1 eth0
Run UE1, then UE2
- sudo ./lte-softmodem-stub -U --emul_iface eth0 TEST ONE-TO-MANY
Run UE1 then UE2, for example:
UE1: sudo ./lte-softmodem-stub -U --emul_iface eth0
UE2: sudo ./lte-softmodem-stub -U --emul_iface eno1
Test with Ping Test with Ping
- Sender - UE1: ping -I oip0 224.0.0.1 - Sender - UE1: ping -I oip0 224.0.0.1
...@@ -53,8 +56,6 @@ Test with Iperf ...@@ -53,8 +56,6 @@ Test with Iperf
- Sender - UE1: iperf -c 224.0.0.1 -u -b 0.1M --bind 10.0.0.1 -t 100 - Sender - UE1: iperf -c 224.0.0.1 -u -b 0.1M --bind 10.0.0.1 -t 100
- Receiver - UE2: sudo ./mcreceive 224.0.0.1 5001 - Receiver - UE2: sudo ./mcreceive 224.0.0.1 5001
......
...@@ -1368,6 +1368,7 @@ typedef struct { ...@@ -1368,6 +1368,7 @@ typedef struct {
int sltx_active; int sltx_active;
SLSCH_t slsch; SLSCH_t slsch;
ULSCH_PDU slsch_pdu; ULSCH_PDU slsch_pdu;
int slsch_lcid;
#endif #endif
/// number of attempt for rach /// number of attempt for rach
uint8_t RA_attempt_number; uint8_t RA_attempt_number;
......
...@@ -77,6 +77,7 @@ extern UL_IND_t *UL_INFO; ...@@ -77,6 +77,7 @@ extern UL_IND_t *UL_INFO;
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
/* /*
*
#ifndef USER_MODE #ifndef USER_MODE
#define msg debug_msg #define msg debug_msg
#endif #endif
...@@ -753,7 +754,6 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -753,7 +754,6 @@ void ue_send_sl_sdu(module_id_t module_idP,
int rlc_sdu_len; int rlc_sdu_len;
char *rlc_sdu; char *rlc_sdu;
uint32_t sourceL2Id;
uint32_t destinationL2Id =0x00000000; uint32_t destinationL2Id =0x00000000;
// Notes: 1. no control elements are supported yet // Notes: 1. no control elements are supported yet
...@@ -762,7 +762,7 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -762,7 +762,7 @@ 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,"LCID is %d (not 3)\n",longh->LCID); AssertFatal(((longh->LCID==3)|(longh->LCID==10)),"LCID is %d (not 3 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);
LOG_I( MAC, "[DestinationL2Id: %"PRIu32"] \n", destinationL2Id ); LOG_I( MAC, "[DestinationL2Id: %"PRIu32"] \n", destinationL2Id );
...@@ -771,7 +771,6 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -771,7 +771,6 @@ void ue_send_sl_sdu(module_id_t module_idP,
LOG_I( MAC, "[Destination Id is neither matched with Source Id nor with Group Id, drop the packet!!! \n"); LOG_I( MAC, "[Destination Id is neither matched with Source Id nor with Group Id, drop the packet!!! \n");
return; return;
} }
//AssertFatal(((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) | (destinationL2Id == UE_mac_inst[module_idP].groupL2Id)), "Destination Id is neither matched with Source Id nor with Group Id \n")
if (longh->F==1) { if (longh->F==1) {
rlc_sdu_len = ((longh->L_MSB<<8)&0x7F00)|(longh->L_LSB&0xFF); rlc_sdu_len = ((longh->L_MSB<<8)&0x7F00)|(longh->L_LSB&0xFF);
...@@ -788,7 +787,7 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -788,7 +787,7 @@ void ue_send_sl_sdu(module_id_t module_idP,
frameP, frameP,
ENB_FLAG_NO, ENB_FLAG_NO,
MBMS_FLAG_NO, MBMS_FLAG_NO,
3, longh->LCID, //3/10
rlc_sdu, rlc_sdu,
rlc_sdu_len, rlc_sdu_len,
1, 1,
...@@ -2736,11 +2735,12 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t ...@@ -2736,11 +2735,12 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t
SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframeP) { SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframeP) {
mac_rlc_status_resp_t rlc_status; mac_rlc_status_resp_t rlc_status, rlc_status_data;
uint32_t absSF = (frameP*10)+subframeP; uint32_t absSF = (frameP*10)+subframeP;
UE_MAC_INST *ue = &UE_mac_inst[module_idP]; UE_MAC_INST *ue = &UE_mac_inst[module_idP];
int rvtab[4] = {0,2,3,1}; int rvtab[4] = {0,2,3,1};
int sdu_length; int sdu_length;
// Note: this is hard-coded for now for the default SL configuration (4 SF PSCCH, 36 SF PSSCH) // Note: this is hard-coded for now for the default SL configuration (4 SF PSCCH, 36 SF PSSCH)
SLSCH_t *slsch = &UE_mac_inst[module_idP].slsch; SLSCH_t *slsch = &UE_mac_inst[module_idP].slsch;
...@@ -2748,13 +2748,25 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2748,13 +2748,25 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
if ((absSF%40) == 0) { // fill PSCCH data later in first subframe of SL period if ((absSF%40) == 0) { // fill PSCCH data later in first subframe of SL period
ue->sltx_active = 0; ue->sltx_active = 0;
rlc_status = mac_rlc_status_ind(module_idP, 0x1234,0,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO, rlc_status = mac_rlc_status_ind(module_idP, 0x1234,0,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
3, 10,
0xFFFF); 0xFFFF);//for signaling - hardcoded
if (rlc_status.bytes_in_buffer > 2) { rlc_status_data = mac_rlc_status_ind(module_idP, 0x1234,0,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
LOG_I(MAC,"SFN.SF %d.%d: Scheduling for %d bytes in Sidelink buffer\n",frameP,subframeP,rlc_status.bytes_in_buffer); 3,
// Fill in group id for off-network communications 0xFFFF); //for data - hardcoded
ue->sltx_active = 1;
if (rlc_status.bytes_in_buffer > 2){
LOG_I(MAC,"SFN.SF %d.%d: Scheduling for %d bytes in Sidelink buffer\n",frameP,subframeP,rlc_status.bytes_in_buffer);
// Fill in group id for off-network communications
ue->sltx_active = 1;
ue->slsch_lcid = 10;
}
else if (rlc_status_data.bytes_in_buffer >2){
LOG_I(MAC,"SFN.SF %d.%d: Scheduling for %d bytes in Sidelink buffer\n",frameP,subframeP,rlc_status_data.bytes_in_buffer);
// Fill in group id for off-network communications
ue->sltx_active = 1;
ue->slsch_lcid = 3;
} }
} // we're not in the SCCH period } // we're not in the SCCH period
else if (((absSF & 3) == 0 ) && else if (((absSF & 3) == 0 ) &&
...@@ -2762,14 +2774,15 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2762,14 +2774,15 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
// 10 PRBs, mcs 19 // 10 PRBs, mcs 19
int TBS = 4584/8; int TBS = 4584/8;
int req; int req;
if (ue->slsch_lcid == 10) {
rlc_status = mac_rlc_status_ind(module_idP, 0x1234,0,frameP,subframeP,ENB_FLAG_NO,MBMS_FLAG_NO,
3,
0xFFFF);
if (TBS<=rlc_status.bytes_in_buffer) req=TBS; if (TBS<=rlc_status.bytes_in_buffer) req=TBS;
else req = rlc_status.bytes_in_buffer; else req = rlc_status.bytes_in_buffer;
} else if (ue->slsch_lcid == 3){
if (TBS<=rlc_status_data.bytes_in_buffer) req=TBS;
else req = rlc_status_data.bytes_in_buffer;
}
if (req>0) { if (req>0) {
sdu_length = mac_rlc_data_req(module_idP, sdu_length = mac_rlc_data_req(module_idP,
0x1234, 0x1234,
...@@ -2777,7 +2790,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2777,7 +2790,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
frameP, frameP,
ENB_FLAG_NO, ENB_FLAG_NO,
MBMS_FLAG_NO, MBMS_FLAG_NO,
3, ue->slsch_lcid,
req, req,
(char*)(ue->slsch_pdu.payload + sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG))); (char*)(ue->slsch_pdu.payload + sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG)));
...@@ -2787,8 +2800,8 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2787,8 +2800,8 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
if (sdu_length > 0) { if (sdu_length > 0) {
LOG_I(MAC,"SFN.SF %d.%d : got %d bytes from Sidelink buffer (%d requested)\n",frameP,subframeP,sdu_length,req); LOG_I(MAC,"SFN.SF %d.%d : got %d bytes from Sidelink buffer (%d requested)\n",frameP,subframeP,sdu_length,req);
LOG_I(MAC,"sourceL2Id %d: \n",ue->sourceL2Id); LOG_I(MAC,"sourceL2Id: %d \n",ue->sourceL2Id);
LOG_I(MAC,"groupL2Id %d: \n",ue->groupL2Id); LOG_I(MAC,"groupL2Id: %d \n",ue->groupL2Id);
slsch->payload = (unsigned char*)ue->slsch_pdu.payload; slsch->payload = (unsigned char*)ue->slsch_pdu.payload;
if (sdu_length < 128) { if (sdu_length < 128) {
...@@ -2797,14 +2810,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2797,14 +2810,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
shorth->F=0; shorth->F=0;
shorth->L=sdu_length; shorth->L=sdu_length;
shorth->E=0; shorth->E=0;
shorth->LCID=3; shorth->LCID=ue->slsch_lcid;
/* shorth->SRC07=0x12;
shorth->SRC1623=0x56;
shorth->SRC815=0x34;
shorth->DST07=0x78;
shorth->DST815=0x9A;
shorth->DST1623=0xBC;*/
shorth->SRC07 = (ue->sourceL2Id>>16) & 0x000000ff; shorth->SRC07 = (ue->sourceL2Id>>16) & 0x000000ff;
shorth->SRC815 = (ue->sourceL2Id>>8) & 0x000000ff; shorth->SRC815 = (ue->sourceL2Id>>8) & 0x000000ff;
shorth->SRC1623 = ue->sourceL2Id & 0x000000ff; shorth->SRC1623 = ue->sourceL2Id & 0x000000ff;
...@@ -2820,15 +2826,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2820,15 +2826,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
longh->L_LSB=sdu_length&0xff; longh->L_LSB=sdu_length&0xff;
longh->L_MSB=(sdu_length>>8)&0x7f; longh->L_MSB=(sdu_length>>8)&0x7f;
longh->E=0; longh->E=0;
longh->LCID=3; longh->LCID=ue->slsch_lcid;
/*
longh->SRC07=0x12;
longh->SRC815=0x34;
longh->SRC1623=0x56;
longh->DST07=0x78;
longh->DST815=0x9A;
longh->DST1623=0xBC;
*/
longh->SRC07 = (ue->sourceL2Id >>16) & 0x000000ff; longh->SRC07 = (ue->sourceL2Id >>16) & 0x000000ff;
longh->SRC815 = (ue->sourceL2Id>>8) & 0x000000ff; longh->SRC815 = (ue->sourceL2Id>>8) & 0x000000ff;
longh->SRC1623 = ue->sourceL2Id & 0x000000ff; longh->SRC1623 = ue->sourceL2Id & 0x000000ff;
......
...@@ -403,6 +403,54 @@ struct pdcp_netlink_element_s { ...@@ -403,6 +403,54 @@ struct pdcp_netlink_element_s {
uint8_t *data; uint8_t *data;
}; };
//TTN for D2D (PC5S)
#ifdef Rel14
#define PDCP_SOCKET_PORT_NO 9999 //temporary value
int pdcp_pc5_sockfd;
struct sockaddr_in prose_app_addr;
struct sockaddr_in pdcp_sin;
int pdcp_pc5_socket_init();
typedef enum SL_PC5S_TYPES_e {
SL_PC5S_INIT=1,
SL_DIRECT_COMMUNICATION_REQUEST,
SL_DIRECT_COMMUNICATION_ACCEPT,
SL_DIRECT_COMMUNICATION_REJECT,
SL_DIRECT_SECURITY_MODE_COMMAND,
SL_DIRECT_SECURITY_MODE_COMPLETE
} SL_PC5S_TYPES_t;
typedef struct {
SL_PC5S_TYPES_t msg_type;
uint16_t rb_id;
int32_t data_size;
uint8_t inst;
} __attribute__((__packed__)) pdcp_data_header_t;
//should be completed with other IEs (3GPP TS 24.334)
typedef struct {
uint16_t sequenceNumber;
uint8_t ipAddressConfig;
} __attribute__((__packed__)) PC5SDirectCommunicationRequest;
typedef struct {
uint16_t sequenceNumber;
uint8_t ipAddressConfig;
} __attribute__((__packed__)) PC5SDirectCommunicationAccept;
//example of PC5-S messages
typedef struct {
pdcp_data_header_t pdcp_data_header;
union {
PC5SDirectCommunicationRequest pc5s_direct_communication_req;
PC5SDirectCommunicationAccept pc5s_direct_communication_accept;
uint8_t status;
} pc5sPrimitive;
} __attribute__((__packed__)) sidelink_pc5s_element;
#endif
#if 0 #if 0
/* /*
* Missing PDU information struct, a copy of this will be enqueued * Missing PDU information struct, a copy of this will be enqueued
......
This diff is collapsed.
...@@ -84,8 +84,6 @@ static uint32_t *pdcp_netlink_nb_element_ue = NULL; ...@@ -84,8 +84,6 @@ static uint32_t *pdcp_netlink_nb_element_ue = NULL;
time_stats_t ip_pdcp_stats_tmp; time_stats_t ip_pdcp_stats_tmp;
static void *pdcp_netlink_thread_fct(void *arg);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
pdcp_netlink_init( pdcp_netlink_init(
...@@ -152,6 +150,8 @@ pdcp_netlink_init( ...@@ -152,6 +150,8 @@ pdcp_netlink_init(
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
sched_param.sched_priority = 10; sched_param.sched_priority = 10;
pthread_attr_setschedpolicy(&attr, SCHED_RR); pthread_attr_setschedpolicy(&attr, SCHED_RR);
...@@ -168,6 +168,7 @@ pdcp_netlink_init( ...@@ -168,6 +168,7 @@ pdcp_netlink_init(
} }
pthread_setname_np( pdcp_netlink_thread, "PDCP netlink" ); pthread_setname_np( pdcp_netlink_thread, "PDCP netlink" );
} }
return 0; return 0;
...@@ -218,6 +219,7 @@ void *pdcp_netlink_thread_fct(void *arg) ...@@ -218,6 +219,7 @@ void *pdcp_netlink_thread_fct(void *arg)
len = recvmsg(nas_sock_fd, &nas_msg_rx, 0); len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
if (len == 0) { if (len == 0) {
/* Other peer (kernel) has performed an orderly shutdown /* Other peer (kernel) has performed an orderly shutdown
*/ */
...@@ -311,8 +313,11 @@ void *pdcp_netlink_thread_fct(void *arg) ...@@ -311,8 +313,11 @@ void *pdcp_netlink_thread_fct(void *arg)
} }
} }
} }
} }
return NULL; return NULL;
} }
#endif #endif
...@@ -63,4 +63,7 @@ extern void pdcp_process_input_sdus_tr (struct pdcp_entity *pdcpP); ...@@ -63,4 +63,7 @@ extern void pdcp_process_input_sdus_tr (struct pdcp_entity *pdcpP);
extern void init_pdcp (struct pdcp_entity *pdcpP, struct rb_dispatcher *rbP, uint8_t rb_idP); extern void init_pdcp (struct pdcp_entity *pdcpP, struct rb_dispatcher *rbP, uint8_t rb_idP);
extern void *pdcp_tx (void *argP); extern void *pdcp_tx (void *argP);
#endif #endif
void pdcp_pc5_socket_init();
#endif #endif
...@@ -104,11 +104,19 @@ struct GroupCommunicationEstablishReq { ...@@ -104,11 +104,19 @@ struct GroupCommunicationEstablishReq {
uint8_t pppp; uint8_t pppp;
}; };
struct GroupCommunicationReleaseReq {
uint32_t sourceL2Id;
uint32_t groupL2Id;
int slrb_id;
};
struct DirectCommunicationEstablishReq { struct DirectCommunicationEstablishReq {
uint32_t sourceL2Id; uint32_t sourceL2Id;
uint32_t destinationL2Id; uint32_t destinationL2Id;
uint32_t pppp;
}; };
struct sidelink_ctrl_element { struct sidelink_ctrl_element {
unsigned short type; unsigned short type;
union { union {
...@@ -117,6 +125,7 @@ struct sidelink_ctrl_element { ...@@ -117,6 +125,7 @@ struct sidelink_ctrl_element {
Group_Communication_Status_t group_comm_release_rsp; Group_Communication_Status_t group_comm_release_rsp;
//struct DirectCommunicationReleaseReq direct_comm_release_req; //struct DirectCommunicationReleaseReq direct_comm_release_req;
SL_UE_STATE_t ue_state; SL_UE_STATE_t ue_state;
//struct GroupCommunicationReleaseReq group_comm_release_req;
int slrb_id; int slrb_id;
} sidelinkPrimitive; } sidelinkPrimitive;
...@@ -693,13 +702,19 @@ typedef struct UE_RRC_INST_s { ...@@ -693,13 +702,19 @@ typedef struct UE_RRC_INST_s {
SystemInformationBlockType11_t *sib11[NB_CNX_UE]; SystemInformationBlockType11_t *sib11[NB_CNX_UE];
uint8_t *MIB; uint8_t *MIB;
#ifdef Rel14 #ifdef Rel14
//TTN - SIB18 //SIB18
SystemInformationBlockType18_r12_t *sib18[NB_CNX_UE]; SystemInformationBlockType18_r12_t *sib18[NB_CNX_UE];
SystemInformationBlockType19_r12_t *sib19[NB_CNX_UE]; SystemInformationBlockType19_r12_t *sib19[NB_CNX_UE];
SBCCH_SL_BCH_MessageType_t mib_sl[NB_CNX_UE]; SBCCH_SL_BCH_MessageType_t mib_sl[NB_CNX_UE];
/// Preconfiguration for Sidelink /// Preconfiguration for Sidelink
struct SL_Preconfiguration_r12 *SL_Preconfiguration[NB_CNX_UE]; struct SL_Preconfiguration_r12 *SL_Preconfiguration[NB_CNX_UE];
//source L2 Id
uint32_t sourceL2Id;
//group L2 Id
uint32_t groupL2Id;
//destination L2 Id
uint32_t destinationL2Id;
#endif #endif
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
......
...@@ -369,8 +369,15 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) ...@@ -369,8 +369,15 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long)); UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
*(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
// TTN - Establish a new SLRB for PC5-S (using DRB 10 for now)
UE->DRB_config[0][1] = CALLOC(1,sizeof(struct DRB_ToAddMod));
UE->DRB_config[0][1]->eps_BearerIdentity = CALLOC(1, sizeof(long));
UE->DRB_config[0][1]->drb_Identity = 10;
UE->DRB_config[0][1]->eps_BearerIdentity = CALLOC(1, sizeof(long));
// allowed value 5..15, value : x+4
*(UE->DRB_config[0][1]->eps_BearerIdentity) = 10;
UE->DRB_config[0][1]->logicalChannelIdentity = CALLOC(1, sizeof(long));
*(UE->DRB_config[0][1]->logicalChannelIdentity) = UE->DRB_config[0][1]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
struct RLC_Config *DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config)); struct RLC_Config *DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config));
struct PDCP_Config *DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config)); struct PDCP_Config *DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config));
...@@ -385,9 +392,11 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) ...@@ -385,9 +392,11 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config; UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
UE->DRB_config[0][1]->rlc_Config = DRB_rlc_config;
DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config; UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
UE->DRB_config[0][1]->pdcp_Config = DRB_pdcp_config;
DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
*DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_AM = NULL;
...@@ -401,6 +410,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) ...@@ -401,6 +410,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config; UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
UE->DRB_config[0][1]->logicalChannelConfig = DRB_lchan_config;
DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
...@@ -417,6 +427,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) ...@@ -417,6 +427,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t)); UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t));
ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]); ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][1]);
rrc_pdcp_config_asn1_req(&ctxt, rrc_pdcp_config_asn1_req(&ctxt,
(SRB_ToAddModList_t *) NULL, (SRB_ToAddModList_t *) NULL,
...@@ -5422,6 +5433,7 @@ void *rrc_control_socket_thread_fct(void *arg) ...@@ -5422,6 +5433,7 @@ void *rrc_control_socket_thread_fct(void *arg)
uint32_t groupL2Id; uint32_t groupL2Id;
module_id_t module_id; module_id_t module_id;
module_id = 0 ; //hardcoded for testing only
//from the main program, listen for the incoming messages from control socket (ProSe App) //from the main program, listen for the incoming messages from control socket (ProSe App)
prose_addr_len = sizeof(prose_app_addr); prose_addr_len = sizeof(prose_app_addr);
...@@ -5488,8 +5500,7 @@ void *rrc_control_socket_thread_fct(void *arg) ...@@ -5488,8 +5500,7 @@ void *rrc_control_socket_thread_fct(void *arg)
case GROUP_COMMUNICATION_ESTABLISH_REQ: case GROUP_COMMUNICATION_ESTABLISH_REQ:
sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id; sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id;
groupL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id; groupL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id;
//sourceL2Id = 0x123456;
//groupL2Id = 0x789ABC;
#ifdef DEBUG_CTRL_SOCKET #ifdef DEBUG_CTRL_SOCKET
LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type); LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.type); LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.type);
...@@ -5497,10 +5508,14 @@ void *rrc_control_socket_thread_fct(void *arg) ...@@ -5497,10 +5508,14 @@ void *rrc_control_socket_thread_fct(void *arg)
LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] group Id: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id); LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] group Id: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] group IP Address: " IPV4_ADDR "\n",IPV4_ADDR_FORMAT(sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupIpAddress)); LOG_I(RRC,"[rrc_control_socket_thread_fct][GroupCommunicationEstablishReq] group IP Address: " IPV4_ADDR "\n",IPV4_ADDR_FORMAT(sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupIpAddress));
#endif #endif
//store sourceL2Id
UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
UE_rrc_inst[module_id].groupL2Id = groupL2Id;
// configure lower layers PDCP/MAC/PHY for this communication // configure lower layers PDCP/MAC/PHY for this communication
//init_SL_preconfig() //init_SL_preconfig()
//configure MAC with sourceL2Id/groupL2ID (to be used in MAC/ue_procedures.c) //configure MAC with sourceL2Id/groupL2ID (to be used in MAC/ue_procedures.c)
module_id = 0 ; //hardcoded for testing only
rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0 rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0