Commit Graph

366 Commits

Author SHA1 Message Date
Pau Espin 90a46d1d2a rlcmac: Implement UL TBF Countdown procedure
The Countdown procedure (decreasing CV field in UL RLCMAC data blocks)
is defined in TS 44.060 9.3.1.

It is implemented by means of counting/calculating the amount of RLC/MAC
blocks to be transmitted based on the LLC frames in the several LLC
queues, without actually generating the RLC/MAC blocks. The blocks
cannot be generated ahead of time because that wouldn't allow recreating
them in case Tx UL CS changes, or if a higher priority LLC frames
arrives.
The functions calculating the required amount of RLC/MAC blocks are
coded so that they early return to avoid spending more time than
necessary counting blocks (< BS_CV_MAX).
An extra heuristic optimization to be used when LLC queues are long is left
documented as a TODO, in order to test further the general non-optimized
path for now. Once the counting is proved to work reliably, that and
other heuristic optimizations ca be implemented, like keeping and
decreasing CV cached counter while no Tx CS change occurs or no new LLC
frames are enqueued.

Change-Id: If043c86a0c2b89d0ac0b8174de39fbcb22bed8cb
2023-06-06 12:54:38 +02:00
Pau Espin fd397fe215 gmm: Avoid submitting GMMSM-Release.ind if no session was requested
Change-Id: I2fecfd122fc4be863be184f1ff08d9a31e07b956
2023-05-31 14:47:56 +02:00
Pau Espin 7b9654c4d0 sm: Handle GMMSM-Release.ind
Change-Id: Ia2ac9dbffe29c3509f1088ceb327569a331ec598
2023-05-31 14:47:56 +02:00
Pau Espin 4c225a7912 rlcmac: Avoid generating UL data if no data to be sent available
Dummy LLC commands only make sense in the network->MS direction, in
order to delay closing the DL TBF (3GPP TS 44.064 6.4.2.2). That code in
the MS is a leftover from porting code from osmo-pcu.

Change-Id: I062aa9aea4f7d66a70ed53eae1c67780ddc3dca5
2023-05-29 16:22:13 +02:00
Pau Espin d2fd394e4d gmm: Implement rx RAU Reject
Change-Id: I0d4d8288b78cfd3140c786a52a3906eaf37ebe6b
2023-05-29 16:22:13 +02:00
Pau Espin b182b7c26d gmm: Fix typo checking IE presence in Rx Attach Rej
Change-Id: Ifaf653d89efd4ff4776e0e9b9e8dff625c4f9ebb
2023-05-29 16:22:13 +02:00
Pau Espin 5e083ed3b9 gmm: Initial implementation of T3166, rx Auth & Ciph Reject
As specified in 3GPP TS 24.008 Table 11.3/3.

Change-Id: I2c24b968e90cf5ec71fa8a777ec57b407eec015f
2023-05-29 16:22:13 +02:00
Pau Espin 120401f60d gmm: Tx Auth & Ciph Failure
Change-Id: I3ebb3dba20010e57f29dd5b8bbec457c2b08a8e1
2023-05-29 16:22:13 +02:00
Pau Espin cd5810291e gmm: Rename s/ciph_auth/auth_ciph/
The procedure is called "Authentication and ciphering", not the other
way around.

Change-Id: I02c7edede8db8dbe94e129529ad8fb03fe1b4089
2023-05-29 16:22:13 +02:00
Pau Espin 1576144542 gmm: Initial implementation of rx GMM Information msg
Basic implementation of gprs_gmm_decode_network_name() was cherry-picked
from osmocom-bb 2dfa84e73dca455900e6522f61f5c610077783b7
decode_network_name().

