Change in libosmo-abis[master]: ipa: Introduce support for user-specific DSCP and priority

laforge gerrit-no-reply at lists.osmocom.org
Thu Apr 29 19:31:40 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/23957 )

Change subject: ipa: Introduce support for user-specific DSCP and priority
......................................................................

ipa: Introduce support for user-specific DSCP and priority

This adds new members to struct ipa_server_link and ipa_client_conn,
which can be set by the user before ipa_client_conn_open() or
ipa_server_link_open() to ensure DSCP / priority values are applied
from the first outgoing packet onwards.

Change-Id: I5ab22d35d9b11eca47d9ea12208e5589a1a5713c
Depends: libosmocore.git If22988735fe05e51226c6b091a5348dcf1208cdf
---
M TODO-RELEASE
M include/osmocom/abis/ipa.h
M src/input/ipa.c
3 files changed, 15 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..8c417cd 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,6 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public release: c:r:0.
 #library	what		description / commit summary line
+update libosmocore dependency to > 1.5.1 for OSMO_SOCK_F_{DSCP,PRIO}()
+libosmo-abis	new member	ipa_client_conn new struct members dscp, priority
+libosmo-abis	new member	ipa_server_link new struct members dscp, priority
diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h
index 4764a95..7e13a6d 100644
--- a/include/osmocom/abis/ipa.h
+++ b/include/osmocom/abis/ipa.h
@@ -19,6 +19,8 @@
 	uint16_t			port;
 	int (*accept_cb)(struct ipa_server_link *link, int fd);
 	void				*data;
+	uint8_t				dscp;
+	uint8_t				priority;
 };
 
 struct ipa_server_link *
@@ -80,6 +82,8 @@
 	struct msgb			*pending_msg;
 	const char			*local_addr;
 	uint16_t			local_port;
+	uint8_t				dscp;
+	uint8_t				priority;
 };
 
 struct ipa_client_conn *
diff --git a/src/input/ipa.c b/src/input/ipa.c
index f01ecd9..c121987 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -224,7 +224,8 @@
 	ret = osmo_sock_init2(AF_INET, SOCK_STREAM, IPPROTO_TCP,
 			     link->local_addr, link->local_port,
 			     link->addr, link->port,
-			     OSMO_SOCK_F_BIND|OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK);
+			     OSMO_SOCK_F_BIND|OSMO_SOCK_F_CONNECT|OSMO_SOCK_F_NONBLOCK|
+			     OSMO_SOCK_F_DSCP(link->dscp) | OSMO_SOCK_F_PRIO(link->priority));
 	if (ret < 0)
 		return ret;
 	link->ofd->fd = ret;
@@ -282,6 +283,10 @@
 	LOGIPA(link, LOGL_NOTICE, "accept()ed new link from %s:%u\n",
 		inet_ntoa(sa.sin_addr), ntohs(sa.sin_port));
 
+	/* make new fd inherit DSCP + priority of listen-socket */
+	osmo_sock_set_dscp(fd, link->dscp);
+	osmo_sock_set_priority(fd, link->priority);
+
 	ret = link->accept_cb(link, fd);
 	if (ret < 0) {
 		LOGP(DLINP, LOGL_ERROR,
@@ -330,7 +335,8 @@
 	int ret;
 
 	ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP,
-			     link->addr, link->port, OSMO_SOCK_F_BIND);
+			     link->addr, link->port, OSMO_SOCK_F_BIND|
+			     OSMO_SOCK_F_DSCP(link->dscp) | OSMO_SOCK_F_PRIO(link->priority));
 	if (ret < 0)
 		return ret;
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/23957
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I5ab22d35d9b11eca47d9ea12208e5589a1a5713c
Gerrit-Change-Number: 23957
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith 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/20210429/851d3cad/attachment.htm>


More information about the gerrit-log mailing list