laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-bts/+/31534 )
Change subject: common: Make socket queue max. length configurable
......................................................................
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
---
M include/osmo-bts/bts.h
M include/osmo-bts/pcu_if.h
M src/common/bts.c
M src/common/main.c
M src/common/pcu_sock.c
M src/common/vty.c
M tests/osmo-bts.vty
7 files changed, 59 insertions(+), 25 deletions(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index a21a5df..a17278e 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -356,6 +356,7 @@
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 b8ce9c4..d6e5d24 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -27,7 +27,7 @@
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 18f742d..2e73ad4 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -348,6 +348,7 @@
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 ed11956..a9ec0e7 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -380,7 +380,7 @@
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 8f34c33..9e34fe8 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -1167,7 +1167,7 @@
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 @@
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 0fc9007..31104c2 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 @@
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 @@
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 @@
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 @@
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 c473234..8c58aca 100644
--- a/tests/osmo-bts.vty
+++ b/tests/osmo-bts.vty
@@ -249,6 +249,7 @@
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)# ?
...
- 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
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/31534
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id6ba6e4eadce9ce82ef2407f4e28346e7fe4abfa
Gerrit-Change-Number: 31534
Gerrit-PatchSet: 18
Gerrit-Owner: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: msuraev <msuraev(a)sysmocom.de>
Gerrit-MessageType: merged