Change-Id: I9b81f8f9113a95cc75666dac5ff9e315d0845fcb
2023-05-29 16:22:13 +02:00
Pau Espin 770ed7fc24 gmm: Implement rx GMM STATUS msg
Change-Id: I46719a3bf6d5e93e25f41f01f5c2ab889ff62803
2023-05-29 16:22:10 +02:00
Pau Espin 42f51083f5 gmm: Implement submitting GMMSM-RELEASE.ind when MS becomes detached
Change-Id: I74176eba870b19b30666ab5deef5eb56f0f0fd83
2023-05-29 11:35:35 +02:00
Pau Espin 16ed7760f1 rlcmac: P1,P2 Rest Octets: Add missing final padding to definitions
Change-Id: I26f1405bd99a7c1aba0782a25e22a69943493a69
2023-05-29 11:35:35 +02:00
Pau Espin 7638cb7e7b gmm: Stop READY timer upon receiving force_stdby IE
Change-Id: I44d0f69571f6425fef74a10602001aca4ecb5716
2023-05-29 11:35:35 +02:00
Pau Espin 489499caa9 gmm: Implement P-TMSI Reallocation Cmd/Compl
Change-Id: I1bf8bf5f4299db7b026fed2e2c21c07f15690942
2023-05-29 11:35:32 +02:00
Pau Espin 9cf485e45b rlcmac: Submit GMMRR-PAGE.ind upon rx of Paging Request Type 1/2
Change-Id: I64db4277b5c54870a258d63c554f470011bcc989
2023-05-25 16:46:05 +02:00
Pau Espin 7bbdcc4414 gmm: Provide rlcmac with IMSI & PTMSI information
This information will be needed once the GRR layer starts listening for
paging requests, which identify MS by either PTMSI or IMSI.

Change-Id: I3a0c4a57c3d624c3ebb40ae2cc0c96626ccc2c99
2023-05-25 16:07:26 +02:00
Pau Espin c9f5abdbff gmm: Implement GMMR-PAGE.ind
Submit an LLGM-TRIGGER.req as described in TS 24.007 C.13.

Change-Id: Iba77b4a5280ce08f099f4e15934fa92d4ba8ba10
2023-05-25 15:48:44 +02:00
Pau Espin 8700df25d7 llc: Implement LLGM-TRIGGER.req
Change-Id: Id1af5912f407fe055a59a4bb217936307697975f
2023-05-25 15:28:31 +02:00
Pau Espin 409bb636d9 Fix typo llgm -> llgmm everywhere
Change-Id: Ic9cd63a6086526efdbd9184729bfae4b1cea56c1
2023-05-25 15:26:59 +02:00
Pau Espin 2a50ef7b07 rlcmac: Add APIs to decode P1/P2 Rest Octets
Change-Id: I59c6723d969880a4481e3b86a172d59f0edeb1e4
2023-05-25 15:10:19 +02:00
Pau Espin 5d8283f31b gmm: Implement periodic RAU procedure
Related: OS#5501
Change-Id: Ie7cba8a2fe3b97bebc558c957cc1bcbe3cc81dbc
2023-05-23 16:53:25 +02:00
Pau Espin 72ea2cf2fc llc: Add APIs to submit LLGM-trigger/suspend/resume.req primitives
This commit also adds an initial implementation of
LLGM-suspend/resume.req.

Change-Id: I890c7a4ace6fb8ca362ec41bd18e9c229191a587
2023-05-23 16:43:15 +02:00
Pau Espin 05b127acbb gmm: Initial implementation of T3312
The RAU procedure triggered by T3312 expiration will be implemented
in a follow-up patch.

Change-Id: If1ca164b7a6c7f7750e2e2f0812d6fde828ed4a4
2023-05-22 18:46:46 +02:00
Pau Espin a2fe6f302a gmm: Initial implementation of READY timer
Change-Id: I451ce08d80fb247c28819de065136e2e4d49f3f5
2023-05-22 17:45:01 +02:00
Pau Espin c6e7a3bd88 gmm: Introduce APIs & unit test to enc/dec GPRS Timer IE
enc/dec implementation and unit test are imported from osmo-sgsn.git
b83aabaa95695c61a64e5e990944f8e55934a976.

