Commit Graph

87 Commits

Author SHA1 Message Date
Vadim Yanitskiy fc11417ce6 tests/rlcmac: make linter happy: use const char * const
Change-Id: I26748681d13441fdfb9c46d9a476ea669b308ff7
2023-01-03 00:27:38 +07:00
Vadim Yanitskiy 36a6ff60f0 rlcmac: rename s/SI_13_t/SI13_RestOctets_t/
Change-Id: I74ed534b9b52b70cdf8e4e2d4d960bb1d9aaf27b
2023-01-02 12:56:38 +00:00
Vadim Yanitskiy 79a945feba rlcmac: use OSMO_ASSERT instead of plain assert()
Change-Id: Ia834285cbaba34e2f0783bf83bd2f3934d74d778
2023-01-02 12:56:38 +00:00
Vadim Yanitskiy 3095b63610 rlcmac: remove unneeded includes
Change-Id: Ie82fb9e5fe607f925bb8a698a789ef79f168add2
2023-01-02 12:56:38 +00:00
Vadim Yanitskiy caef6c1b13 rlcmac: implement the missing IA_MultiBlock_PktDlAss_t
Add missing definition for the <Multiple Blocks Packet Downlink
Assignment> structure.  It's not 100% complete, but should serve
a good starting point if we ever need to support this.

Change-Id: I544245f690fdd14a94f858a5f3cd8f8d39d17611
Related: OS#5500
2023-01-02 12:56:38 +00:00
Vadim Yanitskiy d2edff76d0 rlcmac: rename s/IA_EGPRS_00_t/IA_EGPRS_PktUlAss_t/
Use a self-explanatory name instead of the one with magic numbers.
It's safe to rename it because this API is not used anywhere yet.

Change-Id: I884cba359bfda21cf45fa846e5b7ff20d129bdf7
Related: OS#5500
2023-01-02 12:56:38 +00:00
Vadim Yanitskiy 376f2a1297 rlcmac: fix coding of EGPRS Packet Uplink Assignment in IA RestOctets
Thanks to the unit tests, it was found that decoding of the LH part,
specifically the EGPRS Packet Uplink Assignment structure, is done
incorrectly.  This patch fixes incorrect decoding.

Double usage of the UnionType element in the IA_EGPRS_t has a side
effect: the M_UINT actually consumes one bit, so the remaining bit
stream is shifted and decoded incorrectly.

Replace a combination of M_UINT and M_CHOICE with two M_UNIONs.
Remove struct IA_EGPRS_t, which is not used anywhere yet.

For reference, see 3GPP TS 44.018, table 10.5.2.16.1.

Change-Id: I7fedbad1ac4d744d1d3941553e573d4202e9d24a
Fixes: I39a29dc9b5b22ce4374ae33336696014e326d012
Related: OS#5500
2023-01-02 12:56:38 +00:00
Vadim Yanitskiy 84b385d15c rlcmac: add decoder and test vectors for IA Rest Octets
This new API is needed for the MS side GPRS implementation in order
to be able to establish an Uplink TBF.  Both wireshark and osmo-pcu
rely on hand-written code for parsing and generating the IA Rest
Octets IE, making no use of the CSN.1 codec.

We already have some (mostly commented out) CSN.1 definitions needed
for decoding the IA Rest Octets IE, inherited as-is from wireshark.
Ths patch adds the missing bits and a few unit test vectors.

Note that decoding of the LH part, specifically the EGPRS Packet
Uplink Assignment structure, is currently done incorrectly because
there is a problem in the IA_EGPRS_t definition.  This will be
fixed in a follow-up patch.

For reference, see 3GPP TS 44.018, table 10.5.2.16.1.

Change-Id: I39a29dc9b5b22ce4374ae33336696014e326d012
Related: OS#5500
2023-01-02 12:56:38 +00:00
Pau Espin 0d9bbbc7e5 osmo_gprs_llc_bssgp_prim: cell_id is always RAI + CI
As per what's specified in 3GPP TS 48.018 section 11.3.9 Cell
Identifier.

