hi,

this patch allows to tune control channel. it can be used to speed up
GPRS TBF establishment.

regards,

andreas

>From 79048da5cefa1e8934420d43f9d1981c70062332 Mon Sep 17 00:00:00 2001
From: Andreas Eversberg <[email protected]>
Date: Sat, 13 Oct 2012 07:27:47 +0200
Subject: [PATCH] Allow setting of Control Channel Description parameters via VTY

---
 openbsc/src/libbsc/bsc_init.c    |    8 ++--
 openbsc/src/libbsc/bsc_vty.c     |   59 ++++++++++++++++++++++++++++++++++++++
 openbsc/src/libcommon/gsm_data.c |    3 ++
 3 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 2533aa7..f5d7969 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -421,10 +421,7 @@ static int bootstrap_bts(struct gsm_bts *bts)
                        "GSM networks and should only be used in a RF "
                        "shielded environment such as a faraday cage!\n\n");
 
-       /* Control Channel Description */
-       bts->si_common.chan_desc.att = 1;
-       bts->si_common.chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5;
-       bts->si_common.chan_desc.bs_ag_blks_res = 1;
+       /* Control Channel Description is set from vty/config */
 
        /* T3212 is set from vty/config */
 
@@ -435,6 +432,9 @@ static int bootstrap_bts(struct gsm_bts *bts)
        switch (n) {
        case 0:
                bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_C;
+               /* Limit reserved block to 2 on combined channel */
+               if (bts->si_common.chan_desc.bs_ag_blks_res > 2)
+                       bts->si_common.chan_desc.bs_ag_blks_res = 2;
                break;
        case 1:
                bts->si_common.chan_desc.ccch_conf = RSL_BCCH_CCCH_CONF_1_NC;
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index b91304d..61b0911 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -256,6 +256,12 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts 
*bts)
                VTY_NEWLINE);
        if (bts->si_common.rach_control.cell_bar)
                vty_out(vty, "  CELL IS BARRED%s", VTY_NEWLINE);
+       vty_out(vty, "Channel Description Attachment: %s%s",
+               (bts->si_common.chan_desc.att) ? "yes" : "no", VTY_NEWLINE);
+       vty_out(vty, "Channel Description BS-PA-MFRMS: %u%s",
+               bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
+       vty_out(vty, "Channel Description BS-AG_BLKS-RES: %u%s",
+               bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
        vty_out(vty, "System Information present: 0x%08x, static: 0x%08x%s",
                bts->si_valid, bts->si_mode_static, VTY_NEWLINE);
        if (is_ipaccess_bts(bts))
@@ -496,6 +502,13 @@ static void config_write_bts_single(struct vty *vty, 
struct gsm_bts *bts)
                rach_max_trans_raw2val(bts->si_common.rach_control.max_trans),
                VTY_NEWLINE);
 
+       vty_out(vty, "  channel-descrption attach %u%s",
+               bts->si_common.chan_desc.att, VTY_NEWLINE);
+       vty_out(vty, "  channel-descrption bs-pa-mfrms %u%s",
+               bts->si_common.chan_desc.bs_pa_mfrms + 2, VTY_NEWLINE);
+       vty_out(vty, "  channel-descrption bs-ag-blks-res %u%s",
+               bts->si_common.chan_desc.bs_ag_blks_res, VTY_NEWLINE);
+
        if (bts->rach_b_thresh != -1)
                vty_out(vty, "  rach nm busy threshold %u%s",
                        bts->rach_b_thresh, VTY_NEWLINE);
@@ -1770,6 +1783,49 @@ DEFUN(cfg_bts_rach_max_trans,
        return CMD_SUCCESS;
 }
 
+#define CD_STR "Channel Description\n"
+
+DEFUN(cfg_bts_chan_desc_att,
+      cfg_bts_chan_desc_att_cmd,
+      "channel-descrption attach (0|1)",
+       CD_STR
+      "Set if attachment is required\n"
+      "Attachment is NOT required\n"
+      "Attachment is required (standard)\n")
+{
+       struct gsm_bts *bts = vty->index;
+       bts->si_common.chan_desc.att = atoi(argv[0]);
+       return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_chan_desc_bs_pa_mfrms,
+      cfg_bts_chan_desc_bs_pa_mfrms_cmd,
+      "channel-descrption bs-pa-mfrms <2-9>",
+       CD_STR
+      "Set number of multiframe periods for paging groups\n"
+      "Number of multiframe periods for paging groups\n")
+{
+       struct gsm_bts *bts = vty->index;
+       int bs_pa_mfrms = atoi(argv[0]);
+
+       bts->si_common.chan_desc.bs_pa_mfrms = bs_pa_mfrms - 2;
+       return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_chan_desc_bs_ag_blks_res,
+      cfg_bts_chan_desc_bs_ag_blks_res_cmd,
+      "channel-descrption bs-ag-blks-res <0-7>",
+       CD_STR
+      "Set number of blocks reserved for access grant\n"
+      "Number of blocks reserved for access grant\n")
+{
+       struct gsm_bts *bts = vty->index;
+       int bs_ag_blks_res = atoi(argv[0]);
+
+       bts->si_common.chan_desc.bs_ag_blks_res = bs_ag_blks_res;
+       return CMD_SUCCESS;
+}
+
 #define NM_STR "Network Management\n"
 
 DEFUN(cfg_bts_rach_nm_b_thresh,
@@ -2942,6 +2998,9 @@ int bsc_vty_init(const struct log_info *cat)
        install_element(BTS_NODE, &cfg_bts_challoc_cmd);
        install_element(BTS_NODE, &cfg_bts_rach_tx_integer_cmd);
        install_element(BTS_NODE, &cfg_bts_rach_max_trans_cmd);
+       install_element(BTS_NODE, &cfg_bts_chan_desc_att_cmd);
+       install_element(BTS_NODE, &cfg_bts_chan_desc_bs_pa_mfrms_cmd);
+       install_element(BTS_NODE, &cfg_bts_chan_desc_bs_ag_blks_res_cmd);
        install_element(BTS_NODE, &cfg_bts_rach_nm_b_thresh_cmd);
        install_element(BTS_NODE, &cfg_bts_rach_nm_ldavg_cmd);
        install_element(BTS_NODE, &cfg_bts_cell_barred_cmd);
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index 8b030e9..352700a 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -405,6 +405,9 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network 
*net, enum gsm_bts_typ
        bts->si_common.rach_control.tx_integer = 9;  /* 12 slots spread - 
217/115 slots delay */
        bts->si_common.rach_control.max_trans = 3; /* 7 retransmissions */
        bts->si_common.rach_control.t2 = 4; /* no emergency calls */
+       bts->si_common.chan_desc.att = 1; /* attachment required */
+       bts->si_common.chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5; /* paging 
frames */
+       bts->si_common.chan_desc.bs_ag_blks_res = 1; /* reserved AGCH blocks */
 
        llist_add_tail(&bts->list, &net->bts_list);
 
-- 
1.7.3.4

Reply via email to