mirror of https://github.com/pvnis/srsRAN_4G.git
Merge branch 'next' into agpl_next
# Conflicts: # srsenb/hdr/stack/upper/pdcp_nr.h # srsenb/hdr/stack/upper/rlc_nr.h # srsenb/src/stack/upper/pdcp_nr.cc # srsenb/src/stack/upper/rlc_nr.ccmaster
commit
8c3332f894
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSRAN_PBCH_MSG_NR_H
|
||||||
|
#define SRSRAN_PBCH_MSG_NR_H
|
||||||
|
|
||||||
|
#include "srsran/config.h"
|
||||||
|
#include "srsran/phy/common/phy_common_nr.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief NR PBCH payload size generated by higher layers, deduced from TS 38.331 MIB description
|
||||||
|
*/
|
||||||
|
#define SRSRAN_PBCH_MSG_NR_SZ 24
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Describes the NR PBCH message
|
||||||
|
*/
|
||||||
|
typedef struct SRSRAN_API {
|
||||||
|
uint8_t payload[SRSRAN_PBCH_MSG_NR_SZ]; ///< Actual PBCH payload provided by higher layers
|
||||||
|
uint8_t sfn_4lsb; ///< SFN 4 LSB
|
||||||
|
uint8_t ssb_idx; ///< SS/PBCH blocks index described in TS 38.213 4.1
|
||||||
|
uint8_t k_ssb_msb; ///< Subcarrier offset MSB described in TS 38.211 7.4.3.1
|
||||||
|
bool hrf; ///< Half Radio Frame bit
|
||||||
|
bool crc; ///< Decoder only, it is true only if the received CRC matches
|
||||||
|
} srsran_pbch_msg_nr_t;
|
||||||
|
|
||||||
|
typedef struct SRSRAN_API {
|
||||||
|
uint32_t sfn; ///< System frame number
|
||||||
|
uint8_t ssb_idx; ///< SS/PBCH blocks index described in TS 38.213 4.1
|
||||||
|
bool hrf; ///< Half Radio Frame bit
|
||||||
|
srsran_subcarrier_spacing_t scs_common; ///< Subcarrier spacing common
|
||||||
|
uint32_t ssb_offset; ///< SSB subcarrier offset
|
||||||
|
srsran_dmrs_sch_typeA_pos_t dmrs_typeA_pos; ///< DMRS typeA position
|
||||||
|
uint32_t coreset0_idx; ///< CORESET Zero configuration index (0-15)
|
||||||
|
uint32_t ss0_idx; ///< SearchSpace Zero configuration index (0-15)
|
||||||
|
bool cell_barred; ///< Set to true if the cell is barred
|
||||||
|
bool intra_freq_reselection; ///< Set to true if allowed
|
||||||
|
uint32_t spare; ///< Unused bits
|
||||||
|
} srsran_mib_nr_t;
|
||||||
|
|
||||||
|
SRSRAN_API bool srsran_pbch_msg_nr_is_mib(const srsran_pbch_msg_nr_t* msg);
|
||||||
|
|
||||||
|
SRSRAN_API int srsran_pbch_msg_nr_mib_pack(const srsran_mib_nr_t* mib, srsran_pbch_msg_nr_t* msg);
|
||||||
|
|
||||||
|
SRSRAN_API int srsran_pbch_msg_nr_mib_unpack(const srsran_pbch_msg_nr_t* pbch_msg, srsran_mib_nr_t* mib);
|
||||||
|
|
||||||
|
SRSRAN_API uint32_t srsran_pbch_msg_info(const srsran_pbch_msg_nr_t* msg, char* str, uint32_t str_len);
|
||||||
|
|
||||||
|
SRSRAN_API uint32_t srsran_pbch_msg_nr_mib_info(const srsran_mib_nr_t* mib, char* str, uint32_t str_len);
|
||||||
|
|
||||||
|
#endif // SRSRAN_PBCH_MSG_NR_H
|
@ -0,0 +1,179 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "srsran/phy/phch/pbch_msg_nr.h"
|
||||||
|
#include "srsran/phy/utils/bit.h"
|
||||||
|
#include "srsran/phy/utils/vector.h"
|
||||||
|
|
||||||
|
static bool pbch_msg_nr_is_mib(const srsran_pbch_msg_nr_t* msg)
|
||||||
|
{
|
||||||
|
return msg->payload[0] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool srsran_pbch_msg_nr_is_mib(const srsran_pbch_msg_nr_t* msg)
|
||||||
|
{
|
||||||
|
if (msg == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pbch_msg_nr_is_mib(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
int srsran_pbch_msg_nr_mib_pack(const srsran_mib_nr_t* mib, srsran_pbch_msg_nr_t* pbch_msg)
|
||||||
|
{
|
||||||
|
if (mib == NULL || pbch_msg == NULL) {
|
||||||
|
return SRSRAN_ERROR_INVALID_INPUTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy PBCH message context
|
||||||
|
pbch_msg->sfn_4lsb = mib->sfn & 0b1111;
|
||||||
|
pbch_msg->ssb_idx = mib->ssb_idx;
|
||||||
|
pbch_msg->k_ssb_msb = mib->ssb_offset >> 4U;
|
||||||
|
pbch_msg->hrf = mib->hrf;
|
||||||
|
|
||||||
|
// Pack MIB payload
|
||||||
|
uint8_t* y = pbch_msg->payload;
|
||||||
|
|
||||||
|
// MIB - 1 bit
|
||||||
|
*(y++) = 0;
|
||||||
|
|
||||||
|
// systemFrameNumber - 6 bits MSB
|
||||||
|
srsran_bit_unpack(mib->sfn >> 4U, &y, 6);
|
||||||
|
|
||||||
|
// subCarrierSpacingCommon - 1 bit
|
||||||
|
*(y++) = (mib->scs_common == srsran_subcarrier_spacing_15kHz || mib->scs_common == srsran_subcarrier_spacing_60kHz)
|
||||||
|
? 0
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
// ssb-SubcarrierOffset - 4 bits
|
||||||
|
srsran_bit_unpack(mib->ssb_offset, &y, 4);
|
||||||
|
|
||||||
|
// dmrs-TypeA-Position - 1 bit
|
||||||
|
*(y++) = (mib->dmrs_typeA_pos == srsran_dmrs_sch_typeA_pos_2) ? 0 : 1;
|
||||||
|
|
||||||
|
// pdcch-ConfigSIB1
|
||||||
|
// controlResourceSetZero - 4 bits
|
||||||
|
srsran_bit_unpack(mib->coreset0_idx, &y, 4);
|
||||||
|
|
||||||
|
// searchSpaceZero - 4 bits
|
||||||
|
srsran_bit_unpack(mib->ss0_idx, &y, 4);
|
||||||
|
|
||||||
|
// Barred - 1 bit
|
||||||
|
*(y++) = (mib->cell_barred) ? 0 : 1;
|
||||||
|
|
||||||
|
// intraFreqReselection - 1 bit
|
||||||
|
*(y++) = (mib->intra_freq_reselection) ? 0 : 1;
|
||||||
|
|
||||||
|
// Spare - 1 bit
|
||||||
|
srsran_bit_unpack(mib->spare, &y, 1);
|
||||||
|
|
||||||
|
return SRSRAN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int srsran_pbch_msg_nr_mib_unpack(const srsran_pbch_msg_nr_t* pbch_msg, srsran_mib_nr_t* mib)
|
||||||
|
{
|
||||||
|
if (mib == NULL || pbch_msg == NULL) {
|
||||||
|
return SRSRAN_ERROR_INVALID_INPUTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy PBCH message context
|
||||||
|
mib->sfn = pbch_msg->sfn_4lsb;
|
||||||
|
mib->ssb_idx = pbch_msg->ssb_idx;
|
||||||
|
mib->hrf = pbch_msg->hrf;
|
||||||
|
mib->ssb_offset = pbch_msg->k_ssb_msb << 4U;
|
||||||
|
|
||||||
|
// Pack MIB payload
|
||||||
|
uint8_t* y = (uint8_t*)pbch_msg->payload;
|
||||||
|
|
||||||
|
// MIB - 1 bit
|
||||||
|
if (!pbch_msg_nr_is_mib(pbch_msg)) {
|
||||||
|
return SRSRAN_ERROR;
|
||||||
|
}
|
||||||
|
y++;
|
||||||
|
|
||||||
|
// systemFrameNumber - 6 bits MSB
|
||||||
|
mib->sfn |= srsran_bit_pack(&y, 6) << 4U;
|
||||||
|
|
||||||
|
// subCarrierSpacingCommon - 1 bit
|
||||||
|
mib->scs_common = *(y++) == 0 ? srsran_subcarrier_spacing_15kHz : srsran_subcarrier_spacing_30kHz;
|
||||||
|
|
||||||
|
// ssb-SubcarrierOffset - 4 bits
|
||||||
|
mib->ssb_offset |= srsran_bit_pack(&y, 4);
|
||||||
|
|
||||||
|
// dmrs-TypeA-Position - 1 bit
|
||||||
|
mib->dmrs_typeA_pos = *(y++) == 0 ? srsran_dmrs_sch_typeA_pos_2 : srsran_dmrs_sch_typeA_pos_3;
|
||||||
|
|
||||||
|
// pdcch-ConfigSIB1
|
||||||
|
// controlResourceSetZero - 4 bits
|
||||||
|
mib->coreset0_idx = srsran_bit_pack(&y, 4);
|
||||||
|
|
||||||
|
// searchSpaceZero - 4 bits
|
||||||
|
mib->ss0_idx = srsran_bit_pack(&y, 4);
|
||||||
|
|
||||||
|
// Barred - 1 bit
|
||||||
|
mib->cell_barred = (*(y++) == 0);
|
||||||
|
|
||||||
|
// intraFreqReselection - 1 bit
|
||||||
|
mib->intra_freq_reselection = (*(y++) == 0);
|
||||||
|
|
||||||
|
// Spare - 1 bit
|
||||||
|
mib->spare = srsran_bit_pack(&y, 1);
|
||||||
|
|
||||||
|
return SRSRAN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t srsran_pbch_msg_info(const srsran_pbch_msg_nr_t* msg, char* str, uint32_t str_len)
|
||||||
|
{
|
||||||
|
if (msg == NULL || str == NULL || str_len == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t len = 0;
|
||||||
|
|
||||||
|
len = srsran_print_check(str, str_len, len, "payload=");
|
||||||
|
|
||||||
|
len += srsran_vec_sprint_hex(&str[len], str_len - len, (uint8_t*)msg->payload, SRSRAN_PBCH_MSG_NR_SZ);
|
||||||
|
|
||||||
|
len = srsran_print_check(str,
|
||||||
|
str_len,
|
||||||
|
len,
|
||||||
|
" sfn_lsb=%d ssb_idx=%d k_ssb_msb=%d hrf=%d ",
|
||||||
|
msg->sfn_4lsb,
|
||||||
|
msg->ssb_idx,
|
||||||
|
msg->k_ssb_msb,
|
||||||
|
msg->hrf);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t srsran_pbch_msg_nr_mib_info(const srsran_mib_nr_t* mib, char* str, uint32_t str_len)
|
||||||
|
{
|
||||||
|
uint32_t len = 0;
|
||||||
|
|
||||||
|
len = srsran_print_check(str,
|
||||||
|
str_len,
|
||||||
|
len,
|
||||||
|
"sfn=%d ssb_idx=%d hrf=%c scs=%d ssb_offset=%d dmrs_typeA_pos=%s coreset0=%d ss0=%d "
|
||||||
|
"barred=%c intra_freq_reselection=%c spare=%d",
|
||||||
|
mib->sfn,
|
||||||
|
mib->ssb_idx,
|
||||||
|
mib->hrf ? 'y' : 'n',
|
||||||
|
SRSRAN_SUBC_SPACING_NR(mib->scs_common) / 1000,
|
||||||
|
mib->ssb_offset,
|
||||||
|
mib->dmrs_typeA_pos == srsran_dmrs_sch_typeA_pos_2 ? "pos2" : "pos3",
|
||||||
|
mib->coreset0_idx,
|
||||||
|
mib->ss0_idx,
|
||||||
|
mib->cell_barred ? 'y' : 'n',
|
||||||
|
mib->intra_freq_reselection ? 'y' : 'n',
|
||||||
|
mib->spare);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "srsran/phy/phch/pbch_msg_nr.h"
|
||||||
|
#include "srsran/phy/utils/debug.h"
|
||||||
|
#include "srsran/phy/utils/random.h"
|
||||||
|
#include "srsran/support/srsran_test.h"
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static uint32_t nof_repetitions = 16;
|
||||||
|
static srsran_random_t random_gen = NULL;
|
||||||
|
|
||||||
|
static int test_packing_unpacking()
|
||||||
|
{
|
||||||
|
for (uint32_t r = 0; r < nof_repetitions; r++) {
|
||||||
|
srsran_mib_nr_t mib = {};
|
||||||
|
mib.sfn = srsran_random_uniform_int_dist(random_gen, 0, 1023);
|
||||||
|
mib.ssb_idx = srsran_random_uniform_int_dist(random_gen, 0, 127);
|
||||||
|
mib.hrf = srsran_random_bool(random_gen, 0.5f);
|
||||||
|
mib.scs_common =
|
||||||
|
srsran_random_bool(random_gen, 0.5f) ? srsran_subcarrier_spacing_15kHz : srsran_subcarrier_spacing_30kHz;
|
||||||
|
mib.ssb_offset = srsran_random_uniform_int_dist(random_gen, 0, 31);
|
||||||
|
mib.dmrs_typeA_pos =
|
||||||
|
srsran_random_bool(random_gen, 0.5f) ? srsran_dmrs_sch_typeA_pos_2 : srsran_dmrs_sch_typeA_pos_3;
|
||||||
|
mib.coreset0_idx = srsran_random_uniform_int_dist(random_gen, 0, 15);
|
||||||
|
mib.ss0_idx = srsran_random_uniform_int_dist(random_gen, 0, 15);
|
||||||
|
mib.cell_barred = srsran_random_bool(random_gen, 0.5f);
|
||||||
|
mib.intra_freq_reselection = srsran_random_bool(random_gen, 0.5f);
|
||||||
|
mib.spare = srsran_random_uniform_int_dist(random_gen, 0, 1);
|
||||||
|
|
||||||
|
srsran_pbch_msg_nr_t pbch_msg = {};
|
||||||
|
TESTASSERT(srsran_pbch_msg_nr_mib_pack(&mib, &pbch_msg) == SRSRAN_SUCCESS);
|
||||||
|
|
||||||
|
TESTASSERT(srsran_pbch_msg_nr_is_mib(&pbch_msg));
|
||||||
|
|
||||||
|
srsran_mib_nr_t mib2 = {};
|
||||||
|
TESTASSERT(srsran_pbch_msg_nr_mib_unpack(&pbch_msg, &mib2) == SRSRAN_SUCCESS);
|
||||||
|
|
||||||
|
char str1[256];
|
||||||
|
char str2[256];
|
||||||
|
char strp[256];
|
||||||
|
srsran_pbch_msg_nr_mib_info(&mib, str1, (uint32_t)sizeof(str1));
|
||||||
|
srsran_pbch_msg_nr_mib_info(&mib2, str2, (uint32_t)sizeof(str2));
|
||||||
|
srsran_pbch_msg_info(&pbch_msg, strp, (uint32_t)sizeof(strp));
|
||||||
|
|
||||||
|
if (memcmp(&mib, &mib2, sizeof(srsran_mib_nr_t)) != 0) {
|
||||||
|
ERROR("Failed packing/unpacking MIB");
|
||||||
|
printf(" Source: %s\n", str1);
|
||||||
|
printf("Unpacked: %s\n", str2);
|
||||||
|
printf(" Packed: %s\n", strp);
|
||||||
|
return SRSRAN_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SRSRAN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void usage(char* prog)
|
||||||
|
{
|
||||||
|
printf("Usage: %s [cpndv]\n", prog);
|
||||||
|
printf("\t-v Increase verbose [default none]\n");
|
||||||
|
printf("\t-R Set number of Packing/Unpacking [default %d]\n", nof_repetitions);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void parse_args(int argc, char** argv)
|
||||||
|
{
|
||||||
|
int opt;
|
||||||
|
while ((opt = getopt(argc, argv, "vR")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 'v':
|
||||||
|
srsran_verbose++;
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
nof_repetitions = (uint32_t)strtol(argv[optind], NULL, 10);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage(argv[0]);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
parse_args(argc, argv);
|
||||||
|
|
||||||
|
int ret = SRSRAN_ERROR;
|
||||||
|
random_gen = srsran_random_init(1234);
|
||||||
|
|
||||||
|
if (test_packing_unpacking() < SRSRAN_SUCCESS) {
|
||||||
|
goto clean_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = SRSRAN_SUCCESS;
|
||||||
|
|
||||||
|
clean_exit:
|
||||||
|
srsran_random_free(random_gen);
|
||||||
|
return ret;
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSRAN_SCHED_NR_SIGNALLING_H
|
||||||
|
#define SRSRAN_SCHED_NR_SIGNALLING_H
|
||||||
|
|
||||||
|
#include "sched_nr_cfg.h"
|
||||||
|
#include "sched_nr_interface.h"
|
||||||
|
|
||||||
|
namespace srsenb {
|
||||||
|
namespace sched_nr_impl {
|
||||||
|
|
||||||
|
/// Schedule NZP-CSI-RS resources for given slot
|
||||||
|
void sched_nzp_csi_rs(srsran::const_span<srsran_csi_rs_nzp_set_t> nzp_csi_rs_sets,
|
||||||
|
const srsran_slot_cfg_t& slot_cfg,
|
||||||
|
nzp_csi_rs_list& csi_rs_list);
|
||||||
|
|
||||||
|
/// For a given BWP and slot, schedule SSB, NZP CSI RS and SIBs
|
||||||
|
void sched_dl_signalling(const bwp_params& bwp_params,
|
||||||
|
slot_point sl_pdcch,
|
||||||
|
ssb_list& ssb_list,
|
||||||
|
nzp_csi_rs_list& nzp_csi_rs);
|
||||||
|
|
||||||
|
} // namespace sched_nr_impl
|
||||||
|
} // namespace srsenb
|
||||||
|
|
||||||
|
#endif // SRSRAN_SCHED_NR_SIGNALLING_H
|
@ -0,0 +1,73 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSENB_NGAP_UE_BEARER_MANAGER_H
|
||||||
|
#define SRSENB_NGAP_UE_BEARER_MANAGER_H
|
||||||
|
|
||||||
|
#include "srsran/asn1/asn1_utils.h"
|
||||||
|
#include "srsran/asn1/ngap.h"
|
||||||
|
#include "srsran/config.h"
|
||||||
|
#include "srsran/interfaces/enb_gtpu_interfaces.h"
|
||||||
|
#include "srsran/interfaces/gnb_rrc_nr_interfaces.h"
|
||||||
|
|
||||||
|
namespace srsenb {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Manages the GTPU bearers as part of the NGAP session procedures
|
||||||
|
* */
|
||||||
|
|
||||||
|
class ngap_ue_bearer_manager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct pdu_session_t {
|
||||||
|
struct gtpu_tunnel {
|
||||||
|
uint32_t teid_out = 0;
|
||||||
|
uint32_t teid_in = 0;
|
||||||
|
asn1::bounded_bitstring<1, 160, true, true> address_out;
|
||||||
|
asn1::bounded_bitstring<1, 160, true, true> address_in;
|
||||||
|
};
|
||||||
|
uint8_t id = 0;
|
||||||
|
uint8_t lcid = 0;
|
||||||
|
asn1::ngap_nr::qos_flow_level_qos_params_s qos_params;
|
||||||
|
std::vector<gtpu_tunnel> tunnels;
|
||||||
|
};
|
||||||
|
|
||||||
|
ngap_ue_bearer_manager(rrc_interface_ngap_nr* rrc_, gtpu_interface_rrc* gtpu_, srslog::basic_logger& logger_);
|
||||||
|
~ngap_ue_bearer_manager();
|
||||||
|
|
||||||
|
int add_pdu_session(uint16_t rnti,
|
||||||
|
uint8_t pdu_session_id,
|
||||||
|
const asn1::ngap_nr::qos_flow_level_qos_params_s& qos,
|
||||||
|
const asn1::bounded_bitstring<1, 160, true, true>& addr,
|
||||||
|
uint32_t teid_out,
|
||||||
|
uint16_t& lcid,
|
||||||
|
asn1::bounded_bitstring<1, 160, true, true>& addr_in,
|
||||||
|
uint32_t& teid_in,
|
||||||
|
asn1::ngap_nr::cause_c& cause);
|
||||||
|
|
||||||
|
private:
|
||||||
|
gtpu_interface_rrc* gtpu = nullptr;
|
||||||
|
rrc_interface_ngap_nr* rrc = nullptr;
|
||||||
|
std::map<uint8_t, pdu_session_t> pdu_session_list;
|
||||||
|
srslog::basic_logger& logger;
|
||||||
|
|
||||||
|
int add_gtpu_bearer(uint16_t rnti,
|
||||||
|
uint32_t lcid,
|
||||||
|
uint32_t pdu_session_id,
|
||||||
|
uint32_t teid_out,
|
||||||
|
asn1::bounded_bitstring<1, 160, true, true> address,
|
||||||
|
pdu_session_t::gtpu_tunnel& tunnel, // out parameter
|
||||||
|
const gtpu_interface_rrc::bearer_props* props = nullptr);
|
||||||
|
void rem_gtpu_bearer(uint16_t rnti, uint32_t pdu_session_id);
|
||||||
|
};
|
||||||
|
} // namespace srsenb
|
||||||
|
#endif // SRSENB_NGAP_UE_BEARER_MANAGER_H
|
@ -1,126 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2013-2021 Software Radio Systems Limited
|
|
||||||
*
|
|
||||||
* This file is part of srsRAN.
|
|
||||||
*
|
|
||||||
* srsRAN is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* srsRAN is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* A copy of the GNU Affero General Public License can be found in
|
|
||||||
* the LICENSE file in the top-level directory of this distribution
|
|
||||||
* and at http://www.gnu.org/licenses/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "srsran/interfaces/gnb_interfaces.h"
|
|
||||||
#include "srsran/interfaces/ue_gw_interfaces.h"
|
|
||||||
#include "srsran/interfaces/ue_rlc_interfaces.h"
|
|
||||||
#include "srsran/upper/pdcp.h"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#ifndef SRSENB_PDCP_NR_H
|
|
||||||
#define SRSENB_PDCP_NR_H
|
|
||||||
|
|
||||||
namespace srsenb {
|
|
||||||
|
|
||||||
struct pdcp_nr_args_t {
|
|
||||||
std::string log_level;
|
|
||||||
uint32_t log_hex_limit;
|
|
||||||
};
|
|
||||||
|
|
||||||
class pdcp_nr : public pdcp_interface_rlc_nr, public pdcp_interface_sdap_nr, public pdcp_interface_rrc_nr
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit pdcp_nr(srsran::task_sched_handle task_sched_, const char* logname);
|
|
||||||
virtual ~pdcp_nr() = default;
|
|
||||||
void init(const pdcp_nr_args_t& args_,
|
|
||||||
rlc_interface_pdcp_nr* rlc_,
|
|
||||||
rrc_interface_pdcp_nr* rrc_,
|
|
||||||
sdap_interface_pdcp_nr* gtpu_);
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
// pdcp_interface_rlc_nr
|
|
||||||
void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu);
|
|
||||||
void notify_delivery(uint16_t rnti, uint32_t lcid, const srsran::pdcp_sn_vector_t& pdcp_sn);
|
|
||||||
void notify_failure(uint16_t rnti, uint32_t lcid, const srsran::pdcp_sn_vector_t& pdcp_sn);
|
|
||||||
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
|
|
||||||
|
|
||||||
// pdcp_interface_rrc_nr
|
|
||||||
void reset(uint16_t rnti) final;
|
|
||||||
void add_user(uint16_t rnti) final;
|
|
||||||
void rem_user(uint16_t rnti) final;
|
|
||||||
void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) final;
|
|
||||||
void add_bearer(uint16_t rnti, uint32_t lcid, srsran::pdcp_config_t cnfg) final;
|
|
||||||
void config_security(uint16_t rnti, uint32_t lcid, srsran::as_security_config_t sec_cfg) final;
|
|
||||||
void enable_integrity(uint16_t rnti, uint32_t lcid) final;
|
|
||||||
void enable_encryption(uint16_t rnti, uint32_t lcid) final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
class user_interface_rlc final : public srsue::rlc_interface_pdcp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
uint16_t rnti;
|
|
||||||
srsenb::rlc_interface_pdcp_nr* rlc;
|
|
||||||
// rlc_interface_pdcp_nr
|
|
||||||
void write_sdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu) final;
|
|
||||||
void discard_sdu(uint32_t lcid, uint32_t discard_sn) final;
|
|
||||||
bool rb_is_um(uint32_t lcid) final;
|
|
||||||
bool sdu_queue_is_full(uint32_t lcid) final;
|
|
||||||
};
|
|
||||||
|
|
||||||
class user_interface_sdap : public srsue::gw_interface_pdcp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
uint16_t rnti;
|
|
||||||
srsenb::sdap_interface_pdcp_nr* sdap;
|
|
||||||
// gw_interface_pdcp
|
|
||||||
void write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t pdu) final;
|
|
||||||
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) final {}
|
|
||||||
};
|
|
||||||
|
|
||||||
class user_interface_rrc : public srsue::rrc_interface_pdcp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
uint16_t rnti;
|
|
||||||
srsenb::rrc_interface_pdcp_nr* rrc;
|
|
||||||
// rrc_interface_pdcp_nr
|
|
||||||
void write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t pdu) final;
|
|
||||||
void write_pdu_bcch_bch(srsran::unique_byte_buffer_t pdu) final;
|
|
||||||
void write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t pdu) final;
|
|
||||||
void write_pdu_pcch(srsran::unique_byte_buffer_t pdu) final;
|
|
||||||
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t pdu) final {}
|
|
||||||
void notify_pdcp_integrity_error(uint32_t lcid) final {}
|
|
||||||
const char* get_rb_name(uint32_t lcid) final;
|
|
||||||
};
|
|
||||||
|
|
||||||
class user_interface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
user_interface_rlc rlc_itf;
|
|
||||||
user_interface_sdap sdap_itf;
|
|
||||||
user_interface_rrc rrc_itf;
|
|
||||||
std::unique_ptr<srsran::pdcp> pdcp;
|
|
||||||
};
|
|
||||||
|
|
||||||
// args
|
|
||||||
pdcp_nr_args_t m_args = {};
|
|
||||||
rlc_interface_pdcp_nr* m_rlc = nullptr;
|
|
||||||
rrc_interface_pdcp_nr* m_rrc = nullptr;
|
|
||||||
sdap_interface_pdcp_nr* m_sdap = nullptr;
|
|
||||||
|
|
||||||
std::map<uint32_t, user_interface> users;
|
|
||||||
|
|
||||||
srsran::task_sched_handle task_sched;
|
|
||||||
srslog::basic_logger& logger;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace srsenb
|
|
||||||
|
|
||||||
#endif // SRSENB_PDCP_NR_H
|
|
@ -1,104 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2013-2021 Software Radio Systems Limited
|
|
||||||
*
|
|
||||||
* This file is part of srsRAN.
|
|
||||||
*
|
|
||||||
* srsRAN is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* srsRAN is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* A copy of the GNU Affero General Public License can be found in
|
|
||||||
* the LICENSE file in the top-level directory of this distribution
|
|
||||||
* and at http://www.gnu.org/licenses/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SRSENB_RLC_NR_H
|
|
||||||
#define SRSENB_RLC_NR_H
|
|
||||||
|
|
||||||
#include "srsran/interfaces/gnb_interfaces.h"
|
|
||||||
#include "srsran/interfaces/gnb_mac_interfaces.h"
|
|
||||||
#include "srsran/rlc/rlc.h"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace srsenb {
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint32_t lcid;
|
|
||||||
uint32_t plmn;
|
|
||||||
uint16_t mtch_stop;
|
|
||||||
uint8_t* payload;
|
|
||||||
} mch_service_t;
|
|
||||||
|
|
||||||
class rlc_nr final : public rlc_interface_mac_nr, public rlc_interface_rrc_nr, public rlc_interface_pdcp_nr
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit rlc_nr(const char* logname);
|
|
||||||
void init(pdcp_interface_rlc_nr* pdcp_,
|
|
||||||
rrc_interface_rlc_nr* rrc_,
|
|
||||||
mac_interface_rlc_nr* mac_,
|
|
||||||
srsran::timer_handler* timers_);
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
// rlc_interface_rrc_nr
|
|
||||||
void clear_buffer(uint16_t rnti);
|
|
||||||
void add_user(uint16_t rnti);
|
|
||||||
void rem_user(uint16_t rnti);
|
|
||||||
void add_bearer(uint16_t rnti, uint32_t lcid, srsran::rlc_config_t cnfg);
|
|
||||||
void add_bearer_mrb(uint16_t rnti, uint32_t lcid);
|
|
||||||
|
|
||||||
// rlc_interface_pdcp_nr
|
|
||||||
void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu);
|
|
||||||
bool rb_is_um(uint16_t rnti, uint32_t lcid);
|
|
||||||
bool sdu_queue_is_full(uint16_t rnti, uint32_t lcid);
|
|
||||||
const char* get_rb_name(uint32_t lcid);
|
|
||||||
|
|
||||||
// rlc_interface_mac_nr
|
|
||||||
int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
|
|
||||||
// void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t* payload);
|
|
||||||
void write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes);
|
|
||||||
void read_pdu_pcch(uint8_t* payload, uint32_t buffer_size);
|
|
||||||
|
|
||||||
private:
|
|
||||||
class user_interface : public srsue::pdcp_interface_rlc, public srsue::rrc_interface_rlc
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void write_pdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu);
|
|
||||||
void notify_delivery(uint32_t lcid, const srsran::pdcp_sn_vector_t& pdcp_sns);
|
|
||||||
void notify_failure(uint32_t lcid, const srsran::pdcp_sn_vector_t& pdcp_sns);
|
|
||||||
void write_pdu_bcch_bch(srsran::unique_byte_buffer_t sdu);
|
|
||||||
void write_pdu_bcch_dlsch(srsran::unique_byte_buffer_t sdu);
|
|
||||||
void write_pdu_pcch(srsran::unique_byte_buffer_t sdu);
|
|
||||||
void write_pdu_mch(uint32_t lcid, srsran::unique_byte_buffer_t sdu) {}
|
|
||||||
void max_retx_attempted() final;
|
|
||||||
void protocol_failure() final;
|
|
||||||
const char* get_rb_name(uint32_t lcid) final;
|
|
||||||
uint16_t rnti;
|
|
||||||
|
|
||||||
srsenb::pdcp_interface_rlc_nr* m_pdcp = nullptr;
|
|
||||||
srsenb::rrc_interface_rlc_nr* m_rrc = nullptr;
|
|
||||||
std::unique_ptr<srsran::rlc> m_rlc;
|
|
||||||
rlc_nr* parent = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
// args
|
|
||||||
srsran::timer_handler* timers = nullptr;
|
|
||||||
mac_interface_rlc_nr* m_mac = nullptr;
|
|
||||||
pdcp_interface_rlc_nr* m_pdcp = nullptr;
|
|
||||||
rrc_interface_rlc_nr* m_rrc = nullptr;
|
|
||||||
srslog::basic_logger& logger;
|
|
||||||
|
|
||||||
// state
|
|
||||||
std::map<uint32_t, user_interface> users;
|
|
||||||
std::vector<mch_service_t> mch_services;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace srsenb
|
|
||||||
|
|
||||||
#endif // SRSENB_RLC_NR_H
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue