Commit Graph

509 Commits

Author SHA1 Message Date
Alejandro Leal Conejos 1a64c6adad Enum fixes so clang 12 can build the repo 2021-10-14 08:48:04 +02:00
David Rupprecht 5c44d774d0 Added 5G Metrics 2021-10-12 10:48:10 +02:00
David Rupprecht 59e847ba08 Added NAS 5G args 2021-10-12 10:48:10 +02:00
David Rupprecht 5910d8847a Split NAS security ctxt 2021-10-12 10:48:10 +02:00
Francisco b8976ca463 nr,ue,rrc: avoid configuring the CSI until NR RA is complete 2021-10-08 12:15:55 +01:00
Francisco 47e5e85449 refactor: clean unnecessary includes of the asn1/rrc_nr.h 2021-10-07 23:08:07 +01:00
Bedran Karakoc 1e1e1420b1 Return AUTS in authentication failure for case AUTH_SYNCH_FAILURE 2021-10-06 20:01:00 +02:00
Bedran Karakoc de750fad09 Added helper function for replayed security capabilities 2021-10-06 20:01:00 +02:00
Bedran Karakoc 193ec4abfa Trigger switch_off in NAS 2021-10-06 20:01:00 +02:00
Bedran Karakoc 441251bdd1 Remove unused parameter 2021-10-06 20:01:00 +02:00
Bedran Karakoc a4cc9b6ca0 Fix handle_authentication_request and add handler for authentication reject 2021-10-06 20:01:00 +02:00
Bedran Karakoc e8bcc0a61e Added handler for identity request and sender for identity response 2021-10-06 20:01:00 +02:00
Bedran Karakoc 850606f20b Added deregistration (UE terminating) 2021-10-06 20:01:00 +02:00
faluco a9c65bd369 UE: Implement a thread safe wrapper class for accessing the mac_grant_ul_t member in ul_harq_process.
This fixes many race conditions detected by TSAN around this class.
2021-10-06 14:47:23 +02:00
faluco 6c4548c243 Fix several data races in LTE and NR harq classes. 2021-10-06 14:47:23 +02:00
Andre Puschmann bf2606f94e ue,mac_nr: fix race condition by using thread-safe RNTI class 2021-09-30 10:36:29 +02:00
Ismael Gomez c09f09b7be Move rrc_common from srsue to lib 2021-09-29 21:39:56 +02:00
Fabian Eckermann 8830c2796f Add support for NSA FDD on band n3, n5 and n7. 2021-09-29 16:03:44 +02:00
Andre Puschmann bed4cfb5e5 ue,mac_nr: fix generation of padding BSRs
* in Msg3 don't add explicit SBSR (rely on padding BSR to add)
* fix padding BSR generation to always use padding bytes to add it
2021-09-27 21:15:30 +02:00
faluco fa351cd285 Rename functions that contain the unsafe word to nolock.
The term "unsafe" does not clearly state that the function is not locking the shared date and it sounds "dangerous", so use a more explicit term.
2021-09-27 13:26:21 +02:00
Bedran Karakoc 43915550cc NGAP GTP Bearer Establishment 2021-09-22 15:15:47 +02:00
David Rupprecht 3712983308 Added PDU Session est request 2021-09-22 15:15:47 +02:00
David Rupprecht c670383ae9 Added NAS 5G functions incoming msg and reg proc 2021-09-22 15:15:47 +02:00
faluco 55f5f74ff3 Fixed case where calling gw::setup_if_addr after ue attachment would spawn a new thread without closing the current one.
This would end up being a resource leak as the number of threads grow forever until the application crashes.
2021-09-22 13:26:59 +02:00
Andre Puschmann 26cc6d7886 ue: remove stack type parameter
for the moment we always use the LTE stack (also for NSA mode).
For SA we likely pick a smarter approach to pick the stack type, i.e.
using the ARFCN specified in the config.
2021-09-22 10:56:56 +02:00
faluco c2b705c5ce Fix several data races in proc_phr, class needs to be fully protected since most member variables are accessed by different threads. 2021-09-17 11:34:28 +02:00
faluco 6b07e886b7 Fix data race in is_first_ul_grant. 2021-09-17 11:34:28 +02:00
faluco 7dae4a491e Fix data race in ue_stack_lte::ul_dropped_sdus. 2021-09-17 11:34:28 +02:00
faluco 1796e12084 Fix data race in ul_harq_entity. 2021-09-17 11:34:28 +02:00
faluco 2b73beb3dd Fix data race in ul_harq. 2021-09-17 11:34:28 +02:00
David Rupprecht e8a464228d Cleaned string helpers 2021-09-16 15:24:32 +02:00
Andre Puschmann ab6210b1fc ue,proc_sr_nr: add mutex to protect access from PHY and Stack
also detected by TSAN
2021-09-16 15:22:59 +02:00
Andre Puschmann 2248e63219 ue,proc_ra_nr: add mutex to protect access from PHY and Stack
detected with TSAN
2021-09-16 15:22:59 +02:00
Andre Puschmann f382a7c7db Revert "ue,proc_ra_nr: add temporary flag to skip RAR reception"
This reverts commit 28668aac34.
2021-09-09 14:29:04 +02:00
Andre Puschmann 5a936d9940 ue,rrc: handle DRB removal correctly
when RRC receives a command to remove a DRB, it also needs to delete
the bearer at RLC and PDCP
2021-09-09 14:29:04 +02:00
Andre Puschmann 54ab64327a ue,mac_nr: move BSR levels lookup table into lib header
prepare for shared use with gNB
2021-09-09 14:29:04 +02:00
David Rupprecht a9a23214b0 Added more 5G security kdfs
Added new 5G SIM functions