Change-Id: Ia3b903e8bc7890489390dcc5b2d4b60efd55dc2c
2023-05-22 13:42:12 +02:00
Pau Espin a03f36654b gmmrr: Add new LLC_TRANSMITTED.ind
This event doesn't show up as an explicit primitive in TS 24.007 GMMRR
SAP, but it is clearly needed to (re)arm the READY timer in GMM layer as
per TS 24.008 section 4.7.2.1.1:
"""
The READY timer is started:
- in the MS when the GMM entity receives an indication from lower layers that an LLC frame other than LLC
NULL frame has been transmitted on the radio interface;
"""

Change-Id: I9fd4047cfae4a12ad3be41860032eeda263d3276
2023-05-22 12:49:25 +02:00
Pau Espin 7d7040976f sm: Forward forth and back the P-TMSI signature
Change-Id: Ia69b6f885d612c42ab015822031e4c7262f4714e
2023-05-22 10:43:28 +02:00
Pau Espin 104562737c gmm: Forward forth and back the P-TMSI signature
Change-Id: Ibf12589e7d3029f80b4ced99992155deb9dba036
2023-05-22 10:43:28 +02:00
Pau Espin 73bc3768d9 rlcmac: Fix TFI not assigned during UL TBF CCCH ImmAss
Change-Id: Ieda67c27e2cfd75922efa9613cafce7adb639e5c
2023-05-22 08:42:47 +00:00
Pau Espin 824d00f9e7 sm: Provide RAI obtained from network
MS needs to store this information, hence the app needs to be provided
with it.

Change-Id: Icd357d8c7f4848441da011d59a4e520785d64779
2023-05-22 08:42:47 +00:00
Pau Espin 1947a84469 gmm: Provide RAI obtained from network
MS needs to store this information, hence the app needs to be provided
with it.

Change-Id: Ifdc4d0ccb8bb5ad145cd749bc83df202e91627a3
2023-05-22 08:42:47 +00:00
Pau Espin c57f5d70c4 sm: Allow passing old RAI during attach
This is stored by the MS and hence shall be passed by the application.

Change-Id: I13118bed3f7035ff9b4c2c21ed9557f48f5596e6
2023-05-22 08:42:47 +00:00
Pau Espin 1d1b704dca gmm: Allow passing old RAI during attach
This is stored by the MS and hence shall be passed by the application.

Change-Id: I22ffa8a169c09445e7126892616f61b8d01cbfe7
2023-05-22 08:42:47 +00:00
Vadim Yanitskiy a57e7293df copyright: fix typo: sysmocom s/s.m.f.c./s.f.m.c./ GmbH
Change-Id: I1235050daa0a7e6bb82a7bdcefeac4360dcaa188
2023-05-18 17:22:26 +07:00
Pau Espin 1ccc5e384b sm: Fix APN IE content not transmitted in Act PDP Ctx Req
Change-Id: I70be2ff5e7e0fea5e93d7b9963064c38a0382f30
2023-05-05 19:27:14 +02:00
Pau Espin ed7c99f6ba grr,bssgp,llc,sndcp: Define qos_params
3GPP TS 44.064 loosely defines "QoS params" on each primitive by listing
the fields, which are a bit different on each primitive.

Change-Id: I6760bace69d400edd4576ec2820e29b74f8dfca5
2023-05-05 18:38:19 +02:00
Pau Espin 4c2f0ced47 sm: Use & forward to upper layers the PTMSI & TLLI received from GMM
App and SM itself may need access to PTMSI or TLLI.

PTMSI:
- App may want to store it somewhere in order to reuse it next time
  it wants to GMM Attach.
TLLI:
- App will need the TLLI to identify the MS when sending/receiving
  primitives over SN SAP (app<->SNDCP).
- SM layer will need the TLLI to communicate over SNSM SAP (SM<->SNDCP),
  as well as relay the information to the app if the GMM Attach happens
  implicitly over SMREG-Act_Pdp_Ctx.req -> GMMSM-Establish-Req.

Change-Id: I7b1b8ac414474652b438f15b7f07961032a0f56d
2023-05-05 14:44:58 +02:00
Pau Espin 6979b511fb gmm: Provide allocated PTMSI & TLLI to upper layers
Upper layers (SM or app) may need access to PTMSI or TLLI.

