Commit 709e5974 authored by matzakos's avatar matzakos

Merge branch 'master' of gitlab.eurecom.fr:matzakos/LTE-D2D

Merge with latest changes of LTE-D2D/master
parents 8b28e71b 314bf57f
Scenario 1 : Off-network UE2UE link Scenario 1 : Off-network UE2UE link
SynchREF UE (UE1) SynchREF UE (UE1)
UE1(eth0 - 10.10.10.1)--------UE2(eth0 - 10.10.10.2) UE1(eth0 - 10.10.10.1)--------UE2(eno1 - 10.10.10.2)
Here's an example of /etc/network/interfaces configuration for UE1 Here's an example of /etc/network/interfaces configuration for UE1
auto eth0 auto eth0
...@@ -36,58 +36,72 @@ OAI build/execute ...@@ -36,58 +36,72 @@ OAI build/execute
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.3 -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
UE2: UE2:
- sudo ifconfig oip1 10.0.0.2 - sudo ifconfig oip0 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 oip0 -d 224.0.0.3 -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 eno1
UE1 and UE2: Get and build vencore_app from d2d-l3-stub (branch: l3_stub) UE1 and UE2: Get and build vencore_app from d2d-l3-stub (branch: l3_stub)
- gcc -I . vencore_app.c -o vencore_app -lpthread - gcc -I . vencore_app.c -o vencore_app -lpthread
-------------------------------- --------------------------------
TEST ONE-TO-MANY TEST ONE-TO-MANY
Run UE1 then UE2, for example: Run UE1 then UE2, for example:
UE1: sudo ./lte-softmodem-stub -U --emul_iface eth0 UE1: sudo ./lte-softmodem-stub -U --emul-iface eth0
UE2: sudo ./lte-softmodem-stub -U --emul_iface eno1 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.3
- Receiver - UE2: using wireshark - Receiver - UE2: using wireshark
Test with Iperf 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.3 -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.3 5001
Filter the incomming packets according to GroupL2Id: receiver (one-to-many) can discard the packets if it doesn't belong to this group. Filter the incomming packets according to GroupL2Id: receiver (one-to-many) can discard the packets if it doesn't belong to this group.
For the moment, both sender and receiver use the same set of Ids (hardcoded) For the moment, both sender and receiver use the same set of Ids (hardcoded)
UE1 (sender) UE1 (sender)
- sudo ./lte-softmodem-stub -U --emul_iface eth0 - sudo ./lte-softmodem-stub -U --emul-iface eth0
- ./vencore_app #send the sourceL2Id, groupL2Id to OAI - ./vencore_app #send the sourceL2Id, groupL2Id to OAI
- ping -I oip0 224.0.0.1 - ping -I oip0 224.0.0.3
UE2(receiver) UE2(receiver)
- sudo ./lte-softmodem-stub -U --emul_iface eno1 - sudo ./lte-softmodem-stub -U --emul-iface eno1
#we can see the incomming packets from OAI log, however, cannot see from Wireshark -> they are discarded at MAC layer #we can see the incomming packets from OAI log, however, cannot see from Wireshark -> they are discarded at MAC layer
- ./vencore_app #we can see the packets appearing in Wireshark - ./vencore_app #we can see the packets appearing in Wireshark
-------------------------------------- --------------------------------------
TEST PC5-S (UE1 -sender, UE2 - receiver) TEST PC5-S (UE1 -sender, UE2 - receiver) and PC5-U for ONE-TO-ONE scenario
Configure UE1/UE2
UE1:
- sudo ifconfig oip0 10.0.0.1
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 10.0.0.2 -j MARK --set-mark 3
- sudo route add default gw 10.10.10.1 eth0
UE2:
- sudo ifconfig oip0 10.0.0.2
- sudo iptables -A POSTROUTING -t mangle -o oip0 -d 10.0.0.1 -j MARK --set-mark 3
- sudo route add default gw 10.10.10.1 eno1
step 1: step 1:
- UE1: sudo ./lte-softmodem-stub -U --emul_iface eth0 - UE1: sudo ./lte-softmodem-stub -U --emul-iface eth0
step 2: step 2:
- UE2: sudo ./lte-softmodem-stub -U --emul_iface eno1 - UE2: sudo ./lte-softmodem-stub -U --emul-iface eno1
- UE2: ./vencore_app -r #listen to incomming message from PC5-S - UE2: ./vencore_app -r #listen to incomming message from PC5-S
step 3: step 3:
- UE1: ./vencore_app -s #send a message via PC5-S (e.g., DirectCommunicationRequest) - UE1: ./vencore_app -s #send a message via PC5-S (e.g., DirectCommunicationRequest)
Generate unicast traffic
UE1: ping -I oip0 10.0.0.2
-------------------------------------- --------------------------------------
TEST PC5-D TEST PC5-D
step 1: step 1:
- UE1: sudo ./lte-softmodem-stub -U --emul_iface eth0 - UE1: sudo ./lte-softmodem-stub -U --emul-iface eth0
- UE1: ./vencore_app -d #send a PC5-Discovery-Announcement via PC5D - UE1: ./vencore_app -d #send a PC5-Discovery-Announcement via PC5D
step 2: step 2:
- UE2: sudo ./lte-softmodem-stub -U --emul_iface eno1 - UE2: sudo ./lte-softmodem-stub -U --emul-iface eno1
- UE2: ./vencore_app -d #send a PC5-Discovery-Announcement via PC5D - UE2: ./vencore_app -d #send a PC5-Discovery-Announcement via PC5D
...@@ -113,7 +113,7 @@ multicast_link_init(void) ...@@ -113,7 +113,7 @@ multicast_link_init(void)
if (multicast_if != NULL) { if (multicast_if != NULL) {
if (setsockopt(group_list[group].socket, SOL_SOCKET,SO_BINDTODEVICE, if (setsockopt(group_list[group].socket, SOL_SOCKET,SO_BINDTODEVICE,
multicast_if, 4) < 0) { multicast_if, strlen(multicast_if)) < 0) {
LOG_E(EMU, LOG_E(EMU,
"[MULTICAST] ERROR : setsockopt:SO_BINDTODEVICE on interface %s, exiting ...\n", "[MULTICAST] ERROR : setsockopt:SO_BINDTODEVICE on interface %s, exiting ...\n",
multicast_if); multicast_if);
......
...@@ -1249,6 +1249,8 @@ rrc_mac_config_req_ue( ...@@ -1249,6 +1249,8 @@ rrc_mac_config_req_ue(
//for D2D //for D2D
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
int j = 0;
int k = 0;
switch (config_action) { switch (config_action) {
case CONFIG_ACTION_ADD: case CONFIG_ACTION_ADD:
if (sourceL2Id){ if (sourceL2Id){
...@@ -1257,15 +1259,33 @@ rrc_mac_config_req_ue( ...@@ -1257,15 +1259,33 @@ rrc_mac_config_req_ue(
} }
if (destinationL2Id) { if (destinationL2Id) {
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 );
int j = 0; for (k=0; k< MAX_NUM_DEST; k++) {
int i = 0; if ((UE_mac_inst[Mod_idP].destinationList[k] == 0) && (j == 0)) j = k+1;
for (i=0; i< MAX_NUM_DEST; i++) { if (UE_mac_inst[Mod_idP].destinationList[k] == *destinationL2Id) break; //destination already exists!
if ((UE_mac_inst[Mod_idP].destinationList[i] == 0) && (j == 0)) j = i+1; }
if (UE_mac_inst[Mod_idP].destinationList[i] == *destinationL2Id) break; //destination already exists! if ((k == MAX_NUM_DEST) && (j > 0)) {
UE_mac_inst[Mod_idP].destinationList[j-1] = *destinationL2Id;
// UE_mac_inst[Mod_idP].numCommFlows++;
}
for (k=0; k< MAX_NUM_DEST; k++) {
LOG_I(MAC,"[UE %d] destination %d L2Id 0x%08x\n", Mod_idP,k,UE_mac_inst[Mod_idP].destinationList[k] );
} }
if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[Mod_idP].destinationList[j-1] = *destinationL2Id; }
//store list of LCIDs for SL
if (logicalChannelIdentity >0 ){
j = 0;
for (k=0; k< MAX_NUM_LCID; k++) {
if ((UE_mac_inst[Mod_idP].SL_LCID[k] == 0) && (j == 0)) j = k+1;
if (UE_mac_inst[Mod_idP].SL_LCID[k] == logicalChannelIdentity) break; //LCID already exists!
}
if ((k == MAX_NUM_LCID) && (j > 0)) {
UE_mac_inst[Mod_idP].SL_LCID[j-1] = logicalChannelIdentity;
UE_mac_inst[Mod_idP].numCommFlows++; UE_mac_inst[Mod_idP].numCommFlows++;
} }
for (k=0; k< MAX_NUM_LCID; k++) {
LOG_I(MAC,"[UE %d] logical channel %d channel id %d\n", Mod_idP,k,UE_mac_inst[Mod_idP].SL_LCID[k] );
}
}
break; break;
case CONFIG_ACTION_REMOVE: case CONFIG_ACTION_REMOVE:
//TODO //TODO
......
...@@ -1355,6 +1355,7 @@ typedef struct { ...@@ -1355,6 +1355,7 @@ typedef struct {
//List of destinations //List of destinations
uint32_t destinationList[MAX_NUM_DEST]; uint32_t destinationList[MAX_NUM_DEST];
uint8_t numCommFlows; uint8_t numCommFlows;
uint32_t SL_LCID[MAX_NUM_LCID];
#endif #endif
/// pointer to TDD Configuration (NULL for FDD) /// pointer to TDD Configuration (NULL for FDD)
......
...@@ -848,12 +848,17 @@ void ue_send_sl_sdu(module_id_t module_idP, ...@@ -848,12 +848,17 @@ void ue_send_sl_sdu(module_id_t module_idP,
//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: 0x%08x] \n", destinationL2Id ); LOG_I( MAC, "[DestinationL2Id: 0x%08x] \n", destinationL2Id );
//in case of 1-n communication, verify that UE belongs to that group
int i=0;
for (i=0; i< MAX_NUM_DEST; i++)
if (UE_mac_inst[module_idP].destinationList[i] == destinationL2Id) 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) | (destinationL2Id == UE_mac_inst[module_idP].groupL2Id))){ if (!((destinationL2Id == UE_mac_inst[module_idP].sourceL2Id) | (i < MAX_NUM_DEST))){
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;
} }
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);
rlc_sdu = sdu+sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG); rlc_sdu = sdu+sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG);
...@@ -3225,7 +3230,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -3225,7 +3230,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
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;
uint8_t sl_lcids[2] = {3, 10}; //list of lcids for SL - hardcoded //uint8_t sl_lcids[2] = {3, 10}; //list of lcids for SL - hardcoded
int i = 0; int i = 0;
// 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)
...@@ -3235,22 +3240,24 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -3235,22 +3240,24 @@ 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;
for (i = 0; i < 2; i++){ for (i = 0; i < MAX_NUM_LCID; i++){
if (ue->SL_LCID[i] > 0) {
for (int j = 0; j < ue->numCommFlows; j++){ for (int j = 0; j < ue->numCommFlows; j++){
if ((ue->sourceL2Id > 0) && (ue->destinationList[j] >0) ){ if ((ue->sourceL2Id > 0) && (ue->destinationList[j] >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,
sl_lcids[i], 0xFFFF, ue->sourceL2Id, ue->destinationList[j]); ue->SL_LCID[i], 0xFFFF, ue->sourceL2Id, ue->destinationList[j]);
if (rlc_status.bytes_in_buffer > 2){ 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); 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 // Fill in group id for off-network communications
ue->sltx_active = 1; ue->sltx_active = 1;
//store LCID, destinationL2Id //store LCID, destinationL2Id
ue->slsch_lcid = sl_lcids[i]; ue->slsch_lcid = ue->SL_LCID[i];
ue->destinationL2Id = ue->destinationList[j]; ue->destinationL2Id = ue->destinationList[j];
break; break;
} }
} }
} }
}
if ( ue->sltx_active == 1) break; if ( ue->sltx_active == 1) break;
} }
} // we're not in the SCCH period } // we're not in the SCCH period
......
...@@ -419,7 +419,7 @@ struct pdcp_netlink_element_s { ...@@ -419,7 +419,7 @@ struct pdcp_netlink_element_s {
//TTN for D2D (PC5S) //TTN for D2D (PC5S)
#ifdef Rel14 #ifdef Rel14
#define PDCP_SOCKET_PORT_NO 9999 //temporary value #define PDCP_SOCKET_PORT_NO 9999 //temporary value
#define PC5_SIGNALLING_PAYLOAD_SIZE 5 //should be updated with a correct value #define PC5_SIGNALLING_PAYLOAD_SIZE 100 //should be updated with a correct value
int pdcp_pc5_sockfd; int pdcp_pc5_sockfd;
struct sockaddr_in prose_ctrl_addr; struct sockaddr_in prose_ctrl_addr;
struct sockaddr_in prose_pdcp_addr; struct sockaddr_in prose_pdcp_addr;
...@@ -433,7 +433,7 @@ typedef struct { ...@@ -433,7 +433,7 @@ typedef struct {
ip_traffic_type_t traffic_type; ip_traffic_type_t traffic_type;
uint32_t sourceL2Id; uint32_t sourceL2Id;
uint32_t destinationL2Id; uint32_t destinationL2Id;
} __attribute__((__packed__)) pdcp_data_header_t; } __attribute__((__packed__)) pc5s_header_t;
//new PC5S-message //new PC5S-message
typedef struct { typedef struct {
...@@ -442,7 +442,7 @@ typedef struct { ...@@ -442,7 +442,7 @@ typedef struct {
//example of PC5-S messages //example of PC5-S messages
typedef struct { typedef struct {
pdcp_data_header_t pdcp_data_header; pc5s_header_t pc5s_header;
union { union {
uint8_t status; uint8_t status;
PC5SignallingMessage pc5_signalling_message; PC5SignallingMessage pc5_signalling_message;
......
This diff is collapsed.
...@@ -395,7 +395,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -395,7 +395,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
rlc_mode = rlc_union_p->mode; rlc_mode = rlc_union_p->mode;
} else { } else {
rlc_mode = RLC_MODE_NONE; rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "RLC not configured key %ju\n", key); //AssertFatal (0 , "RLC not configured key %ju\n", key);
} }
if (MBMS_flagP == 0) { if (MBMS_flagP == 0) {
......
...@@ -101,7 +101,6 @@ typedef enum { ...@@ -101,7 +101,6 @@ typedef enum {
} Group_Communication_Status_t; } Group_Communication_Status_t;
struct GroupCommunicationEstablishReq { struct GroupCommunicationEstablishReq {
uint8_t type; //0 - rx, 1 - tx
uint32_t sourceL2Id; uint32_t sourceL2Id;
uint32_t groupL2Id; uint32_t groupL2Id;
uint32_t groupIpAddress; uint32_t groupIpAddress;
...@@ -127,11 +126,12 @@ struct PC5SEstablishReq{ ...@@ -127,11 +126,12 @@ struct PC5SEstablishReq{
}; };
struct PC5SEstablishRsp{ struct PC5SEstablishRsp{
uint32_t sourceL2Id; uint32_t slrbid_lcid28;
uint32_t destinationL2Id; uint32_t slrbid_lcid29;
uint8_t status; uint32_t slrbid_lcid30;
}; };
//PC5_DISCOVERY MESSAGE //PC5_DISCOVERY MESSAGE
typedef struct { typedef struct {
unsigned char payload[PC5_DISCOVERY_PAYLOAD_SIZE]; unsigned char payload[PC5_DISCOVERY_PAYLOAD_SIZE];
...@@ -143,7 +143,7 @@ struct sidelink_ctrl_element { ...@@ -143,7 +143,7 @@ struct sidelink_ctrl_element {
unsigned short type; unsigned short type;
union { union {
struct GroupCommunicationEstablishReq group_comm_establish_req; struct GroupCommunicationEstablishReq group_comm_establish_req;
struct DirectCommunicationEstablishReq direct_comm_estblish_req; struct DirectCommunicationEstablishReq direct_comm_establish_req;
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;
......
This diff is collapsed.
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