Commit Graph

3312 Commits

Author SHA1 Message Date
Vadim Yanitskiy 3b582af2eb modem: route L1CTL prims to/from libosmo-gprs-rlcmac
Change-Id: I38e9a686f8edc3fe55f961d75e68602c33bbbaaf
Related: OS#5500
2023-03-17 12:15:29 +00:00
Vadim Yanitskiy bb6df124d2 layer23: implement Rx/Tx API for GPRS related messages
Change-Id: I87950e893ef96ff8328f43f1548111aa9f66439b
Related: OS#5500
2023-03-17 12:15:29 +00:00
Vadim Yanitskiy 2b462dd89d {trxcon,virt_phy}: shared GPRS L1 (MAC) implementation
Change-Id: I9567d64f9d00262e36147e8d7e541e5e246bda5f
Related: OS#5500
2023-03-17 12:15:29 +00:00
Vadim Yanitskiy e15996378f modem: fix modem_gmm_prim_up_cb(): add missing break
Change-Id: Ibd16232d76d83d90f27d08b47aa38509161270b6
Fixes: CID#311019
2023-03-17 16:21:00 +07:00
Vadim Yanitskiy 4949ab7471 layer23/{mobile,modem}: prefix VTY prompt with project's name
Change-Id: If7ce89362c75e2c15995dfb08cfcfdcad24e2529
2023-03-17 16:11:48 +07:00
Vadim Yanitskiy b2dfbb8859 layer23/{mobile,modem}: fix segfault on VTY connection
It was a mistake to call vty_init(), passing it a pointer to the
vty_app_info structure allocated on the stack, because it gets
overwritten when the calling function _vty_init() returns.

Change-Id: I75843a964254243c70bedcf8ff97d854107ee21a
Fixes: 9feb5057 "layer23: refactor the application API concept"
2023-03-16 23:41:48 +00:00
Vadim Yanitskiy 42ca40dd1e modem: add test VTY command for sending raw LLC PDUs
Change-Id: I14f58e715d77a1b1cb40fdd3ddd09084360f2274
Related: OS#5500
2023-03-16 13:47:06 +00:00
Vadim Yanitskiy b29a26c620 modem: add test VTY command to send CHANNEL REQUEST
Do not call grr_tx_chan_req() unconditionally from grr_rx_bcch().
Add a special (hidden, expert mode) VTY command for that.

Change-Id: I049a8d7f58ae9703d06dff235973ba376702c873
Related: OS#5500
2023-03-16 13:46:53 +00:00
Pau Espin 1612c8f862 layer23: modem: Depend on libosmo-gprs-gmm
Related: OS#5501
Change-Id: I82a2b9c043eae42435ca781689fc3381e7a31bea
2023-03-15 15:38:54 +01:00
Vadim Yanitskiy 7ea900525c modem: clean up #includes (using include-what-you-use)
Change-Id: I728f3eea1590f46bef6e0eb4beb9714f6c9a1614
2023-03-14 15:06:26 +00:00
Vadim Yanitskiy 8240ef74fc modem: move GRR specific code into its own file
Change-Id: I25caa0bd01e3d090803512f5b13cad58439f44f8
Related: OS#5500
2023-03-14 15:06:26 +00:00
Pau Espin b8c3bef737 layer23: Call osmo_fd_unregister() before closing and changing bfd->fd
Change-Id: I886062c1a944acf0982755a7acddf7e2233d13a8
2023-03-14 12:17:36 +00:00
Vadim Yanitskiy 6db5f8b9ce modem: get rid of app_data.chan_req, use ms->rrlayer
Change-Id: I77d0a834a73c511f157c6f1524b9e98df3f4def4
Related: OS#5500
2023-03-14 18:51:09 +07:00
Vadim Yanitskiy 7f9c01f00f modem: get rid of app_data.{ccch_mode,si}, use ms->cellsel
Change-Id: Ib711a3b893c43c0875c431c90cd0a2ebfafe1926
Related: OS#5500
2023-03-14 18:51:09 +07:00
Vadim Yanitskiy 94bfc1d051 virt_phy: avoid confusion between RSSI (dBm) and RxLev (0..63)
Change-Id: I4f2982cd8fa1b7a47f983c9cd11bf0180f7878ec
Related: OS#5500
2023-03-13 21:43:45 +00:00
Vadim Yanitskiy 4b859aae59 virt_phy: cosmetic: make the linter happy about identifier names
Change-Id: I415f4b6f65c16a5dac84c75c5f97bf12109c74e5
Related: OS#5500
2023-03-13 21:43:45 +00:00
Vadim Yanitskiy 20ee798ffd virt_phy: cosmetic: make the linter happy about code indent
Change-Id: Iba777a4aff261006ae1aec9b583fecd12295c837
Related: OS#5500
2023-03-13 21:43:45 +00:00
Vadim Yanitskiy 0504bd028e virt_phy: clean up and improve Makefile.am
* Make virtphy_{SOURCES,LDADD} git-friendly: one file per line;
* Remove '-pthread' from LDADD, it's not really needed;
* Remove debugging leftovers.

