Commit Graph

27 Commits

Author SHA1 Message Date
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 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 8d7192673c virt_phy: support building with -Werror
Change-Id: Iccd2575faadee1ad3982466bf6a07fa5d52b0250
2022-11-05 19:05:15 +07:00
Harald Welte c429e7a1d8 virtphy: Add command line arguments to set multicast netdev + TTL
This allows us to bind the multicast sockets to a given network device
and/or to set the TTL of the multicast frames and hence control their
reach in terms of number of network hops.

Change-Id: Ia74aa381a4c1921cb8c7e263842a864ea8028139
Related: OS#2966
2020-03-10 18:58:55 +01:00
Harald Welte 17a9089452 virtphy: Sync virtual_um.[ch] with osmo-bts
The files are used in both projects, and while the osmo-bts code has
evolved, this copy didn't.  Let's sync again (to libosmocore
change-Id I303f2e616d2d32b5a8005c3dcf0f5fad19ad3445).

Change-Id: I189ee28a85a6d7a7a07b062f6b07012478503e8f
Depends: libosmocore.git Ib52d22710020b56965aefcef09bde8247ace4a9c
Related: OS#2966
2020-03-10 18:58:55 +01:00
Harald Welte cfd28d5e29 virtphy: Handle strtok() returning NULL on first call
Change-Id: I37bfb91cf75982bfa2f75bd62d0c13859268cd93
Closes: CID#198565
2019-07-21 09:04:16 +02:00
Philipp Maier 1f578082e9 cosmetic: add commandline help
There is no helptext for the commandline options, which makes it
difficult for new users to use the program.

- Add commandline help

Change-Id: I8d04644342acd64432742f96e32dc9f2e0e91c20
2018-08-27 13:03:20 +02:00
Harald Welte 3595402641 virtphy: Add SIGINT+SIGTERM handlers
Change-Id: I2fe65e0c1912c4d72c276a2db169f0bdbcbda2b8
2017-08-20 22:19:17 +02:00
Harald Welte 5e0fa863cb VIRT-PHY: enable proper memory leak debugging
We make sure that all allocations are tracked back to one talloc root
context, and install the usual SIGUSR1 handler to dump the talloc
report.  This enables us to do interactive debugging for memory leaks
while virtphy is running.

Change-Id: I73b3cf86eea5f56595c1b045cf0fde8035ff185a
2017-07-19 14:10:04 +02:00
Harald Welte dd3fd10903 VIRT-PHY: We don't do line-breaks inside log statements
Change-Id: I27cba13ee782c53a9b2406319241fc7f4e3db0bd
2017-07-19 14:00:09 +02:00
Harald Welte f122d4cd36 VIRT-PHY: Properly destroy l1_model_ms after disconnect
If a MS disconnects, we need to clean up all related state

Change-Id: Ib7adef61150b5a4338483019e4dd75d7279d1f5d
2017-07-19 13:53:30 +02:00
Harald Welte c0fba7a298 VIRT-PHY: Change default log levels
This will basically only print L1C message for all L1CTL happening
between MS and the BTS, while suppressing the GSMTAP/virtUM and L1P
related messages.

Change-Id: I9513db3cee12644ed9b9858e13b740ffd27aba24
2017-07-19 13:39:54 +02:00
Harald Welte f7dafcc5d2 VIRT-PHY: Separate logging of L1 Control and L1 Data
L1 Data is quite verbose, while control is typically limited, so let's
make sure we log them as separate sub-systems

Change-Id: Idebc371a63508c593855486ff01b2ba6e8c2cfd1
2017-07-19 12:14:35 +02:00
Harald Welte 198dbda3c8 VIRT-PHY: Log MS context number whenever possible
Now that we can have multiple MS connected to one virtphy instance,
it is important to log some context whenever possible.  To do so, we
introduce a monotonically increasing MS number which gets assigned
whenever we allocate a l1_model_ms and printed when the LOGPMS() or
DEBUGPMS() macros are used.

Change-Id: Id7d9507126a03def5bd7690f1dbe987f9a749e65
2017-07-19 11:53:13 +02:00
Harald Welte f5e0f6424b VIRT-PHY: Major rewrite to deal with muliple L1CTL clients
Change-Id: Ibfb2a93f8b45a95215c01368b1a52d92283474e6
2017-07-19 11:30:26 +02:00
Harald Welte ef9ee6116b VIRT-PHY: Don't redefine GSMTAP port number, use libosmocore
Change-Id: I11d04d76292c52ec5ab70893e8c6a2e55586b2ec
2017-07-19 00:32:36 +02:00
Harald Welte c2083feefa VIRT-PHY: reorganize data structures
* l1_model_ms can become a static member of l1_model_ms
* crypto_info_ms can become a static member of l1_state_ms

Change-Id: I94ca4dad1c6c668ce6307d5e5d728b1c1502af12
2017-07-18 22:18:52 +02:00
Harald Welte 7e65a1483f VIRT-PHY: coding style / API usage cleanup
This is the result of my manual clean-up of the many coding style issues
found in the stumpf/virt-phy branch of OsmocomBB.  Some may remain, but
it's much closer to what we're used to in the Osmocom world now.

