Skip to content
Success

Changes

Summary

  1. logging_vty: Allow setting gsmtap log tgt as (details)
  2. logging_vty: Set 'gsmtap log nonblocking-io' as default (details)
  3. gsmtap_util: Set sink_fd RCVBUF and SNDBUF to minimum (details)
  4. gsmtap_util: Set source_fd RCVBUF to minimum (details)
  5. gsmtap_util: Increase source_fd's SO_SNDBUF to 4MB (details)
Commit 862deae282cfa3b9dcd41d10f0fd24959d646050 by Pau Espin Pedrol
logging_vty: Allow setting gsmtap log tgt as (blocking-io|nonblocking-io|wq)

The current patch adds the possibility to configure it, and leaves the
previous behavior as default: blocking-io.

Related: OS#6213
Change-Id: Id5d31bedd7d265d18f6e475ccbc94ced80598d04
The file was modifiedsrc/core/socket.c
The file was modifiedinclude/osmocom/core/gsmtap_util.h
The file was modifiedsrc/vty/logging_vty.c
The file was modifiedsrc/core/libosmocore.map
The file was modifiedsrc/core/gsmtap_util.c
The file was modifiedinclude/osmocom/core/socket.h
The file was modifiedTODO-RELEASE
Commit c70a84daebb8141062fef352866cc9ee0364b58e by Pau Espin Pedrol
logging_vty: Set 'gsmtap log nonblocking-io' as default

Apps using a VTY are expected to be using an event loop, and hence
should not be using blocking operations which would stall the event
loop.

If user fears losing messages (eg, when enabling a lot of DEBUG),
then the taget can still be switched to "wq" at the expense of
losing performance, or increasing the kernel UDP socket sndbuf by means
of sysctl net.core.wmem_{default,max}.

Related: OS#6213
Related: OS#6794
Change-Id: Ifca8a821e13ec1327ab2476b0db91078fcff948b
The file was modifiedsrc/vty/logging_vty.c
Commit 74643c5fdd3302f42eca6b2995e084d3f0d342f9 by Pau Espin Pedrol
gsmtap_util: Set sink_fd RCVBUF and SNDBUF to minimum

We never transmit anything over the socket, nor are interested in
reading from it. We are only interested in having the socket open to
avoid ICMP errors.
Hence, set the buffers to the minimum to save some memory which we won't
ever need/use.

Change-Id: Icfbc24ff679898496666d224d49e1ff06ddffda8
The file was modifiedsrc/core/gsmtap_util.c
Commit 098af6958efbf9b41bee3f5a29d5bf143a036871 by Pau Espin Pedrol
gsmtap_util: Set source_fd RCVBUF to minimum

We never expect to receive anything on this socket, so set its RCVBUF to
the minimum possible to save some memory.

Change-Id: If82b3edf11dea1a124035d4eb0e6aa44f4223555
The file was modifiedsrc/core/gsmtap_util.c
Commit e02b95a6d98e7e1f7051bf4a6447f590e76eb8fb by Pau Espin Pedrol
gsmtap_util: Increase source_fd's SO_SNDBUF to 4MB

Using bpftrace we spotted osmo-bts sporadically blocking on send()
of gsmtap_log for 2-4s, most probably due to the UDP send buffer being
full. The wmem_default of ~292KB is indeed a bit tight, and for instance
upstream Linux got its wmem_max to 4MB in april 2025 since it's becoming
more usual that sockets need to increase this value.

Hence, increase the SO_SNDBUF to 4MB to get some extra room and avoid
blocks (or drops if socket is later on set non-blocking) and be able to
accomodate to logging spikes better.

The kernel will take care of lowering the size set to the configured
net.core.wmem_max if needed.

Related: OS#6794
Change-Id: I5033a018dfc748b309600102b8a9ade0df014615
The file was modifiedsrc/core/gsmtap_util.c