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


Change subject: common: Make max length of osmo_wqueue for PCU socket 
connection configurable
......................................................................

common: Make max length of osmo_wqueue for PCU socket connection configurable

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, 76 insertions(+), 28 deletions(-)



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

diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 0ecec1e..2c36c55 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -360,6 +360,7 @@

        struct {
                char *sock_path;
+               int sock_qlength_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 6cdc682..d38f631 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -25,7 +25,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 gsm_network *net, 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 9cc694f..d19fb39 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -360,6 +360,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_qlength_max = PCU_SOCK_QLENGTH_MAX_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 2b86a77..0d81cc5 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -373,7 +373,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_qlength_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 1d9fd2e..06c2615 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -1168,7 +1168,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;
@@ -1178,7 +1178,7 @@
        if (!state)
                return -ENOMEM;

-       osmo_wqueue_init(&state->upqueue, PCU_SOCK_QLENGTH_MAX_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 5877a41..3bbc0af 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>
@@ -68,6 +69,7 @@
 #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
+#define BTS_CFG_PCU_SOCK_QLENGTH_MAX_MAX 128

 #define X(x) (1 << x)

@@ -461,6 +463,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_qlength_max != PCU_SOCK_QLENGTH_MAX_DEFAULT)
+               vty_out(vty, " pcu-socket-queue-length %d%s", 
bts->pcu.sock_qlength_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);
@@ -964,7 +968,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")
@@ -977,6 +981,22 @@
        return CMD_SUCCESS;
 }

+DEFUN(cfg_bts_pcu_sock_ql, cfg_bts_pcu_sock_ql_cmd,
+       "pcu-socket-queue-length <1-" 
OSMO_STRINGIFY_VAL(BTS_CFG_PCU_SOCK_QLENGTH_MAX_MAX) ">",
+       "Configure the PCU socket queue length\n"
+       "Queue length\n")
+{
+       struct gsm_bts *bts = vty->index;
+       bts->pcu.sock_qlength_max = atoi(argv[0]);
+       if (bts->pcu.sock_qlength_max < 1 || bts->pcu.sock_qlength_max >
+           BTS_CFG_PCU_SOCK_QLENGTH_MAX_MAX) {
+               vty_out(vty, "%% Invalid length for PCU socket queue: %s%s",
+                       argv[0], VTY_NEWLINE);
+               return CMD_WARNING;
+       }
+       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"
@@ -2643,7 +2663,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 0b67ae9..83971dc 100644
--- a/tests/osmo-bts.vty
+++ b/tests/osmo-bts.vty
@@ -225,7 +225,17 @@

 OsmoBTS(config)# bts 0
 OsmoBTS(bts)# list
-...
+  help
+  list [with-flags]
+  show vty-attributes
+  show vty-attributes (application|library|global)
+  write terminal
+  write file [PATH]
+  write memory
+  write
+  show running-config
+  exit
+  end
   ipa unit-id <0-65534> <0-255>
   oml remote-ip A.B.C.D
   no oml remote-ip A.B.C.D
@@ -244,6 +254,7 @@
   min-qual-norm <-100-100>
   max-ber10k-rach <0-10000>
   pcu-socket PATH
+  pcu-socket-queue-length <1-128>
   supp-meas-info toa256
   no supp-meas-info toa256
   smscb queue-max-length <1-60>
@@ -256,28 +267,32 @@
   no gsmtap-sapi 
(bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
   osmux
   trx <0-254>
-...
 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-sapi         Enable/disable sending of UL/DL messages over GSMTAP
-  osmux               Configure Osmux
-  trx                 Select a TRX to configure
-...
+  help                     Description of the interactive help system
+  list                     Print command list
+  show                     Show running system information
+  write                    Write running configuration to memory, network, or 
terminal
+  exit                     Exit current mode and down to previous mode
+  end                      End current mode and change to enable mode.
+  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-queue-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-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: 1
Gerrit-Owner: arehbein <[email protected]>
Gerrit-MessageType: newchange

Reply via email to