Change-Id: I3aa95dbef75d7749d490aad0237d074528527e8b
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 203f7e0c7f VIRT-PHY: Configurable signal power reductions for multiple arfcns.
Model was expanded and holds now power management information consisting
of an array of received power levels for all arfcns and one for the
reduction of this signal in dbm. The reduction is configurable by
commandline by --arfcn-sig-lev-red 666,12:888,13. The signal level is
assumed to be max level (-63) if a packet from that arfcn is received
within a timeframe (also configurable via  cmd -- timeout-pm 5:800 ==
<seconds>:<microseconds>). After that timeout it will be reduced to min
level (-110).

Change-Id: I369ca26703f14bba4e9334b8f417deef640462f9
2017-07-12 23:26:26 +02:00
Sebastian Stumpf ba1f7c2974 VIRT-PHY: Added option parsing.
Available options:
dl-rx-grp: mcast group messages on downlink are received from
ul-tx-grp: mcast group messages on uplink are sent to
port: port used for mcast sockets
log-mask: logging mask
l1ctl-sock: l1ctl socket path to connect to l23

Change-Id: Id939e5d7b90b592c85ad19f3ad6f459351e2d8f6
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 7ea7b8ac05 VIRT-PHY: Add downlink filter for msg on dedicated channels.
Messages incoming on dedicated channel (SDCCH/8, SDCCH/4) are no longer
forwarded to l23 if their timeslot/subchannel is not fitting the ones
configured by l23 via L1CTL_DM_EST_REQ.

Change-Id: I6112b20e31c25636e53d3a6cda6f7443a94ff9c3
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 360de6bead VIRT-PHY: Data and traffic req from l23 now use scheduler.
Msgs are not put on virt um directly in the handler like before, but are
scheduled. FN they are scheduled with not yet properly calculated.

Also, code was extracted from lactl_sap.c into own files.

Change-Id: Ibe57abebadf294f1407d82cef3fd0b51e7c1b23e
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 63f3ce2482 VIRT-PHY: Uplink scheduler implementation.
Implemented simple scheduler depending on frame number in downlink. It
will be executed each time we receive a msg on downlink and send out all
scheduled uplink msgs with a sched_fn smaller than the one of this
received downlink msg.

Further refactored l1ctl_sap by extracting rach and fbsb logic and
putting it to own files virt_prim_fbsb.c and virt_prim_rach.c

Added simple states to the ms layer 1 model, indicating if the ms is
currently searching for bts, syncing to or camping on a bts. Downlink
will be handled differently dependent of the state.

Change-Id: I8937b1d6568f5d3750bbdc5d77fa283074d5365e
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 5490fa9097 VIRT-PHY: Enable multiple phy-instances by configurable l1ctl-sock-path.
Change-Id: Ief22eedacd1929450ff68f553068b95a778df80f
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 2e265c897a VIRT-PHY: Cleanup dirs, makefile, dependencies and formatting code.
Change-Id: Ibd68a03bcc439c262ba513782936c6b62937eaaa
2017-07-12 23:26:26 +02:00
Sebastian Stumpf fa2ce6396f VIRT_PHY: Improved l1ctl-to-l23 interface + gsmtap header parsing.
Fixed mapping from gsmtap msg type to rsl msg type and vice versa.
Proper chan_nr decoding instead of usage of dummy values for timeslot /
link_id / subslot.
Implemented missing l23 rx handler routines.

Change-Id: Ibad741d112643c55091b8ba00164b05d728ae1a1
2017-07-12 23:26:26 +02:00
Sebastian Stumpf a4aaa14878 VIRT-PHY: Initial commit of virt-phy to work with osmo-bts virt-phy.
This patch implements a virtual physical layer replacing the air
interface. The purpose is to get rid of the hardware requirements
and be able to start testing and implementing layer 2 communication
functionality on one machine. Multicast sockets are used to enable
bidirectional communication between the BTS and the MS process.
The GSMTAP protocol designed for wireshark capturing is used to
encapsulate the payload on the virtual physical layer.
The virtual physical layer on the osmocom-bb side implements the
L1CTL interface to the layer23 apps like mobile.

* Working mcast socket communication and extraction of its
  functionality.
* Basic handlers for file descriptor callbacks from incoming L1CTL
  messages and extraction of that functionality to a l1ctl socket class.
* Multiplexing to different routines depending on incoming L1CTL
  message type.
* Uses virt_um and osmocom_mcast_sock implementation from osmo-bts
  virt-phy.
* Ecapsulation and parsing methods to and from GSMTAP messages.
* Basic handlers for file descriptor callbacks from incoming mcast
  messages on the virtual um.
* Multiplexing to different channel routines based on GSMTAP header
  channel type.
* Example configuration for l23 app mobile using virtual test sim.

Change-Id: I203c8ec58326e52a09603a37232fce7ae3641415
2017-07-12 23:26:26 +02:00