Commit Graph

31 Commits

Author SHA1 Message Date
Martin Hauke 1f7a2ab5d3 Fix common misspellings and typos
Change-Id: I962b42871693f33b1054d43d195817e9cd84bb64
2019-10-17 08:07:39 +00:00
Harald Welte b2c19fc5d3 VIRT-PHY: Add support for GPRS / TBF mode
we add a new STATE_TBF to vthe MS model and add some L1CTL primitives
to configure that TBF mode as well as to enqueue transmissions for
blocks at a given USF+TS.

Change-Id: Ie6f37090bd45f463aa25d9e00bc06f563be5264a
2017-08-20 22:19:17 +02:00
Harald Welte 35564c691f VIRT-PHY: virt_l1_sched: Pass timeslot number into call-back
When we schedule a given frame for transmission, we save its timeslot
number.  However, the callback doesn't get informed about this so far.

Change-Id: I608a91ae8e2a57a2d6f87f4b873c82edb0215bf6
2017-08-20 22:19:17 +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 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 3ee8ac1593 VIRT-PHY: some more comments/documentation
Change-Id: I24fc98624178e9441d6cfcd61bc14e17c1391e9e
2017-07-18 21:41:24 +02:00
Harald Welte 70dd7e5b75 VIRT-PHY: Use IPv4 multicast groups for private / local scope
The addresses in the original code make little sense:
* 224.0.0.1 is "All systems on this subnet" and not routed
  outside the local ethernet segment
* 225.0.0.1 is in a RESERVED range that shouldn't be used

Change-Id: I8e3acd745e65a6cfa70b681a440da6a59a1ed0b5
2017-07-13 17:18:00 +02:00
Harald Welte 48d2a55b40 VIRT-PHY mcast_sock: Use uint16_t for ports, bool and const
Change-Id: I4eab1da8d43fdad05c04f23d89711081c4696fe7
2017-07-13 14:24:57 +02:00
Harald Welte 0d0d2ec724 VIRT-PHY: Further simplify mcast_sock code
By avoiding dynamic allocations and relying on osmo_fd, we can
significantly simplify the code.

Change-Id: Iad653686ac2bda5b3c92c30b4386ee7727d16271
2017-07-13 14:16:31 +02:00
Harald Welte 91a0c20bb3 VIRT-PHY: mcast_sock: Don't keep subscribed multicast group around
We can avoid having to keep around the multicast group in a chunk of
dynamically allocated memory and simplify related code.

Change-Id: Ic39ffe73dfd2cb8ffefb9614340e275dac87bd50
2017-07-13 13:58:28 +02:00
Harald Welte dd94566f7b VIRT-PHY: mcast_sock: Avoid dynamic allocation of osmo_fd member
Change-Id: I11e0137849797eb67047b4ddca0e917c599ed909
2017-07-13 13:54:21 +02:00
Harald Welte a2f06f28e2 VIRT-PHY: osmo_mcast_sock: Get rid of server_sock.sock_conf
We don't need to store this data, we cans simply connect the socket to
the destination mcast address instead.

Change-Id: I3c98653c41eff9feb649d9c47cd40b26fd81ed05
2017-07-13 13:49:37 +02:00
Harald Welte 656cd327f9 VIRT-PHY: common_util: chantype_gsmtap2rsl() now in libosmocore
As of Change-Id Ie1bc00670887064da0fea61c3dab036c23ceea25, this function
is offered by libosmocore.

Change-Id: Ie269afe314967fd2c42b91ee854c217f699252dc
2017-07-13 12:23:00 +02:00
Harald Welte c8d1ad36eb VIRT-PHY: Fix all compiler warnings on gcc-6.3.0
Change-Id: I95b93ec907fbfd180a0f2ac681dd63791ede24db
2017-07-12 23:26:26 +02:00
Harald Welte 5abc25c852 VIRT-PHY: Make sure heaer files are part of 'make dist'
Change-Id: Ib4cd0463da1cf22e04a1debfed55a33f7b6542d4
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 59cc3c3ab1 VIRT-PHY: Extracted common virtphy utils.
Change-Id: I759c6e9805ab012f9553bcba9b5d379193462955
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 c1705d53db VIRT-PHY: Fixed power management and PCS sync.
PCS flag was ignored in fbsb. Power management returned a perfect link
for all possible arfcns causing the mobile trying to sync to all these
afterwards. This took too long and PM now only returnes a good link
quality for arfcns configured as available.

Power management was also extracted to an own file.

Change-Id: Ia1b79aa47c9df3b1e316122455ceccb4a66724e0
2017-07-12 23:26:26 +02:00
Sebastian Stumpf e7600a0d57 VIRT-PHY: Fixed FACCH processing on TCH.
As TCH is not supported in GSMTAP yet, all incoming frames on the
virt-phy are forwarded as FACCH to the l23 for now.

Cleanup code in virt_prim_data and virt_prim_traffic.

Change-Id: I6b41f21b6984e62ad98edfe4398bd678d5b2dad5
2017-07-12 23:26:26 +02:00
Sebastian Stumpf 30cc674df8 VIRT-PHY: Calculate correct scheduler fn for data- and tch-msgs on ul.
Proper calculation of the scheduled frame number and appending the jobs
with that fn to the scheduler. Thus uplink msgs are scheduled at the
(approx.) correct fn and with this fn set in the gsmtap hdr.

Change-Id: I0f44d0b5b9208755e671c619d1f851a043aefb54
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 2dfe603117 VIRT-PHY: Using IANA-registered port 4729 for GSMTAP for virt um.
Change-Id: Id8e262c9a9a6260353bfb98e774b9d0b6eecae53
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 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