Commit 8d25885c authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/qoe-e2' into telnet-o1

parents 5ba0f11e 53d5c9fa
...@@ -56,7 +56,7 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -56,7 +56,7 @@ int get_single_rnti(char *buf, int debug, telnet_printfunc_t prnt)
return 0; return 0;
} }
//void rrc_gNB_trigger_new_bearer(int rnti); void rrc_gNB_trigger_new_bearer(int rnti);
int add_bearer(char *buf, int debug, telnet_printfunc_t prnt) int add_bearer(char *buf, int debug, telnet_printfunc_t prnt)
{ {
int rnti = -1; int rnti = -1;
...@@ -75,13 +75,12 @@ int add_bearer(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -75,13 +75,12 @@ int add_bearer(char *buf, int debug, telnet_printfunc_t prnt)
if (!rrcue) if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti); ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
AssertFatal(false, "not implemented\n"); rrc_gNB_trigger_new_bearer(rnti);
//rrc_gNB_trigger_new_bearer(rnti);
prnt("called rrc_gNB_trigger_new_bearer(%04x)\n", rnti); prnt("called rrc_gNB_trigger_new_bearer(%04x)\n", rnti);
return 0; return 0;
} }
//void rrc_gNB_trigger_release_bearer(int rnti); void rrc_gNB_trigger_release_bearer(int rnti);
int release_bearer(char *buf, int debug, telnet_printfunc_t prnt) int release_bearer(char *buf, int debug, telnet_printfunc_t prnt)
{ {
int rnti = -1; int rnti = -1;
...@@ -100,8 +99,7 @@ int release_bearer(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -100,8 +99,7 @@ int release_bearer(char *buf, int debug, telnet_printfunc_t prnt)
if (!rrcue) if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti); ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
AssertFatal(false, "not implemented\n"); rrc_gNB_trigger_release_bearer(rnti);
//rrc_gNB_trigger_release_bearer(rnti);
prnt("called rrc_gNB_trigger_release_bearer(%04x)\n", rnti); prnt("called rrc_gNB_trigger_release_bearer(%04x)\n", rnti);
return 0; return 0;
} }
......
Active_gNBs = ( "gNB-CU-in-docker");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
Num_Threads_PUSCH = 8;
gNBs =
(
{
////////// Identification parameters:
gNB_ID = 0xc00;
# cell_type = "CELL_MACRO_GNB";
gNB_name = "gNB-CU-in-docker";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1 }) });
nr_cellid = 1L;
tr_s_preference = "f1";
local_s_if_name = "eth0";
local_s_address = "16.1.1.3";
remote_s_address = "16.1.1.2";
local_s_portc = 501;
local_s_portd = 2154;
remote_s_portc = 500;
remote_s_portd = 2153;
#min_rxtxtime = 6;
enable_sdap = 1;
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// AMF parameters:
amf_ip_address = ( { ipv4 = "192.168.70.132";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
GNB_INTERFACE_NAME_FOR_NG_AMF = "enp3s0";
GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129";
GNB_INTERFACE_NAME_FOR_NGU = "enp3s0";
GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129";
GNB_PORT_FOR_S1U = 2152; # Spec 2152
};
}
);
e2_agent = {
#near_ric_ip_addr = "16.1.1.3";
#near_ric_ip_addr = "10.104.66.177";
near_ric_ip_addr = "16.1.1.3";
sm_dir = "/usr/local/lib/flexric/"
}
security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
# valid values: nia0, nia1, nia2, nia3
integrity_algorithms = ( "nia2", "nia0" );
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="debug";
f1ap_log_level ="info";
};
Active_gNBs = ( "gNB");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
sa=1;
gNBs =
(
{
////////// Identification parameters:
gNB_ID = 0xd00;
gNB_DU_ID = 0xd01;
# cell_type = "CELL_MACRO_GNB";
gNB_name = "gNB";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1 }) });
nr_cellid = 1L;
////////// Physical parameters:
#min_rxtxtime = 6;
force_256qam_off = 0;
do_CSIRS = 0;
do_SRS = 0;
pdcch_ConfigSIB1 = (
{
controlResourceSetZero = 12;
searchSpaceZero = 0;
}
);
servingCellConfigCommon = (
{
#spCellConfigCommon
physCellId = 0;
# downlinkConfigCommon
#frequencyInfoDL
# this is 3300.30 MHz + (19 PRBs + 10 SCs)@30kHz SCS (GSCN: 7715)
absoluteFrequencySSB = 641280; #620736;
dl_frequencyBand = 78;
# this is 3300.30 MHz
dl_absoluteFrequencyPointA = 640596; #620052;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_subcarrierSpacing = 1;
dl_carrierBandwidth = 51;
#initialDownlinkBWP
#genericParameters
# this is RBstart=27,L=48 (275*(L-1))+RBstart
initialDLBWPlocationAndBandwidth = 13750;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
initialDLBWPcontrolResourceSetZero = 12;
initialDLBWPsearchSpaceZero = 0;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 78;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_subcarrierSpacing = 1;
ul_carrierBandwidth = 51;
pMax = 20;
#initialUplinkBWP
#genericParameters
initialULBWPlocationAndBandwidth = 13750;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
#rach-ConfigCommon
#rach-ConfigGeneric
prach_ConfigurationIndex = 98;
#prach_msg1_FDM
#0 = one, 1=two, 2=four, 3=eight
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 0;
zeroCorrelationZoneConfig = 13;
preambleReceivedTargetPower = -96;
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
preambleTransMax = 6;
#powerRampingStep
# 0=dB0,1=dB2,2=dB4,3=dB6
powerRampingStep = 1;
#ra_ReponseWindow
#1,2,4,8,10,20,40,80
ra_ResponseWindow = 4;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
#oneHalf (0..15) 4,8,12,16,...60,64
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14;
#ra_ContentionResolutionTimer
#(0..7) 8,16,24,32,40,48,56,64
ra_ContentionResolutionTimer = 7;
rsrp_ThresholdSSB = 19;
#prach-RootSequenceIndex_PR
#1 = 839, 2 = 139
prach_RootSequenceIndex_PR = 2;
prach_RootSequenceIndex = 1;
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
#
msg1_SubcarrierSpacing = 1,
# restrictedSetConfig
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
# pucch-ConfigCommon setup :
# pucchGroupHopping
# 0 = neither, 1= group hopping, 2=sequence hopping
pucchGroupHopping = 0;
hoppingId = 40;
p0_nominal = -90;
# ssb_PositionsInBurs_BitmapPR
# 1=short, 2=medium, 3=long
ssb_PositionsInBurst_PR = 2;
ssb_PositionsInBurst_Bitmap = 1;
# ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
ssb_periodicityServingCell = 2;
# dmrs_TypeA_position
# 0 = pos2, 1 = pos3
dmrs_TypeA_Position = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
subcarrierSpacing = 1;
#tdd-UL-DL-ConfigurationCommon
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
referenceSubcarrierSpacing = 1;
# pattern1
# dl_UL_TransmissionPeriodicity
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
dl_UL_TransmissionPeriodicity = 6;
nrofDownlinkSlots = 7;
nrofDownlinkSymbols = 6;
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
ssPBCH_BlockPower = -25;
}
);
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
}
);
MACRLCs = (
{
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "f1";
local_n_if_name = "eth0";
local_n_address = "16.1.1.2";
#local_n_address = "172.23.100.26";
remote_n_address = "16.1.1.3";
#remote_n_address = "172.23.100.27";
local_n_portc = 500;
local_n_portd = 2153;
remote_n_portc = 501;
remote_n_portd = 2154;
pusch_TargetSNRx10 = 230; # 200; after test in lab
pucch_TargetSNRx10 = 200;
ulsch_max_frame_inactivity = 1;
ul_max_mcs = 16;
min_grant_prb = 20;
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 120;
pucch0_dtx_threshold = 100;
ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
max_ldpc_iterations = 10;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 6; # 8; after test in lab
att_rx = 6; # 8; after test in lab
bands = [78];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
clock_src = "internal";
}
);
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
e2_agent = {
#near_ric_ip_addr = "16.1.1.3"
#near_ric_ip_addr = "10.104.66.177"
near_ric_ip_addr = "16.1.1.3";
sm_dir = "/usr/local/lib/flexric/"
};
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="info";
f1ap_log_level ="info";
};
Active_gNBs = ( "gNB-DU-in-docker");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
sa=1;
gNBs =
(
{
////////// Identification parameters:
gNB_ID = 0xd00;
gNB_DU_ID = 0xd01;
# cell_type = "CELL_MACRO_GNB";
gNB_name = "gNB-DU-in-docker";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1 }) });
nr_cellid = 1L;
////////// Physical parameters:
#min_rxtxtime = 6;
force_256qam_off = 0;
do_CSIRS = 0;
do_SRS = 0;
pdcch_ConfigSIB1 = (
{
controlResourceSetZero = 12;
searchSpaceZero = 0;
}
);
servingCellConfigCommon = (
{
#spCellConfigCommon
physCellId = 0;
# downlinkConfigCommon
#frequencyInfoDL
# this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
absoluteFrequencySSB = 641280;
dl_frequencyBand = 78;
# this is 3600 MHz
dl_absoluteFrequencyPointA = 640008;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_subcarrierSpacing = 1;
dl_carrierBandwidth = 106;
#initialDownlinkBWP
#genericParameters
# this is RBstart=27,L=48 (275*(L-1))+RBstart
initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
initialDLBWPcontrolResourceSetZero = 12;
initialDLBWPsearchSpaceZero = 0;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 78;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_subcarrierSpacing = 1;
ul_carrierBandwidth = 106;
pMax = 20;
#initialUplinkBWP
#genericParameters
initialULBWPlocationAndBandwidth = 28875;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
#rach-ConfigCommon
#rach-ConfigGeneric
prach_ConfigurationIndex = 98;
#prach_msg1_FDM
#0 = one, 1=two, 2=four, 3=eight
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 0;
zeroCorrelationZoneConfig = 13;
preambleReceivedTargetPower = -96;
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
preambleTransMax = 6;
#powerRampingStep
# 0=dB0,1=dB2,2=dB4,3=dB6
powerRampingStep = 1;
#ra_ReponseWindow
#1,2,4,8,10,20,40,80
ra_ResponseWindow = 4;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
#oneHalf (0..15) 4,8,12,16,...60,64
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14;
#ra_ContentionResolutionTimer
#(0..7) 8,16,24,32,40,48,56,64
ra_ContentionResolutionTimer = 7;
rsrp_ThresholdSSB = 19;
#prach-RootSequenceIndex_PR
#1 = 839, 2 = 139
prach_RootSequenceIndex_PR = 2;
prach_RootSequenceIndex = 1;
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
#
msg1_SubcarrierSpacing = 1,
# restrictedSetConfig
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
# pucch-ConfigCommon setup :
# pucchGroupHopping
# 0 = neither, 1= group hopping, 2=sequence hopping
pucchGroupHopping = 0;
hoppingId = 40;
p0_nominal = -90;
# ssb_PositionsInBurs_BitmapPR
# 1=short, 2=medium, 3=long
ssb_PositionsInBurst_PR = 2;
ssb_PositionsInBurst_Bitmap = 1;
# ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
ssb_periodicityServingCell = 2;
# dmrs_TypeA_position
# 0 = pos2, 1 = pos3
dmrs_TypeA_Position = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
subcarrierSpacing = 1;
#tdd-UL-DL-ConfigurationCommon
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
referenceSubcarrierSpacing = 1;
# pattern1
# dl_UL_TransmissionPeriodicity
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
dl_UL_TransmissionPeriodicity = 6;
nrofDownlinkSlots = 7;
nrofDownlinkSymbols = 6;
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
ssPBCH_BlockPower = -25;
}
);
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
}
);
MACRLCs = (
{
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "f1";
local_n_if_name = "eth0";
local_n_address = "16.1.1.2";
#local_n_address = "172.23.100.26";
remote_n_address = "16.1.1.3";
#remote_n_address = "172.23.100.27";
local_n_portc = 500;
local_n_portd = 2153;
remote_n_portc = 501;
remote_n_portd = 2154;
pusch_TargetSNRx10 = 230; # 200; after test in lab
pucch_TargetSNRx10 = 200;
ulsch_max_frame_inactivity = 1;
ul_max_mcs = 16;
min_grant_prb = 20;
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 120;
pucch0_dtx_threshold = 100;
ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
max_ldpc_iterations = 10;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 6; # 8; after test in lab
att_rx = 6; # 8; after test in lab
bands = [78];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
clock_src = "internal";
}
);
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
e2_agent = {
#near_ric_ip_addr = "16.1.1.3"
#near_ric_ip_addr = "10.104.66.177"
near_ric_ip_addr = "16.1.1.3";
sm_dir = "/usr/local/lib/flexric/"
};
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="info";
f1ap_log_level ="info";
};
Active_gNBs = ( "gNB-DU-in-docker"); Active_gNBs = ( "du");
# Asn1_verbosity, choice in: none, info, annoying # Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none"; Asn1_verbosity = "none";
...@@ -10,7 +10,7 @@ gNBs = ...@@ -10,7 +10,7 @@ gNBs =
# cell_type = "CELL_MACRO_GNB"; # cell_type = "CELL_MACRO_GNB";
gNB_name = "gNB-DU-in-docker"; gNB_name = "du";
// Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1; tracking_area_code = 1;
...@@ -250,4 +250,8 @@ log_config : ...@@ -250,4 +250,8 @@ log_config :
rrc_log_level ="info"; rrc_log_level ="info";
ngap_log_level ="info"; ngap_log_level ="info";
f1ap_log_level ="info"; f1ap_log_level ="info";
<<<<<<< HEAD
=======
gtp_log_level ="debug";
>>>>>>> origin/qoe-e2
}; };
...@@ -214,22 +214,43 @@ sm_ag_if_ans_t write_subs_rc_sm(void const* src) ...@@ -214,22 +214,43 @@ sm_ag_if_ans_t write_subs_rc_sm(void const* src)
return ans; return ans;
} }
void rrc_gNB_trigger_new_bearer(int rnti);
void rrc_gNB_trigger_release_bearer(int rnti);
sm_ag_if_ans_t write_ctrl_rc_sm(void const* data) sm_ag_if_ans_t write_ctrl_rc_sm(void const* data)
{ {
assert(data != NULL); assert(data != NULL);
// assert(data->type == RAN_CONTROL_CTRL_V1_03 ); // assert(data->type == RAN_CONTROL_CTRL_V1_03 );
rc_ctrl_req_data_t const* ctrl = (rc_ctrl_req_data_t const*)data; rc_ctrl_req_data_t const* ctrl = (rc_ctrl_req_data_t const*)data;
if(ctrl->hdr.format == FORMAT_1_E2SM_RC_CTRL_HDR){ if(ctrl->hdr.format == FORMAT_1_E2SM_RC_CTRL_HDR){
if(ctrl->hdr.frmt_1.ric_style_type == 1 && ctrl->hdr.frmt_1.ctrl_act_id == 2){ if(ctrl->hdr.frmt_1.ric_style_type == 1 && ctrl->hdr.frmt_1.ctrl_act_id == 2){
printf("QoS flow mapping configuration \n");
//mir
//int const rnti = get_single_ue_rnti();
int const rnti = -1;
printf("QoS flow mapping configuration with rnti %d \n", rnti);
e2sm_rc_ctrl_msg_frmt_1_t const* frmt_1 = &ctrl->msg.frmt_1; e2sm_rc_ctrl_msg_frmt_1_t const* frmt_1 = &ctrl->msg.frmt_1;
printf("int_ran %ld \n", frmt_1->ran_param[0].ran_param_val.flag_true->int_ran);
for(size_t i = 0; i < frmt_1->sz_ran_param; ++i){ for(size_t i = 0; i < frmt_1->sz_ran_param; ++i){
seq_ran_param_t const* rp = frmt_1->ran_param; seq_ran_param_t const* rp = frmt_1->ran_param;
if(rp[i].ran_param_id == 1){ if(rp[i].ran_param_id == 1){
assert(rp[i].ran_param_val.type == ELEMENT_KEY_FLAG_TRUE_RAN_PARAMETER_VAL_TYPE ); assert(rp[i].ran_param_val.type == ELEMENT_KEY_FLAG_TRUE_RAN_PARAMETER_VAL_TYPE );
printf("DRB ID %ld \n", rp[i].ran_param_val.flag_true->int_ran); printf("DRB ID %ld \n", rp[i].ran_param_val.flag_true->int_ran);
if(rp[i].ran_param_val.flag_true->int_ran == 5){
printf("[O-RAN RC]: Creating a new bearer\n");
fflush(stdout);
rrc_gNB_trigger_new_bearer(rnti);
} else if(rp[i].ran_param_val.flag_true->int_ran == 4){
printf("[O-RAN RC]: Releasing bearer\n");
fflush(stdout);
rrc_gNB_trigger_release_bearer(rnti);
} else{
assert(0!=0 && "Unknown int_ran");
}
} else if(rp[i].ran_param_id == 2){ } else if(rp[i].ran_param_id == 2){
assert(rp[i].ran_param_val.type == LIST_RAN_PARAMETER_VAL_TYPE); assert(rp[i].ran_param_val.type == LIST_RAN_PARAMETER_VAL_TYPE);
printf("List of QoS Flows to be modified \n"); printf("List of QoS Flows to be modified \n");
......
flexric @ e4a676b5
Subproject commit 29af8408afad3da36824bd7912562202023ae924 Subproject commit e4a676b58b1dd4dfb4809ad2d38a0a6bb8a3d139
...@@ -212,6 +212,8 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(sctp_assoc_t assoc_id, const f1ap_in ...@@ -212,6 +212,8 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(sctp_assoc_t assoc_id, const f1ap_in
} }
f1ap_itti_send_sctp_data_req(assoc_id, buffer, len); f1ap_itti_send_sctp_data_req(assoc_id, buffer, len);
free(msg->rrc_container);
free(tmp);
return 0; return 0;
} }
......
...@@ -370,10 +370,12 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo ...@@ -370,10 +370,12 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
if (rlc_bearer2release_list) { if (rlc_bearer2release_list) {
for (int i = 0; i < rlc_bearer2release_list->list.count; i++) { for (int i = 0; i < rlc_bearer2release_list->list.count; i++) {
for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) {
if (sched_ctrl->dl_lc_ids[idx] == *rlc_bearer2release_list->list.array[i]) { const int lcid = *rlc_bearer2release_list->list.array[i];
if (sched_ctrl->dl_lc_ids[idx] == lcid) {
const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1; const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1;
memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs); memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs);
sched_ctrl->dl_lc_num--; sched_ctrl->dl_lc_num--;
LOG_I(NR_MAC, "remove LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
break; break;
} }
} }
...@@ -383,7 +385,7 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo ...@@ -383,7 +385,7 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
if (rlc_bearer2add_list) { if (rlc_bearer2add_list) {
// keep lcids // keep lcids
for (int i = 0; i < rlc_bearer2add_list->list.count; i++) { for (int i = 0; i < rlc_bearer2add_list->list.count; i++) {
const int lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity; const uint8_t lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity;
bool found = false; bool found = false;
for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) {
if (sched_ctrl->dl_lc_ids[idx] == lcid) { if (sched_ctrl->dl_lc_ids[idx] == lcid) {
...@@ -393,9 +395,19 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo ...@@ -393,9 +395,19 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
} }
if (!found) { if (!found) {
/* we assume that the first two are SRB bearers, and we add before
* other DRB */
uint8_t i = 0;
/* go beyond all SRBs */
while (i < sched_ctrl->dl_lc_num && sched_ctrl->dl_lc_ids[i] < 4)
i++;
uint8_t remaining_lcs = sched_ctrl->dl_lc_num - i;
memmove(&sched_ctrl->dl_lc_ids[i + 1], &sched_ctrl->dl_lc_ids[i], sizeof(sched_ctrl->dl_lc_ids[i]) * remaining_lcs);
sched_ctrl->dl_lc_ids[i] = lcid;
sched_ctrl->dl_lc_num++; sched_ctrl->dl_lc_num++;
sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid;
LOG_D(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid); LOG_I(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
} }
} }
} }
......
...@@ -330,7 +330,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram ...@@ -330,7 +330,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram
const int lcid = sched_ctrl->dl_lc_ids[i]; const int lcid = sched_ctrl->dl_lc_ids[i];
const uint16_t rnti = UE->rnti; const uint16_t rnti = UE->rnti;
LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid); LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid);
if (lcid == DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) { if (lcid >= DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) {
continue; continue;
} }
start_meas(&RC.nrmac[module_id]->rlc_status_ind); start_meas(&RC.nrmac[module_id]->rlc_status_ind);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "openair2/E1AP/e1ap_common.h" #include "openair2/E1AP/e1ap_common.h"
#include "openair2/F1AP/f1ap_common.h" #include "openair2/F1AP/f1ap_common.h"
static void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const pdu_session_to_setup_t *pdu) void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const pdu_session_to_setup_t *pdu)
{ {
for (int i=0; i < pdu->numDRB2Setup; i++) { for (int i=0; i < pdu->numDRB2Setup; i++) {
const DRB_nGRAN_to_setup_t *drb = pdu->DRBnGRanList + i; const DRB_nGRAN_to_setup_t *drb = pdu->DRBnGRanList + i;
...@@ -90,7 +90,7 @@ static void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const ...@@ -90,7 +90,7 @@ static void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const
} }
} }
static int drb_gtpu_create(instance_t instance, int drb_gtpu_create(instance_t instance,
uint32_t ue_id, uint32_t ue_id,
int incoming_id, int incoming_id,
int outgoing_id, int outgoing_id,
...@@ -124,7 +124,7 @@ static instance_t get_n3_gtp_instance(void) ...@@ -124,7 +124,7 @@ static instance_t get_n3_gtp_instance(void)
return inst->gtpInstN3; return inst->gtpInstN3;
} }
static instance_t get_f1_gtp_instance(void) instance_t get_f1_gtp_instance(void)
{ {
const f1ap_cudu_inst_t *inst = getCxt(0); const f1ap_cudu_inst_t *inst = getCxt(0);
if (!inst) if (!inst)
......
...@@ -1194,6 +1194,12 @@ void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id) ...@@ -1194,6 +1194,12 @@ void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id)
drb->delete_entity(drb); drb->delete_entity(drb);
ue->drb[drb_id - 1] = NULL; ue->drb[drb_id - 1] = NULL;
LOG_I(PDCP, "release DRB %d of UE %ld\n", drb_id, ue_id); LOG_I(PDCP, "release DRB %d of UE %ld\n", drb_id, ue_id);
int sessionId = 1;
nr_sdap_entity_t *sdap = nr_sdap_get_entity(ue_id, sessionId); /* default */
if (sdap == NULL)
LOG_E(PDCP, "no SDAP entity for UE %ld PDU session ID %d\n", ue_id, sessionId);
else
sdap->has_second_bearer = 0;
} }
else else
LOG_E(PDCP, "Attempting to release DRB%d but it is not configured\n", drb_id); LOG_E(PDCP, "Attempting to release DRB%d but it is not configured\n", drb_id);
......
...@@ -1765,7 +1765,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, ...@@ -1765,7 +1765,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity,
/* log SDUs rejected, at most once per second */ /* log SDUs rejected, at most once per second */
if (entity->sdu_rejected != 0 if (entity->sdu_rejected != 0
&& entity->t_current > entity->t_log_buffer_full + 1000) { && entity->t_current > entity->t_log_buffer_full + 1000) {
LOG_E(RLC, "%s:%d:%s: warning: %d SDU rejected, SDU buffer full\n", LOG_W(RLC, "%s:%d:%s: warning: %d SDU rejected, SDU buffer full\n",
__FILE__, __LINE__, __FUNCTION__, __FILE__, __LINE__, __FUNCTION__,
entity->sdu_rejected); entity->sdu_rejected);
entity->sdu_rejected = 0; entity->sdu_rejected = 0;
......
...@@ -78,14 +78,15 @@ static int generate_tx_pdu(nr_rlc_entity_tm_t *entity, char *buffer, int size) ...@@ -78,14 +78,15 @@ static int generate_tx_pdu(nr_rlc_entity_tm_t *entity, char *buffer, int size)
entity->tx_size -= sdu->size; entity->tx_size -= sdu->size;
entity->common.stats.txpdu_pkts++; entity->common.stats.txpdu_pkts++;
entity->common.stats.txpdu_bytes += size; entity->common.stats.txpdu_bytes += size;
/*
/* No need to 'zero' time-of-arrival; if (sdu->sdu->time_of_arrival) {
Segmented packets do need to be duplicated in time-sensitive use cases */
if (entity->common.avg_time_is_on) {
uint64_t time_now = time_average_now(); uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival; uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
// set time_of_arrival to 0 so as to update stats only once
sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time); time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
} }
*/
/* update buffer status */ /* update buffer status */
entity->common.bstatus.tx_size -= sdu->size; entity->common.bstatus.tx_size -= sdu->size;
......
...@@ -521,13 +521,15 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size) ...@@ -521,13 +521,15 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
entity->common.stats.txpdu_pkts++; entity->common.stats.txpdu_pkts++;
entity->common.stats.txpdu_bytes += size; entity->common.stats.txpdu_bytes += size;
/* No need to 'zero' time-of-arrival; /*
Segmented packets do need to be duplicated in time-sensitive use cases */ if (sdu->sdu->time_of_arrival) {
if (entity->common.avg_time_is_on) {
uint64_t time_now = time_average_now(); uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival; uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
// set time_of_arrival to 0 so as to update stats only once
sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time); time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
} }
*/
nr_rlc_free_sdu_segment(sdu); nr_rlc_free_sdu_segment(sdu);
......
...@@ -2617,6 +2617,255 @@ rrc_gNB_generate_RRCRelease( ...@@ -2617,6 +2617,255 @@ rrc_gNB_generate_RRCRelease(
/* UE will be freed after UE context release complete */ /* UE will be freed after UE context release complete */
} }
static pdu_session_to_setup_t fill_pdu_session(const rrc_pdu_session_param_t *session, const drb_t *rrc_drb)
{
pdu_session_to_setup_t pdu = {0};
pdu.sessionId = session->param.pdusession_id;
pdu.numDRB2Setup = 1;
DRB_nGRAN_to_setup_t *drb = &pdu.DRBnGRanList[0];
drb->id = rrc_drb->drb_id;
const struct sdap_config_s *sdap_config = &rrc_drb->cnAssociation.sdap_config;
drb->defaultDRB = sdap_config->defaultDRB ? E1AP_DefaultDRB_true : E1AP_DefaultDRB_false;
drb->sDAP_Header_UL = sdap_config->sdap_HeaderUL;
drb->sDAP_Header_DL = sdap_config->sdap_HeaderDL;
drb->numQosFlow2Setup = 1;
const struct pdcp_config_s *pdcp_config = &rrc_drb->pdcp_config;
drb->pDCP_SN_Size_UL = pdcp_config->pdcp_SN_SizeUL;
drb->pDCP_SN_Size_DL = pdcp_config->pdcp_SN_SizeDL;
drb->discardTimer = pdcp_config->discardTimer;
drb->reorderingTimer = pdcp_config->t_Reordering;
drb->rLC_Mode = E1AP_RLC_Mode_rlc_am; //rrc->configuration.um_on_default_drb ? E1AP_RLC_Mode_rlc_um_bidirectional : E1AP_RLC_Mode_rlc_am;
drb->numCellGroups = 1; // assume one cell group associated with a DRB
for (int k=0; k < drb->numCellGroups; k++) {
cell_group_t *cellGroup = drb->cellGroupList + k;
cellGroup->id = 0; // MCG
}
drb->numQosFlow2Setup = session->param.nb_qos;
for (int k=0; k < drb->numQosFlow2Setup; k++) {
qos_flow_to_setup_t *qos_flow = drb->qosFlows + k;
const pdusession_level_qos_parameter_t *qos_session = session->param.qos + k;
qos_characteristics_t *qos_char = &qos_flow->qos_params.qos_characteristics;
qos_flow->qfi = qos_session->qfi;
qos_char->qos_type = qos_session->fiveQI_type;
if (qos_char->qos_type == dynamic) {
qos_char->dynamic.fiveqi = qos_session->fiveQI;
qos_char->dynamic.qos_priority_level = qos_session->qos_priority;
} else {
qos_char->non_dynamic.fiveqi = qos_session->fiveQI;
qos_char->non_dynamic.qos_priority_level = qos_session->qos_priority;
}
ngran_allocation_retention_priority_t *rent_priority = &qos_flow->qos_params.alloc_reten_priority;
const ngap_allocation_retention_priority_t *rent_priority_in = &qos_session->allocation_retention_priority;
rent_priority->priority_level = rent_priority_in->priority_level;
rent_priority->preemption_capability = rent_priority_in->pre_emp_capability;
rent_priority->preemption_vulnerability = rent_priority_in->pre_emp_vulnerability;
}
return pdu;
}
static int get_single_ue_rnti(void)
{
rrc_gNB_ue_context_t *ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[0]->rrc_ue_head)) {
return ue_context_p->ue_context.rnti;
}
return -1;
}
extern instance_t get_f1_gtp_instance(void);
void rrc_gNB_trigger_new_bearer(int rnti)
{
/* get RRC and UE */
gNB_RRC_INST *rrc = RC.nrrrc[0];
if (rnti < 0)
rnti = get_single_ue_rnti();
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti);
if (ue_context_p == NULL) {
LOG_E(RRC, "unknown UE RNTI %04x\n", rnti);
return;
}
gNB_RRC_UE_t *ue = &ue_context_p->ue_context;
/* get the existing PDU sessoin */
if (ue->nb_of_pdusessions < 1) {
LOG_E(RRC, "no PDU session set up yet, cannot create additional bearer\n");
return;
}
const rrc_pdu_session_param_t *session = &ue->pduSession[0];
DevAssert(session->param.nb_qos == 1);
if (ue->established_drbs[0].status != DRB_INACTIVE
&& ue->established_drbs[1].status != DRB_INACTIVE) {
LOG_E(RRC, "already have two established bearers, aborting\n");
return;
}
int drb_id = 2;
drb_t *rrc_drb = generateDRB(ue,
drb_id,
session,
rrc->configuration.enable_sdap,
rrc->security.do_drb_integrity,
rrc->security.do_drb_ciphering);
/* the only thing E1 can do as of now, is to generate new PDU sessions. This
* includes SDAP, and GTP/NG-U, but we don't want that. therefore, use PDCP
* and GTP/F1-U directly below */
/* generate dummy PDU session, from which we generate DRB info, used to
* initialize PDCP */
pdu_session_to_setup_t pdu = fill_pdu_session(session, rrc_drb);
pdu.integrityProtectionIndication = rrc->security.do_drb_integrity ? E1AP_IntegrityProtectionIndication_required : E1AP_IntegrityProtectionIndication_not_needed;
pdu.confidentialityProtectionIndication = rrc->security.do_drb_ciphering ? E1AP_ConfidentialityProtectionIndication_required : E1AP_ConfidentialityProtectionIndication_not_needed;
NR_DRB_ToAddModList_t DRB_configList = {0};
extern void fill_DRB_configList_e1(NR_DRB_ToAddModList_t *DRB_configList, const pdu_session_to_setup_t *pdu);
fill_DRB_configList_e1(&DRB_configList, &pdu);
uint8_t enc_key[16];
nr_derive_key(UP_ENC_ALG, ue->ciphering_algorithm, ue->kgnb, enc_key);
uint8_t int_key[16];
nr_derive_key(UP_INT_ALG, ue->integrity_algorithm, ue->kgnb, int_key);
nr_pdcp_add_drbs(true, // set this to notify PDCP that his not UE
ue->rrc_ue_id,
&DRB_configList,
(ue->integrity_algorithm << 4) | ue->ciphering_algorithm,
enc_key,
int_key);
/* initialize F1 GTP, if necessary */
instance_t f1inst = get_f1_gtp_instance();
uint8_t tlAddress[4] = {0};
long teid = 0;
if (f1inst >= 0) { /* we have F1(-U) */
teid_t dummy_teid = 0xffff; // we will update later with answer from DU
in_addr_t dummy_address = {0}; // IPv4, updated later with answer from DU
gtpv1u_gnb_create_tunnel_resp_t resp_f1 = {0};
int qfi = -1; // don't put PDU session marker in GTP
extern int drb_gtpu_create(instance_t instance, uint32_t ue_id, int incoming_id, int outgoing_id,
int qfi, in_addr_t tlAddress, teid_t outgoing_teid,
gtpCallback callBack, gtpCallbackSDAP callBackSDAP, gtpv1u_gnb_create_tunnel_resp_t *create_tunnel_resp);
int ret = drb_gtpu_create(f1inst,
ue->rrc_ue_id,
rrc_drb->drb_id,
rrc_drb->drb_id,
qfi,
dummy_address,
dummy_teid,
cu_f1u_data_req,
NULL,
&resp_f1);
AssertFatal(ret >= 0, "Unable to create GTP Tunnel for F1-U\n");
memcpy(tlAddress, &resp_f1.gnb_addr.buffer, 4);
teid = resp_f1.gnb_NGu_teid[0];
}
int xid = rrc_gNB_get_next_transaction_identifier(0);
/* associate the new bearer to it */
ue->xids[xid] = RRC_DEDICATED_RECONF;
ue->pduSession[0].xid = xid; // hack: fake xid for ongoing PDU session
LOG_W(RRC, "trigger new bearer %d for UE %04x xid %d\n", rrc_drb->drb_id, ue->rnti, xid);
/* as noted above, cannot go via E1, but reuse E1 setup response handler to
* set up the DRB via F1 (and then the reconfiguration) */
e1ap_bearer_setup_resp_t resp = {
.gNB_cu_cp_ue_id = ue->rrc_ue_id,
.gNB_cu_up_ue_id = ue->rrc_ue_id,
.numPDUSessions = 1,
.pduSession[0].id = session->param.pdusession_id,
.pduSession[0].numDRBSetup = 1,
.pduSession[0].DRBnGRanList[0].id = drb_id,
.pduSession[0].DRBnGRanList[0].numQosFlowSetup = 1,
.pduSession[0].DRBnGRanList[0].qosFlows[0].qfi = session->param.qos[0].qfi,
};
if (f1inst >= 0) { /* we have F1(-U) */
DRB_nGRAN_setup_t *resp_drb = &resp.pduSession[0].DRBnGRanList[0];
resp_drb->numUpParam = 1;
memcpy(&resp_drb->UpParamList[0].tlAddress, tlAddress, 4);
resp_drb->UpParamList[0].teId = teid;
}
rrc_gNB_process_e1_bearer_context_setup_resp(&resp, 0);
}
void rrc_gNB_trigger_release_bearer(int rnti)
{
/* get RRC and UE */
gNB_RRC_INST *rrc = RC.nrrrc[0];
if (rnti < 0)
rnti = get_single_ue_rnti();
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti);
if (ue_context_p == NULL) {
LOG_E(RRC, "unknown UE RNTI %04x\n", rnti);
return;
}
gNB_RRC_UE_t *ue = &ue_context_p->ue_context;
if (ue->established_drbs[1].status == DRB_INACTIVE) {
LOG_E(RRC, "no second bearer, aborting\n");
return;
}
// don't use E1: bearer release is not implemented, call directly
// into PDCP/SDAP and then send corresponding message via F1
int drb_id = 2;
ue->established_drbs[1].status = DRB_INACTIVE;
ue->DRB_ReleaseList = calloc(1, sizeof(*ue->DRB_ReleaseList));
AssertFatal(ue->DRB_ReleaseList != NULL, "out of memory\n");
NR_DRB_Identity_t *asn1_drb = malloc(sizeof(*asn1_drb));
AssertFatal(asn1_drb != NULL, "out of memory\n");
int idx = 0;
NR_DRB_ToAddModList_t *drb_list = createDRBlist(ue, false);
while (idx < drb_list->list.count) {
const NR_DRB_ToAddMod_t *drbc = drb_list->list.array[idx];
if (drbc->drb_Identity == drb_id)
break;
++idx;
}
if (idx < drb_list->list.count) {
nr_pdcp_release_drb(rnti, drb_id);
asn_sequence_del(&drb_list->list, idx, 1);
}
*asn1_drb = drb_id;
asn1cSeqAdd(&ue->DRB_ReleaseList->list, asn1_drb);
instance_t f1inst = get_f1_gtp_instance();
if (f1inst >= 0)
newGtpuDeleteOneTunnel(f1inst, ue->rrc_ue_id, drb_id);
nr_pdcp_release_drb(ue->rrc_ue_id, drb_id);
f1ap_drb_to_be_released_t drbs_to_be_released[1] = {{.rb_id = drb_id}};
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue->rrc_ue_id);
RETURN_IF_INVALID_ASSOC_ID(ue_data);
f1ap_ue_context_modif_req_t ue_context_modif_req = {
.gNB_CU_ue_id = ue->rrc_ue_id,
.gNB_DU_ue_id = ue_data.secondary_ue,
.plmn.mcc = rrc->configuration.mcc[0],
.plmn.mnc = rrc->configuration.mnc[0],
.plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0],
.nr_cellid = rrc->nr_cellid,
.servCellId = 0, /* TODO: correct value? */
.srbs_to_be_setup_length = 0,
.srbs_to_be_setup = NULL,
.drbs_to_be_setup_length = 0,
.drbs_to_be_setup = NULL,
.drbs_to_be_released_length = 1,
.drbs_to_be_released = drbs_to_be_released,
};
rrc->mac_rrc.ue_context_modification_request(ue_data.du_assoc_id, &ue_context_modif_req);
}
int rrc_gNB_generate_pcch_msg(sctp_assoc_t assoc_id, const NR_SIB1_t *sib1, uint32_t tmsi, uint8_t paging_drx) int rrc_gNB_generate_pcch_msg(sctp_assoc_t assoc_id, const NR_SIB1_t *sib1, uint32_t tmsi, uint8_t paging_drx)
{ {
instance_t instance = 0; instance_t instance = 0;
......
...@@ -25,6 +25,13 @@ ...@@ -25,6 +25,13 @@
#include <openair3/ocp-gtpu/gtp_itf.h> #include <openair3/ocp-gtpu/gtp_itf.h>
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h" #include "openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h"
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <pthread.h> #include <pthread.h>
...@@ -56,6 +63,50 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s ...@@ -56,6 +63,50 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s
return; return;
} }
/* \brief returns 1 for packets matching criteria, otherwise 1. Criteria is:
* - TCP packet AND dport != 10101 AND dport != 5201 AND second bearer
* - UDP packet AND dport != 10101 AND dport != 5201 AND dport != 2153 AND dport != 2153 AND second bearer
* - ICMP
*/
static int analyze_packet_inc(nr_sdap_entity_t *entity, const unsigned char *sdu_buffer)
{
// mir
// Naive L4/L3 packet classifier
struct iphdr* hdr = (struct iphdr*)sdu_buffer;
if(hdr->protocol == IPPROTO_TCP){
struct tcphdr* tcp = (struct tcphdr*)((uint32_t*)hdr + hdr->ihl);
//uint16_t const src_port = ntohs(tcp->source);
uint16_t const dst_port = ntohs(tcp->dest);
//printf("TCP pkt src_port %d dst_port %d \n", src_port, dst_port);
if (entity->is_gnb && entity->has_second_bearer && dst_port != 10101 && dst_port != 5201) {
return 1;
}
//printf("TCP\n");
} else if(hdr->protocol == IPPROTO_UDP){
struct udphdr *udp = (struct udphdr *)((uint32_t*)hdr + hdr->ihl);
//uint16_t const src_port = ntohs(udp->source);
uint16_t const dst_port = ntohs(udp->dest);
//printf("UDP pkt src_port %d dst_port %d \n", src_port, dst_port);
if (entity->is_gnb && entity->has_second_bearer && dst_port != 10101 && dst_port != 5201 && dst_port != 2154 && dst_port != 2153) {
return 1;
}
} else if(hdr->protocol == IPPROTO_ICMP){
//printf("Ping packet detected \n");
if (entity->is_gnb && entity->has_second_bearer) {
return 1;
}
//printf("ping\n");
//cnt++;
} else {
printf("undetected header\n");
}
return 0;
}
static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity, static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
protocol_ctxt_t *ctxt_p, protocol_ctxt_t *ctxt_p,
const srb_flag_t srb_flag, const srb_flag_t srb_flag,
...@@ -91,7 +142,9 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity, ...@@ -91,7 +142,9 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
} }
if(!pdcp_ent_has_sdap){ if(!pdcp_ent_has_sdap){
LOG_D(SDAP, "TX - DRB ID: %ld does not have SDAP\n", entity->qfi2drb_table[qfi].drb_id); LOG_W(SDAP, "TX - DRB ID: %ld does not have SDAP\n", entity->qfi2drb_table[qfi].drb_id);
sdap_drb_id += analyze_packet_inc(entity, sdu_buffer);
ret = nr_pdcp_data_req_drb(ctxt_p, ret = nr_pdcp_data_req_drb(ctxt_p,
srb_flag, srb_flag,
sdap_drb_id, sdap_drb_id,
...@@ -103,6 +156,7 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity, ...@@ -103,6 +156,7 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
sourceL2Id, sourceL2Id,
destinationL2Id); destinationL2Id);
if(!ret) if(!ret)
LOG_E(SDAP, "%s:%d:%s: PDCP refused PDU\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(SDAP, "%s:%d:%s: PDCP refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
...@@ -114,6 +168,8 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity, ...@@ -114,6 +168,8 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
return 0; return 0;
} }
sdap_drb_id += analyze_packet_inc(entity, sdu_buffer);
if(ctxt_p->enb_flag) { // gNB if(ctxt_p->enb_flag) { // gNB
offset = SDAP_HDR_LENGTH; offset = SDAP_HDR_LENGTH;
/* /*
...@@ -415,11 +471,12 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, ...@@ -415,11 +471,12 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb,
uint8_t mappedQFIs2AddCount) uint8_t mappedQFIs2AddCount)
{ {
if (nr_sdap_get_entity(ue_id, pdusession_id)) { if (nr_sdap_get_entity(ue_id, pdusession_id)) {
LOG_E(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id); LOG_I(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id);
nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id); nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id);
rb_id_t pdcp_entity = existing_sdap_entity->default_drb; rb_id_t pdcp_entity = existing_sdap_entity->default_drb;
if(!is_gnb) if(!is_gnb)
nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, ue_id, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity, has_sdap_rx, has_sdap_tx); nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, ue_id, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity, has_sdap_rx, has_sdap_tx);
existing_sdap_entity->has_second_bearer = 1;
return existing_sdap_entity; return existing_sdap_entity;
} }
...@@ -433,6 +490,7 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, ...@@ -433,6 +490,7 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb,
sdap_entity->ue_id = ue_id; sdap_entity->ue_id = ue_id;
sdap_entity->pdusession_id = pdusession_id; sdap_entity->pdusession_id = pdusession_id;
sdap_entity->is_gnb = is_gnb;
sdap_entity->tx_entity = nr_sdap_tx_entity; sdap_entity->tx_entity = nr_sdap_tx_entity;
sdap_entity->rx_entity = nr_sdap_rx_entity; sdap_entity->rx_entity = nr_sdap_rx_entity;
......
...@@ -79,6 +79,8 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s ...@@ -79,6 +79,8 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s
typedef struct nr_sdap_entity_s { typedef struct nr_sdap_entity_s {
ue_id_t ue_id; ue_id_t ue_id;
rb_id_t default_drb; rb_id_t default_drb;
int is_gnb;
int has_second_bearer;
int pdusession_id; int pdusession_id;
qfi2drb_t qfi2drb_table[SDAP_MAX_QFI]; qfi2drb_t qfi2drb_table[SDAP_MAX_QFI];
......
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