pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30295 )


Change subject: paging: constify bts param in some functions
......................................................................

paging: constify bts param in some functions

Related: libosmocore.git Change-Id Ib11bfe57f546a5618f70152b9b75115808e54bf6
Change-Id: Icb85fecba142151b05f289adae8894cd50396224
---
M include/osmocom/bsc/paging.h
M src/osmo-bsc/paging.c
2 files changed, 15 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/95/30295/1

diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index ccee2d4..720ee1c 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -135,12 +135,12 @@
 void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);

 /* pending paging requests */
-unsigned int paging_pending_requests_nr(struct gsm_bts *bts);
+unsigned int paging_pending_requests_nr(const struct gsm_bts *bts);

 void paging_flush_bts(struct gsm_bts *bts, struct bsc_msc_data *msc);
 void paging_flush_network(struct gsm_network *net, struct bsc_msc_data *msc);

-uint16_t paging_estimate_available_slots(struct gsm_bts *bts, unsigned int 
time_span_s);
+uint16_t paging_estimate_available_slots(const struct gsm_bts *bts, unsigned 
int time_span_s);

 int bsc_paging_start(struct bsc_paging_params *params);
 #endif
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index c7a93d0..27162d6 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -626,7 +626,7 @@
 }

 /*! Count the number of pending paging requests on given BTS */
-unsigned int paging_pending_requests_nr(struct gsm_bts *bts)
+unsigned int paging_pending_requests_nr(const struct gsm_bts *bts)
 {
        return bts->paging.pending_requests_len;
 }
@@ -658,10 +658,18 @@
                paging_flush_bts(bts, msc);
 }

-/*! Estimate available_slots credit over a time period, used when below CCCH 
Load Indication Threshold */
-uint16_t paging_estimate_available_slots(struct gsm_bts *bts, unsigned int 
time_span_s)
+/* Shim to avoid problems when compiling against libosmocore <= 1.7.0, since
+ * gsm0502_get_n_pag_blocks() was not declared const despite being readonly. 
Once
+ * osmo-bsc depends on libosmocore > 1.7.0, this shim can be dropped. */
+static inline unsigned int _gsm0502_get_n_pag_blocks(const struct 
gsm48_control_channel_descr *chan_desc)
 {
-       unsigned int n_pag_blocks = 
gsm0502_get_n_pag_blocks(&bts->si_common.chan_desc);
+       return gsm0502_get_n_pag_blocks((struct gsm48_control_channel_descr 
*)chan_desc);
+}
+
+/*! Estimate available_slots credit over a time period, used when below CCCH 
Load Indication Threshold */
+uint16_t paging_estimate_available_slots(const struct gsm_bts *bts, unsigned 
int time_span_s)
+{
+       unsigned int n_pag_blocks = 
_gsm0502_get_n_pag_blocks(&bts->si_common.chan_desc);
        uint16_t available_slots = n_pag_blocks * time_span_s * 1000000 / 
GSM51_MFRAME_DURATION_us;
        LOG_BTS(bts, DPAG, LOGL_DEBUG, "Estimated %u paging available_slots 
over %u seconds\n",
                available_slots, time_span_s);
@@ -676,7 +684,7 @@
 {
        unsigned int n_pag_blocks, n_mframes, time_us = 0;

-       n_pag_blocks = gsm0502_get_n_pag_blocks(&bts->si_common.chan_desc);
+       n_pag_blocks = _gsm0502_get_n_pag_blocks(&bts->si_common.chan_desc);

        /* First of all, we need to extend the timeout in relation to the amount
         * of paging requests in the BSC queue. In here we don't care about the

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30295
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Icb85fecba142151b05f289adae8894cd50396224
Gerrit-Change-Number: 30295
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to