mirror of https://github.com/PentHertz/srsLTE.git
fix latest static analysis warnings in rrc paging
This commit is contained in:
parent
996d8ef74d
commit
32228389a9
|
@ -76,13 +76,21 @@ private:
|
||||||
const static size_t nof_paging_subframes = 4;
|
const static size_t nof_paging_subframes = 4;
|
||||||
|
|
||||||
bool add_paging_record(uint32_t ueid, const asn1::rrc::paging_record_s& paging_record);
|
bool add_paging_record(uint32_t ueid, const asn1::rrc::paging_record_s& paging_record);
|
||||||
pcch_info& get_pcch_info(tti_point tti_tx_dl)
|
pcch_info* get_pcch_info(tti_point tti_tx_dl)
|
||||||
{
|
{
|
||||||
return pending_paging[tti_tx_dl.sfn() % T][get_sf_idx_key(tti_tx_dl.sf_idx())];
|
int sf_key = get_sf_idx_key(tti_tx_dl.sf_idx());
|
||||||
|
if (sf_key < 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return &pending_paging[tti_tx_dl.sfn() % T][sf_key];
|
||||||
}
|
}
|
||||||
const pcch_info& get_pcch_info(tti_point tti_tx_dl) const
|
const pcch_info* get_pcch_info(tti_point tti_tx_dl) const
|
||||||
{
|
{
|
||||||
return pending_paging[tti_tx_dl.sfn() % T][get_sf_idx_key(tti_tx_dl.sf_idx())];
|
int sf_key = get_sf_idx_key(tti_tx_dl.sf_idx());
|
||||||
|
if (sf_key < 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return &pending_paging[tti_tx_dl.sfn() % T][sf_key];
|
||||||
}
|
}
|
||||||
static int get_sf_idx_key(uint32_t sf_idx)
|
static int get_sf_idx_key(uint32_t sf_idx)
|
||||||
{
|
{
|
||||||
|
@ -147,12 +155,13 @@ bool paging_manager::add_paging_record(uint32_t ueid, const asn1::rrc::paging_re
|
||||||
logger.error("SF pattern is N/A for Ns=%d, i_s=%d, imsi_decimal=%d", Ns, i_s, ueid);
|
logger.error("SF pattern is N/A for Ns=%d, i_s=%d, imsi_decimal=%d", Ns, i_s, ueid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
size_t sf_key = static_cast<size_t>(get_sf_idx_key(sf_idx));
|
||||||
|
|
||||||
size_t sfn_cycle_idx = (T / N) * (ueid % N);
|
size_t sfn_cycle_idx = (T / N) * (ueid % N);
|
||||||
pcch_info& pending_pcch = pending_paging[sfn_cycle_idx][get_sf_idx_key(sf_idx)];
|
pcch_info& pending_pcch = pending_paging[sfn_cycle_idx][sf_key];
|
||||||
auto& record_list = pending_pcch.pcch_msg.msg.c1().paging().paging_record_list;
|
auto& record_list = pending_pcch.pcch_msg.msg.c1().paging().paging_record_list;
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(sf_idx_mutex[get_sf_idx_key(sf_idx)]);
|
std::lock_guard<std::mutex> lock(sf_idx_mutex[sf_key]);
|
||||||
|
|
||||||
if (record_list.size() >= ASN1_RRC_MAX_PAGE_REC) {
|
if (record_list.size() >= ASN1_RRC_MAX_PAGE_REC) {
|
||||||
logger.warning("Failed to add new paging record for ueid=%d. Cause: no paging record space left.", ueid);
|
logger.warning("Failed to add new paging record for ueid=%d. Cause: no paging record space left.", ueid);
|
||||||
|
@ -188,19 +197,19 @@ size_t paging_manager::pending_pcch_bytes(tti_point tti_tx_dl)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(sf_idx_mutex[sf_key]);
|
std::lock_guard<std::mutex> lock(sf_idx_mutex[static_cast<size_t>(sf_key)]);
|
||||||
|
|
||||||
// clear old PCCH that has been transmitted at this point
|
// clear old PCCH that has been transmitted at this point
|
||||||
pcch_info& old_pcch = get_pcch_info(tti_tx_dl - SRSRAN_NOF_SF_X_FRAME);
|
pcch_info* old_pcch = get_pcch_info(tti_tx_dl - SRSRAN_NOF_SF_X_FRAME);
|
||||||
if (not old_pcch.empty()) {
|
if (old_pcch != nullptr and not old_pcch->empty()) {
|
||||||
old_pcch.clear();
|
old_pcch->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const pcch_info& pending_pcch = get_pcch_info(tti_tx_dl);
|
const pcch_info* pending_pcch = get_pcch_info(tti_tx_dl);
|
||||||
if (pending_pcch.empty()) {
|
if (pending_pcch->empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return pending_pcch.pdu->size();
|
return pending_pcch->pdu->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Callable>
|
template <typename Callable>
|
||||||
|
@ -212,18 +221,18 @@ bool paging_manager::read_pdu_pcch(tti_point tti_tx_dl, const Callable& func)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcch_info& pending_pcch = get_pcch_info(tti_tx_dl);
|
std::lock_guard<std::mutex> lock(sf_idx_mutex[static_cast<size_t>(sf_key)]);
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(sf_idx_mutex[get_sf_idx_key(tti_tx_dl.sf_idx())]);
|
pcch_info* pending_pcch = get_pcch_info(tti_tx_dl);
|
||||||
|
|
||||||
if (pending_pcch.empty()) {
|
if (pending_pcch->empty()) {
|
||||||
logger.warning("read_pdu_pdcch(...) called for tti=%d, but there is no pending pcch message", tti_tx_dl.to_uint());
|
logger.warning("read_pdu_pdcch(...) called for tti=%d, but there is no pending pcch message", tti_tx_dl.to_uint());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call callable for existing PCCH pdu
|
// Call callable for existing PCCH pdu
|
||||||
if (func(*pending_pcch.pdu, pending_pcch.pcch_msg, pending_pcch.tti_tx_dl.is_valid())) {
|
if (func(*pending_pcch->pdu, pending_pcch->pcch_msg, pending_pcch->tti_tx_dl.is_valid())) {
|
||||||
pending_pcch.tti_tx_dl = tti_tx_dl;
|
pending_pcch->tti_tx_dl = tti_tx_dl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
ngap(srsran::task_sched_handle task_sched_,
|
ngap(srsran::task_sched_handle task_sched_,
|
||||||
srslog::basic_logger& logger,
|
srslog::basic_logger& logger,
|
||||||
srsran::socket_manager_itf* rx_socket_handler);
|
srsran::socket_manager_itf* rx_socket_handler);
|
||||||
int init(ngap_args_t args_, rrc_interface_ngap_nr* rrc_);
|
int init(const ngap_args_t& args_, rrc_interface_ngap_nr* rrc_);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
// RRC NR interface
|
// RRC NR interface
|
||||||
|
|
|
@ -121,9 +121,11 @@ const gtpu_tunnel* gtpu_tunnel_manager::add_tunnel(uint16_t rnti, uint32_t lcid,
|
||||||
|
|
||||||
bool gtpu_tunnel_manager::update_rnti(uint16_t old_rnti, uint16_t new_rnti)
|
bool gtpu_tunnel_manager::update_rnti(uint16_t old_rnti, uint16_t new_rnti)
|
||||||
{
|
{
|
||||||
srsran_assert(find_rnti_tunnels(new_rnti) == nullptr, "New rnti=0x%x already exists", new_rnti);
|
|
||||||
|
|
||||||
auto* old_rnti_ptr = find_rnti_tunnels(old_rnti);
|
auto* old_rnti_ptr = find_rnti_tunnels(old_rnti);
|
||||||
|
if (old_rnti_ptr == nullptr or find_rnti_tunnels(new_rnti) != nullptr) {
|
||||||
|
logger.error("Modifying bearer rnti. Old rnti=0x%x, new rnti=0x%x", old_rnti, new_rnti);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
logger.info("Modifying bearer rnti. Old rnti: 0x%x, new rnti: 0x%x", old_rnti, new_rnti);
|
logger.info("Modifying bearer rnti. Old rnti: 0x%x, new rnti: 0x%x", old_rnti, new_rnti);
|
||||||
|
|
||||||
// create new RNTI and update TEIDs of old rnti to reflect new rnti
|
// create new RNTI and update TEIDs of old rnti to reflect new rnti
|
||||||
|
@ -509,11 +511,6 @@ void gtpu::rem_bearer(uint16_t rnti, uint32_t lcid)
|
||||||
|
|
||||||
void gtpu::mod_bearer_rnti(uint16_t old_rnti, uint16_t new_rnti)
|
void gtpu::mod_bearer_rnti(uint16_t old_rnti, uint16_t new_rnti)
|
||||||
{
|
{
|
||||||
auto* old_rnti_ptr = tunnels.find_rnti_tunnels(old_rnti);
|
|
||||||
if (old_rnti_ptr == nullptr or tunnels.find_rnti_tunnels(new_rnti) != nullptr) {
|
|
||||||
logger.error("Modifying bearer rnti. Old rnti=0x%x, new rnti=0x%x", old_rnti, new_rnti);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tunnels.update_rnti(old_rnti, new_rnti);
|
tunnels.update_rnti(old_rnti, new_rnti);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ ngap::ngap(srsran::task_sched_handle task_sched_,
|
||||||
amf_task_queue = task_sched.make_task_queue();
|
amf_task_queue = task_sched.make_task_queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ngap::init(ngap_args_t args_, rrc_interface_ngap_nr* rrc_)
|
int ngap::init(const ngap_args_t& args_, rrc_interface_ngap_nr* rrc_)
|
||||||
{
|
{
|
||||||
rrc = rrc_;
|
rrc = rrc_;
|
||||||
args = args_;
|
args = args_;
|
||||||
|
|
Loading…
Reference in New Issue