Added const parameters for security functions
2021-09-07 11:06:56 +02:00
David Rupprecht a645d74eaf USIM functions for res star
Added gen_res_star in security.h

Added USIM interfaces for res star

Added RES star test case
2021-09-07 11:06:56 +02:00
Francisco Paisana f4df55c245 stack lte: separate bearer manager into two classes, one for the ue and one for the enb 2021-09-03 12:06:17 +02:00
Andre Puschmann db8b710442 bearer_manager: move to lib folder and extend for multiple users
prepare bearer manager to be used by eNB which requires
to support multiple RNTIs
2021-09-02 17:12:04 +02:00
Andre Puschmann 40499e6b6d ue_stack_lte: use std::atomic for running var 2021-08-31 17:01:50 +02:00
Andre Puschmann 79cdc28015 nas_test_common: call NAS layer from stack thread context
since NAS layers insn't thread safe, all calls must come from
the same thread
2021-08-31 17:00:59 +02:00
Andre Puschmann 78d60bc138 nas: remove all uses of atomic from 4G and 5G classes
the NAS classes aren't thread safe and thread-safety shouldn't be
pretended by using atomics. Remove them and add explicit notice.
2021-08-31 17:00:59 +02:00
Ismael Gomez 7839ab09dc Add RLF-Reportv9 to srsUE 2021-08-23 16:34:33 +02:00
David Rupprecht 3217c00cfc Adjusting NAS base security function to 5G 2021-08-19 11:03:06 +02:00
Andre Puschmann 28668aac34 ue,proc_ra_nr: add temporary flag to skip RAR reception
this will be removed again as soon as the eNB supports full RAR
transmission.
2021-08-02 15:18:47 +02:00
Andre Puschmann 99dc94ab38 nas: make state variables atomics
NAS states and substates maybe be requested from other threads so
they need to be protected.

