Project

General

Profile

Actions

osmo_io

osmo_io is the new (2023) way of ho we do I/O in osmocom projects. It moves from a raw select/poll abstraction (where every application performs its own read/write once the fd becomes readble/writable) to a submission/completion model, where the actual I/O is performed by the library, an the application just submits write requests (as struct msgb) and receives write-completion and read-completion call-backs.

Apart from having more code reuse and a cleaner split between application and I/O library, this has the added advantage that the underlying operating system I/O mechanism can be swapped out without touching each and every application. Specifically, we have currently the following two back-ends implemented in libosmocore:
  • POLL: classic osmo_fd based implementation using poll(2) (default)
  • IO_URING: a backend using the Linux kernel io_uring(7) API

The choice of back-end is done via setting the LIBOSMO_IO_BACKEND environment variable. If you set it to IO_URING when starting an osmocom program, all sub-systems / interfaces ported over to the osmo_io API will make use of the io_uring(7) API (via liburing).

The main advantage of io_uring is performance. Benchmarking has shown that a classic, poll-based production osmo-bsc loaded with 400 TRX is spending about 40% of its CPU cycles in the system call overhad (sock_poll, tcp_poll and do_sys_poll) and a lot of system call entry/exit in general, due to the many small read/write/recvmsg/sendmsg/recfrom/sendto and poll calls.

For more information, see:
  • the original discussion in #5751
  • FIXME

API reference at https://ftp.osmocom.org/api/latest/libosmocore/core/html/osmo__io_8c.html#details

Implementation status

The below tables indicate the implementation status of the osmo_io migration:

Libraries

library/interface protocol transport users commit issue
libosmocore gsmtap UDP everyone libosmocore #6213
libosmo-mgcp-client MGCP UDP osmo-bsc, osmo-msc, osmo-hnbgw osmo-mgw #5754
libosmogb ns2 NS UDP osmo-pcu, osmo-gbproxy, osmo-sgsn libosmocore #5751
libosmo-netif stream_cli TCP libosmo-sigtran(ipa), osmo-bsc(cbsp), osmo-cbc(cbsp) libosmo-netif #5753
libosmo-netif stream_cli SCTP libosmo-sigtran libosmo-netif #5753
libosmo-sigtran xUA ASP (SUA, M3UA) SCTP osmo-bsc, osmo-msc, osmo-sgsn, osmo-hnbgw, osmo-smlc libosmo-sigtran #5752

Program

program Interface/protocol transport commit issue
osmo-gbproxy Gb/NS UDP indirect via libosmogb ns2
osmo-bsc CBSP TCP client+server osmo-bsc #6170
osmo-bsc meas_feed UDP osmo-bsc
osmo-bsc MGCP UDP indirect via libosmo-mgcp-client #5755
osmo-bsc M3UA/SUA/IPA SCTP/TCP indirect via libosmo-sigtran #5755
osmo-hnbgw MGCP UDP indirect via libosmo-mgcp-client
osmo-hnbgw M3UA/SUA/IPA SCTP/TCP indirect via libosmo-sigtran
osmo-msc MGCP UDP indirect via libosmo-mgcp-client
osmo-msc M3UA/SUA/IPA SCTP/TCP indirect via libosmo-sigtran
osmo-sgsn M3UA/SUA/IPA SCTP/TCP indirect via libosmo-sigtran
osmo-sgsn Gb/NS UDP indirect via libosmogb ns2
osmo-smlc M3UA/SUA/IPA SCTP/TCP indirect via libosmo-sigtran
osmo-stp M3UA/SUA/IPA SCTP/TCP indirect via libosmo-sigtran #5752
osmo-mgw RTP/RTCP UDP #6387

Further reading

Files (0)

Updated by laforge about 1 month ago · 8 revisions

Add picture from clipboard (Maximum size: 48.8 MB)