mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 20:50:28 +00:00
Compare commits
12 Commits
pre-commit
...
srs_e2_aer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
970cfa3695 | ||
|
|
ac46473406 | ||
|
|
5382d1d947 | ||
|
|
d272c57063 | ||
|
|
7a2be8f1d8 | ||
|
|
95606fcfbf | ||
|
|
ef064b91a4 | ||
|
|
0444a7038a | ||
|
|
059e927af6 | ||
|
|
11def4f355 | ||
|
|
82a687d014 | ||
|
|
25be958d65 |
@@ -22,14 +22,21 @@
|
||||
#
|
||||
# Dockerfile for the Open-Air-Interface BUILD service
|
||||
# Valid for Ubuntu 24.04
|
||||
# The default build target produces a gNB for use with the Aerial L1
|
||||
# Using --target oai-gnb-ric produces a gNB with the e2 agent that can connect to nearRT-RIC,
|
||||
# and a the SRS channel display or visualization application.
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
FROM ran-base:latest AS ran-build
|
||||
ARG E2AP_VERSION=E2AP_V3
|
||||
ARG KPM_VERSION=KPM_V3_00
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
|
||||
FROM ran-base:latest AS ran-base
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt update && \
|
||||
apt upgrade --yes && \
|
||||
apt install --yes \
|
||||
wget \
|
||||
ninja-build \
|
||||
#unzip is needed for protobuf
|
||||
@@ -37,35 +44,65 @@ RUN apt-get update && \
|
||||
moreutils \
|
||||
vim-tiny \
|
||||
nano \
|
||||
# For the RIC visualization
|
||||
libglew-dev libglfw3 libglfw3-dev \
|
||||
# To build libnvipc
|
||||
cmake libpcap-dev libcunit1-dev libnuma-dev pkg-config
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY nvipc_src.*.tar.gz .
|
||||
|
||||
RUN tar -xvzf nvipc_src.*.tar.gz && \
|
||||
cd nvipc_src.* && \
|
||||
rm -rf build && mkdir build && cd build && \
|
||||
cmake .. -DNVIPC_DPDK_ENABLE=OFF -DNVIPC_DOCA_ENABLE=OFF -DNVIPC_CUDA_ENABLE=OFF -DENABLE_SLT_RSP=ON && \
|
||||
make -j && make install
|
||||
|
||||
|
||||
FROM ran-base AS ran-build
|
||||
ARG E2AP_VERSION
|
||||
ARG KPM_VERSION
|
||||
|
||||
RUN rm -Rf /oai-ran
|
||||
WORKDIR /oai-ran
|
||||
COPY . .
|
||||
|
||||
RUN /bin/sh oaienv && \
|
||||
tar -xvzf nvipc_src.*.tar.gz && \
|
||||
cd nvipc_src.* && \
|
||||
rm -rf build && mkdir build && cd build && \
|
||||
cmake .. -DNVIPC_DPDK_ENABLE=OFF -DNVIPC_DOCA_ENABLE=OFF -DNVIPC_CUDA_ENABLE=OFF -DENABLE_SLT_RSP=ON && \
|
||||
make -j && make install
|
||||
cd cmake_targets && \
|
||||
mkdir -p log && \
|
||||
./build_oai -c -w AERIAL --gNB --ninja --build-tool-opt -k10 \
|
||||
--cmake-opt -DE2AP_VERSION=$E2AP_VERSION \
|
||||
--cmake-opt -DKPM_VERSION=$KPM_VERSION \
|
||||
--cmake-opt -DCMAKE_C_FLAGS="-Werror" --cmake-opt -DCMAKE_CXX_FLAGS="-Werror"
|
||||
|
||||
FROM ran-build AS ran-build-ric
|
||||
ARG E2AP_VERSION
|
||||
ARG KPM_VERSION
|
||||
|
||||
RUN cd openair2/E2AP/flexric && \
|
||||
git submodule update --init --recursive && \
|
||||
git checkout origin/srs_sm_aerial && \
|
||||
cmake -B build -GNinja -DOAI_AERIAL=ON \
|
||||
-DE2AP_VERSION=$E2AP_VERSION -DKPM_VERSION=$KPM_VERSION && \
|
||||
cmake --build build --target install -- -j30
|
||||
|
||||
RUN /bin/sh oaienv && \
|
||||
cd cmake_targets && \
|
||||
mkdir -p log && \
|
||||
./build_oai -c -w AERIAL --gNB --ninja --build-tool-opt -k10 \
|
||||
--cmake-opt -DCMAKE_C_FLAGS="-Werror" --cmake-opt -DCMAKE_CXX_FLAGS="-Werror"
|
||||
./build_oai -c --gNB --ninja --build-tool-opt -k10 \
|
||||
--build-e2 \
|
||||
--cmake-opt -DE2AP_VERSION=$E2AP_VERSION \
|
||||
--cmake-opt -DKPM_VERSION=$KPM_VERSION \
|
||||
--cmake-opt -DCMAKE_C_FLAGS="-Werror" --cmake-opt -DCMAKE_CXX_FLAGS="-Werror" \
|
||||
--cmake-opt -DOAI_AERIAL=ON;
|
||||
|
||||
|
||||
#start from scratch for target executable
|
||||
FROM ubuntu:noble AS oai-gnb-aerial
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
##start from scratch for target executable
|
||||
FROM ubuntu:noble AS oai-gnb-base
|
||||
ENV TZ=Europe
|
||||
ENV PATH="$PATH:/opt/oai-gnb/bin"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade --yes && \
|
||||
apt-get install --yes \
|
||||
RUN apt update && \
|
||||
apt upgrade --yes && \
|
||||
apt install --yes \
|
||||
software-properties-common \
|
||||
procps \
|
||||
libsctp1 \
|
||||
@@ -79,13 +116,15 @@ RUN apt-get update && \
|
||||
iputils-ping \
|
||||
gdb \
|
||||
moreutils \
|
||||
libusb-1.0-0 \
|
||||
libyaml-cpp-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
util-linux \
|
||||
libyaml-cpp-dev
|
||||
#Cleanup done in the final FROM, so we don't need to re-update in oai-gnb-ric
|
||||
|
||||
WORKDIR /opt/oai-gnb/bin
|
||||
COPY --from=ran-build \
|
||||
/oai-ran/cmake_targets/ran_build/build/nr-softmodem ./
|
||||
/oai-ran/cmake_targets/ran_build/build/nr-softmodem \
|
||||
/opt/oai-gnb/bin/
|
||||
|
||||
COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh
|
||||
|
||||
COPY --from=ran-build \
|
||||
@@ -93,7 +132,7 @@ COPY --from=ran-build \
|
||||
/oai-ran/cmake_targets/ran_build/build/libparams_yaml.so \
|
||||
/usr/local/lib/
|
||||
|
||||
#copy files from nvIPC
|
||||
FROM oai-gnb-base AS oai-gnb
|
||||
COPY --from=ran-build \
|
||||
/usr/local/lib/libfmtlog-shared.so \
|
||||
/usr/local/lib/libnvlog.so \
|
||||
@@ -113,3 +152,32 @@ WORKDIR /opt/oai-gnb
|
||||
COPY --from=ran-build /tini /tini
|
||||
ENTRYPOINT ["/tini", "-v", "--", "/opt/oai-gnb/bin/entrypoint.sh"]
|
||||
CMD ["/opt/oai-gnb/bin/nr-softmodem"]
|
||||
|
||||
FROM oai-gnb AS oai-gnb-ric
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get install --yes libglew-dev libglfw3 libglfw3-dev
|
||||
|
||||
COPY --from=ran-build-ric \
|
||||
/oai-ran/openair2/E2AP/flexric/flexric.conf \
|
||||
/usr/local/etc/flexric/
|
||||
|
||||
COPY --from=ran-build-ric \
|
||||
/usr/local/lib/flexric/ \
|
||||
/usr/local/lib/flexric
|
||||
|
||||
COPY --from=ran-build-ric \
|
||||
/oai-ran/openair2/E2AP/flexric/build/examples/xApp/c/srs/xapp_srs_channel \
|
||||
/oai-ran/openair2/E2AP/flexric/build/examples/xApp/c/srs/localization_plots/demo \
|
||||
/oai-ran/openair2/E2AP/flexric/build/examples/xApp/c/srs/xapp_srs_ind \
|
||||
/oai-ran/openair2/E2AP/flexric/build/examples/ric/nearRT-RIC \
|
||||
/opt/oai-gnb/bin/
|
||||
|
||||
COPY --from=ran-build-ric \
|
||||
/oai-ran/cmake_targets/ran_build/build/nr-softmodem \
|
||||
/opt/oai-gnb/bin/
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#This makes the non-RIC version the default target.
|
||||
FROM oai-gnb AS default-gnb
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
@@ -22,6 +22,10 @@ if (OAI_AERIAL)
|
||||
target_link_libraries(aerial_lib PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
|
||||
target_link_libraries(aerial_lib PRIVATE nr_fapi_p5 nr_fapi_p7)
|
||||
target_link_libraries(aerial_lib PRIVATE "${NVLOG_LIB}" "${NVIPC_LIB}")
|
||||
if(E2_AGENT)
|
||||
target_link_libraries(aerial_lib PRIVATE e2_agent e2_agent_arg e2_ran_func_du_cucp_cuup)
|
||||
target_compile_definitions(aerial_lib PRIVATE ${E2AP_VERSION} ${KPM_VERSION} E2_AGENT)
|
||||
endif()
|
||||
else ()
|
||||
message(STATUS "No Support for Aerial")
|
||||
endif ()
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
|
||||
#include "system.h"
|
||||
#include "fapi_vnf_p7.h"
|
||||
#ifdef E2_AGENT
|
||||
#include "openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_extern.h"
|
||||
#endif
|
||||
|
||||
#define MAX_EVENTS 10
|
||||
#define RECV_BUF_LEN 8192
|
||||
@@ -139,6 +142,9 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
|
||||
if (vnf_p7_config->_public.nr_srs_indication) {
|
||||
(vnf_p7_config->_public.nr_srs_indication)(&ind);
|
||||
}
|
||||
#ifdef E2_AGENT
|
||||
signal_nfapi_srs_indication(&ind);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,11 @@ set(SM_ENCODING_GTP "PLAIN" CACHE STRING "The GTP SM encoding to use")
|
||||
set_property(CACHE SM_ENCODING_GTP PROPERTY STRINGS "PLAIN")
|
||||
message(STATUS "Selected GTP SM_ENCODING: ${SM_ENCODING_GTP}")
|
||||
|
||||
# SRS Service Model
|
||||
set(SM_ENCODING_SRS "PLAIN" CACHE STRING "The SRS SM encoding to use")
|
||||
set_property(CACHE SM_ENCODING_SRS PROPERTY STRINGS "PLAIN")
|
||||
message(STATUS "Selected SRS SM_ENCODING: ${SM_ENCODING_SRS}")
|
||||
|
||||
|
||||
if(E2AP_VERSION STREQUAL "E2AP_V1")
|
||||
add_library(e2ap_ran_func_obj OBJECT
|
||||
|
||||
@@ -51,9 +51,12 @@ add_library(e2_ran_func_cuup STATIC
|
||||
CUSTOMIZED/ran_func_pdcp.c
|
||||
CUSTOMIZED/ran_func_tc.c # currently, not implemented; therefore, filling rnd data
|
||||
../flexric/test/rnd/fill_rnd_data_tc.c
|
||||
CUSTOMIZED/ran_func_srs.c # just a first step
|
||||
CUSTOMIZED/ran_func_srs_subs.c
|
||||
../flexric/src/sm/srs_sm/ie/srs_data_ie.c
|
||||
)
|
||||
|
||||
target_link_libraries(e2_ran_func_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj e2sm_rc_ir_obj sm_common_ie_obj ds alg sm_common_enc_asn_obj_rc 3gpp_derived_ie_enc_asn_obj_rc)
|
||||
target_link_libraries(e2_ran_func_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj e2sm_rc_ir_obj sm_common_ie_obj ds alg sm_common_enc_asn_obj_rc 3gpp_derived_ie_enc_asn_obj_rc nfapi_common nr_fapi_p7)
|
||||
target_compile_definitions(e2_ran_func_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_CUUP)
|
||||
|
||||
|
||||
@@ -75,9 +78,12 @@ add_library(e2_ran_func_du_cucp_cuup STATIC
|
||||
../flexric/test/rnd/fill_rnd_data_slice.c
|
||||
CUSTOMIZED/ran_func_tc.c # currently, not implemented; therefore, filling rnd data
|
||||
../flexric/test/rnd/fill_rnd_data_tc.c
|
||||
CUSTOMIZED/ran_func_srs.c # just a first step
|
||||
CUSTOMIZED/ran_func_srs_subs.c
|
||||
../flexric/src/sm/srs_sm/ie/srs_data_ie.c
|
||||
)
|
||||
|
||||
target_link_libraries(e2_ran_func_du_cucp_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj e2sm_rc_ir_obj sm_common_ie_obj ds sm_common_enc_asn_obj_rc 3gpp_derived_ie_enc_asn_obj_rc)
|
||||
target_link_libraries(e2_ran_func_du_cucp_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj e2sm_rc_ir_obj sm_common_ie_obj ds sm_common_enc_asn_obj_rc 3gpp_derived_ie_enc_asn_obj_rc nfapi_common nr_fapi_p7)
|
||||
target_compile_definitions(e2_ran_func_du_cucp_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_DU NGRAN_GNB_CUCP NGRAN_GNB_CUUP)
|
||||
|
||||
# Current implementation:
|
||||
|
||||
185
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs.c
Normal file
185
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs.c
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* 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 "ran_func_srs.h"
|
||||
#include "ran_func_srs_extern.h"
|
||||
#include "ran_func_srs_subs.h"
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
|
||||
|
||||
#include "../../flexric/src/agent/e2_agent_api.h"
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
// for the packing functions
|
||||
#include "nfapi/open-nFAPI/common/public_inc/nfapi.h"
|
||||
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi_p7.h"
|
||||
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi.h"
|
||||
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi_p7_utils.h"
|
||||
|
||||
#include "openair2/F1AP/f1ap_ids.h"
|
||||
static seq_arr_t srs_subs_data = {0};
|
||||
|
||||
bool read_srs_sm(void* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void read_srs_setup_sm(void* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(0!=0 && "Not implemented");
|
||||
}
|
||||
|
||||
sm_ag_if_ans_t write_ctrl_srs_sm(void const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
assert(0 !=0 && "Not supported");
|
||||
}
|
||||
|
||||
|
||||
static srs_ind_hdr_t fill_srs_ind_hdr(void)
|
||||
{
|
||||
srs_ind_hdr_t hdr = {0};
|
||||
hdr.ev_trigger_cond_id = 2;
|
||||
return hdr;
|
||||
}
|
||||
|
||||
static srs_ind_msg_t fill_srs_ind_msg(nfapi_nr_srs_indication_t *nfapi_srs_ind)
|
||||
{
|
||||
srs_ind_msg_t msg = {0};
|
||||
msg.len = 1; // only for now
|
||||
msg.tstamp = time_now_us();
|
||||
|
||||
if(msg.len > 0 ){
|
||||
msg.indication_stats = calloc(msg.len, sizeof(srs_indication_stats_impl_t));
|
||||
assert(msg.indication_stats != NULL && "Memory exhausted");
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < msg.len; ++i){
|
||||
srs_indication_stats_impl_t* indication_stats = &msg.indication_stats[i];
|
||||
|
||||
f1_ue_data_t ue_data = du_get_f1_ue_data(nfapi_srs_ind->pdu_list[0].rnti); // Unique CU-UE ID
|
||||
indication_stats->ue_id= ue_data.secondary_ue;
|
||||
size_t ba_len = get_srs_indication_size(nfapi_srs_ind);
|
||||
byte_array_t ba = {.len = ba_len};
|
||||
ba.buf = malloc(ba.len);
|
||||
uint8_t *pPackedBuf = ba.buf;
|
||||
uint8_t *pWritePackedMessage = pPackedBuf;
|
||||
uint8_t *pPackMessageEnd = pPackedBuf + ba.len;
|
||||
|
||||
#ifdef RIC_DEBUG
|
||||
printf("CU-UE ID: %u\n", indication_stats->ue_id);
|
||||
#ifdef RIC_DEBUG_VERBOSE
|
||||
printf("[RIC DEBUG INFO] pointer = %p\n",(void*)nfapi_srs_ind);
|
||||
printf("[RIC DEBUG INFO] ba initialized len: %zu bytes\n", ba.len);
|
||||
printf("[RIC DEBUG INFO] Sending SFN: %u\n", nfapi_srs_ind->sfn);
|
||||
printf("[RIC DEBUG INFO] Sending Slot: %u\n", nfapi_srs_ind->slot);
|
||||
printf("[RIC DEBUG INFO] Sending num srs: %d\n", nfapi_srs_ind->number_of_pdus);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const uint8_t result = pack_nr_srs_indication(nfapi_srs_ind, &pWritePackedMessage, pPackMessageEnd, 0);
|
||||
assert(result != 0 && "Error in packing SRS Indication message");
|
||||
size_t packedBufLen = pWritePackedMessage - pPackedBuf;// this should be eq to the ba.len
|
||||
|
||||
ba.len = packedBufLen;
|
||||
#ifdef RIC_DEBUG
|
||||
printf("[RIC DEBUG INFO] ba updated len: %zu bytes\n", ba.len);
|
||||
#endif
|
||||
indication_stats->srs_indication_ba = copy_byte_array(ba);
|
||||
|
||||
// Clean up
|
||||
free_byte_array(ba);
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
static void send_ric_indication(const uint32_t ric_req_id, srs_ind_data_t* srs_ind_data)
|
||||
{
|
||||
async_event_agent_api(ric_req_id, srs_ind_data);
|
||||
#ifdef RIC_DEBUG
|
||||
printf("[RIC DEBUG INFO] Event for RIC Req ID %u generated\n", ric_req_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void free_aperiodic_subscription(uint32_t ric_req_id)
|
||||
{
|
||||
remove_srs_subs_data(&srs_subs_data, ric_req_id);
|
||||
}
|
||||
|
||||
|
||||
static srs_ind_data_t* fill_fapi_srs_indication(nfapi_nr_srs_indication_t *nfapi_srs_ind)
|
||||
{
|
||||
srs_ind_data_t* srs_ind = calloc(1,sizeof(srs_ind_data_t));
|
||||
assert(srs_ind != NULL && "Memory exhausted");
|
||||
|
||||
srs_ind->hdr = fill_srs_ind_hdr();
|
||||
srs_ind->msg = fill_srs_ind_msg(nfapi_srs_ind);
|
||||
|
||||
return srs_ind;
|
||||
}
|
||||
|
||||
void signal_nfapi_srs_indication(nfapi_nr_srs_indication_t *nfapi_srs_ind)
|
||||
{
|
||||
// Check number of subscriptions:
|
||||
const size_t num_subs = seq_arr_size(&srs_subs_data);
|
||||
for (size_t sub_idx = 0; sub_idx < num_subs; sub_idx++) {
|
||||
const ran_param_data_t data = *(const ran_param_data_t *)seq_arr_at(&srs_subs_data, sub_idx);
|
||||
srs_ind_data_t* srs_ind_data = fill_fapi_srs_indication(nfapi_srs_ind);
|
||||
//Send RIC indication
|
||||
send_ric_indication(data.ric_req_id, srs_ind_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sm_ag_if_ans_t write_subs_srs_sm(void const* src)
|
||||
{
|
||||
assert(src != NULL);
|
||||
wr_srs_sub_data_t* wr_srs = (wr_srs_sub_data_t*)src;
|
||||
assert(wr_srs->srs.ad != NULL && "Cannot be NULL");
|
||||
|
||||
sm_ag_if_ans_t ans = {0};
|
||||
|
||||
const uint32_t ric_req_id = wr_srs->ric_req_id;
|
||||
|
||||
struct ran_param_data data = { .ric_req_id = ric_req_id};
|
||||
init_srs_subs_data(&srs_subs_data);
|
||||
insert_srs_subs_data(&srs_subs_data,&data);
|
||||
|
||||
ans.type = SUBS_OUTCOME_SM_AG_IF_ANS_V0;
|
||||
ans.subs_out.type = APERIODIC_SUBSCRIPTION_FLRC;
|
||||
ans.subs_out.aper.free_aper_subs = free_aperiodic_subscription;
|
||||
|
||||
|
||||
return ans;
|
||||
}
|
||||
35
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs.h
Normal file
35
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 RAN_FUNC_SM_SRS_READ_WRITE_AGENT_H
|
||||
#define RAN_FUNC_SM_SRS_READ_WRITE_AGENT_H
|
||||
|
||||
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
|
||||
|
||||
bool read_srs_sm(void* data);
|
||||
|
||||
void read_srs_setup_sm(void* data);
|
||||
|
||||
sm_ag_if_ans_t write_ctrl_srs_sm(void const* data);
|
||||
|
||||
sm_ag_if_ans_t write_subs_srs_sm(void const* src);
|
||||
|
||||
#endif
|
||||
35
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_extern.h
Normal file
35
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_extern.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 RAN_FUNC_SM_SRS_EXTERN_AGENT_H
|
||||
#define RAN_FUNC_SM_SRS_EXTERN_AGENT_H
|
||||
|
||||
// #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||
#include "openair2/E2AP/flexric/src/util/byte_array.h"
|
||||
|
||||
|
||||
// uint8_t pack_nr_srs_report_tlv(const nfapi_srs_report_tlv_t *report_tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
// uint8_t pack_nr_srs_indication_body(const nfapi_nr_srs_indication_pdu_t *value, uint8_t **ppWritePackedMsg, uint8_t *end);
|
||||
// void signal_nfapi_srs_indication(NR_UL_IND_t *UL_info, nfapi_nr_srs_indication_pdu_t *nfapi_srs_ind);
|
||||
void signal_nfapi_srs_indication(nfapi_nr_srs_indication_t *nfapi_srs_ind);
|
||||
|
||||
#endif
|
||||
56
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_subs.c
Normal file
56
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_subs.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 "ran_func_srs_subs.h"
|
||||
#include "common/utils/assertions.h"
|
||||
#include "common/utils/alg/find.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
// static pthread_mutex_t srs_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static bool eq_int(const void* value, const void* it)
|
||||
{
|
||||
const uint32_t ric_req_id = *(uint32_t *)value;
|
||||
const ran_param_data_t *dit = (const ran_param_data_t *)it;
|
||||
return ric_req_id == dit->ric_req_id;
|
||||
}
|
||||
|
||||
void init_srs_subs_data(seq_arr_t *srs_subs_data)
|
||||
{
|
||||
seq_arr_init(srs_subs_data, sizeof(ran_param_data_t));
|
||||
|
||||
}
|
||||
void insert_srs_subs_data(seq_arr_t *seq_arr, ran_param_data_t *data)
|
||||
{
|
||||
// Insert RIC Req ID
|
||||
seq_arr_push_back(seq_arr, data, sizeof(*data));
|
||||
}
|
||||
void remove_srs_subs_data(seq_arr_t *srs_subs_data, uint32_t ric_req_id){
|
||||
elm_arr_t elm = find_if(srs_subs_data, (void *)&ric_req_id, eq_int);
|
||||
ran_param_data_t *data = elm.it;
|
||||
if (data != NULL) {
|
||||
// free_srs_event_trigger...
|
||||
seq_arr_erase(srs_subs_data, elm.it);
|
||||
}
|
||||
}
|
||||
40
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_subs.h
Normal file
40
openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_subs.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 RAN_FUNC_SM_SRS_SUBSCRIPTION_AGENT_H
|
||||
#define RAN_FUNC_SM_SRS_SUBSCRIPTION_AGENT_H
|
||||
|
||||
#include "openair2/E2AP/flexric/src/sm/srs_sm/ie/srs_data_ie.h"
|
||||
#include "common/utils/ds/seq_arr.h"
|
||||
|
||||
typedef struct ran_param_data {
|
||||
uint32_t ric_req_id;
|
||||
//srs_event_trigger_t ev_tr;
|
||||
} ran_param_data_t;
|
||||
|
||||
|
||||
// seq_arr_t srs_subs_data;
|
||||
|
||||
void init_srs_subs_data(seq_arr_t *srs_subs_data);
|
||||
void insert_srs_subs_data(seq_arr_t *seq_arr, ran_param_data_t *data);
|
||||
void remove_srs_subs_data(seq_arr_t *srs_subs_data, uint32_t ric_req_id);
|
||||
|
||||
#endif
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "O-RAN/ran_func_kpm.h"
|
||||
#include "O-RAN/ran_func_rc.h"
|
||||
#include "CUSTOMIZED/ran_func_srs.h"
|
||||
|
||||
static
|
||||
void init_read_ind_tbl(read_ind_fp (*read_ind_tbl)[SM_AGENT_IF_READ_V0_END])
|
||||
@@ -53,6 +54,7 @@ void init_read_ind_tbl(read_ind_fp (*read_ind_tbl)[SM_AGENT_IF_READ_V0_END])
|
||||
|
||||
(*read_ind_tbl)[KPM_STATS_V3_0] = read_kpm_sm ;
|
||||
(*read_ind_tbl)[RAN_CTRL_STATS_V1_03] = read_rc_sm;
|
||||
(*read_ind_tbl)[SRS_STATS_V0] = read_srs_sm;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -71,6 +73,7 @@ void init_read_setup_tbl(read_e2_setup_fp (*read_setup_tbl)[SM_AGENT_IF_E2_SETUP
|
||||
|
||||
(*read_setup_tbl)[KPM_V3_0_AGENT_IF_E2_SETUP_ANS_V0] = read_kpm_setup_sm ;
|
||||
(*read_setup_tbl)[RAN_CTRL_V1_3_AGENT_IF_E2_SETUP_ANS_V0] = read_rc_setup_sm;
|
||||
(*read_setup_tbl)[SRS_AGENT_IF_E2_SETUP_ANS_V0] = read_srs_setup_sm ;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -88,6 +91,7 @@ void init_write_ctrl( write_ctrl_fp (*write_ctrl_tbl)[SM_AGENT_IF_WRITE_CTRL_V0_
|
||||
#endif
|
||||
|
||||
(*write_ctrl_tbl)[RAN_CONTROL_CTRL_V1_03] = write_ctrl_rc_sm;
|
||||
(*write_ctrl_tbl)[SRS_CTRL_REQ_V0] = write_ctrl_srs_sm;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -106,6 +110,7 @@ void init_write_subs(write_subs_fp (*write_subs_tbl)[SM_AGENT_IF_WRITE_SUBS_V0_E
|
||||
|
||||
(*write_subs_tbl)[KPM_SUBS_V3_0] = NULL;
|
||||
(*write_subs_tbl)[RAN_CTRL_SUBS_V1_03] = write_subs_rc_sm;
|
||||
(*write_subs_tbl)[SRS_SUBS_V0] = write_subs_srs_sm;
|
||||
}
|
||||
|
||||
sm_io_ag_ran_t init_ran_func_ag(void)
|
||||
|
||||
@@ -343,23 +343,13 @@ NR_pdsch_dmrs_t get_dl_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
|
||||
switch (Layers) {
|
||||
case 1:
|
||||
#ifdef ENABLE_AERIAL
|
||||
dmrs.dmrs_ports_id = 3;
|
||||
dmrs.numDmrsCdmGrpsNoData = 2;
|
||||
#else
|
||||
dmrs.dmrs_ports_id = 0;
|
||||
dmrs.numDmrsCdmGrpsNoData = 1;
|
||||
#endif
|
||||
frontloaded_symb = 1;
|
||||
break;
|
||||
case 2:
|
||||
#ifdef ENABLE_AERIAL
|
||||
dmrs.dmrs_ports_id = 7;
|
||||
dmrs.numDmrsCdmGrpsNoData = 2;
|
||||
#else
|
||||
dmrs.dmrs_ports_id = 2;
|
||||
dmrs.numDmrsCdmGrpsNoData = 1;
|
||||
#endif
|
||||
frontloaded_symb = 1;
|
||||
break;
|
||||
case 3:
|
||||
@@ -737,15 +727,10 @@ NR_pusch_dmrs_t get_ul_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
const int Layers)
|
||||
{
|
||||
NR_pusch_dmrs_t dmrs = {0};
|
||||
// TODO setting of cdm groups with no data to be redone for MIMO
|
||||
if(NFAPI_MODE == NFAPI_MODE_AERIAL) {
|
||||
if (ul_bwp->transform_precoding && Layers < 3)
|
||||
dmrs.num_dmrs_cdm_grps_no_data = ul_bwp->dci_format == NR_UL_DCI_FORMAT_0_1 || tda_info->nrOfSymbols <= 2 ? 1 : 2;
|
||||
else
|
||||
dmrs.num_dmrs_cdm_grps_no_data = 2;
|
||||
} else {
|
||||
if (ul_bwp->transform_precoding && Layers < 3)
|
||||
dmrs.num_dmrs_cdm_grps_no_data = ul_bwp->dci_format == NR_UL_DCI_FORMAT_0_1 || tda_info->nrOfSymbols <= 2 ? 1 : 2;
|
||||
else
|
||||
dmrs.num_dmrs_cdm_grps_no_data = 2;
|
||||
}
|
||||
|
||||
const NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = get_DMRS_UplinkConfig(ul_bwp->pusch_Config, tda_info);
|
||||
dmrs.ptrsConfig = NR_DMRS_UplinkConfig
|
||||
@@ -1246,8 +1231,7 @@ void config_uldci(const NR_UE_ServingCell_Info_t *sc_info,
|
||||
|
||||
// antenna_ports.val = 0 for transform precoder is disabled, dmrs-Type=1, maxLength=1, Rank=1/2/3/4
|
||||
// Antenna Ports
|
||||
|
||||
dci_pdu_rel15->antenna_ports.val = NFAPI_MODE == NFAPI_MODE_AERIAL ? 2 : 0;
|
||||
dci_pdu_rel15->antenna_ports.val = 0;
|
||||
|
||||
// DMRS sequence initialization
|
||||
dci_pdu_rel15->dmrs_sequence_initialization.val = pusch_pdu->scid;
|
||||
|
||||
@@ -38,11 +38,40 @@
|
||||
|
||||
//#define SRS_IND_DEBUG
|
||||
|
||||
#ifdef SRS_IND_DEBUG
|
||||
static void dump_srs_channel_iq_matrix(nfapi_nr_srs_normalized_channel_iq_matrix_t* channel_iq_matrix, const char* filename) {
|
||||
FILE* f = fopen(filename, "wb");
|
||||
if (!f) {
|
||||
perror("Failed to open file");
|
||||
return;
|
||||
}
|
||||
uint16_t Ng = channel_iq_matrix->num_gnb_antenna_elements;
|
||||
uint16_t Nu = channel_iq_matrix->num_ue_srs_ports;
|
||||
// uint16_t prg_size = channel_iq_matrix->prg_size;
|
||||
uint16_t num_prgs = channel_iq_matrix->num_prgs;
|
||||
|
||||
// Could be a csv file header
|
||||
//fprintf(f, "Num gNB antennas, Num UE SRS Ports, PRG size, Num of PRG");
|
||||
|
||||
printf("Ng = %u\t ,Nu = %u\t, Np = %u\n", Ng, Nu, num_prgs);
|
||||
|
||||
uint32_t total = Nu * Ng * num_prgs;
|
||||
|
||||
const c16_t *channel = (const c16_t*)channel_iq_matrix->channel_matrix;
|
||||
fwrite(channel, sizeof(c16_t), total, f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* \brief Get the number of UL TDAs that could be used in slot, reachable
|
||||
* via specific k2. The output parameter first_idx is a pointer to the first
|
||||
* suitable TDA, and the function returns the number of suitable TDAs, or 0. */
|
||||
int get_num_ul_tda(gNB_MAC_INST *nrmac, int slot, int k2, const NR_tda_info_t **first_idx)
|
||||
{
|
||||
|
||||
/* we assume that this function is mutex-protected from outside */
|
||||
NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock);
|
||||
|
||||
@@ -1592,6 +1621,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
sizeof(nfapi_nr_srs_normalized_channel_iq_matrix_t));
|
||||
|
||||
#ifdef SRS_IND_DEBUG
|
||||
dump_srs_channel_iq_matrix(&nr_srs_channel_iq_matrix, "mac_channel_rfsim.iq");
|
||||
LOG_I(NR_MAC, "nr_srs_channel_iq_matrix.normalized_iq_representation = %i\n", nr_srs_channel_iq_matrix.normalized_iq_representation);
|
||||
LOG_I(NR_MAC, "nr_srs_channel_iq_matrix.num_gnb_antenna_elements = %i\n", nr_srs_channel_iq_matrix.num_gnb_antenna_elements);
|
||||
LOG_I(NR_MAC, "nr_srs_channel_iq_matrix.num_ue_srs_ports = %i\n", nr_srs_channel_iq_matrix.num_ue_srs_ports);
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
#include "utils.h"
|
||||
#include "nfapi/oai_integration/nfapi_pnf.h"
|
||||
|
||||
#ifdef E2_AGENT
|
||||
#include "openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_srs_extern.h"
|
||||
#endif
|
||||
|
||||
#define MAX_IF_MODULES 100
|
||||
|
||||
static NR_IF_Module_t *nr_if_inst[MAX_IF_MODULES];
|
||||
@@ -209,6 +213,22 @@ static void handle_nr_ulsch(NR_UL_IND_t *UL_info)
|
||||
}
|
||||
}
|
||||
|
||||
// static void dump_srs_report(const nfapi_srs_report_tlv_t* report_tlv, const char* filename) {
|
||||
// FILE* f = fopen(filename, "w");
|
||||
// if (!f) {
|
||||
// perror("Failed to open file");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// for (size_t i = 0; i < 16384; ++i) {
|
||||
// fprintf(f, "%zu,%u\n", i, report_tlv->value[i]);
|
||||
// }
|
||||
|
||||
// fclose(f);
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
static void handle_nr_srs(NR_UL_IND_t *UL_info)
|
||||
{
|
||||
if(NFAPI_MODE == NFAPI_MODE_PNF) {
|
||||
@@ -228,14 +248,20 @@ static void handle_nr_srs(NR_UL_IND_t *UL_info)
|
||||
nfapi_nr_srs_indication_pdu_t *srs_list = UL_info->srs_ind.pdu_list;
|
||||
|
||||
// from here
|
||||
|
||||
for (int i = 0; i < num_srs; i++) {
|
||||
nfapi_nr_srs_indication_pdu_t *srs_ind = &srs_list[i];
|
||||
LOG_D(NR_PHY, "(%d.%d) UL_info->srs_ind.pdu_list[%d].rnti: 0x%04x\n", frame, slot, i, srs_ind->rnti);
|
||||
LOG_I(NR_PHY, "(%d.%d) UL_info->srs_ind.pdu_list[%d].rnti: 0x%04x\n", frame, slot, i, srs_ind->rnti);
|
||||
handle_nr_srs_measurements(module_id,
|
||||
frame,
|
||||
slot,
|
||||
srs_ind);
|
||||
#ifdef E2_AGENT
|
||||
printf("[RIC DEBUG INFO] Sent pointer = %p\n",(void*)&UL_info->srs_ind);
|
||||
signal_nfapi_srs_indication(&UL_info->srs_ind);
|
||||
#endif
|
||||
// if (num_srs>0 && i==0){
|
||||
// dump_srs_report(&srs_ind->report_tlv, "tlv_value_agent.csv");
|
||||
// }
|
||||
}
|
||||
|
||||
UL_info->srs_ind.number_of_pdus = 0;
|
||||
|
||||
Reference in New Issue
Block a user