Note that the caller still needs to hold it's own mutex if different
actions are required based on the state.
2021-08-01 11:41:11 +02:00
David Rupprecht 04ef6e120d Added new SIM functions to get MCC, MNC and MSIN 2021-07-27 09:26:52 +02:00
Andre Puschmann 9c298b203d srsue: reduce the default RRC release to 8 (minimum value) 2021-07-26 11:04:02 +02:00
David Rupprecht 2563a78f34 Added basic 5G NAS metrics 2021-07-22 19:41:26 +02:00
David Rupprecht 9172059078 Supply ctor with logger instead of fetching 2021-07-22 14:12:39 +02:00
David Rupprecht 0217bf5332 Fixed name space for rrc ue 2021-07-16 10:09:07 +02:00
David Rupprecht fb92118bb7 Add 5G NAS infrastructure 2021-07-14 13:38:08 +02:00
David Rupprecht 505225d845 Added ue nas base class with security functions 2021-07-14 13:38:08 +02:00
David Rupprecht 7fa85ab336 Added nas test common file 2021-07-14 13:38:08 +02:00
Andre Puschmann e0d9afc342 proc_ra: fix race detected with TSAN
rar_received is accessed from PHY worker and Stack thread
2021-07-13 10:16:36 +02:00
Ismael Gomez 4e39982a19
Fix TSAN warnings in UE (#3021)
* Protect PHY SR signal management in a class

* Protect intra_freq_meas vector

* Protect cell and srate shared variables in thread-safe classes

* srsue,srsenb: include TSAN options header

* Protect ue_rnti_t and rnti scheduling windows behind thread-safe classes

* Protect access to state variable in sync_state

* Protect access to metrics configuration

* Protect access to is_pending_sr

* Protect access to UE prach worker

* Protect UE mux

* Avoid unlocking mutex twice

* Fix data races in RF/ZMQ

* Fix data races in intra_measure and PHY

* Fix minor data races in MAC

* Make TSAN default behaviour to not halt on error

* Fix blocking in intra cell measurement

* Address comments

Co-authored-by: Andre Puschmann <andre@softwareradiosystems.com>
2021-07-01 17:39:54 +02:00
Pedro Alvarez 171d5727be Moved lib RLC into it's own folder 2021-06-30 18:19:20 +01:00
Andre Puschmann 0a16f48869 gw: fix race condition
GW thread was checking the default_eps_bearer variable without
protection. RRC could update it when deleting DRB or receiving RRC
connection release.
2021-06-28 17:35:02 +02:00
Andre Puschmann 368c7b9e4f ue,stack: clear all EPS bearers when going RRC idle
the EPS bearer manager was only informed when a single DRB
was removed but not when entering idle which requires to
remove all bearers.

This cause the service request to fail.
2021-06-28 17:35:02 +02:00
Andre Puschmann 5313fb99d6 tft: add helper to delete all TFTs for EPS bearer
when a EPS bearer is removed, all associated TFTs need
to be removed as well.
2021-06-24 16:52:58 +02:00
Andre Puschmann 483a216bd5 ue,stack: refactor handling of radio bearears in UE stack
this is a rather large commit that is hard to split because
it touches quite a few components.

It's a preparation patch for adding NR split bearers in the next
step.

We realized that managing RLC and PDCP bearers for both NR and LTE
in the same entity doesn't work. This is because we use the LCID
as a key for all accesses. With NR dual connectivity however we
can have the same LCID active at the same time for both LTE and NR
carriers.

The patch solves that by creating a dedicated NR instance for RLC/PDCP
in the stack. But then the question arises for UL traffic on, e.g. LCID 4
what PDCP instance the GW should use for pushing SDUs. It doesnt' know
that. And in fact it doesn't need to. It just needs to know EPS
bearer IDs. So the next change was to remove the knowledge of what
LCIDs are from the GW. Make is agnostic and only work on EPS bearer IDs.

The handling and mapping between EPS bearer IDs and LCIDs for LTE
or NR (mainly PDCP for pushing data) is done in the Stack because
it has access to both.

The NAS also has a EPS bearer map but only knows about default and
dedicated bearers. It doesn't know on which logical channels they
are transmitted.
2021-06-24 16:52:58 +02:00
Andre Puschmann 3f9c069ff7 ue_stack_lte: add RLC and PDCP entities for NR 2021-06-24 16:52:58 +02:00
David Rupprecht d1d8500ce5 Add testcase for reconfiguration 2021-06-24 16:52:58 +02:00
Andre Puschmann e2c496d825 srsue,mac: fix race between PHY and MAC when stopping UE
the issue let to unwanted log warning at the end of the UE
execution when the PHY was still pushing DL PDUs while MAC
was already stopped.

This fixes #3003
2021-06-24 16:46:25 +02:00
Ismael Gomez e35a0d72fa Revert UE changes 2021-06-18 23:17:14 +02:00
Ismael Gomez dd9889e07c Add carrier index to uplink PCAP captures 2021-06-18 23:17:14 +02:00
Pedro Alvarez 299d2ee35d Added interface to make the PDCP notify the RRC of integrity check
failures.
2021-06-08 18:52:22 +01:00
Andre Puschmann aaffdeb326 rrc,rlc: add method to signal protocol failure to RRC
general-purpose method for lower layers to signal protocol
failures to higher layers, i.e. RRC.

In the current case, implement a direct release of the UE (enb) or
a reestablishment (UE).
2021-06-03 21:11:47 +02:00
Francisco 486823e5de sched,bugfix: The PHR handling scheme now considers the number of PRBs of the UL grant that carried the PHR. Before, it was assuming the most conservative scenario of Nprb=1 2021-06-03 15:33:38 +01:00
Andre Puschmann 018c734b09 dl_harq: fix unlocking of unlocked mutex bug detected by TSAN
in the mac_test the tb_decoded() method was called twice for
the 2nd codeword, causig TSAN to complain about an unlocked mutex
being unlocked.

The patch resolves the potential issue only calling tb_decoded
for a grant/tb thas has a non-zero MCS.

The patch also adjusts the reset function to have a safe and "unsafe"
version to be called from inside the class, similar to other
classes where we do the same.
2021-05-31 10:54:14 +02:00
Andre Puschmann b40867ffec ue,rrc: add simple connection setup procedure
this is an attempt to fix #2850 by defering the transmission of
the connection setup complete until the PHY has applied
the dedicated config in the connection setup.
2021-05-26 14:43:52 +02:00
David Rupprecht 8c194b887b Allow NAS init function to fail 2021-05-04 19:18:22 +02:00
David Rupprecht 617fb2ba7e Added default destructor for args 2021-05-04 19:17:34 +02:00
David Rupprecht 102a943171 Fixed naming srsLTE to srsRAN 2021-04-23 14:25:02 +02:00
David Rupprecht fd451e8be3 Configure Short PDCP NR SN support 2021-04-23 12:49:53 +02:00
Andre Puschmann e3b77fd82a rrc_nr: set timeout for NR cell measurement to 250ms
the low timout of 10ms was:
1) causing too frequent measurement reports
2) causes a MO ping test to fail where the ICMP request
was sent on the LTE carrier but never got a reply because
the MCG addition was inbetween
2021-04-21 12:50:43 +02:00
David Rupprecht d2aa25d451 Added option for simulated measurement 2021-04-20 21:47:37 +02:00
Xavier Arteaga 715f8900a8 Selected NR RA procedure PRACH send timeout according to system frame number period from PRACH PHY tables 2021-04-20 15:07:18 +02:00
Andre Puschmann 4b3538aaa8 {dl,ul}_harq: fix metrics calculation
rewrite  metrics calculation for NR HARQ and remove
unneeded operations.
2021-04-20 15:05:20 +02:00
Andre Puschmann b6f2c80f66 mac_common: add helper method to get total buffer state 2021-04-20 15:05:20 +02:00
David Rupprecht a064e85c54 rename common lte header 2021-04-19 22:23:59 +02:00
David Rupprecht 81ad72b0ff Refactor srb and drb handling 2021-04-19 22:23:59 +02:00
David Rupprecht 91ff8a2e6d Add rrc_nr to rlc init function 2021-04-19 22:23:59 +02:00
Andre Puschmann c8d3e133dc ue: bump default RRC release announced to 15 2021-04-19 22:08:03 +02:00
David Rupprecht 75cd5e65e5 Removed arfcn and freq, and nof_prbs from config file 2021-04-19 15:18:35 +02:00
David Rupprecht bfe2ad98ef Added parsing for NR DL HARQ cfg 2021-04-17 12:33:21 +02:00
Andre Puschmann b9ae064338 mac_nr: add DL HARQ
this commit adds a complete DL HARQ entity to the MAC of the UE.
It also refactors demux into an own class and adapts the PHY-MAC
interface to use the new MAC capabilities.
2021-04-16 15:32:09 +02:00
David Rupprecht fe8727050b Added new rrc_nr to phy flattening functions and fixes 2021-04-16 09:02:29 +02:00
David Rupprecht 4c68c17bd3 Fixed log level of nr loggers to lte level and hex size 2021-04-15 12:12:20 +02:00
Andre Puschmann 44baea6666 mac_nr: add UL HARQ
this patch adds a basic UL HARQ entity for NR.