Change-Id: I1efcdbe3e42be35e191bcb1ae513c768d63096aa
2022-12-23 18:03:00 +01:00
Pau Espin f2c6bb980d llc: Initialize gprs_cipher
Change-Id: Ifac6239a3695b69f694eb55574de64a62b0787ed
2022-12-23 13:32:44 +01:00
Pau Espin 91c87d6907 llc: Proper separation of public & private APIs, Introduce llc_prim API
Most of the existing (and added) data structures are kept private, since
most of those don't really need to be used outside internal code in the
library.

Most if not all the interaction from upper and lower layers  towards LLC
is now done through the new llc_prim pubic interface. This interface is
based on 3GPP TS 44.064 section 7.1.2.

This commit also implements some of the code paths of the public API by
means on importing LLC code from osmo-sgsn.git commit
57b63875c762a784127a13becd1c2549ca6c5454.
The import of code cannot be done in a separate commit since existing code
in osmo-sgsn.git is low quality and has tons of layer violations in all
directions.
Hence, this commit aims at being an initial point of having some working
LLC stack by means of a few unit tests, but by no means aims to be a
total working implementation. Some code paths are missing; bugs are
expected at this point.

Related: OS#5502
Change-Id: I588eb576b2703262f4ab9566ec362920d8390cfd
2022-12-21 04:49:08 +07:00
Pau Espin f6e4b3be4c llc: rework logging, add LOGLLC macro
Change-Id: I8ad3267f890a21b6c935b36b256b00bd0a4da8d6
Related: OS#5502
2022-12-21 04:49:08 +07:00
Pau Espin 9f7a142868 llc: split up enum osmo_gprs_llc_prim_type
Change-Id: Ic5b7a2fb8d028a6e2031fb805189be4e92d80b9f
Related: OS#5502
2022-12-21 04:49:08 +07:00
Pau Espin 05a16204f9 llc: add enum osmo_gprs_llc_{location,prim_sap}
Change-Id: I5606c0b41196f25adbc00cfdce9927daaed9a901
Related: OS#5502
2022-12-21 04:48:19 +07:00
Pau Espin 1868001ee0 llc: add libosmogsm dependency
libosmogsm is needed for the follow-up patch [1].

Change-Id: Iee45fb87905ea29df02a48003396bde27e6c550c
Related: [1] I588eb576b2703262f4ab9566ec362920d8390cfd
Related: OS#5502
2022-12-21 03:46:08 +07:00
Pau Espin 3681629a29 llc: libosmo-gprs-llc.pc.in: add 'Requires.private: talloc'
This is needed for the follow-up patch [1].

Change-Id: Ie8ba61b124585e55accdaf2713b72e3ace78772f
Related: [1] I588eb576b2703262f4ab9566ec362920d8390cfd
Related: OS#5502
2022-12-21 03:45:41 +07:00
Pau Espin 384172005c llc: fix typo: OSMO_GPRS_LLC_SAPI_SNDCP{12->11}
Change-Id: Icee190d0e20044d3808a8b1beb237a987a795d8e
Related: OS#5502
2022-12-21 03:16:08 +07:00
Vadim Yanitskiy 4f1ee42c60 Add -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition
... if --enable-werror is used

Change-Id: I6d37291f66afacfc2d9cb7133f7240bbf87c0003
2022-11-05 03:52:41 +07:00
Vadim Yanitskiy 9987fd5592 contrib/jenkins.sh: build with --enable-werror
Change-Id: Ib61a8b464ae55ef055a3ea5a0de9b6b2d4a9044b
2022-11-05 03:52:35 +07:00
Vadim Yanitskiy 7768003cce tests/rlcmac/ts_44_018_test: do not depend on libosmogsm
Header file <osmocom/gsm/protocol/gsm_04_08.h> belongs to libosmogsm.
However, file 'contrib/libosmo-gprs.spec.in' does not list this lib
as a build dependency.  So building the RPM package currently fails.

We could have listed libosmogsm as 'BuildRequires', but given that
the only thing we use from this lib is the GSM_MACBLOCK_LEN macro,
there is no real need to depend on it.

Change-Id: Ieac350e7a05965c64e8ccf8dd17a569f0afd9514
2022-10-11 04:28:18 +07:00
Vadim Yanitskiy 4c624aaff8 tests/llc/pdu_codec_test: use const char * const
Not really important, just makes the linter happy.

