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
e121c5c7
Commit
e121c5c7
authored
Feb 21, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PS local release improvement
parent
9206684b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
72 deletions
+132
-72
src/ue/app/task.cpp
src/ue/app/task.cpp
+7
-0
src/ue/mm/dereg.cpp
src/ue/mm/dereg.cpp
+4
-2
src/ue/nts.hpp
src/ue/nts.hpp
+4
-0
src/ue/sm/allocation.cpp
src/ue/sm/allocation.cpp
+103
-0
src/ue/sm/resource.cpp
src/ue/sm/resource.cpp
+8
-68
src/ue/sm/sm.hpp
src/ue/sm/sm.hpp
+6
-2
No files found.
src/ue/app/task.cpp
View file @
e121c5c7
...
@@ -137,6 +137,13 @@ void UeAppTask::receiveStatusUpdate(NwUeStatusUpdate &msg)
...
@@ -137,6 +137,13 @@ void UeAppTask::receiveStatusUpdate(NwUeStatusUpdate &msg)
m_statusInfo
.
pduSessions
[
session
->
id
]
=
std
::
move
(
sessionInfo
);
m_statusInfo
.
pduSessions
[
session
->
id
]
=
std
::
move
(
sessionInfo
);
setupTunInterface
(
session
);
setupTunInterface
(
session
);
return
;
}
if
(
msg
.
what
==
NwUeStatusUpdate
::
SESSION_RELEASE
)
{
// TODO
m_logger
->
err
(
"todo: release"
);
}
}
}
}
...
...
src/ue/mm/dereg.cpp
View file @
e121c5c7
...
@@ -56,7 +56,8 @@ void NasMm::sendDeregistration(nas::ESwitchOff switchOff, bool dueToDisable5g)
...
@@ -56,7 +56,8 @@ void NasMm::sendDeregistration(nas::ESwitchOff switchOff, bool dueToDisable5g)
switchMmState
(
EMmState
::
MM_DEREGISTERED_INITIATED
,
EMmSubState
::
MM_DEREGISTERED_INITIATED_NA
);
switchMmState
(
EMmState
::
MM_DEREGISTERED_INITIATED
,
EMmSubState
::
MM_DEREGISTERED_INITIATED_NA
);
// TODO local release of all PDU sessions
// Release all PDU sessions
m_sm
->
localReleaseSession
(
0
);
if
(
switchOff
==
nas
::
ESwitchOff
::
SWITCH_OFF
)
if
(
switchOff
==
nas
::
ESwitchOff
::
SWITCH_OFF
)
m_base
->
appTask
->
push
(
new
NwUeNasToApp
(
NwUeNasToApp
::
PERFORM_SWITCH_OFF
));
m_base
->
appTask
->
push
(
new
NwUeNasToApp
(
NwUeNasToApp
::
PERFORM_SWITCH_OFF
));
...
@@ -137,7 +138,8 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi
...
@@ -137,7 +138,8 @@ void NasMm::receiveDeregistrationRequest(const nas::DeRegistrationRequestUeTermi
msg
.
deRegistrationType
.
reRegistrationRequired
==
nas
::
EReRegistrationRequired
::
REQUIRED
&&
msg
.
deRegistrationType
.
reRegistrationRequired
==
nas
::
EReRegistrationRequired
::
REQUIRED
&&
!
forceIgnoreReregistration
;
!
forceIgnoreReregistration
;
// todo local release of pdu sessions
// Release all PDU sessions
m_sm
->
localReleaseSession
(
0
);
if
(
reRegistrationRequired
)
if
(
reRegistrationRequired
)
{
{
...
...
src/ue/nts.hpp
View file @
e121c5c7
...
@@ -239,12 +239,16 @@ struct NwUeNasToApp : NtsMessage
...
@@ -239,12 +239,16 @@ struct NwUeNasToApp : NtsMessage
struct
NwUeStatusUpdate
:
NtsMessage
struct
NwUeStatusUpdate
:
NtsMessage
{
{
static
constexpr
const
int
SESSION_ESTABLISHMENT
=
1
;
static
constexpr
const
int
SESSION_ESTABLISHMENT
=
1
;
static
constexpr
const
int
SESSION_RELEASE
=
2
;
const
int
what
{};
const
int
what
{};
// SESSION_ESTABLISHMENT
// SESSION_ESTABLISHMENT
PduSession
*
pduSession
{};
PduSession
*
pduSession
{};
// SESSION_RELEASE
int
psi
{};
// psi=0 means release all of the sessions
explicit
NwUeStatusUpdate
(
const
int
what
)
:
NtsMessage
(
NtsMessageType
::
UE_STATUS_UPDATE
),
what
(
what
)
explicit
NwUeStatusUpdate
(
const
int
what
)
:
NtsMessage
(
NtsMessageType
::
UE_STATUS_UPDATE
),
what
(
what
)
{
{
}
}
...
...
src/ue/sm/allocation.cpp
0 → 100644
View file @
e121c5c7
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include "sm.hpp"
#include <nas/utils.hpp>
namespace
nr
::
ue
{
int
NasSm
::
allocatePduSessionId
(
const
SessionConfig
&
config
)
{
if
(
config
.
type
!=
nas
::
EPduSessionType
::
IPV4
)
{
m_logger
->
debug
(
"PDU session type [%s] is not supported"
,
nas
::
utils
::
EnumToString
(
config
.
type
));
return
0
;
}
auto
&
arr
=
m_pduSessions
;
int
id
=
-
1
;
for
(
int
i
=
PduSession
::
MIN_ID
;
i
<=
PduSession
::
MAX_ID
;
i
++
)
{
if
(
arr
[
i
].
id
==
0
)
{
id
=
i
;
break
;
}
}
if
(
id
==
-
1
)
{
m_logger
->
err
(
"PDU session allocation failed"
);
return
0
;
}
arr
[
id
]
=
{};
arr
[
id
].
id
=
id
;
arr
[
id
].
isEstablished
=
false
;
arr
[
id
].
apn
=
config
.
apn
;
arr
[
id
].
sessionType
=
config
.
type
;
arr
[
id
].
sNssai
=
config
.
sNssai
;
return
id
;
}
int
NasSm
::
allocateProcedureTransactionId
()
{
auto
&
arr
=
m_procedureTransactions
;
int
id
=
-
1
;
for
(
int
i
=
ProcedureTransaction
::
MIN_ID
;
i
<=
ProcedureTransaction
::
MAX_ID
;
i
++
)
{
if
(
arr
[
i
].
id
==
0
)
{
id
=
i
;
break
;
}
}
if
(
id
==
-
1
)
{
m_logger
->
err
(
"PTI allocation failed"
);
return
0
;
}
arr
[
id
]
=
{};
arr
[
id
].
id
=
id
;
return
id
;
}
void
NasSm
::
freeProcedureTransactionId
(
int
pti
)
{
if
(
pti
==
0
)
{
for
(
auto
&
transaction
:
m_procedureTransactions
)
transaction
=
{};
}
else
{
m_procedureTransactions
[
pti
].
id
=
0
;
}
}
void
NasSm
::
freePduSessionId
(
int
psi
)
{
if
(
psi
==
0
)
{
for
(
auto
&
session
:
m_pduSessions
)
session
=
{};
}
else
{
m_pduSessions
[
psi
]
=
{};
}
}
}
// namespace nr::ue
\ No newline at end of file
src/ue/sm/resource.cpp
View file @
e121c5c7
...
@@ -7,82 +7,22 @@
...
@@ -7,82 +7,22 @@
//
//
#include "sm.hpp"
#include "sm.hpp"
#include <nas/proto_conf.hpp>
#include <nas/utils.hpp>
#include <nas/utils.hpp>
#include <ue/app/task.hpp>
namespace
nr
::
ue
namespace
nr
::
ue
{
{
int
NasSm
::
allocatePduSessionId
(
const
SessionConfig
&
config
)
void
NasSm
::
localReleaseSession
(
int
psi
)
{
{
if
(
config
.
type
!=
nas
::
EPduSessionType
::
IPV4
)
m_logger
->
debug
(
"Performing local release of PDU session[%d]"
,
psi
);
{
m_logger
->
debug
(
"PDU session type [%s] is not supported"
,
nas
::
utils
::
EnumToString
(
config
.
type
));
return
0
;
}
auto
&
arr
=
m_pduSessions
;
freePduSessionId
(
psi
)
;
int
id
=
-
1
;
auto
*
statusUpdate
=
new
NwUeStatusUpdate
(
NwUeStatusUpdate
::
SESSION_RELEASE
);
for
(
int
i
=
PduSession
::
MIN_ID
;
i
<=
PduSession
::
MAX_ID
;
i
++
)
statusUpdate
->
psi
=
psi
;
{
m_base
->
appTask
->
push
(
statusUpdate
);
if
(
arr
[
i
].
id
==
0
)
{
id
=
i
;
break
;
}
}
if
(
id
==
-
1
)
{
m_logger
->
err
(
"PDU session allocation failed"
);
return
0
;
}
arr
[
id
]
=
{};
arr
[
id
].
id
=
id
;
arr
[
id
].
isEstablished
=
false
;
arr
[
id
].
apn
=
config
.
apn
;
arr
[
id
].
sessionType
=
config
.
type
;
arr
[
id
].
sNssai
=
config
.
sNssai
;
return
id
;
}
int
NasSm
::
allocateProcedureTransactionId
()
{
auto
&
arr
=
m_procedureTransactions
;
int
id
=
-
1
;
for
(
int
i
=
ProcedureTransaction
::
MIN_ID
;
i
<=
ProcedureTransaction
::
MAX_ID
;
i
++
)
{
if
(
arr
[
i
].
id
==
0
)
{
id
=
i
;
break
;
}
}
if
(
id
==
-
1
)
{
m_logger
->
err
(
"PTI allocation failed"
);
return
0
;
}
arr
[
id
]
=
{};
arr
[
id
].
id
=
id
;
return
id
;
}
void
NasSm
::
freeProcedureTransactionId
(
int
pti
)
{
m_procedureTransactions
[
pti
].
id
=
0
;
}
void
NasSm
::
freePduSessionId
(
int
psi
)
{
m_pduSessions
[
psi
].
id
=
0
;
m_logger
->
info
(
"PDU session[%d] released"
,
psi
);
}
}
}
// namespace nr::ue
}
// namespace nr::ue
\ No newline at end of file
src/ue/sm/sm.hpp
View file @
e121c5c7
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#pragma once
#pragma once
#include <array>
#include <nas/nas.hpp>
#include <nas/nas.hpp>
#include <nas/timer.hpp>
#include <nas/timer.hpp>
#include <ue/nts.hpp>
#include <ue/nts.hpp>
...
@@ -27,7 +28,7 @@ class NasSm
...
@@ -27,7 +28,7 @@ class NasSm
std
::
unique_ptr
<
Logger
>
m_logger
;
std
::
unique_ptr
<
Logger
>
m_logger
;
NasMm
*
m_mm
;
NasMm
*
m_mm
;
PduSession
m_pduSessions
[
16
]
{};
std
::
array
<
PduSession
,
16
>
m_pduSessions
{};
ProcedureTransaction
m_procedureTransactions
[
255
]{};
ProcedureTransaction
m_procedureTransactions
[
255
]{};
friend
class
UeCmdHandler
;
friend
class
UeCmdHandler
;
...
@@ -44,13 +45,16 @@ class NasSm
...
@@ -44,13 +45,16 @@ class NasSm
/* Transport */
/* Transport */
void
receiveSmMessage
(
const
nas
::
SmMessage
&
msg
);
void
receiveSmMessage
(
const
nas
::
SmMessage
&
msg
);
/* Resource */
void
localReleaseSession
(
int
psi
);
private:
private:
/* Transport */
/* Transport */
void
sendSmMessage
(
int
psi
,
const
nas
::
SmMessage
&
msg
);
void
sendSmMessage
(
int
psi
,
const
nas
::
SmMessage
&
msg
);
void
receiveSmStatus
(
const
nas
::
FiveGSmStatus
&
msg
);
void
receiveSmStatus
(
const
nas
::
FiveGSmStatus
&
msg
);
void
receiveSmCause
(
const
nas
::
IE5gSmCause
&
msg
);
void
receiveSmCause
(
const
nas
::
IE5gSmCause
&
msg
);
/*
Resource
*/
/*
Allocation
*/
int
allocatePduSessionId
(
const
SessionConfig
&
config
);
int
allocatePduSessionId
(
const
SessionConfig
&
config
);
int
allocateProcedureTransactionId
();
int
allocateProcedureTransactionId
();
void
freeProcedureTransactionId
(
int
pti
);
void
freeProcedureTransactionId
(
int
pti
);
...
...
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