The patch also updates some interfaces between MAC/RA/HARQ,
i.e. get_temp_crnti().

It also adds a Msg3 unit test.
2021-04-14 13:40:31 +02:00
David Rupprecht eeddbe69ce Fixes repeating proc RA due to SR trigger 2021-04-12 20:51:07 +02:00
David Rupprecht 5a3a2a6d6f Added functions for adding phr and tag config 2021-04-12 20:50:30 +02:00
Francisco f7a8b8bf94 separate drb srb ids into separate enum types 2021-04-12 13:21:43 +01:00
Francisco 21718af3b6 avoid allocating std::string to get lcid radio bearer name. Refactored the lte radio bearer enum type 2021-04-12 13:21:43 +01:00
Andre Puschmann cf696138d3 mac_nr: fix packing order of SDU and CEs
SDUs need to go first in the MAC PDU, followed by CEs
2021-04-10 14:01:43 +02:00
Andre Puschmann 7f415189f3 ue,mac: enable basic MAC metrics
this adds basic MAC metrics calculation for the DL NR MAC
2021-04-10 14:01:43 +02:00
Andre Puschmann db496df1e6 mac_nr: add support for periodic BSR reporting
building on the previous refactor this patch now adds support
for peridoic BSR reporting (using short BSR). It furthermore does
the following changes:

* add BSR packing
* add proc_bsr_nr unit test
* move mac_nr test code into test folder under src (needs to be done with other test code too)
2021-04-09 12:28:05 +02:00
David Rupprecht 56e947bf27 Added functionality for releasing a NR bearer 2021-04-08 17:37:36 +02:00
David Rupprecht cc6d8128ad Added gw interface if it is running 2021-04-08 17:37:36 +02:00