Change-Id: I9b952b05fed11f26d2839314270e2862db3d036a
2022-09-28 23:01:16 +07:00
Vadim Yanitskiy 1880e28bbc llc: implement Exchange Identification (XID) codec
Change-Id: I16b3f7ab82c489144098aad0dccc4c67d8382c67
2022-09-28 23:01:16 +07:00
Vadim Yanitskiy 11d55e8fc4 llc: add missing enum osmo_gprs_llc_xid_type values
See 3GPP TS 44.064 version 16.0.0 Release 16, table 6.

Change-Id: Ifdca0c742727a030008a01848153c23e0e0017bd
2022-09-26 17:12:34 +07:00
Vadim Yanitskiy ed231df931 llc: add value-string for enum osmo_gprs_llc_xid_type
Change-Id: I90b6a1aa4e13984f4c43245df1308d0c3f82636f
2022-09-26 17:12:34 +07:00
Vadim Yanitskiy 38dce83bf6 llc: fix warning: 'struct msgb' declared inside parameter list
Change-Id: Idecb64f4838106a166f6a5cba5536a61de71c152
2022-09-26 17:12:34 +07:00
Vadim Yanitskiy ea26c243fc .gitignore: add missing debian/libosmo-gprs-llc*
Change-Id: I31ad48b75a5e2dfdce05731ab90146d66c776581
2022-09-26 17:12:34 +07:00
Vadim Yanitskiy 0b5a816356 llc: make logging category configurable
Similar to Icfef6de126304da81120f1d7b212992ead3409aa, let's add
osmo_gprs_llc_set_log_cat() allowing the API users to change
logging category for libosmo-gprs-llc (DLGLOBAL is default).

Change-Id: I9deb794db1c80257ba81523f815232208381bc27
2022-09-22 01:54:07 +07:00
Vadim Yanitskiy 22189e7329 llc: add definitions of service primitive parameters
Change-Id: Iaa520a818b05c962e0d3be9607d3a8c5991f539e
2022-09-22 01:02:21 +07:00
Vadim Yanitskiy f981c629d5 llc: rename enum osmo_gprs_llc_{primitive->prim_type}
Change-Id: Ie0f9cd174934c54940217b89e46568a7c1b76b96
2022-09-22 01:02:21 +07:00
Vadim Yanitskiy 4a108f3a89 llc: separate enum osmo_gprs_llc_primitive to llc_prim.h
Change-Id: Ida9ce56f48474313064d798ea7b9a72e9b99bb8d
2022-09-22 01:02:21 +07:00
Vadim Yanitskiy 19799d106e tests: reorganize llc/rlcmac specific dirs and files
Change-Id: I8592cea020dbbf64940266cd6af14b14d34be3a6
2022-09-22 01:02:21 +07:00
Vadim Yanitskiy 76ac335541 llc: osmo_gprs_llc_hdr_dump[_buf](): also print SAPI name
Change-Id: I95763e622bb3c3678c06901ddaecfc200d359d8d
2022-09-22 01:02:21 +07:00
Vadim Yanitskiy 0963447322 llc: add struct value_string osmo_gprs_llc_sapi_names[]
Change-Id: I8ae048ab9e6b63697951fa3f74ce671c88328f5f
2022-09-22 01:02:21 +07:00
Vadim Yanitskiy c892acda1f llc: re-define value-string API as static inline functions
Using static inline functions allows for type checking at compile-time.

Change-Id: I1b3245f62f5182aa91dbad7958d89220f7107337
Fixes: I6d0e1a878fb80c57a901da08798620a6ea4471a4
2022-09-22 01:00:37 +07:00
Vadim Yanitskiy c1ca5406bc llc: implement LLC PDU codec based on code from osmo-sgsn.git
osmo-sgsn.git 13ccbc1e6120fe78f6f9f950d7242090920ca41b

Change-Id: I61d7e2e6d0a8f2cdfc2113e637e447dc428cc70d
2022-09-22 00:56:15 +07:00
Vadim Yanitskiy bae1ec285b llc: add -export-symbols-regex '^osmo_' to CFLAGS
Change-Id: I7fac3ef730ea4b2719002dd61289b22c424f43f4
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy 4762fcc885 llc: import FCS (CRC24) calculation API from osmo-sgsn.git
osmo-sgsn.git fb6cf3221ef4989441c09a650011e4a334c37d12

