clean paging_opportunity function

master
Francisco Paisana 5 years ago
parent 77f63f7bcd
commit 0f01b0acc2

@ -515,7 +515,7 @@ void rrc::add_paging_id(uint32_t ueid, LIBLTE_S1AP_UEPAGINGID_STRUCT UEPagingID)
// Described in Section 7 of 36.304
bool rrc::is_paging_opportunity(uint32_t tti, uint32_t* payload_len)
{
int sf_pattern[4][4] = {{9, 4, -1, 0}, {-1, 9, -1, 4}, {-1, -1, -1, 5}, {-1, -1, -1, 9}};
constexpr static int sf_pattern[4][4] = {{9, 4, -1, 0}, {-1, 9, -1, 4}, {-1, -1, -1, 5}, {-1, -1, -1, 9}};
if (pending_paging.empty()) {
return false;
@ -538,18 +538,25 @@ bool rrc::is_paging_opportunity(uint32_t tti, uint32_t* payload_len)
std::vector<uint32_t> ue_to_remove;
int n = 0;
for (auto iter = pending_paging.begin(); n < ASN1_RRC_MAX_PAGE_REC && iter != pending_paging.end(); ++iter) {
LIBLTE_S1AP_UEPAGINGID_STRUCT u = (LIBLTE_S1AP_UEPAGINGID_STRUCT)iter->second;
uint32_t ueid = ((uint32_t)iter->first) % 1024;
for (auto& item : pending_paging) {
if (n >= ASN1_RRC_MAX_PAGE_REC) {
break;
}
LIBLTE_S1AP_UEPAGINGID_STRUCT u = (LIBLTE_S1AP_UEPAGINGID_STRUCT)item.second;
uint32_t ueid = ((uint32_t)item.first) % 1024;
uint32_t i_s = (ueid / N) % Ns;
if ((sfn % T) == (T / N) * (ueid % N)) {
if ((sfn % T) != (T / N) * (ueid % N)) {
continue;
}
int sf_idx = sf_pattern[i_s % 4][(Ns - 1) % 4];
if (sf_idx < 0) {
rrc_log->error("SF pattern is N/A for Ns=%d, i_s=%d, imsi_decimal=%d\n", Ns, i_s, ueid);
} else if ((uint32_t)sf_idx == (tti % 10)) {
continue;
}
if ((uint32_t)sf_idx == (tti % 10)) {
paging_rec->paging_record_list_present = true;
paging_record_s paging_elem;
if (u.choice_type == LIBLTE_S1AP_UEPAGINGID_CHOICE_IMSI) {
@ -573,7 +580,6 @@ bool rrc::is_paging_opportunity(uint32_t tti, uint32_t* payload_len)
rrc_log->info("Assembled paging for ue_id=%d, tti=%d\n", ueid, tti);
}
}
}
for (unsigned int i : ue_to_remove) {
pending_paging.erase(i);

Loading…
Cancel
Save