Change in osmo-hlr[master]: Set TCP NODELAY sockopt to GSUP cli and srv connections

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Wed Oct 14 16:27:33 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hlr/+/20577 )

Change subject: Set TCP NODELAY sockopt to GSUP cli and srv connections
......................................................................

Set TCP NODELAY sockopt to GSUP cli and srv connections

GSUP is message based on top of IPA, and hence TCP. We don't want to
have Nagle algorithm enabled, since we are interested in having messages
sent as quickly as possible and there's no need for lower layers to wait
for more data (because we send all the message data at once).

Related: OS#4499
Change-Id: I4653b95ef0d4e1184f81f28408e9eb5d665206ec
---
M src/gsup_server.c
M src/gsupclient/gsup_client.c
2 files changed, 33 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/gsup_server.c b/src/gsup_server.c
index 830a5a7..756473a 100644
--- a/src/gsup_server.c
+++ b/src/gsup_server.c
@@ -18,6 +18,8 @@
  */
 
 #include <errno.h>
+#include <netinet/tcp.h>
+#include <netinet/in.h>
 
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/logging.h>
@@ -352,6 +354,19 @@
 	llist_add(&conn->list, &prev_conn->list);
 }
 
+static void update_fd_settings(int fd)
+{
+	int ret;
+	int val;
+
+	/*TODO: Set keepalive settings here. See OS#4312 */
+
+	val = 1;
+	ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
+	if (ret < 0)
+		LOGP(DLGSUP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
+}
+
 /* a client has connected to the server socket and we have accept()ed it */
 static int osmo_gsup_server_accept_cb(struct ipa_server_link *link, int fd)
 {
@@ -376,6 +391,8 @@
 	LOGP(DLGSUP, LOGL_INFO, "New GSUP client %s:%d (IND=%u)\n",
 	     conn->conn->addr, conn->conn->port, conn->auc_3g_ind);
 
+	update_fd_settings(fd);
+
 	/* request the identity of the client */
 	rc = ipa_ccm_send_id_req(fd);
 	if (rc < 0)
diff --git a/src/gsupclient/gsup_client.c b/src/gsupclient/gsup_client.c
index 4f76efc..4041366 100644
--- a/src/gsupclient/gsup_client.c
+++ b/src/gsupclient/gsup_client.c
@@ -31,6 +31,8 @@
 
 #include <errno.h>
 #include <string.h>
+#include <netinet/tcp.h>
+#include <netinet/in.h>
 
 static void start_test_procedure(struct osmo_gsup_client *gsupc);
 
@@ -129,6 +131,19 @@
 	client_send(gsupc, IPAC_PROTO_EXT_OAP, msg_tx);
 }
 
+static void update_fd_settings(int fd)
+{
+	int ret;
+	int val;
+
+	/*TODO: Set keepalive settings here. See OS#4312 */
+
+	val = 1;
+	ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
+	if (ret < 0)
+		LOGP(DLGSUP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno));
+}
+
 static void gsup_client_updown_cb(struct ipa_client_conn *link, int up)
 {
 	struct osmo_gsup_client *gsupc = link->data;
@@ -139,6 +154,7 @@
 	gsupc->is_connected = up;
 
 	if (up) {
+		update_fd_settings(link->ofd->fd);
 		start_test_procedure(gsupc);
 
 		if (gsupc->oap_state.state == OSMO_OAP_INITIALIZED)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/20577
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I4653b95ef0d4e1184f81f28408e9eb5d665206ec
Gerrit-Change-Number: 20577
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201014/e104ee18/attachment.htm>


More information about the gerrit-log mailing list