Changes made:

* Add 'osmo_' prefix to gprs_llc_fcs(),
* osmo_gprs_llc_fcs() takes size_t and returns uint32_t,
* crc24_calc() takes size_t.

Change-Id: Ib4465c289d9ef2a1b8ef5730c559bc799bb1f012
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy fcd76ba2d1 llc: add definitions from 3GPP TS 44.064 section 6.4
Change-Id: I6d0e1a878fb80c57a901da08798620a6ea4471a4
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy 8ab2897836 llc: add missing LLE <-> (RLC/MAC,BSSGP) primitives
3GPP TS 44.064, section 7.1.2, Table 7: "LLC layer service primitives".

Change-Id: I10bb63220585424584185ce2bde2d9f8fd0d8342
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy d622de8362 llc: add missing LLGMM primitive types
From 3GPP TS 44.064 version 16.0.0 (2020-08) Release 16.

Change-Id: I85d3403f26ed1d80453affb7e01803402ccd7937
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy 4566897df8 llc: enum osmo_gprs_llc_primitive: drop Req/Ind/Rsp/Cnf
The libosmocore's prim API offers 'enum osmo_prim_operation', which
contains all required primitive operations: Req/Ind/Rsp/Cnf.  Having
LLC primitive types discriminated by operation is redundant.

Change-Id: Ifa7512d0f6c7d3577358fd1449707315ba55894d
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy 2f1755face llc: enum osmo_gprs_llc_sapi: fix spec reference
The actual SAPI values are given in section 6.2.3, table 2.

Change-Id: I84de7718e12b6b55a1735da148d7f8b0dacb72df
2022-09-18 20:45:44 +07:00
Vadim Yanitskiy 609e7b4cd4 llc: ensure all symbols have 'osmo_gprs_llc_' prefix
Change-Id: I569d8023d701bd14ee78baa9394b6983d9cafca8
2022-09-18 20:45:42 +07:00
Vadim Yanitskiy efef180c86 llc: check-in basic LLC definitions from osmo-sgsn.git
osmo-sgsn.git fb6cf3221ef4989441c09a650011e4a334c37d12

Change-Id: I6ed0f4820b3a12a00be71ce63757765551743101
2022-09-18 20:25:36 +07:00
Vadim Yanitskiy 2639b78795 Initial libosmo-gprs-llc library skeleton
Change-Id: Ia537acc6f4e6ab576dc7959d427b80f62c474296
2022-09-02 00:58:05 +07:00
Vadim Yanitskiy 4e50861ea0 rlcmac/ts_44_018: add missing M_PADDING_BITS to SI_13_t
According to table 10.5.2.37b.1, SI 13 Rest Octets IE does contain
spare padding.  Adding M_PADDING_BITS fixes decoder warnings about
unhandled remaining bits.

Change-Id: I44fb7e2a60da022ee99f1a6cd4f2635bef2bfe1e
2022-08-24 21:15:56 +07:00
Vadim Yanitskiy 74ec6d9cb6 rlcmac: add osmo_gprs_rlcmac_decode_si13ro()
Change-Id: Ic8446509ef474b8496e5557aab3d2a9e94e11897
2022-08-24 21:15:56 +07:00
Vadim Yanitskiy 4a04f1d5ab rlcmac: split ts_24_008.c out of ts_44_060.c
Change-Id: Idedf52423fef18b929e8096fbe4e130b5a6c7d2c
2022-08-24 21:15:53 +07:00
Vadim Yanitskiy 931b64ee79 rlcmac: split gprs_rlcmac.c onto ts_44_{060,018}.c
Change-Id: I2b941f06a70a25e92ba3fd2638f87360a5aa5435
2022-08-24 21:03:51 +07:00
Vadim Yanitskiy 8e3f0fd84a rlcmac: make logging category configurable
Change-Id: Icfef6de126304da81120f1d7b212992ead3409aa
2022-08-24 20:56:17 +07:00