Change in libosmo-abis[master]: e1_input: Allow (vty) configuration of IP DSCP and socket priority

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


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

Change subject: e1_input: Allow (vty) configuration of IP DSCP and socket priority
......................................................................

e1_input: Allow (vty) configuration of IP DSCP and socket priority

Change-Id: I8991dd6eb406a5b9a70498974fc1ad339452f871
Related: SYS#5427
---
M include/internal.h
M src/e1_input_vty.c
M src/input/ipaccess.c
3 files changed, 69 insertions(+), 2 deletions(-)

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



diff --git a/include/internal.h b/include/internal.h
index aeca02f..0ee2dcb 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -10,6 +10,19 @@
 struct e1inp_sign_link;
 struct e1inp_ts;
 
+struct ipa_proto_pars {
+	uint8_t dscp;
+	uint8_t priority;
+};
+
+struct ipa_pars {
+	struct ipa_proto_pars oml;
+	struct ipa_proto_pars rsl;
+};
+
+/* global parameters of IPA input driver */
+extern struct ipa_pars g_e1inp_ipaccess_pars;
+
 /* talloc context for libosmo-abis. */
 extern void *libosmo_abis_ctx;
 
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c
index 64f5f63..c392a3b 100644
--- a/src/e1_input_vty.c
+++ b/src/e1_input_vty.c
@@ -1,5 +1,5 @@
 /* E1 vty interface */
-/* (C) 2011 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2011-2021 by Harald Welte <laforge at gnumonks.org>
  * All Rights Reserved
  *
  * SPDX-License-Identifier: AGPL-3.0+
@@ -327,6 +327,38 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_USRATTR(cfg_ipa_dscp, cfg_ipa_dscp_cmd,
+	      X(OSMO_ABIS_LIB_ATTR_IPA_NEW_LNK),
+	      "ipa ip-dscp (oml|rsl) <0-63>",
+	      "ipa driver config\n"
+	      "Set IP DSCP value for outbound packets\n"
+	      "Set IP DSCP for OML link\n"
+	      "Set IP DSCP for RSL link\n"
+	      "IP DSCP Value to use\n")
+{
+	if (!strcmp(argv[0], "oml"))
+		g_e1inp_ipaccess_pars.oml.dscp = atoi(argv[1]);
+	else
+		g_e1inp_ipaccess_pars.rsl.dscp = atoi(argv[1]);
+	return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_ipa_priority, cfg_ipa_priority_cmd,
+	      X(OSMO_ABIS_LIB_ATTR_IPA_NEW_LNK),
+	      "ipa socket-priority (oml|rsl) <0-255>",
+	      "ipa driver config\n"
+	      "Set socket priority value for outbound packets\n"
+	      "Set socket priority for OML link\n"
+	      "Set socket priority for RSL link\n"
+	      "socket priority value to use (>6 requires CAP_NET_ADMIN)\n")
+{
+	if (!strcmp(argv[0], "oml"))
+		g_e1inp_ipaccess_pars.oml.priority = atoi(argv[1]);
+	else
+		g_e1inp_ipaccess_pars.rsl.priority = atoi(argv[1]);
+	return CMD_SUCCESS;
+}
+
 static int e1inp_config_write(struct vty *vty)
 {
 	struct e1inp_line *line;
@@ -373,6 +405,15 @@
 		vty_out(vty, " ipa bind %s%s",
 			ipa_bind, VTY_NEWLINE);
 
+	if (g_e1inp_ipaccess_pars.oml.dscp)
+		vty_out(vty, " ipa ip-dscp oml %u%s", g_e1inp_ipaccess_pars.oml.dscp, VTY_NEWLINE);
+	if (g_e1inp_ipaccess_pars.rsl.dscp)
+		vty_out(vty, " ipa ip-dscp rsl %u%s", g_e1inp_ipaccess_pars.rsl.dscp, VTY_NEWLINE);
+	if (g_e1inp_ipaccess_pars.oml.priority)
+		vty_out(vty, " ipa socket-priority oml %u%s", g_e1inp_ipaccess_pars.oml.priority, VTY_NEWLINE);
+	if (g_e1inp_ipaccess_pars.rsl.priority)
+		vty_out(vty, " ipa socket-priority rsl %u%s", g_e1inp_ipaccess_pars.rsl.priority, VTY_NEWLINE);
+
 	return CMD_SUCCESS;
 }
 
@@ -532,6 +573,8 @@
 	install_lib_element(L_E1INP_NODE, &cfg_e1_line_no_ipa_keepalive_cmd);
 
 	install_lib_element(L_E1INP_NODE, &cfg_ipa_bind_cmd);
+	install_lib_element(L_E1INP_NODE, &cfg_ipa_dscp_cmd);
+	install_lib_element(L_E1INP_NODE, &cfg_ipa_priority_cmd);
 
 	install_lib_element_ve(&show_e1drv_cmd);
 	install_lib_element_ve(&show_e1line_cmd);
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index be882a9..e876790 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -1,6 +1,6 @@
 /* OpenBSC Abis input driver for ip.access */
 
