Project

General

Profile

Actions

Feature #5752

closed

io_uring support in libosmo-sigtran

Added by laforge over 1 year ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Target version:
-
Start date:
11/09/2022
Due date:
% Done:

100%

Spec Reference:
Tags:

Description

Once libosmocore provides the new API for the upcoming io_uring backend (#5751) we will need to port libosmo-sccp over to this new API.

Currently we're using the following code-paths for I/O

libosmo-sigtran function I/O function provided by
xua_srv_conn_cb sctp_recvmsg libsctp
ipa_cli_read_cb ipa_msg_recv_buffered libosmocore
osmo_ss7_asp_send osmo_stream_srv_send libosmo-netif
osmo_ss7_asp_send osmo_stream_cli_send libosmo-netif

We need to analyze each of those and migrate, if possible.


Related issues

Related to libosmocore - Feature #5751: io_uring support in libosmocoreResolvedjolly11/09/2022

Actions
Related to libosmo-netif - Feature #5753: io_uring support in libosmo-netifResolvedHoernchen11/09/2022

Actions
Related to Core testing infrastructure - Feature #6357: run (some?) tests with io_uring backend for osmo_ioResolvedosmith02/09/2024

Actions
Actions #1

Updated by laforge over 1 year ago

  • Related to Feature #5751: io_uring support in libosmocore added
Actions #2

Updated by laforge over 1 year ago

  • Description updated (diff)
Actions #3

Updated by laforge over 1 year ago

  • Tags set to io_uring
Actions #4

Updated by laforge over 1 year ago

  • Priority changed from Normal to High
Actions #5

Updated by laforge about 1 year ago

  • Priority changed from High to Urgent
Actions #6

Updated by laforge about 1 year ago

  • Related to Feature #5753: io_uring support in libosmo-netif added
Actions #7

Updated by laforge about 1 year ago

  • Assignee set to daniel
Actions #8

Updated by laforge 4 months ago

code paths we have to cover:

  • ss7_asp_xua_srv_conn_cb()
    • uses osmo_stream_srv_recv(), which in turn calls stream_sctp_recvmsg_wrapper() which in turn calls sctp_recvmsg()
      • sets msgb_sctp_ppid/msgb_sctp_stream to data from sctp_sndrcvinfo
      • performs processing (well, actually really just logging) of flags / MSG_NOTIFICATION
  • xua_cli_read_cb()
    • uses osmo_stream_cli_recv(), which in turn calls stream_sctp_recvmsg_wrapper() which in turn calls sctp_recvmsg() [see above]
  • osmo_ss7_asp_send()
    • set msgb_sctp_ppid [and possibly stream?]
    • uses osmo_stream_{srv,cli})_send(), which in turn uses (via write_queue) osmo_stream_cli_write()
      • osmo_stream_{cli,srv}_write(), which uses sctp_send() with sctp_streaminfo
Actions #9

Updated by laforge 4 months ago

sctp_send

sctp_send() in libsctp is turning the data+len bytes and the sctp_sndrecvinfo into a sendmsg() call whose msghdr contains one io_vector and one cmsg header. In order to do the cmsg trick, it needs to have a memory buffer of CMSG_SPACE(sizeof(struct sctp_sndrcvinfo)) - a macro that aligns/pads to size_t.

So we'd have to
  • extend struct iofd_msghdr with a char cmdsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))] element
  • implement the sctp_send() function semantics on top of that

sctp_recvmsg

The naming is really confusing. Normally, recvmsg is something that deals with struct msghdr but in the case of sctp_recvmsg it actually does not. The user can only pass one buffer, and not an io_vector to it.

sctp_recvmsg is turning the data+len bytes and the sctp_sndrcvinfo into a recvmsg call whose msghdr contains one io_vector and one cmsg header. In order to do the cmsg trick, it needs to have a memory buffer of CMSG_SPACE(sizeof(struct sctp_sndrcvinfo)) - a macro that aligns/pads to size_t.

So we'd have to
  • extend struct iofd_msghdr with a char cmdsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))] element
  • implement the sctp_recvmsg() function semantics on top of that
Actions #10

Updated by laforge 4 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by laforge 3 months ago

  • Status changed from Resolved to Stalled
  • Assignee changed from daniel to Hoernchen
  • % Done changed from 100 to 70

the latest WIP code is in laforge/osmo_io_sctp branch.

Actions #12

Updated by laforge about 2 months ago

  • Related to Feature #6357: run (some?) tests with io_uring backend for osmo_io added
Actions #13

Updated by laforge about 2 months ago

  • Assignee changed from Hoernchen to jolly
Actions #14

Updated by laforge about 2 months ago

  • Status changed from Stalled to Resolved
  • % Done changed from 70 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)