Project

General

Profile

Actions

Bug #4499

closed

Verify we set TCP_NODELAY socket option where needed

Added by pespin almost 4 years ago. Updated over 3 years 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));
 }
Actions #1

Updated by osmith almost 4 years ago

  • Assignee changed from osmith to pespin

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

Actions #2

Updated by pespin over 3 years 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.

Actions #3

Updated by pespin over 3 years ago

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

Actions #4

Updated by pespin over 3 years 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

Actions #5

Updated by pespin over 3 years 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.

Actions #6

Updated by pespin over 3 years ago

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

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)