Change-Id: Iccd07614aabfc2845424d25962f48e4231a50a90
Related: OS#5500
2023-03-13 21:43:45 +00:00
Vadim Yanitskiy 0b51656c06 virt_phy: rearrange and clean up header files
* Build up the usual include directory hierarchy.
* Move l1ctl_proto.h to 'include/osmocom/bb/'.
* System headers first, then libosmo*, the local ones.

Change-Id: I25145630ec53c2b8065a42fb12a778eec010f10c
Related: OS#5500
2023-03-13 21:43:45 +00:00
Vadim Yanitskiy 38ef3280d2 trxcon: do not send DATA.cnf for L1SCHED_DT_TRAFFIC
The event TRXCON_EV_TX_DATA_CNF is not premitted in state
TRXCON_ST_PACKET_DATA, and is not of any use for l1gprs.

Change-Id: Iee5ee404f1eb77091c388a641d0a78d01a8d7e7f
Related: OS#5500
2023-03-13 21:43:45 +00:00
Vadim Yanitskiy 67943df4b7 layer23: fix parsing of command line options
After the recent refactoring, parsing of the command line options is
broken for some arguments.  Specifically, the value of '-a'/'--arfcn'
is ignored and hard-coded ARFCN=871 is used instead.

The problem is that l23_app_init(), which allocates an MS state and
sets the initial ARFCN, is called *before* handle_options().  So the
cfg_test_arfcn is used before it gets overwritten from the argv[].

The usual approach in osmo-* apps is to parse the command line
arguments first, and only then execute code which depends on
configurable parameters.  Let's follow this approach too.

Change-Id: I77ca11c14561fa3fcb9add60ccea5b0b847a20c4
2023-03-13 06:18:02 +07:00
Vadim Yanitskiy 9feb5057da layer23: refactor the application API concept
With this set of changes we have a cleaner l23 app architecture:

* struct vty_app_info: all l23 applications must define this struct;
* struct vty_app_info: *cfg_supported() becomes a mask of L23_OPT_*;
* struct vty_app_info: explicitly set L23_OPT_* in all l23 apps;
* drop l23_app_info(), there can be only one vty_app_info per an app;

It's no more needed to obtain the vty_app_info by calling a function
and checking the returned value against NULL everywhere.  This kind
of information is rather static (not dynamically composed) and needs
not to be encapsulated into functions.

Change-Id: I89004cd5308927305f79b102f7b695709148df6d
2023-03-13 06:16:48 +07:00
Vadim Yanitskiy c43d4183f5 gprsdecode: Makefile.am: drop -Wno-missing-braces and -O3
Do not hard-code these CFLAGs, let the user decide on them.

Change-Id: I3a946b853029cc4cff9c2b15aa7339f84b2cb6c9
2023-03-13 02:52:34 +07:00
Vadim Yanitskiy 5adc13d69d trxcon: move l1ctl_proto.h to 'include/osmocom/bb/'
The upcoming l1gprs library will be using this header too.

Change-Id: I2101b20637f837038115497873bd905f95a3d0c2
2023-03-08 21:11:27 +00:00
Max 22f12ba92e vty: fix local-host docs
Change-Id: I69d0fa32105a3d114cdcae84ef2cc3ada578f13a
2023-03-08 22:05:07 +03:00
Max 736438693e mobile: allow configuring local GSMTAP address
Change-Id: Ia1555db653cf0bb20af74617f33aad31c971bfdb
2023-03-08 17:47:04 +00:00
Vadim Yanitskiy 6fe33fd6d4 trxcon: do not crash on receipt of 8-PSK modulated bursts
TRXDv0 PDUs may have 2 additional dummy bytes at the end.  Such
a PDU will crash trxcon if it contains an 8-PSK modulated burst:

  Assert failed phybi->burst_len <= sizeof(bi.burst)

In this case phybi->burst_len would be 444 + 2, while size of the
burst buffer in struct l1sched_burst_ind is limited to the length
of an 8-PSK modulated burst (444).

