aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarehbein <arehbein@sysmocom.de>2023-02-27 01:29:13 +0100
committerlaforge <laforge@osmocom.org>2023-07-12 07:46:05 +0000
commit34077236f2676432f0f1a0c9b451c67fa7801509 (patch)
tree9d3632998b19626877595733b838b3edcb047cde
parentd53a084fd67454912aa093774ec9f896fddc8d06 (diff)
common: Make socket queue max. length configurable
Title refers to the maximum length of the osmo_wqueue used for the PCU socket connection. Related: OS#5774 Change-Id: Id6ba6e4eadce9ce82ef2407f4e28346e7fe4abfa
-rw-r--r--include/osmo-bts/bts.h1
-rw-r--r--include/osmo-bts/pcu_if.h2
-rw-r--r--src/common/bts.c1
-rw-r--r--src/common/main.c2
-rw-r--r--src/common/pcu_sock.c4
-rw-r--r--src/common/vty.c21
-rw-r--r--tests/osmo-bts.vty40
7 files changed, 46 insertions, 25 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index a21a5df8..a17278e4 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -356,6 +356,7 @@ struct gsm_bts {
struct {
char *sock_path;
+ unsigned int sock_wqueue_len_max;
} pcu;
/* GSMTAP Um logging (disabled by default) */
diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index b8ce9c44..d6e5d24b 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -27,7 +27,7 @@ int pcu_tx_pch_data_cnf(uint32_t fn, uint32_t tlli);
int pcu_tx_susp_req(struct gsm_lchan *lchan, uint32_t tlli, const uint8_t *ra_id, uint8_t cause);
int pcu_sock_send(struct msgb *msg);
-int pcu_sock_init(const char *path);
+int pcu_sock_init(const char *path, int qlength_max);
void pcu_sock_exit(void);
bool pcu_connected(void);
diff --git a/src/common/bts.c b/src/common/bts.c
index 18f742de..2e73ad4f 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -348,6 +348,7 @@ int bts_init(struct gsm_bts *bts)
bts->min_qual_norm = MIN_QUAL_NORM;
bts->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 */
bts->pcu.sock_path = talloc_strdup(bts, PCU_SOCK_DEFAULT);
+ bts->pcu.sock_wqueue_len_max = BTS_PCU_SOCK_WQUEUE_LEN_DEFAULT;
for (i = 0; i < ARRAY_SIZE(bts->t200_ms); i++)
bts->t200_ms[i] = oml_default_t200_ms[i];
diff --git a/src/common/main.c b/src/common/main.c
index ed119568..a9ec0e7c 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -380,7 +380,7 @@ int bts_main(int argc, char **argv)
exit(1);
}
- if (pcu_sock_init(g_bts->pcu.sock_path)) {
+ if (pcu_sock_init(g_bts->pcu.sock_path, g_bts->pcu.sock_wqueue_len_max)) {
fprintf(stderr, "PCU L1 socket failed\n");
exit(1);
}
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 8f34c339..9e34fe8b 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -1167,7 +1167,7 @@ static int pcu_sock_accept(struct osmo_fd *bfd, unsigned int flags)
return 0;
}
-int pcu_sock_init(const char *path)
+int pcu_sock_init(const char *path, int qlength_max)
{
struct pcu_sock_state *state;
struct osmo_fd *bfd;
@@ -1177,7 +1177,7 @@ int pcu_sock_init(const char *path)
if (!state)
return -ENOMEM;
- osmo_wqueue_init(&state->upqueue, BTS_PCU_SOCK_WQUEUE_LEN_DEFAULT);
+ osmo_wqueue_init(&state->upqueue, qlength_max);
state->upqueue.read_cb = pcu_sock_read;
state->upqueue.write_cb = pcu_sock_write;
state->upqueue.bfd.fd = -1;
diff --git a/src/common/vty.c b/src/common/vty.c
index 0fc9007d..31104c27 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -22,6 +22,7 @@
#include "btsconfig.h"
#include <inttypes.h>
+#include <limits.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -70,6 +71,9 @@
#define BTS_TRX_STR BTS_NR_STR TRX_NR_STR
#define BTS_TRX_TS_STR BTS_TRX_STR TS_NR_STR
#define BTS_TRX_TS_LCHAN_STR BTS_TRX_TS_STR LCHAN_NR_STR
+/* INT32_MAX, because osmo_wqueue_init takes int as an argument
+ * and INT_MAX can't be stringified as a decimal */
+#define BTS_CFG_PCU_SOCK_WQUEUE_LEN_MAX_MAX 2147483647
#define X(x) (1 << x)
@@ -466,6 +470,8 @@ static void config_write_bts_single(struct vty *vty, const struct gsm_bts *bts)
VTY_NEWLINE);
if (strcmp(bts->pcu.sock_path, PCU_SOCK_DEFAULT))
vty_out(vty, " pcu-socket %s%s", bts->pcu.sock_path, VTY_NEWLINE);
+ if (bts->pcu.sock_wqueue_len_max != BTS_CFG_PCU_SOCK_WQUEUE_LEN_MAX_MAX)
+ vty_out(vty, " pcu-socket-wqueue-length %u%s", bts->pcu.sock_wqueue_len_max, VTY_NEWLINE);
if (bts->supp_meas_toa256)
vty_out(vty, " supp-meas-info toa256%s", VTY_NEWLINE);
vty_out(vty, " smscb queue-max-length %d%s", bts->smscb_queue_max_len, VTY_NEWLINE);
@@ -1023,7 +1029,7 @@ DEFUN_ATTR(cfg_bts_max_ber_rach, cfg_bts_max_ber_rach_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd,
+DEFUN(cfg_bts_pcu_sock_path, cfg_bts_pcu_sock_path_cmd,
"pcu-socket PATH",
"Configure the PCU socket file/path name\n"
"UNIX socket path\n")
@@ -1036,6 +1042,16 @@ DEFUN(cfg_bts_pcu_sock, cfg_bts_pcu_sock_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_bts_pcu_sock_ql, cfg_bts_pcu_sock_ql_cmd,
+ "pcu-socket-wqueue-length <1-" OSMO_STRINGIFY_VAL(BTS_CFG_PCU_SOCK_WQUEUE_LEN_MAX_MAX) ">",
+ "Configure the PCU socket queue length\n"
+ "Queue length\n")
+{
+ struct gsm_bts *bts = vty->index;
+ bts->pcu.sock_wqueue_len_max = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN_ATTR(cfg_bts_supp_meas_toa256, cfg_bts_supp_meas_toa256_cmd,
"supp-meas-info toa256",
"Configure the RSL Supplementary Measurement Info\n"
@@ -2741,7 +2757,8 @@ int bts_vty_init(void *ctx)
install_element(BTS_NODE, &cfg_bts_min_qual_rach_cmd);
install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd);
install_element(BTS_NODE, &cfg_bts_max_ber_rach_cmd);
- install_element(BTS_NODE, &cfg_bts_pcu_sock_cmd);
+ install_element(BTS_NODE, &cfg_bts_pcu_sock_path_cmd);
+ install_element(BTS_NODE, &cfg_bts_pcu_sock_ql_cmd);
install_element(BTS_NODE, &cfg_bts_supp_meas_toa256_cmd);
install_element(BTS_NODE, &cfg_bts_no_supp_meas_toa256_cmd);
install_element(BTS_NODE, &cfg_bts_smscb_max_qlen_cmd);
diff --git a/tests/osmo-bts.vty b/tests/osmo-bts.vty
index c4732344..8c58aca7 100644
--- a/tests/osmo-bts.vty
+++ b/tests/osmo-bts.vty
@@ -249,6 +249,7 @@ OsmoBTS(bts)# list
min-qual-norm <-100-100>
max-ber10k-rach <0-10000>
pcu-socket PATH
+ pcu-socket-wqueue-length <1-2147483647>
supp-meas-info toa256
no supp-meas-info toa256
smscb queue-max-length <1-60>
@@ -266,25 +267,26 @@ OsmoBTS(bts)# list
...
OsmoBTS(bts)# ?
...
- ipa ip.access RSL commands
- oml OML Parameters
- no Negate a command or set its defaults
- rtp RTP parameters
- band Set the frequency band of this BTS
- description Save human-readable description of the object
- paging Paging related parameters
- agch-queue-mgmt AGCH queue mgmt
- min-qual-rach Set the minimum link quality level of Access Bursts to be accepted
- min-qual-norm Set the minimum link quality level of Normal Bursts to be accepted
- max-ber10k-rach Set the maximum BER for valid RACH requests
- pcu-socket Configure the PCU socket file/path name
- supp-meas-info Configure the RSL Supplementary Measurement Info
- smscb SMSCB (SMS Cell Broadcast) / CBCH configuration
- gsmtap-remote-host Enable GSMTAP Um logging (see also 'gsmtap-sapi')
- gsmtap-local-host Enable local bind for GSMTAP Um logging (see also 'gsmtap-sapi')
- gsmtap-sapi Enable/disable sending of UL/DL messages over GSMTAP
- osmux Configure Osmux
- trx Select a TRX to configure
+ ipa ip.access RSL commands
+ oml OML Parameters
+ no Negate a command or set its defaults
+ rtp RTP parameters
+ band Set the frequency band of this BTS
+ description Save human-readable description of the object
+ paging Paging related parameters
+ agch-queue-mgmt AGCH queue mgmt
+ min-qual-rach Set the minimum link quality level of Access Bursts to be accepted
+ min-qual-norm Set the minimum link quality level of Normal Bursts to be accepted
+ max-ber10k-rach Set the maximum BER for valid RACH requests
+ pcu-socket Configure the PCU socket file/path name
+ pcu-socket-wqueue-length Configure the PCU socket queue length
+ supp-meas-info Configure the RSL Supplementary Measurement Info
+ smscb SMSCB (SMS Cell Broadcast) / CBCH configuration
+ gsmtap-remote-host Enable GSMTAP Um logging (see also 'gsmtap-sapi')
+ gsmtap-local-host Enable local bind for GSMTAP Um logging (see also 'gsmtap-sapi')
+ gsmtap-sapi Enable/disable sending of UL/DL messages over GSMTAP
+ osmux Configure Osmux
+ trx Select a TRX to configure
...
OsmoBTS(bts)# trx 0
OsmoBTS(trx)# list