aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-04-29 22:02:47 +0200
committerHarald Welte <laforge@osmocom.org>2021-04-29 22:13:05 +0200
commitd9367e34dbeda0125a46513f6d5dd4bf37fc183b (patch)
tree41455967f1d2572472ebc69b1895cffd5a04218c
parent4e453b41f3bd0d1fa9d06d3029bd88aa49f5e70e (diff)
vty: Add configuration for Gb DSCP and socket priority
While libosmogb / ns2 supports that natively in the VTY, the PCU doesn't want to use the complexities of the full NS2 vty. Change-Id: I7bfbad46582e65e5ad2ac0cc66545538bc632df8 Related: SYS#5427
-rw-r--r--TODO-RELEASE1
-rw-r--r--src/gprs_bssgp_pcu.c5
-rw-r--r--src/gprs_pcu.c2
-rw-r--r--src/gprs_pcu.h2
-rw-r--r--src/pcu_vty.c31
5 files changed, 41 insertions, 0 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 716f7133..5b2720b9 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
libosmocore struct bssgp_bvc_ctx->is_sgsn field used available only on libosmocore >1.5.1
+libosmocore gprs_ns2_ip_bind_set_priority function used available only on libosmocore >1.5.1
diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c
index 06e1814a..f6114dea 100644
--- a/src/gprs_bssgp_pcu.c
+++ b/src/gprs_bssgp_pcu.c
@@ -1060,6 +1060,11 @@ static int ns_configure_nse(struct gprs_rlcmac_bts *bts,
continue;
}
}
+
+ if (the_pcu->vty.ns_ip_dscp != -1)
+ gprs_ns2_ip_bind_set_dscp(bind[i], the_pcu->vty.ns_ip_dscp);
+ if (the_pcu->vty.ns_priority != -1)
+ gprs_ns2_ip_bind_set_priority(bind[i], the_pcu->vty.ns_priority);
}
binds |= 1 << i;
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 3875e09f..df439ef8 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -105,6 +105,8 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx)
pcu->vty.mcs_lqual_ranges[8].low = 23;
pcu->vty.mcs_lqual_ranges[8].high = 256;
pcu->vty.ns_dialect = GPRS_NS2_DIALECT_IPACCESS;
+ pcu->vty.ns_ip_dscp = -1;
+ pcu->vty.ns_priority = -1;
/* TODO: increase them when CRBB decoding is implemented */
pcu->vty.ws_base = 64;
pcu->vty.ws_pdch = 0;
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h
index a17144c0..86fe8eb4 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -102,6 +102,8 @@ struct gprs_pcu {
struct {int16_t low; int16_t high; } cs_lqual_ranges[MAX_GPRS_CS];
struct {int16_t low; int16_t high; } mcs_lqual_ranges[MAX_EDGE_MCS];
enum gprs_ns2_dialect ns_dialect; /* Are we talking Gb with IP-SNS (true) or classic Gb? */
+ int ns_ip_dscp;
+ int ns_priority;
uint16_t ws_base;
uint16_t ws_pdch; /* increase WS by this value per PDCH */
uint16_t force_llc_lifetime; /* overrides lifetime from SGSN */
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index abc3d8db..1ca63761 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -251,6 +251,11 @@ static int config_write_pcu(struct vty *vty)
else
vty_out(vty, " gb-dialect classic%s", VTY_NEWLINE);
+ if (the_pcu->vty.ns_ip_dscp != -1)
+ vty_out(vty, " gb ip-dscp %d%s", the_pcu->vty.ns_ip_dscp, VTY_NEWLINE);
+ if (the_pcu->vty.ns_priority != -1)
+ vty_out(vty, " gb socket-priority %d%s", the_pcu->vty.ns_priority, VTY_NEWLINE);
+
if (the_pcu->vty.neigh_ctrl_addr) {
vty_out(vty, " neighbor resolution %s %u%s",
the_pcu->vty.neigh_ctrl_addr, the_pcu->vty.neigh_ctrl_port, VTY_NEWLINE);
@@ -1031,6 +1036,30 @@ DEFUN_USRATTR(cfg_pcu_gb_dialect,
return CMD_SUCCESS;
}
+DEFUN_USRATTR(cfg_pcu_gb_ip_dscp,
+ cfg_pcu_gb_ip_dscp_cmd,
+ X(PCU_VTY_ATTR_NS_RESET),
+ "gb ip-dscp <0-63>",
+ "Configure Gb interface\n"
+ "Set IP DSCP value for outbound packets\n"
+ "IP DSCP value to use\n")
+{
+ the_pcu->vty.ns_ip_dscp = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_pcu_gb_priority,
+ cfg_pcu_gb_priority_cmd,
+ X(PCU_VTY_ATTR_NS_RESET),
+ "gb socket-priority <0-255>",
+ "Configure Gb interface\n"
+ "Set socket priority value for outbound packets\n"
+ "Socket priority value to use (>6 requires CAP_NET_ADMIN)")
+{
+ the_pcu->vty.ns_priority = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_neighbor_resolution, cfg_neighbor_resolution_cmd,
"neighbor resolution " VTY_IPV46_CMD " [<0-65535>]",
"Manage local and remote-BSS neighbor cells\n"
@@ -1265,6 +1294,8 @@ int pcu_vty_init(void)
install_element(PCU_NODE, &cfg_pcu_no_gsmtap_categ_cmd);
install_element(PCU_NODE, &cfg_pcu_sock_cmd);
install_element(PCU_NODE, &cfg_pcu_gb_dialect_cmd);
+ install_element(PCU_NODE, &cfg_pcu_gb_ip_dscp_cmd);
+ install_element(PCU_NODE, &cfg_pcu_gb_priority_cmd);
install_element(PCU_NODE, &cfg_neighbor_resolution_cmd);
install_element(PCU_NODE, &cfg_pcu_timer_cmd);