Change-Id: Icfba986ccf0c696ba019b91575b4d69db001c14f
2023-03-08 09:03:11 +00:00
Vadim Yanitskiy 616949a0be trxcon: use 3GPP TS 45.002 definitions from libosmogsm
Change-Id: Ieb3b502e1e5432e425a55c1217211b77e9ca91c9
Depends: libosmocore.git I1c38ccc2b64ba9046bb3b1221d99cc55ec493802
2023-03-08 09:03:11 +00:00
Oliver Smith ede61f5ded doc/manuals: set OSMO_REPOSITORY
Fix uploading manuals to the wrong directory.

Related: OS#5902
Change-Id: I71ff92fefa5cd84e0e25f9a1c1c9ec9f897a2edc
2023-03-07 14:15:16 +01:00
Max e2930dad35 mobile: log state/event details on error
Change-Id: I24a4635e9a9a0984c0e1036e8b6ea19b08a06223
2023-03-06 17:27:39 +00:00
Max 9a9fca7e1d mobile: deprecate --gsmtap-ip option
Change-Id: I44b355f9a0bafee16a284537de76662a61111b09
2023-03-06 15:19:56 +00:00
Max 69bbbc5249 mobile: log MCC/MNC of the network while registering
Change-Id: I114eade36303f161fea171745a1a9b05e461e349
2023-03-06 15:16:35 +00:00
Max 42beda4557 mobile: drop duplicated #define
Change-Id: If5bda46dcc5b541a9d08cfd880a2a8f181426484
2023-03-04 23:15:18 +03:00
Vadim Yanitskiy 0f06148896 l1ctl_proto.h: explicitly assign message type values
Explicit is better than implicit.  Having the message type values
assigned explicitly allows rearranging messages in the middle
without affecting the message type values following them.

Change-Id: I1ec32289a24c5704ea0676b508cb12ee0b4890d7
2023-02-27 22:56:32 +07:00
Pau Espin 35f93ac454 modem: Use libosmo-gprs-rlcmac L1CTL primitives
Related: OS#5500
Change-Id: I9d3066f19077796b2ccf70b15cc57b6488f015be
2023-02-27 14:50:56 +00:00
Max 0fb9853582 mobile: add vty statsd support
Change-Id: I7905b44478dcb9bcf0a1a68fde95f470c07edca3
2023-02-21 08:49:13 +00:00
Oliver Smith 65957cf877 Run struct_endianness.py
Ensure there is no diff to prepare to run this in CI.

Related: OS#5884
Change-Id: I617c967c5f34c0be2cf6fd43ceb1af17897f2bf1
2023-02-20 11:18:43 +01:00
Oliver Smith f6c1cec3b5 Cosmetic: fix encoding of ui-experiment/font.h
Remove characters 0x80 - 0xff from comments in this source file, as
they can't be parsed as UTF-8. This causes struct_endianness.py to
error on the file, git and gerrit can't display a proper diff and treat
it as binary file, etc.

Related: OS#5884
Change-Id: I0daebccf819595ee64fb4c9713a4f0ce219c58be
2023-02-20 11:11:03 +01:00
Vadim Yanitskiy 260025f39f trxcon: move AMR mode setting to l1sched_lchan_set_amr_cfg()
Change-Id: Ia9504d6194a4aac6256f7d4caf73eb42bb58563e
2023-02-14 07:20:31 +07:00
Vadim Yanitskiy d4d296f1ea trxcon: make l1sched_a5_burst_dec() accept l1sched_burst_ind
Change-Id: I5dd16cff1c9730a496748681842f571d25653cb9
2023-02-14 07:01:09 +07:00
Pau Espin f1e99e59e2 layer23: Support configuring GSMTAP through VTY in l23 apps.
This allow all l23 apps supporting L23_OPT_VTY and L23_OPT_TAP to
dynamically configure gsmtap through a "gsmtap" VTY node:

gsmtap
 remote-host 127.0.0.1
 lchan sacch
 lchan lsacch
 lchan sacch/4
 lchan sacch/8
 lchan sacch/f
 lchan sacch/h
 lchan unknown
 lchan bcch
 lchan ccch
 lchan rach
 lchan agch
 lchan pch
 lchan sdcch
 lchan sdcch/4
 lchan sdcch/8
 lchan facch/f
 lchan facch/h
 lchan pacch
 lchan cbch
 lchan pdch
 lchan pttch
 lchan cbch
 lchan tch/f
 lchan tch/h
 category gprs dl-unknown
 category gprs dl-dummy
 category gprs dl-ctrl
 category gprs dl-data-gprs
 category gprs dl-data-egprs
 category gprs ul-unknown
 category gprs ul-dummy
 category gprs ul-ctrl
 category gprs ul-data-gprs
 category gprs ul-data-egprs

