Change in osmo-bts[master]: Allow user to specify IP DSCP for OML and RSL, too

laforge gerrit-no-reply at lists.osmocom.org
Tue Apr 27 20:27:26 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/23923 )


Change subject: Allow user to specify IP DSCP for OML and RSL, too
......................................................................

Allow user to specify IP DSCP for OML and RSL, too

so far we only assumed that users want to assign as specific non-default
DSCP to RTP (voice) traffic.   However, there are use cases where even
RSL and OML signaling should be covered by specifc, non-default DSCP
values, too.

Depends: libosmocore.git Ia4ba389a5b7e3e9d5f17a742a900d6fd68c08e40
Change-Id: Ic302a695453514459fa27400027154e7e8b74e0e
Related: SYS#5427
---
M TODO-RELEASE
M include/osmo-bts/bts.h
M src/common/bts.c
M src/common/bts_trx.c
M src/common/vty.c
5 files changed, 54 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/23/23923/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index e69de29..0129a7f 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -0,0 +1 @@
+bump requirement to libosmocore for use of osmo_sock_set_dscp()
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index be0222d..67c2b82 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -297,6 +297,8 @@
 	uint16_t rtp_port_range_end;
 	uint16_t rtp_port_range_next;
 	int rtp_ip_dscp;
+	int oml_ip_dscp;
+	int rsl_ip_dscp;
 
 	struct {
 		uint8_t ciphers;	/* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */
diff --git a/src/common/bts.c b/src/common/bts.c
index 06a5ccb..29033ef 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -329,6 +329,8 @@
 	bts->rtp_port_range_end = 17407;
 	bts->rtp_port_range_next = bts->rtp_port_range_start;
 	bts->rtp_ip_dscp = -1;
+	bts->oml_ip_dscp = -1;
+	bts->rsl_ip_dscp = -1;
 
 	/* Default (fall-back) MS/BS Power control parameters */
 	bts->bs_dpc_params = power_ctrl_params_def;
@@ -413,10 +415,16 @@
 /* main link is established, send status report */
 int bts_link_estab(struct gsm_bts *bts)
 {
-	int i, j;
+	int i, j, rc;
 
 	LOGP(DSUM, LOGL_INFO, "Main link established, sending NM Status.\n");
 
+	rc = osmo_sock_set_dscp(bts->oml_link->ts->driver.ipaccess.fd.fd, bts->oml_ip_dscp);
+	if (rc < 0) {
+		LOGP(DSUM, LOGL_ERROR, "Unable to set OML IP DSCP to %u: %d (%s)\n",
+		     bts->oml_ip_dscp, rc, strerror(errno));
+	}
+
 	/* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS is DEPENDENCY */
 	osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SW_ACT, NULL);
 	osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_SW_ACT, NULL);
diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c
index 9fc18e4..b297876 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -17,6 +17,8 @@
  *
  */
 
+#include <errno.h>
+
 #include <osmocom/core/fsm.h>
 
 #include <osmocom/gsm/abis_nm.h>
@@ -202,6 +204,12 @@
 	LOGPTRX(trx, DSUM, LOGL_INFO, "RSL link %s\n",
 		link ? "up" : "down");
 
+	rc = osmo_sock_set_dscp(link->ts->driver.ipaccess.fd.fd, trx->bts->rsl_ip_dscp);
+	if (rc < 0) {
+		LOGPTRX(trx, DSUM, LOGL_ERROR, "Unable to set RSL IP DSCP to %u: %d (%s)\n",
+			trx->bts->rsl_ip_dscp, rc, strerror(errno));
+	}
+
 	osmo_fsm_inst_dispatch(trx->mo.fi, link ? NM_EV_RSL_UP : NM_EV_RSL_DOWN, NULL);
 	osmo_fsm_inst_dispatch(trx->bb_transc.mo.fi, link ? NM_EV_RSL_UP : NM_EV_RSL_DOWN, NULL);
 
diff --git a/src/common/vty.c b/src/common/vty.c
index 45ee32c..398b474 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -300,6 +300,10 @@
 		bts->rtp_port_range_end, VTY_NEWLINE);
 	if (bts->rtp_ip_dscp != -1)
 		vty_out(vty, " rtp ip-dscp %i%s", bts->rtp_ip_dscp, VTY_NEWLINE);
+	if (bts->oml_ip_dscp != -1)
+		vty_out(vty, " oml ip-dscp %i%s", bts->oml_ip_dscp, VTY_NEWLINE);
+	if (bts->rsl_ip_dscp != -1)
+		vty_out(vty, " rsl ip-dscp %i%s", bts->rsl_ip_dscp, VTY_NEWLINE);
 	vty_out(vty, " paging queue-size %u%s", paging_get_queue_max(bts->paging_state),
 		VTY_NEWLINE);
 	vty_out(vty, " paging lifetime %u%s", paging_get_lifetime(bts->paging_state),
@@ -595,6 +599,34 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_USRATTR(cfg_bts_oml_ip_dscp,
+	      cfg_bts_oml_ip_dscp_cmd,
+	      X(BTS_VTY_ATTR_NEW_LCHAN),
+	      "oml ip-dscp <0-63>",
+	      RTP_STR "Specify DSCP for OML/IP packets\n" "The DSCP value (upper 6 bits of TOS)\n")
+{
+	struct gsm_bts *bts = vty->index;
+	int dscp = atoi(argv[0]);
+
+	bts->oml_ip_dscp = dscp;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_bts_rsl_ip_dscp,
+	      cfg_bts_rsl_ip_dscp_cmd,
+	      X(BTS_VTY_ATTR_NEW_LCHAN),
+	      "rsl ip-dscp <0-63>",
+	      RTP_STR "Specify DSCP for RSL/IP packets\n" "The DSCP value (upper 6 bits of TOS)\n")
+{
+	struct gsm_bts *bts = vty->index;
+	int dscp = atoi(argv[0]);
+
+	bts->rsl_ip_dscp = dscp;
+
+	return CMD_SUCCESS;
+}
+
 #define PAG_STR "Paging related parameters\n"
 
 DEFUN_ATTR(cfg_bts_paging_queue_size,
@@ -2312,6 +2344,8 @@
 	install_element(BTS_NODE, &cfg_bts_rtp_jitbuf_cmd);
 	install_element(BTS_NODE, &cfg_bts_rtp_port_range_cmd);
 	install_element(BTS_NODE, &cfg_bts_rtp_ip_dscp_cmd);
+	install_element(BTS_NODE, &cfg_bts_oml_ip_dscp_cmd);
+	install_element(BTS_NODE, &cfg_bts_rsl_ip_dscp_cmd);
 	install_element(BTS_NODE, &cfg_bts_band_cmd);
 	install_element(BTS_NODE, &cfg_description_cmd);
 	install_element(BTS_NODE, &cfg_no_description_cmd);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic302a695453514459fa27400027154e7e8b74e0e
Gerrit-Change-Number: 23923
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210427/3988421c/attachment.htm>


More information about the gerrit-log mailing list