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
This commit is contained in:
Harald Welte 2021-04-29 22:02:47 +02:00
parent 4e453b41f3
commit d9367e34db
5 changed files with 41 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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);