PTMSI:
- App may want to store it somewhere in order to reuse it next time
   it wants to GMM Attach.
TLLI:
- App will need the TLLI to identify the MS when sending/receiving
  primitives over SN SAP (app<->SNDCP).
- SM layer will need the TLLI to communicate over SNSM SAP (SM<->SNDCP),
  as well as relay the information to the app if the GMM Attach happens
  implicitly over SMREG-Act_Pdp_Ctx.req -> GMMSM-Establish-Req.

Change-Id: I552c43c55409773e2d13b72cba45a866165f203f
2023-05-05 14:40:30 +02:00
Pau Espin a76164cd6e tests/gmm: Avoid printing rej_cause if GMMSM-Establish.cnf outcome is accepted
Otherwise it prints memory regions not really filled in.

Change-Id: I9c46e5a42e6b002f51ab19bc5d85b7bdd7da2a4f
2023-05-05 14:39:00 +02:00
Pau Espin f9f7bd31c3 gmm: Fix false positive compilation error with gcc 13.1.1
Newer gcc errors about "cause" being uninitialized, but cause is
guaranteed to be set in the "case GPRS_GMM_MS_EV_LOW_LVL_FAIL" path, it
just fails to find out.

Since the approach used previously is a bit hacky, let's simplify it.

Change-Id: I1c96b0aa92d4f9205a1d4d1760c787fe0e0ed169
2023-05-04 16:12:37 +02:00
Pau Espin 5913437a0c sm: Fix pdp_act_cnf.accepted flag value swapped
Change-Id: Ieb7b4ce7121b82c40dbd16a50981390b47d94c82
2023-05-03 14:44:15 +02:00
Pau Espin 028380ddbb sndcp: Initiate LL-XID.req only if we have something to send at L3
Change-Id: I324d841ae4d725d55d2807067cdd56c4457fa941
2023-05-03 14:44:15 +02:00
Pau Espin 1352cae927 sndcp: Allow cb users taking ownership of primitives
Change-Id: Ie3ddc835d8393e934d3f357108c81f639247c485
2023-05-03 14:44:11 +02:00
Pau Espin dbb588df52 llc: use GRR instead of BSSGP to tx XID.req in MS mode
Change-Id: Ib2ada2cc7160202f9da5b177da8263076e1eef69
2023-05-03 13:18:41 +02:00
Pau Espin d06e29bc9d sm: Avoid freeing the SME object too quickly
At that point in time we may still need it, for instance to send the
primitive to the upper layers. Still, we want it to be t the correct
state when that happens. Hence, delay freeing the object to happen in
next loop iteration, so that it is still available to submit the
primitive, and even skip freeing the object if the SM SAP user decides
to re-activate the PDP context in a synchronous code path from the
primitive callback.

Change-Id: I28655fc6286c92403e3e461cb6433b8567e20fd1
2023-05-03 12:26:43 +02:00
Pau Espin e23c097a5c sm: Implement rx Act PDP Ctx Rej
Change-Id: Ib534ebc2a3a0674675621da2f8bd0de218a08ef0
2023-05-03 12:26:43 +02:00
Pau Espin ab92a12c0a sm: Fix encoding of dynamic IP address in PDPActCtxReq
Change-Id: I2d830604d9d9a3f6939926ab67967d5527fdf5c3
2023-05-03 12:26:40 +02:00
Pau Espin 226c2a140c gmm: Implement GMMSM-UNITDATA.ind
Change-Id: Ib1ac220292c61419a65f27fa88a731357728459d
2023-05-03 11:17:36 +02:00
Pau Espin 644780008d gmm: Rework sess_id to identify one GMME
The GMM layer doesn't really have to differentiate between SM
connections, everything is sent over the LLC "GMM" SAPI.
However, we still want to identify/related a given MS if there are
multiple MS using the stack.

Change-Id: Ib757f016824d918ce8b74ae0c2a652a6c1823556
2023-05-02 20:01:44 +02:00