Project

General

Profile

Bug #4499

Verify we set TCP_NODELAY socket option where needed

Added by pespin 6 months ago. Updated 3 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
04/17/2020
Due date:
% Done:

100%

Spec Reference:

Description

Recently it was spotted that we were not setting TCP_NODELAY option in OML and RSL connections, which means some messages being sent can be delay by considerable amounts of times. This kind of behavior is not beneficial in the context of signalling we do where latency is far more important than amount of data / network performance.

This ticket is a reminder to look for all protocols we implement that use TCP and verify whether it makes sense to enable TCP_NODELAY sockopt. Some I can think of include:
  • Abis (bts and bsc side)
  • OML (bts and bsc side)
  • GSUP (client and server side).
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index e1936af..4d21416 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -271,6 +271,7 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg,
             struct e1inp_ts *ts;
             struct osmo_fd *newbfd;
             struct e1inp_line *new_line;
+            int on = 1;

             sign_link =
                 line->ops->sign_link_up(&unit_data, line,
@@ -309,6 +310,13 @@ static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg,
                      "could not register FD\n");
                 goto err;
             }
+
+            /* set TCP_NODELAY (FIXME: just call update_fd_settings() here instead?) */
+            ret = setsockopt(newbfd->fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+            if (ret < 0)
+                LOGP(DLINP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
+
+
             /* now we can release the dummy RSL line. */
             e1inp_line_put(line);

@@ -587,6 +595,11 @@ static void update_fd_settings(struct e1inp_line *line, int fd)
 #endif
 #endif
     }
+
+    val = 1;
+    ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
+    if (ret < 0)
+        LOGP(DLINP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
 }

History

#1 Updated by osmith 6 months ago

  • Assignee changed from osmith to pespin

(I'm on holiday next week, so assigning back to you as discussed.)

#2 Updated by pespin 12 days ago

RSL/OML (Abis) IPA sockets are set to TCP_NODELAY in update_fd_settings() in libosmo-abis. It is applied to both sockets in BTS and BSC mode.

#3 Updated by pespin 12 days ago

Added TCP_NODELAY to VTY sockets here:
https://gerrit.osmocom.org/c/libosmocore/+/20575 vty: Set TCP_NODELAY on VTY sockets

#4 Updated by pespin 12 days ago

  • Status changed from New to In Progress

ASP related connections in libosmo-sccp are set to NODELAY in osmo_ss7_asp_restart() and osmo_ss7_xua_server_create() through libosmo-netif API: osmo_stream_cli_set_nodelay(asp->client, true);

osmo-iuh.g hnbgw was missing a call to the same osmo_stream_cli_set_nodelay API, I added it here:
https://gerrit.osmocom.org/c/osmo-iuh/+/20576 hnbgw: Mark SCTP conn as NODELAY

#5 Updated by pespin 12 days ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 90

GSUP NODELAY added here:
https://gerrit.osmocom.org/c/osmo-hlr/+/20577 Set TCP NODELAY sockopt to GSUP cli and srv connections

I cannot think of nor find any other protocol using TCP/SCTP which doesn't use NODELAY yet, so marking ticket as feedback until patch are merged, then as resolved.

#6 Updated by pespin 3 days ago

  • Status changed from Feedback to Resolved
  • % Done changed from 90 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)