mirror of https://github.com/PentHertz/srsLTE.git
nr,ngap: use const_byte_spans instead of unique_byte_buffers in ngap interface to avoid intermediate copies
This commit is contained in:
parent
e8beb2ef81
commit
0c733f7ea3
|
@ -37,14 +37,14 @@ public:
|
|||
virtual void initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu) = 0;
|
||||
srsran::const_byte_span pdu) = 0;
|
||||
virtual void initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu,
|
||||
uint32_t m_tmsi) = 0;
|
||||
srsran::const_byte_span pdu,
|
||||
uint32_t m_tmsi) = 0;
|
||||
|
||||
virtual void write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu) = 0;
|
||||
virtual void write_pdu(uint16_t rnti, srsran::const_byte_span pdu) = 0;
|
||||
virtual bool user_exists(uint16_t rnti) = 0;
|
||||
virtual void user_mod(uint16_t old_rnti, uint16_t new_rnti) = 0;
|
||||
virtual bool user_release(uint16_t rnti, asn1::ngap_nr::cause_radio_network_e cause_radio) = 0;
|
||||
|
@ -54,4 +54,4 @@ public:
|
|||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSRAN_GNB_NGAP_INTERFACES_H
|
||||
#endif // SRSRAN_GNB_NGAP_INTERFACES_H
|
||||
|
|
|
@ -24,16 +24,16 @@ class ngap_dummy : public ngap_interface_rrc_nr
|
|||
void initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu)
|
||||
srsran::const_byte_span pdu)
|
||||
{}
|
||||
void initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu,
|
||||
srsran::const_byte_span pdu,
|
||||
uint32_t m_tmsi)
|
||||
{}
|
||||
|
||||
void write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu) {}
|
||||
void write_pdu(uint16_t rnti, srsran::const_byte_span pdu) {}
|
||||
bool user_exists(uint16_t rnti) { return true; }
|
||||
void user_mod(uint16_t old_rnti, uint16_t new_rnti) {}
|
||||
bool user_release(uint16_t rnti, asn1::ngap_nr::cause_radio_network_e cause_radio) { return true; }
|
||||
|
|
|
@ -50,14 +50,14 @@ public:
|
|||
void initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu);
|
||||
srsran::const_byte_span pdu);
|
||||
void initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu,
|
||||
srsran::const_byte_span pdu,
|
||||
uint32_t s_tmsi);
|
||||
|
||||
void write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu);
|
||||
void write_pdu(uint16_t rnti, srsran::const_byte_span pdu);
|
||||
bool user_exists(uint16_t rnti) { return true; };
|
||||
void user_mod(uint16_t old_rnti, uint16_t new_rnti){};
|
||||
bool user_release(uint16_t rnti, asn1::ngap_nr::cause_radio_network_e cause_radio) { return true; };
|
||||
|
|
|
@ -31,11 +31,11 @@ public:
|
|||
virtual ~ue();
|
||||
// TS 38.413 - Section 9.2.5.1 - Initial UE Message
|
||||
bool send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu,
|
||||
srsran::const_byte_span pdu,
|
||||
bool has_tmsi,
|
||||
uint32_t s_tmsi = 0);
|
||||
// TS 38.413 - Section 9.2.5.3 - Uplink NAS Transport
|
||||
bool send_ul_nas_transport(srsran::unique_byte_buffer_t pdu);
|
||||
bool send_ul_nas_transport(srsran::const_byte_span pdu);
|
||||
// TS 38.413 - Section 9.2.2.2 - Initial Context Setup Response
|
||||
bool send_initial_ctxt_setup_response();
|
||||
// TS 38.413 - Section 9.2.2.3 - Initial Context Setup Failure
|
||||
|
@ -77,4 +77,4 @@ private:
|
|||
};
|
||||
|
||||
} // namespace srsenb
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -214,7 +214,7 @@ int ngap::build_tai_cgi()
|
|||
void ngap::initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu)
|
||||
srsran::const_byte_span pdu)
|
||||
{
|
||||
std::unique_ptr<ue> ue_ptr{new ue{this, rrc, gtpu, logger}};
|
||||
ue_ptr->ctxt.rnti = rnti;
|
||||
|
@ -224,13 +224,13 @@ void ngap::initial_ue(uint16_t rnti,
|
|||
logger.error("Failed to add rnti=0x%x", rnti);
|
||||
return;
|
||||
}
|
||||
u->send_initial_ue_message(cause, std::move(pdu), false);
|
||||
u->send_initial_ue_message(cause, pdu, false);
|
||||
}
|
||||
|
||||
void ngap::initial_ue(uint16_t rnti,
|
||||
uint32_t gnb_cc_idx,
|
||||
asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu,
|
||||
srsran::const_byte_span pdu,
|
||||
uint32_t s_tmsi)
|
||||
{
|
||||
std::unique_ptr<ue> ue_ptr{new ue{this, rrc, gtpu, logger}};
|
||||
|
@ -241,7 +241,7 @@ void ngap::initial_ue(uint16_t rnti,
|
|||
logger.error("Failed to add rnti=0x%x", rnti);
|
||||
return;
|
||||
}
|
||||
u->send_initial_ue_message(cause, std::move(pdu), true, s_tmsi);
|
||||
u->send_initial_ue_message(cause, pdu, true, s_tmsi);
|
||||
}
|
||||
|
||||
void ngap::ue_notify_rrc_reconf_complete(uint16_t rnti, bool outcome)
|
||||
|
@ -253,16 +253,16 @@ void ngap::ue_notify_rrc_reconf_complete(uint16_t rnti, bool outcome)
|
|||
u->notify_rrc_reconf_complete(outcome);
|
||||
}
|
||||
|
||||
void ngap::write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu)
|
||||
void ngap::write_pdu(uint16_t rnti, srsran::const_byte_span pdu)
|
||||
{
|
||||
logger.info(pdu->msg, pdu->N_bytes, "Received RRC SDU");
|
||||
logger.info(pdu.data(), pdu.size(), "Received RRC SDU");
|
||||
|
||||
ue* u = users.find_ue_rnti(rnti);
|
||||
if (u == nullptr) {
|
||||
logger.info("The rnti=0x%x does not exist", rnti);
|
||||
return;
|
||||
}
|
||||
u->send_ul_nas_transport(std::move(pdu));
|
||||
u->send_ul_nas_transport(pdu);
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
|
|
|
@ -46,7 +46,7 @@ ngap::ue::~ue() {}
|
|||
********************************************************************************/
|
||||
|
||||
bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e cause,
|
||||
srsran::unique_byte_buffer_t pdu,
|
||||
srsran::const_byte_span pdu,
|
||||
bool has_tmsi,
|
||||
uint32_t s_tmsi)
|
||||
{
|
||||
|
@ -71,8 +71,8 @@ bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e c
|
|||
container.ran_ue_ngap_id.value = ctxt.ran_ue_ngap_id;
|
||||
|
||||
// NAS_PDU
|
||||
container.nas_pdu.value.resize(pdu->N_bytes);
|
||||
memcpy(container.nas_pdu.value.data(), pdu->msg, pdu->N_bytes);
|
||||
container.nas_pdu.value.resize(pdu.size());
|
||||
memcpy(container.nas_pdu.value.data(), pdu.data(), pdu.size());
|
||||
|
||||
// RRC Establishment Cause
|
||||
container.rrcestablishment_cause.value = cause;
|
||||
|
@ -93,7 +93,7 @@ bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e c
|
|||
return ngap_ptr->sctp_send_ngap_pdu(tx_pdu, ctxt.rnti, "InitialUEMessage");
|
||||
}
|
||||
|
||||
bool ngap::ue::send_ul_nas_transport(srsran::unique_byte_buffer_t pdu)
|
||||
bool ngap::ue::send_ul_nas_transport(srsran::const_byte_span pdu)
|
||||
{
|
||||
if (not ngap_ptr->amf_connected) {
|
||||
logger.warning("AMF not connected");
|
||||
|
@ -116,8 +116,8 @@ bool ngap::ue::send_ul_nas_transport(srsran::unique_byte_buffer_t pdu)
|
|||
container.ran_ue_ngap_id.value = ctxt.ran_ue_ngap_id;
|
||||
|
||||
// NAS PDU
|
||||
container.nas_pdu.value.resize(pdu->N_bytes);
|
||||
memcpy(container.nas_pdu.value.data(), pdu->msg, pdu->N_bytes);
|
||||
container.nas_pdu.value.resize(pdu.size());
|
||||
memcpy(container.nas_pdu.value.data(), pdu.data(), pdu.size());
|
||||
|
||||
// User Location Info
|
||||
// userLocationInformationNR
|
||||
|
@ -276,4 +276,4 @@ bool ngap::ue::handle_pdu_session_res_setup_request(const asn1::ngap_nr::pdu_ses
|
|||
return true;
|
||||
}
|
||||
|
||||
} // namespace srsenb
|
||||
} // namespace srsenb
|
||||
|
|
Loading…
Reference in New Issue