VTY cmd "lchan" enables/disables tapping on general channel types,
while "category" allows fine-grained selection of messages being
tapped within the enabled lchan which would tap those messages.

Change-Id: I2582a1633d37d350a7f4c2bb5e03793bdf46e839
2023-02-02 18:18:21 +01:00
Pau Espin 3531b9afb6 layer23: Use updated libosmo-gprs-rlcmac header name
header file name gprs_rlcmac.h was renamed to csn1-defs.h during recent
libosmo-gprs-rlcmac development. Use the new names everywhere.

Depends: libosmo-gprs.git Change-Id I84ea63ed0b804699fd995a2e0c07ced17b3ad4c8

Change-Id: I205536907d9062b78453ce9bc404db1633e9a616
2023-02-01 17:38:52 +01:00
Pau Espin 59f3e4d4fb Get rid of openbsc leftover references
Get rid of the global variable since it's only used once inside a
function anyway.

Change-Id: I0b4f536b16f3693ef16de8505036943c3a30b1df
2023-01-31 12:30:07 +01:00
Pau Espin 738b65d240 layer23: Integreate mobile further into l23_app
Several functions and data structures in mobile app are refactored to
follow more closely the l23_app API and structures. These movements
allow starting to use already some shared infrastructure defined under
layer23/common.
This is not a full migration to l23_app, since mobile still keeps a
separate main() with a few extra code. This commit is rather a step
towards an eventual merge of mobile's main.cpp into
layer23/common/main.c

This is a preparation commit to later one adding gsmtap VTY configuration
to all l23 apps.

Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c
2023-01-31 11:59:08 +01:00
Pau Espin 60716bcfe6 modem: Initial integration of libosmo-gprs-rlcmac
This commit places code to forward unitdata LLC<->RLCMAC.

Depends: libosmo-gprs.git Change-Id I1870fa6a264612c5a669bfb832e6e8c0a892cb74
Related: OS#5500
Change-Id: I0e628d9ddaa5ad6a205f07746d4176d1b8df7eb0
2023-01-30 19:57:36 +00:00
Pau Espin 53996bb3d8 modem: Initial integration of libosmo-gprs-{llc,sndcp}
Change-Id: I820328009ccdd1f8112aeb163efa064ec1465d2a
2023-01-30 19:57:36 +00:00
Pau Espin 2b11e9e97d trxcon: Fix heap-use-after-free in l1ctl_client
If the peer connected to trxcon restarts the process, read() on the unix
socket in trxcon fails, and triggers closing the conn (l1ctl_client),
which ends up freeing the struct. This all happens during read_cb() of
the l1ctl_client wqueue. If the kernel also flags WRITE event in the
same main loop iteration, the wqueue code would end up using the freed
struct again when running the write_cb.

Make sure the read_cb returns -EBADF in the code branch closing the conn
in read_cb, since it makes no sense to handle a write_cb after that.
This saves the code from accessing the potentially freed struct.

Related: OS#5872
Change-Id: I100a8ba056a09b4e52675e3539640da0c0f8d837
2023-01-30 18:23:55 +01:00
Pau Espin c9cc4c305d Depend on libosmo-gprs-{llc,sndcp}
These will be needed for the MS to speak SNDCP and LLC.

Change-Id: I80811f73b798151257107bc94aedabe71fee0300
2023-01-19 20:02:17 +01:00
Pau Espin 3da09d1f7e layer23: Initial integration of tun device
Use the new tundev API from libosmocore to create tun devices for each
configured (and enbled) APN.
No address nor routes are yet set on the tun devices because we still
lack GMM/SNDCP/LLC/RLCMAC layers to negotiate them.

A follow up patch will add some code to interact with the SNDCP layer.

Depends: libosmocore.git Change-Id I3463271666df1e85746fb7b06ec45a17024b8c53
Change-Id: I86cac406843157aa2e51727cf8ccac9804d7961d
2023-01-19 20:02:07 +01:00
Pau Espin 6327f40be6 layer23: Introduce APN VTY node
This commit adds an initial set of VTY commands to manage APN
configuration and set up, which is used by the modem app.

The sample modem.cfg file is updated to showcase how to configure APNs.
The app doesn't do anything with them yet. A follow up patch will add
code to create tun devices for each configured APN.

Change-Id: I7b4eaa0de428b418bb1d89bd544694e89beb3e6e
2023-01-19 19:12:09 +01:00