Commit 382f7aae authored by swu's avatar swu Committed by Jerome Peraldi

bug #129256: add support ip pdu through SDAP loopback(UE loop mode B) and ip...

bug #129256: add support ip pdu through SDAP loopback(UE loop mode B) and ip packet through tun interface
parent 23d7b52d
......@@ -38,3 +38,4 @@ MESSAGE_DEF(RRC_DCCH_DATA_COPY_IND, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataIn
MESSAGE_DEF(NR_RRC_DCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataReq, nr_rrc_dcch_data_req)
MESSAGE_DEF(NR_RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcDcchDataInd, nr_rrc_dcch_data_ind)
MESSAGE_DEF(NR_DTCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, NRDtchDataReq, nr_dtch_data_req)
MESSAGE_DEF(NR_SDAP_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, NRSdapDataReq, nr_sdap_data_req)
......@@ -41,6 +41,8 @@
#define NR_RRC_DCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_req
#define NR_RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_dcch_data_ind
#define NR_DTCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nr_dtch_data_req
#define NR_SDAP_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nr_sdap_data_req
//-------------------------------------------------------------------------------------------//
// Messages between RRC and PDCP layers
......@@ -122,4 +124,20 @@ typedef struct NRDtchDataReq_s {
uint8_t gNB_index;
} NRDtchDataReq;
typedef struct NRSdapDataReq_s {
uint8_t gnb_flag;
rb_id_t rb_id;
uint32_t muip;
uint32_t confirmp;
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t mode;
uint16_t rnti;
uint8_t module_id;
uint8_t gNB_index;
uint8_t qfi;
bool rqi;
int pdu_sessionId;
}NRSdapDataReq;
#endif /* PDCP_MESSAGES_TYPES_H_ */
......@@ -236,18 +236,24 @@ typedef struct ss_vng_proxy_resp_s {
/** DRB **/
typedef struct ss_drb_pdu_req_s {
uint8_t drb_id;
uint8_t data_type;
uint32_t sdu_size;
uint8_t sdu[SDU_SIZE];
uint16_t rnti;
int32_t pdu_sessionId; /* for data_type=DRB_SdapSdu */
int32_t qfi; /* for data_type=DRB_SdapSdu */
} ss_drb_pdu_req_t;
typedef struct ss_drb_pdu_ind_s {
uint8_t drb_id;
uint8_t data_type;
uint32_t sdu_size;
uint8_t sdu[SDU_SIZE];
frame_t frame; /*!< \brief LTE frame number.*/
sub_frame_t subframe; /*!< \brief LTE sub frame number.*/
int physCellId;
int32_t pdu_sessionId; /* for data_type=DRB_SdapSdu */
int32_t qfi; /* for data_type=DRB_SdapSdu */
} ss_drb_pdu_ind_t;
typedef enum carrierBandwidthEUTRA_dl_Bandwidth_e {
......
......@@ -553,6 +553,60 @@ static void start_pdcp_tun_ue(void)
}
}
void enqueue_sdap_data_req(
const uint8_t gnb_flag,
const ue_id_t ue_id,
const srb_flag_t srb_flag,
const rb_id_t rb_id,
const mui_t mui,
const confirm_t confirm,
const sdu_size_t sdu_buffer_size,
unsigned char *const sdu_buffer,
const pdcp_transmission_mode_t pt_mode,
const uint8_t qfi,
const bool rqi,
const int pdu_sessionId,
const uint8_t delaySeconds)
{
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(
&ctxt,
0,
gnb_flag,
ue_id,
nr_pdcp_current_time_last_frame,
nr_pdcp_current_time_last_subframe,
0);
MessageDef *message_p;
uint8_t *message_buffer = itti_malloc(
ctxt.enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
ctxt.enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
sdu_buffer_size);
memcpy(message_buffer, sdu_buffer, sdu_buffer_size);
message_p = itti_alloc_new_message(ctxt.enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, 0, NR_SDAP_DATA_REQ);
NR_SDAP_DATA_REQ (message_p).gnb_flag = gnb_flag;
NR_SDAP_DATA_REQ (message_p).rb_id = rb_id;
NR_SDAP_DATA_REQ (message_p).muip = mui;
NR_SDAP_DATA_REQ (message_p).confirmp = confirm;
NR_SDAP_DATA_REQ (message_p).sdu_size = sdu_buffer_size;
NR_SDAP_DATA_REQ (message_p).sdu_p = message_buffer;
NR_SDAP_DATA_REQ (message_p).mode = pt_mode;
NR_SDAP_DATA_REQ (message_p).module_id = ctxt.module_id;
NR_SDAP_DATA_REQ (message_p).rnti = ue_id;
NR_SDAP_DATA_REQ (message_p).gNB_index = 0;
NR_SDAP_DATA_REQ (message_p).qfi = qfi;
NR_SDAP_DATA_REQ (message_p).rqi = rqi;
NR_SDAP_DATA_REQ (message_p).pdu_sessionId = pdu_sessionId;
itti_send_msg_to_task(
ctxt.enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
ctxt.instance,
message_p);
LOG_I(SDAP, "send NR_SDAP_DATA_REQ to PDCP\n");
}
/****************************************************************************/
/* hacks to be cleaned up at some point - end */
/****************************************************************************/
......@@ -667,13 +721,6 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id)
if (PDCP_USE_NETLINK) {
nas_getparams();
/* TODO: TTCN support, disable TUN device.
* TTCN doesn't send correct IP packet, but random data for DATA loopback,
* need to choose correct flag in 'if' statement to identify that fact. */
if (IS_SOFTMODEM_NOS1 || (ENB_NAS_USE_TUN || UE_NAS_USE_TUN)) {
return pdcp_optmask;
}
if(UE_NAS_USE_TUN) {
char *ifsuffix_ue = get_softmodem_params()->nsa ? "nrue" : "ue";
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1;
......@@ -700,6 +747,12 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id)
return pdcp_optmask ;
}
bool pdcp_test_loop = false;/*TODO: should have multiple DRB list and corresponding scalling configuration from nas CLOSE UE LOOP (mode A)*/
void set_pdcp_loopback(bool enable)
{
pdcp_test_loop = enable;
}
static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
char *buf, int size)
{
......@@ -707,10 +760,10 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
int rb_id;
int i;
/* TODO: TTCN support.
* Also TTCN doesn't send correct IP packet, but random data for DATA loopback,
* need to choose correct flag in 'if' statement to identify that fact. */
if (IS_SOFTMODEM_NOS1 || (ENB_NAS_USE_TUN || UE_NAS_USE_TUN)) {
/*This should use test loop mode instead of the tun flag */
/* For UE, TS38.509 5.3.4.1 UE test loop mode A operation
For gNB: report the data to SS */
if ((entity->is_gnb== GNB_FLAG_NO && pdcp_test_loop) || (entity->is_gnb== GNB_FLAG_YES && RC.ss.mode >= SS_SOFTMODEM && RC.nr_drb_data_type == DRB_PdcpSdu) ){
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(
&ctxt,
......@@ -977,13 +1030,28 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
SS_DRB_PDU_REQ(msg_p).rnti,
msg_p->ittiMsgHeader.lte_time.frame,
msg_p->ittiMsgHeader.lte_time.slot);
if(SS_DRB_PDU_REQ(msg_p).data_type == DRB_SdapSdu){
sdap_data_req(&ctxt,
SS_DRB_PDU_REQ(msg_p).rnti,
SRB_FLAG_NO,
SS_DRB_PDU_REQ(msg_p).drb_id,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
SS_DRB_PDU_REQ(msg_p).sdu_size,
SS_DRB_PDU_REQ(msg_p).sdu,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL,
SS_DRB_PDU_REQ(msg_p).qfi,
0,
SS_DRB_PDU_REQ(msg_p).pdu_sessionId);
pdcp_data_req_drb(&ctxt,
} else if(SS_DRB_PDU_REQ(msg_p).data_type == DRB_PdcpSdu){
pdcp_data_req_drb(&ctxt,
SS_DRB_PDU_REQ(msg_p).drb_id,
0,
0,
SS_DRB_PDU_REQ(msg_p).sdu_size,
SS_DRB_PDU_REQ(msg_p).sdu);
}
}
break;
......@@ -999,9 +1067,6 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
0,
NR_DTCH_DATA_REQ(msg_p).gNB_index);
LOG_I(PDCP, "Sending packet to PDCP, Calling pdcp_data_req ue 0x%lx drb id %ld len %u\n",
ctxt.rntiMaybeUEid, NR_DTCH_DATA_REQ(msg_p).rb_id, NR_DTCH_DATA_REQ(msg_p).sdu_size);
if(ctxt_pP->enb_flag) {
LOG_I(PDCP, "Sending validated PDCP SDU to DBR task at gNB, rb_id=%ld\n", NR_DTCH_DATA_REQ(msg_p).rb_id);
......@@ -1038,6 +1103,67 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP)
}
break;
case NR_SDAP_DATA_REQ:
{
int result = 0;
LOG_I(PDCP, "Received NR_SDAP_DATA_REQ type at PDCP task \n");
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,
NR_SDAP_DATA_REQ(msg_p).module_id,
NR_SDAP_DATA_REQ(msg_p).gnb_flag,
NR_SDAP_DATA_REQ(msg_p).rnti,
nr_pdcp_current_time_last_frame,
nr_pdcp_current_time_last_subframe,
NR_SDAP_DATA_REQ(msg_p).gNB_index);
if(ctxt_pP->enb_flag) {
if(RC.nr_drb_data_type == DRB_SdapSdu){
LOG_I(PDCP, "Sending SDAP SDU to DBR task at gNB.\n");
MessageDef *message_p = itti_alloc_new_message(TASK_SS_DRB, 0, SS_DRB_PDU_IND);
AssertFatal(message_p != NULL, "Failed to allocate msg\n");
SS_DRB_PDU_IND(message_p).frame = nr_pdcp_current_time_last_frame;
SS_DRB_PDU_IND(message_p).subframe = nr_pdcp_current_time_last_subframe;
SS_DRB_PDU_IND(message_p).data_type = DRB_SdapSdu;
/*TODO: physCellId shall be filled if multicell through ue_id(rnti) */
//SS_DRB_PDU_IND(message_p).physCellId =
SS_DRB_PDU_IND(message_p).sdu_size = NR_SDAP_DATA_REQ(msg_p).sdu_size;
memcpy(SS_DRB_PDU_IND(message_p).sdu, NR_SDAP_DATA_REQ(msg_p).sdu_p, NR_SDAP_DATA_REQ(msg_p).sdu_size);
SS_DRB_PDU_IND(message_p).pdu_sessionId = NR_SDAP_DATA_REQ(msg_p).pdu_sessionId;
SS_DRB_PDU_IND(message_p).qfi = NR_SDAP_DATA_REQ(msg_p).qfi;
itti_send_msg_to_task(TASK_SS_DRB, 0, message_p);
result = itti_send_msg_to_task(TASK_SS_DRB, NR_SDAP_DATA_REQ(msg_p).module_id, message_p);
if (result < 0) {
LOG_E(PDCP, "Error in itti_send_msg_to_task!\n");
}
}
} else {
result = sdap_data_req(&ctxt,
NR_SDAP_DATA_REQ(msg_p).rnti,
SRB_FLAG_NO,
NR_SDAP_DATA_REQ(msg_p).rb_id,
NR_SDAP_DATA_REQ(msg_p).muip,
NR_SDAP_DATA_REQ(msg_p).confirmp,
NR_SDAP_DATA_REQ(msg_p).sdu_size,
(unsigned char *)NR_SDAP_DATA_REQ(msg_p).sdu_p,
NR_SDAP_DATA_REQ(msg_p).mode,
NULL,
NULL,
NR_SDAP_DATA_REQ(msg_p).qfi,
NR_SDAP_DATA_REQ(msg_p).rqi,
NR_SDAP_DATA_REQ(msg_p).pdu_sessionId);
if (result != true) {
LOG_E(PDCP, "NR_SDAP_DATA_REQ data request failed!\n");
}
}
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), NR_SDAP_DATA_REQ(msg_p).sdu_p);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
break;
case RRC_PCCH_DATA_REQ:
LOG_I(PDCP, "PDCP Received RRC_PCCH_DATA_REQ CC_id %d length %d \n", RRC_PCCH_DATA_REQ(msg_p).CC_id, RRC_PCCH_DATA_REQ(msg_p).sdu_size);
......
......@@ -728,6 +728,8 @@ static void rrc_gNB_process_RRCSetupComplete(const protocol_ctxt_t *const ctxt_p
ue_context_pP->ue_context.Srb2.Active = 0;
ue_context_pP->ue_context.StatusRrc = NR_RRC_CONNECTED;
if (RC.ss.mode >= SS_SOFTMODEM) return;
if (get_softmodem_params()->sa) {
rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete);
} else {
......@@ -2663,6 +2665,9 @@ rrc_gNB_decode_dcch(
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
}
if(RC.ss.mode >= SS_SOFTMODEM){
break;
}
if (get_softmodem_params()->sa) {
if(ue_context_p->ue_context.pdu_session_release_command_flag == 1) {
......
......@@ -2269,15 +2269,14 @@ nr_rrc_ue_establish_srb2(
uint8_t *pdu_buffer;
MessageDef *msg_p;
for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) {
pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size;
pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF);
NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
}
for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) {
pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size;
pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND);
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length;
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
}
free (ie->nonCriticalExtension->dedicatedNAS_MessageList);
}
......@@ -2437,12 +2436,15 @@ nr_rrc_ue_establish_srb2(
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
/*Send NAS_CONN_ESTABLI_CNF for handling Registration Accept in DL-Info transfer*/
/*Send NAS_CONN_ESTABLI_CNF for handling Registration Accept in DL-Info transfer.*/
/*It is not necessary to process the NAS message request with two request */
/*
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF);
NAS_CONN_ESTABLI_CNF(message_p).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(message_p).nasMsg.length = dedicatedNAS_Message->size;
NAS_CONN_ESTABLI_CNF(message_p).nasMsg.data = dedicatedNAS_Message->buf;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, message_p);
*/
}
}
break;
......
......@@ -24,6 +24,9 @@
uint8_t nas_qfi;
uint8_t nas_pduid;
bool sdap_test_loop = false;
uint8_t sdap_testLoopDelayTimeSeconds = 0;
bool sdap_data_req(protocol_ctxt_t *ctxt_p,
const ue_id_t ue_id,
const srb_flag_t srb_flag,
......@@ -92,3 +95,9 @@ void set_qfi_pduid(uint8_t qfi, uint8_t pduid){
nas_pduid = pduid;
return;
}
void set_sdap_loopback(bool enable, uint8_t testLoopDelayTimeSeconds){
sdap_test_loop = enable;
sdap_testLoopDelayTimeSeconds = testLoopDelayTimeSeconds;
return;
}
\ No newline at end of file
......@@ -63,4 +63,6 @@ void sdap_data_ind(rb_id_t pdcp_entity,
void set_qfi_pduid(uint8_t qfi, uint8_t pduid);
void set_sdap_loopback(bool enable, uint8_t testLoopDelayTimeSeconds);
#endif
......@@ -29,6 +29,9 @@
#include <string.h>
#include <pthread.h>
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
typedef struct {
nr_sdap_entity_t *sdap_entity_llist;
} nr_sdap_entity_info;
......@@ -172,6 +175,21 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
return ret;
}
extern void enqueue_sdap_data_req(
const uint8_t gnb_flag,
const ue_id_t ue_id,
const srb_flag_t srb_flag,
const rb_id_t rb_id,
const mui_t mui,
const confirm_t confirm,
const sdu_size_t sdu_buffer_size,
unsigned char *const sdu_buffer,
const pdcp_transmission_mode_t pt_mode,
const uint8_t qfi,
const bool rqi,
const int pdu_sessionId,
const uint8_t delaySeconds);
static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
rb_id_t pdcp_entity,
int is_gnb,
......@@ -184,9 +202,12 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
int offset=0;
if (is_gnb) { // gNB
uint8_t qfi =1;
bool rqi = false;
if (has_sdap_rx) { // Handling the SDAP Header
offset = SDAP_HDR_LENGTH;
nr_sdap_ul_hdr_t *sdap_hdr = (nr_sdap_ul_hdr_t *)buf;
qfi = sdap_hdr->QFI;
LOG_D(SDAP, "RX Entity Received QFI: %u\n", sdap_hdr->QFI);
LOG_D(SDAP, "RX Entity Received R bit: %u\n", sdap_hdr->R);
LOG_D(SDAP, "RX Entity Received DC bit: %u\n", sdap_hdr->DC);
......@@ -202,6 +223,22 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
}
}
if(RC.ss.mode >= SS_SOFTMODEM){
enqueue_sdap_data_req(GNB_FLAG_YES,
ue_id,
SRB_FLAG_NO,
pdcp_entity,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
size - offset,
(unsigned char *)(buf+offset),
PDCP_TRANSMISSION_MODE_DATA,
qfi,
rqi,
pdusession_id,
0);
return;
}
// Pushing SDAP SDU to GTP-U Layer
MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB,
0,
......@@ -221,6 +258,8 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
// very very dirty hack gloabl var N3GTPUInst
itti_send_msg_to_task(TASK_GTPV1_U, *N3GTPUInst, message_p);
} else { //nrUE
extern uint8_t nas_qfi;
uint8_t qfi = nas_qfi;
/*
* TS 37.324 5.2 Data transfer
* 5.2.2 Downlink
......@@ -237,7 +276,7 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
LOG_D(SDAP, "RX Entity Received QFI : %u\n", sdap_hdr->QFI);
LOG_D(SDAP, "RX Entity Received RQI : %u\n", sdap_hdr->RQI);
LOG_D(SDAP, "RX Entity Received RDI : %u\n", sdap_hdr->RDI);
qfi = sdap_hdr->QFI;
/*
* TS 37.324 5.2 Data transfer
* 5.2.2 Downlink
......@@ -289,6 +328,28 @@ static void nr_sdap_rx_entity(nr_sdap_entity_t *entity,
}
} /* else - retrieve the SDAP SDU from the DL SDAP data PDU as specified in the subclause 6.2.2.1 */
/* TS38.509 5.3.4.2 UE test loop mode B operation */
extern bool sdap_test_loop;
extern uint8_t sdap_testLoopDelayTimeSeconds;
if(sdap_test_loop){
LOG_D(SDAP, "SDAP loop back SDU\n");
bool dc = SDAP_HDR_UL_DATA_PDU;
enqueue_sdap_data_req(GNB_FLAG_NO,
ue_id,
SRB_FLAG_NO,
pdcp_entity,
RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO,
size - offset,
(unsigned char *)(buf+offset),
PDCP_TRANSMISSION_MODE_DATA,
qfi,
dc,
pdusession_id,
sdap_testLoopDelayTimeSeconds);
return;
}
/*
* TS 37.324 5.2 Data transfer
* 5.2.2 Downlink
......
This diff is collapsed.
......@@ -86,9 +86,15 @@ static void ss_send_drb_data(ss_drb_pdu_ind_t *pdu_ind)
ind.Common.CellId = nr_Cell1;
// Populated the Routing Info
ind.Common.RoutingInfo.d = NR_RoutingInfo_Type_RadioBearerId;
ind.Common.RoutingInfo.v.RadioBearerId.d = NR_RadioBearerId_Type_Drb;
ind.Common.RoutingInfo.v.RadioBearerId.v.Drb = pdu_ind->drb_id;
if(_drb_data_type == DRB_SdapSdu){
ind.Common.RoutingInfo.d = NR_RoutingInfo_Type_QosFlow;
ind.Common.RoutingInfo.v.QosFlow.PDU_SessionId = pdu_ind->pdu_sessionId;
ind.Common.RoutingInfo.v.QosFlow.QFI = pdu_ind->qfi;
} else {
ind.Common.RoutingInfo.d = NR_RoutingInfo_Type_RadioBearerId;
ind.Common.RoutingInfo.v.RadioBearerId.d = NR_RadioBearerId_Type_Drb;
ind.Common.RoutingInfo.v.RadioBearerId.v.Drb = pdu_ind->drb_id;
}
// Populated the Timing Info
ind.Common.TimingInfo.d = TimingInfo_Type_SubFrame;
......@@ -228,6 +234,26 @@ static void ss_send_drb_data(ss_drb_pdu_ind_t *pdu_ind)
}
break;
case DRB_SdapSdu:
{
LOG_A(GNB_APP, "[SS_DRB] SDAP SDU received in NR_DRB_COMMON_IND\n");
// Populating the SDU
ind.U_Plane.SlotData.NoOfTTIs = 1;
ind.U_Plane.SlotData.PduSduList.d = NR_L2DataList_Type_SdapSdu;
ind.U_Plane.SlotData.PduSduList.v.SdapSdu.d = 1;
ind.U_Plane.SlotData.PduSduList.v.SdapSdu.v = CALLOC(1, ind.U_Plane.SlotData.PduSduList.v.SdapSdu.d * sizeof(SDAP_SDU_Type));
DevAssert(ind.U_Plane.SlotData.PduSduList.v.SdapSdu.v != NULL);
for (int i = 0; i < ind.U_Plane.SlotData.PduSduList.v.SdapSdu.d; i++) {
SDAP_SDU_Type *sdapSdu = &ind.U_Plane.SlotData.PduSduList.v.SdapSdu.v[i];
sdapSdu->d = pdu_ind->sdu_size;
sdapSdu->v = CALLOC(1, sdapSdu->d);
DevAssert(sdapSdu->v != NULL);
memcpy(sdapSdu->v, pdu_ind->sdu, sdapSdu->d);
}
}
break;
default:
LOG_E(GNB_APP, "[SS_DRB] %s requested NR_L2DataList_Type %d that is not yet implemented\n", _drb_data_type);
}
......@@ -278,7 +304,7 @@ static void ss_task_handle_drb_pdu_req(struct NR_DRB_COMMON_REQ *req)
message_p = itti_alloc_new_message(task_id, 0, SS_DRB_PDU_REQ);
assert(message_p);
memset(SS_DRB_PDU_REQ(message_p).sdu, 0, SDU_SIZE);
SS_DRB_PDU_REQ(message_p).data_type = (uint8_t)DRB_RlcPdu;
if (rlcPdu->d == NR_RLC_PDU_Type_UMD && rlcPdu->v.UMD.d == NR_RLC_UMD_PDU_Type_NoSN)
{
struct NR_RLC_UMD_HeaderNoSN_Type *header = &rlcPdu->v.UMD.v.NoSN.Header;
......@@ -297,12 +323,14 @@ static void ss_task_handle_drb_pdu_req(struct NR_DRB_COMMON_REQ *req)
int pdu_header_size = 1;
bits_copy_from_array((char *)SS_DRB_PDU_REQ(message_p).sdu, 0, (const char *)header->SegmentationInfo, 2);
bits_copy_from_array((char *)SS_DRB_PDU_REQ(message_p).sdu, 2, (const char *)header->SequenceNumber, 6);
SS_DRB_PDU_REQ(message_p).data_type = (uint8_t)DRB_RlcPdu;
if (header->SegmentOffset.d)
{
pdu_header_size += 2;
bits_copy_from_array((char *)SS_DRB_PDU_REQ(message_p).sdu, 8, (const char *)header->SegmentOffset.v, 16);
//we consider only RLC payload is there meaning that RLC packet is segmented
RC.nr_drb_data_type = DRB_RlcSdu;
SS_DRB_PDU_REQ(message_p).data_type = (uint8_t)DRB_RlcSdu;
}
SS_DRB_PDU_REQ(message_p).sdu_size = pdu_header_size + data->d;
LOG_A(GNB_APP, "[SS_DRB] Length of RLC PDU received in NR_DRB_COMMON_REQ (SN6Bit): %lu\n", pdu_header_size + data->d);
......@@ -321,6 +349,7 @@ static void ss_task_handle_drb_pdu_req(struct NR_DRB_COMMON_REQ *req)
bits_copy_from_array((char *)SS_DRB_PDU_REQ(message_p).sdu, 16, (const char *)header->SegmentOffset.v, 16);
//we consider only RLC payload is there meaning that RLC packet is segmented
RC.nr_drb_data_type = DRB_RlcSdu;
SS_DRB_PDU_REQ(message_p).data_type = (uint8_t)DRB_RlcSdu;
}
SS_DRB_PDU_REQ(message_p).sdu_size = pdu_header_size + data->d;
LOG_A(GNB_APP, "[SS_DRB] Length of RLC PDU received in NR_DRB_COMMON_REQ: %lu\n", pdu_header_size + data->d);
......@@ -364,6 +393,44 @@ static void ss_task_handle_drb_pdu_req(struct NR_DRB_COMMON_REQ *req)
SS_DRB_PDU_REQ(message_p).drb_id = req->Common.RoutingInfo.v.RadioBearerId.v.Drb;
SS_DRB_PDU_REQ(message_p).rnti = SS_context.ss_rnti_g;
SS_DRB_PDU_REQ(message_p).data_type = (uint8_t)DRB_PdcpSdu;
if (!nr_vt_timer_push_msg(&req->Common.TimingInfo, req->U_Plane.SlotDataList.v[i].SlotOffset, task_id, instance_g, message_p))
{
int send_res = itti_send_msg_to_task(task_id, instance_g, message_p);
if (send_res < 0)
{
LOG_E(GNB_APP, "[SS_DRB] Error in itti_send_msg_to_task\n");
}
LOG_A(GNB_APP, "[SS_DRB] Send res: %d\n", send_res);
}
}
}
else if (req->U_Plane.SlotDataList.v[i].PduSduList.d == NR_L2DataList_Type_SdapSdu)
{
LOG_A(GNB_APP, "[SS_DRB] Sdap SDU Received in NR_DRB_COMMON_REQ\n");
_drb_data_type = DRB_SdapSdu;
RC.nr_drb_data_type = DRB_SdapSdu;
for (int j = 0; j < req->U_Plane.SlotDataList.v[i].PduSduList.v.SdapSdu.d; j++)
{
task_id = TASK_PDCP_ENB; /* reused the PDCP task intead of create a new SDAP task for SS_DRB_PDU_REQ message processing */
message_p = itti_alloc_new_message(task_id, 0, SS_DRB_PDU_REQ);
assert(message_p);
memset(SS_DRB_PDU_REQ(message_p).sdu, 0, SDU_SIZE);
SDAP_SDU_Type *sdapSdu = &req->U_Plane.SlotDataList.v[i].PduSduList.v.SdapSdu.v[j];
SS_DRB_PDU_REQ(message_p).sdu_size = sdapSdu->d;
memcpy(SS_DRB_PDU_REQ(message_p).sdu, sdapSdu->v, sdapSdu->d);
LOG_A(GNB_APP, "[SS_DRB] Length of SDAP SDU received in NR_DRB_COMMON_REQ: %lu\n", sdapSdu->d);
SS_DRB_PDU_REQ(message_p).drb_id = 1; /* This parameter is not actually used in SDAP entity */
SS_DRB_PDU_REQ(message_p).rnti = SS_context.ss_rnti_g;
SS_DRB_PDU_REQ(message_p).data_type = (uint8_t)DRB_SdapSdu;
if(req->Common.RoutingInfo.d == NR_RoutingInfo_Type_QosFlow){
SS_DRB_PDU_REQ(message_p).pdu_sessionId = req->Common.RoutingInfo.v.QosFlow.PDU_SessionId;
SS_DRB_PDU_REQ(message_p).qfi = req->Common.RoutingInfo.v.QosFlow.QFI;
}
if (!nr_vt_timer_push_msg(&req->Common.TimingInfo, req->U_Plane.SlotDataList.v[i].SlotOffset, task_id, instance_g, message_p))
{
......
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