Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
de27eb68
Commit
de27eb68
authored
May 16, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RRC developments
parent
5e0d35c6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
3 deletions
+90
-3
src/ue/nas/mm/mm.hpp
src/ue/nas/mm/mm.hpp
+3
-1
src/ue/nas/mm/radio.cpp
src/ue/nas/mm/radio.cpp
+58
-1
src/ue/types.hpp
src/ue/types.hpp
+2
-1
src/utils/common_types.cpp
src/utils/common_types.cpp
+10
-0
src/utils/common_types.hpp
src/utils/common_types.hpp
+3
-0
src/utils/locked.hpp
src/utils/locked.hpp
+14
-0
No files found.
src/ue/nas/mm/mm.hpp
View file @
de27eb68
...
...
@@ -57,9 +57,11 @@ class NasMm
// Network feature support information
nas
::
IE5gsNetworkFeatureSupport
m_nwFeatureSupport
{};
// Last time Service Request needed indication for Data
long
m_lastTimeServiceReqNeededIndForData
{};
int64_t
m_lastTimeServiceReqNeededIndForData
{};
// Number of times the network failing the authentication check
int
m_nwConsecutiveAuthFailure
{};
// Last time PLMN search failure logged
int64_t
m_lastTimePlmnSearchFailureLogged
{};
friend
class
UeCmdHandler
;
...
...
src/ue/nas/mm/radio.cpp
View file @
de27eb68
...
...
@@ -7,18 +7,75 @@
//
#include "mm.hpp"
#include <algorithm>
#include <lib/nas/utils.hpp>
#include <ue/app/task.hpp>
#include <ue/nas/sm/sm.hpp>
#include <ue/rrc/task.hpp>
#include <utils/common.hpp>
namespace
nr
::
ue
{
void
NasMm
::
performPlmnSelection
()
{
// TODO
int64_t
currentTime
=
utils
::
CurrentTimeMillis
();
bool
logFailures
=
currentTime
-
m_lastTimePlmnSearchFailureLogged
>=
10'000
;
Plmn
lastSelectedPlmn
=
m_base
->
shCtx
.
selectedPlmn
.
get
();
std
::
unordered_set
<
Plmn
>
plmns
=
m_base
->
shCtx
.
availablePlmns
.
get
();
if
(
!
m_usim
->
isValid
()
||
plmns
.
empty
())
{
if
(
logFailures
)
{
if
(
!
m_usim
->
isValid
())
m_logger
->
warn
(
"No PLMN can be selected, USIM is invalid"
);
else
m_logger
->
err
(
"PLMN selection failure, no cells in coverage"
);
m_lastTimePlmnSearchFailureLogged
=
currentTime
;
}
m_base
->
shCtx
.
selectedPlmn
.
set
({});
return
;
}
std
::
vector
<
Plmn
>
candidates
;
for
(
auto
&
plmn
:
plmns
)
if
(
plmn
==
m_base
->
config
->
hplmn
)
candidates
.
push_back
(
plmn
);
for
(
auto
&
plmn
:
plmns
)
{
if
(
plmn
==
m_base
->
config
->
hplmn
)
continue
;
if
(
nas
::
utils
::
PlmnListContains
(
m_usim
->
m_forbiddenPlmnList
,
plmn
))
continue
;
if
(
nas
::
utils
::
ServiceAreaListForbidsPlmn
(
m_usim
->
m_serviceAreaList
,
nas
::
utils
::
PlmnFrom
(
plmn
)))
continue
;
if
(
nas
::
utils
::
PlmnListContains
(
m_usim
->
m_equivalentPlmnList
,
plmn
))
candidates
.
push_back
(
plmn
);
}
Plmn
selected
=
candidates
.
empty
()
?
Plmn
{}
:
candidates
[
0
];
if
(
!
selected
.
hasValue
())
{
if
(
logFailures
)
{
m_logger
->
err
(
"No PLMN could be selected among [%d] PLMNs"
,
static_cast
<
int
>
(
plmns
.
size
()));
m_lastTimePlmnSearchFailureLogged
=
currentTime
;
}
}
else
if
(
lastSelectedPlmn
!=
selected
)
m_logger
->
info
(
"Selected PLMN[%s]"
,
ToJson
(
selected
).
str
().
c_str
());
m_base
->
shCtx
.
selectedPlmn
.
set
(
selected
);
}
void
NasMm
::
handleServingCellChange
(
const
UeCellInfo
&
servingCell
)
...
...
src/ue/types.hpp
View file @
de27eb68
...
...
@@ -140,7 +140,8 @@ struct UeConfig
struct
UeSharedContext
{
Locked
<
std
::
unordered_set
<
Plmn
>>
availablePlmns
{};
Locked
<
std
::
unordered_set
<
Plmn
>>
availablePlmns
;
Locked
<
Plmn
>
selectedPlmn
;
};
struct
TaskBase
...
...
src/utils/common_types.cpp
View file @
de27eb68
...
...
@@ -96,6 +96,11 @@ bool operator==(const Plmn &lhs, const Plmn &rhs)
return
lhs
.
isLongMnc
==
rhs
.
isLongMnc
;
}
bool
operator
!=
(
const
Plmn
&
lhs
,
const
Plmn
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
bool
operator
==
(
const
GlobalNci
&
lhs
,
const
GlobalNci
&
rhs
)
{
return
lhs
.
plmn
==
rhs
.
plmn
&&
lhs
.
nci
==
rhs
.
nci
;
...
...
@@ -123,3 +128,8 @@ std::size_t std::hash<GlobalNci>::operator()(const GlobalNci &v) const noexcept
utils
::
HashCombine
(
h
,
v
.
nci
);
return
h
;
}
bool
Plmn
::
hasValue
()
const
{
return
this
->
mcc
!=
0
;
}
src/utils/common_types.hpp
View file @
de27eb68
...
...
@@ -30,6 +30,8 @@ struct Plmn
int
mcc
{};
int
mnc
{};
bool
isLongMnc
{};
[[
nodiscard
]]
bool
hasValue
()
const
;
};
struct
SingleSlice
...
...
@@ -197,6 +199,7 @@ struct UacAiBarringSet
bool
operator
==
(
const
SingleSlice
&
lhs
,
const
SingleSlice
&
rhs
);
bool
operator
==
(
const
Plmn
&
lhs
,
const
Plmn
&
rhs
);
bool
operator
!=
(
const
Plmn
&
lhs
,
const
Plmn
&
rhs
);
bool
operator
==
(
const
GlobalNci
&
lhs
,
const
GlobalNci
&
rhs
);
Json
ToJson
(
const
Supi
&
v
);
...
...
src/utils/locked.hpp
View file @
de27eb68
...
...
@@ -24,6 +24,8 @@ class Locked
{
}
static_assert
(
!
std
::
is_reference
<
T
>::
value
);
Locked
(
const
T
&
)
=
delete
;
Locked
(
T
&&
)
=
delete
;
...
...
@@ -43,4 +45,16 @@ class Locked
std
::
lock_guard
lk
(
m_mutex
);
fun
(
m_value
);
}
inline
T
get
()
{
T
copy
{};
access
([
&
copy
](
auto
&
value
)
{
copy
=
value
;
});
return
copy
;
}
inline
void
set
(
const
T
&
value
)
{
mutate
([
&
value
](
auto
&
v
)
{
v
=
value
;
});
}
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment