Commit 01093063 authored by athanassopoulos's avatar athanassopoulos

NR SDAP gNB - Transparent Mode

parent 314760ac
......@@ -1983,6 +1983,10 @@ set(NR_PDCP_SRC
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
)
set(NR_SDAP_SRC
${OPENAIR2_DIR}/SDAP/nr_sdap/nr_sdap_gnb.c
)
set(L2_SRC
${PDCP_DIR}/pdcp.c
${PDCP_DIR}/pdcp_fifo.c
......@@ -2026,6 +2030,7 @@ set(L2_LTE_SRC
set(L2_NR_SRC
${NR_RLC_SRC}
${NR_PDCP_SRC}
${NR_SDAP_SRC}
${NR_RRC_DIR}/rrc_gNB.c
${NR_RRC_DIR}/nr_rrc_common.c
${NR_RRC_DIR}/L2_nr_interface.c
......@@ -2061,6 +2066,7 @@ set(L2_RRC_SRC_UE
set(NR_L2_SRC_UE
${NR_RLC_SRC}
${NR_PDCP_SRC}
${NR_SDAP_SRC}
${NR_UE_RRC_DIR}/L2_interface_ue.c
${NR_UE_RRC_DIR}/main_ue.c
${NR_UE_RRC_DIR}/rrc_UE.c
......
......@@ -36,6 +36,7 @@
#include "pdcp.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "openair2/SDAP/nr_sdap/nr_sdap_gnb.h"
#define TODO do { \
printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \
......@@ -480,7 +481,10 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = entity->pdusession_id;
if (offset==1) LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]);
if (offset==1) {
LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]);
sdap_gnb_ul_header_handler(buf[0]); // Handler for the UL gNB SDAP Header
}
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset);
itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p);
}
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "nr_sdap_gnb.h"
#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h>
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
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 uint32_t *sourceL2Id,
const uint32_t *destinationL2Id
) {
if(sdu_buffer == NULL) {
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - NULL sdu_buffer \n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if(sdu_buffer_size == 0) {
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - NULL or 0 sdu_buffer_size \n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
uint8_t *sdap_buf = (uint8_t *)malloc(sdu_buffer_size+SDAP_HDR_LENGTH);
nr_sdap_dl_hdr_t sdap_hdr;
sdap_hdr.RDI = 0; // SDAP_Hardcoded -
sdap_hdr.RQI = 0; // SDAP_Hardcoded - Should get this info from DL_PDU_SESSION_INFORMATION
sdap_hdr.QFI = 1; // SDAP_Hardcoded - Should get this info from DL_PDU_SESSION_INFORMATION
memcpy(&sdap_buf[0], &sdap_hdr, 1);
memcpy(&sdap_buf[1], sdu_buffer, sdu_buffer_size);
rb_id_t sdap_drb_id = rb_id; // SDAP_Hardcoded - Should get this info from QFI to DRB mapping table
boolean_t ret = pdcp_data_req(ctxt_p,
srb_flag,
sdap_drb_id,
mui,
confirm,
sdu_buffer_size+1,
sdap_buf,
pt_mode,
sourceL2Id,
destinationL2Id);
if(!ret) {
LOG_E(PDCP, "%s:%d:%s: SDAP Layer gNB - PDCP DL refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
free(sdap_buf);
return 0;
}
free(sdap_buf);
return 1;
}
void sdap_gnb_ul_header_handler(char sdap_gnb_ul_hdr) {
nr_sdap_ul_hdr_t *sdap_hdr_ul = (nr_sdap_ul_hdr_t *)&sdap_gnb_ul_hdr;
switch (sdap_hdr_ul->DC) {
case SDAP_HDR_UL_DATA_PDU:
LOG_I(PDCP, "%s:%d:%s: SDAP Layer gNB - UL Received SDAP Data PDU\n", __FILE__, __LINE__, __FUNCTION__);
break;
case SDAP_HDR_UL_CTRL_PDU:
LOG_I(PDCP, "%s:%d:%s: SDAP Layer gNB - Received SDAP Control PDU\n", __FILE__, __LINE__, __FUNCTION__);
break;
}
}
\ No newline at end of file
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _NR_SDAP_GNB_
#define _NR_SDAP_GNB_
#include "openair2/COMMON/platform_types.h"
#include "common/utils/LOG/log.h"
#define SDAP_BITMASK_DC (0x80)
#define SDAP_BITMASK_R (0x40)
#define SDAP_BITMASK_QFI (0x3F)
#define SDAP_HDR_UL_DATA_PDU (1)
#define SDAP_HDR_UL_CTRL_PDU (0)
#define SDAP_HDR_LENGTH (1)
typedef struct nr_sdap_dl_hdr_s {
uint8_t QFI:6;
uint8_t RQI:1;
uint8_t RDI:1;
} __attribute__((packed)) nr_sdap_dl_hdr_t;
typedef struct nr_sdap_ul_hdr_s {
uint8_t QFI:6;
uint8_t R:1;
uint8_t DC:1;
} __attribute__((packed)) nr_sdap_ul_hdr_t;
boolean_t sdap_gnb_data_req(protocol_ctxt_t *ctxt_p,
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 uint32_t *sourceL2Id,
const uint32_t *destinationL2Id
);
void sdap_gnb_ul_header_handler(char sdap_gnb_ul_hdr);
#endif
\ No newline at end of file
......@@ -17,6 +17,7 @@ extern "C" {
#include <openair2/COMMON/gtpv1_u_messages_types.h>
#include <openair3/ocp-gtpu/gtp_itf.h>
#include <openair2/LAYER2/PDCP_v10.1.0/pdcp.h>
#include "openair2/SDAP/nr_sdap/nr_sdap_gnb.h"
//#include <openair1/PHY/phy_extern.h>
#pragma pack(1)
......@@ -532,7 +533,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance,
create_tunnel_req->pdusession_id[i],
create_tunnel_req->upf_NGu_teid[i],
create_tunnel_req->upf_addr[i], 2152,
pdcp_data_req);
sdap_gnb_data_req);
create_tunnel_resp->status=0;
create_tunnel_resp->rnti=create_tunnel_req->rnti;
create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels;
......
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