Project

General

Profile

Actions

Feature #5502

open

MS-side LLC implementation

Added by laforge almost 2 years ago. Updated 7 months ago.

Status:
Stalled
Priority:
Normal
Assignee:
Category:
OsmocomBB mobile (host)
Target version:
Start date:
07/01/2022
Due date:
% Done:

80%

Resolution:
Spec Reference:
LLC: 3GPP TS 44.064, SNDCP: 3GPP TS 44.065
Tags:

Description

The LLC + SNDCP protocols are rather symmetrical, so the existing code from the network side (in osmo-sgsn should be possible to generalize rather easily


Subtasks 2 (1 open1 closed)

Bug #6124: LLC Dummy frames received from osmo-pcu dropped due to invalid FCSResolvedpespin07/31/2023

Actions
Bug #6125: LLC GIA/GEA (auth/encryption) not yet testedNewpespin07/31/2023

Actions

Related issues

Related to OsmocomBB - Feature #5501: MS-side GPRS Mobility Management (GMM) + Session Management (SM)Stalledpespin07/01/2022

Actions
Related to OsmocomBB - Feature #5500: MS-Side GPRS RLC/MAC implementationResolvedpespin07/01/2022

Actions
Actions #1

Updated by laforge almost 2 years ago

  • Related to Feature #5501: MS-side GPRS Mobility Management (GMM) + Session Management (SM) added
Actions #2

Updated by laforge almost 2 years ago

  • Tracker changed from Bug to Feature
Actions #3

Updated by laforge over 1 year ago

  • Tags set to ARDC
Actions #4

Updated by pespin over 1 year ago

  • Spec Reference set to 3GPP TS 44.064

Related primitives to use towards other layers can be found in 3GPP TS 44.064 section 7.1.2 "LLC layer service primitives"

Actions #5

Updated by fixeria over 1 year ago

  • Assignee set to pespin
Actions #6

Updated by pespin over 1 year ago

I started looking at this and took over the code initially pushed by fixeria to libosmo-gprs-llc.

Status there was that the enc/dec functionalitites were already ported, and the primitives and types descriptions were already put into a header file.

I looked at the related specs and I started adding what is going to be the public API based on "struct osmo_gprs_llc_prim" being pushed up and down by upper/lower layers.
Code I am working on can be found in libosmo-gprs.git branch "pespin/master".

Once I'm finished adding the required public APIs to generate the primitives, I'll continue implementing the osmo_gprs_llc_prim_upper_down() and osmo_gprs_llc_prim_lower_up() APIs.

For that, I'll basically need to integrate the data structures available already in osmo-sgsn. The code should be imported and modified to use the newly enc/dec functions prepared by fixeria.
OsmoSGSN already implements the 3GPP TS 44.064 C.2 FSM but without using an osmo-fsm. The idea is to try to import is first as it is, and later on move it to an osmo_fsm.

Hence the FSM and the dec/enc functions remain mainly private and not accessible from the upper/lower layers, which are expected to use mainly the primitive-based API.

Regarding the primitive API, something still not clear is what I should pass as "SAP" to them. I could add a "enum osmo_gprs_llc_sap { LLGM, LL, GRR, BSSGP }" and split enum osmo_gprs_llc_prim_type into per SAP enums, but I'm not sure if it's worth it?

Actions #7

Updated by pespin over 1 year ago

  • Status changed from New to In Progress
  • Spec Reference changed from 3GPP TS 44.064 to LLC: 3GPP TS 44.064, SNDCP: 3GPP TS 44.065
Actions #8

Updated by fixeria over 1 year ago

pespin wrote in #note-6:

For that, I'll basically need to integrate the data structures available already in osmo-sgsn. The code should be imported and modified to use the newly enc/dec functions prepared by fixeria.
OsmoSGSN already implements the 3GPP TS 44.064 C.2 FSM but without using an osmo-fsm. The idea is to try to import is first as it is, and later on move it to an osmo_fsm.

Ack.

Hence the FSM and the dec/enc functions remain mainly private and not accessible from the upper/lower layers, which are expected to use mainly the primitive-based API.

Full ack.

Regarding the primitive API, something still not clear is what I should pass as "SAP" to them. I could add a "enum osmo_gprs_llc_sap { LLGM, LL, GRR, BSSGP }" and split enum osmo_gprs_llc_prim_type into per SAP enums, but I'm not sure if it's worth it?

AFAIR, something like that was already proposed during code review. I don't have a strong preference here.

Actions #9

Updated by pespin over 1 year ago

  • % Done changed from 0 to 20

I already have a big part of LLC layer from osmo-sgsn imported into libosmo-gprs-llc, and today I started importing some of the SNDCP code into a new libosmo-gprs-sndcp.

Importing the code is taking quite a while due to osmo-sgsn having lots of code of different layers mangled together. Also some code paths which are expected to be async were done synchronously (like XID response from XID request).

Work done so far can be found at libosmo-gprs.git branch "pespin/master".

Once I have ported most of the code and it's in good enough shape, I may try to modify osmo-sgsn to use the new libraries in order to test them some more with an existing program.
In parallel also the "modem" app from osmocom-bb can be extended to use the SNDCP layer, and whatever comes/goes down LLC layer can be feed through a UDP packet to osmo-sgsn.

Actions #10

Updated by pespin over 1 year ago

  • % Done changed from 20 to 30

I'm half way with the initial SNDCP public API and import implementation from osmo-sgsn. Work done so far is kept in libosmo-gprs.git branch "pespin/master".

I submitted both commits (LLC & SNDCP) to gerrit. I'd for merging the LLC one already, so that other people working on adjacent stack parts can already make some uf of it or at least reuse some of the working infrastructure, spot bugs, reuse data structures, etc.

https://gerrit.osmocom.org/c/libosmo-gprs/+/30489 llc: Proper separation of public & private APIs, Introduce llc_prim API
https://gerrit.osmocom.org/c/libosmo-gprs/+/30490 sndcp: Initial libosmo-gprs-sndcp support

Next steps:
- Keep porting stuff from osmo-sgsn gprs_sndcp.c to libosmo-gprs-sndcp.git
- Attempt porting osmo-sgsn to use libosmo-gprs-{llc,sndcp} and have as many tests passing.
- Start using the SNDCP upper and LLC lower interface in modem, by pushing down an IP pkt and transmitting the generated LLC to osmo-sgsn through a UDP socket.

Actions #11

Updated by pespin over 1 year ago

I'm still WIP importing the SNDCP layer from osmo-sgsn.

I realized I need to create a new data structure to hold management data shared by all sne (sndcp_entity). What's called in TS 44.065 "SNDCP management entity". This is used to keep track of the XID params at SNDCP layer. In osmo-sgsn this data structure doesn't exist, because the data is stored doing layer violation in "llme" pointer, which is 1 to 1 with the new data structure I need to create.
Then I also have that structure "snme" accessible and refcounted by all "sne" (sndcp_entity" pointers.

Actions #12

Updated by pespin over 1 year ago

  • % Done changed from 30 to 40

I finished the initial integration of osmo-sgsn code for both LLC and SNDCP into libosmo-gprs-*.
The biggest LLC patch has already been merged.
Initial SNDCP support in libosmo-gprs has been submitted to gerrit:
https://gerrit.osmocom.org/c/libosmo-gprs/+/30490 sndcp: Initial libosmo-gprs-sndcp support

I am now working on modifying osmo-sgsn to use the new libraries, which is also quite a lot of work, but that's the best way to test the library is working and to debug several aspects of it. Also to make sure we have everything we need in the API.
I have WIP state in osmo-sgsn.git branch "pespin/llc".

Actions #13

Updated by pespin about 1 year ago

I have been doing quite a lot of osmo-sgsn clean up and refactoring (bunch of patches in gerrit), in order to split stuff into different modules and make it easier to replace code with libosmo-gprs.

self note: Some info on TLLI+RAI and NSAPI to identify MS can be found at 3GPP TS 23.060 section "14.3 NSAPI and TLLI for A/Gb mode"

Actions #14

Updated by pespin about 1 year ago

  • % Done changed from 40 to 50

Today I added initial support to forward GRR unitdata primitive up/down the stack in libosmo-gprs:
https://gerrit.osmocom.org/c/libosmo-gprs/+/31049

I also tested sending a GMM Attach Req LLC->GRR with the modem app and verified it was forwarded to the modem app callback.

This will allow start testing against the RLC/MAC (libosmo-gprs-rlcmac) API.

Actions #15

Updated by pespin about 1 year ago

  • Related to Feature #5500: MS-Side GPRS RLC/MAC implementation added
Actions #16

Updated by pespin 11 months ago

LLC layer seems to be working at least up to the point to do the full GMM attach + SM Activate PDP Ctx.

Stuff still needed to be tested (and which may still not work properly):
- encryption
- Transmit user data (tun->sndcp->llc)

I also noticed that when we receive LLC Dummy frames transmitted by PCU from the GRR-UNITdata.ind, the LLC code discards them due to wrong FCS reported 0x2b2b2b2 instead of the expected value.

The missing bits are right now a bit hard to test due to instabilities and missing features in the lower layers.

Actions #17

Updated by pespin 7 months ago

  • Status changed from In Progress to Stalled
  • % Done changed from 50 to 80

pespin wrote in #note-16:

Stuff still needed to be tested (and which may still not work properly):
- encryption

TODO.

- Transmit user data (tun->sndcp->llc)

This has been tested to work with ping, iperf3, etc.

I also noticed that when we receive LLC Dummy frames transmitted by PCU from the GRR-UNITdata.ind, the LLC code discards them due to wrong FCS reported 0x2b2b2b2 instead of the expected value.

This was expected as per spec and code was updated to allow it.

Marking as stalled since this layer is in general doing its job and the focus is right now on the lower layers which are creating most of the instabilities.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)