-/* (C) 2009 by Harald Welte <laforge at gnumonks.org>
+/* (C) 2009-2021 by Harald Welte <laforge at gnumonks.org>
  * (C) 2010 by Holger Hans Peter Freyther
  * (C) 2010 by On-Waves
  *
@@ -51,6 +51,9 @@
 #include <osmocom/core/backtrace.h>
 #include <osmocom/gsm/ipa.h>
 
+/* global parameters of IPA input driver */
+struct ipa_pars g_e1inp_ipaccess_pars;
+
 static void *tall_ipa_ctx;
 
 #define TS1_ALLOC_SIZE	900
@@ -1041,6 +1044,8 @@
 				"BSC link: %s\n", strerror(errno));
 			return -ENOMEM;
 		}
+		oml_link->dscp = g_e1inp_ipaccess_pars.oml.dscp;
+		oml_link->priority = g_e1inp_ipaccess_pars.oml.priority;
 		if (ipa_server_link_open(oml_link) < 0) {
 			LOGP(DLINP, LOGL_ERROR, "cannot open OML BSC link: %s\n",
 				strerror(errno));
@@ -1055,6 +1060,8 @@
 				"BSC link: %s\n", strerror(errno));
 			return -ENOMEM;
 		}
+		rsl_link->dscp = g_e1inp_ipaccess_pars.rsl.dscp;
+		rsl_link->priority = g_e1inp_ipaccess_pars.rsl.priority;
 		if (ipa_server_link_open(rsl_link) < 0) {
 			LOGP(DLINP, LOGL_ERROR, "cannot open RSL BSC link: %s\n",
 				strerror(errno));
@@ -1087,6 +1094,8 @@
 				"BTS link: %s\n", strerror(errno));
 			return -ENOMEM;
 		}
+		link->dscp = g_e1inp_ipaccess_pars.oml.dscp;
+		link->priority = g_e1inp_ipaccess_pars.oml.priority;
 		if (ipa_client_conn_open(link) < 0) {
 			LOGP(DLINP, LOGL_ERROR, "cannot open OML BTS link: %s\n",
 				strerror(errno));
@@ -1141,6 +1150,8 @@
 			"BTS link: %s\n", strerror(errno));
 		return -ENOMEM;
 	}
+	rsl_link->dscp = g_e1inp_ipaccess_pars.rsl.dscp;
+	rsl_link->priority = g_e1inp_ipaccess_pars.rsl.priority;
 	if (ipa_client_conn_open(rsl_link) < 0) {
 		LOGP(DLINP, LOGL_ERROR, "cannot open RSL BTS link: %s\n",
 			strerror(errno));

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I8991dd6eb406a5b9a70498974fc1ad339452f871
Gerrit-Change-Number: 23958
Gerrit-PatchSet: 4
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/e0e44608/attachment.htm>


More information about the gerrit-log mailing list