From patchwork Wed Jul 16 17:04:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Willmann X-Patchwork-Id: 370817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C6856140116 for ; Thu, 17 Jul 2014 03:10:34 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1X7Sig-0006VR-ER; Wed, 16 Jul 2014 19:10:19 +0200 Received: from isonoe.totalueberwachung.de ([2a01:198:210:100::1]) by ganesha.gnumonks.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1X7Sdg-0005kT-Uh; Wed, 16 Jul 2014 19:05:14 +0200 Received: from adrastea.totalueberwachung.de (91-65-194-134-dynip.superkabel.de [91.65.194.134]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by isonoe.totalueberwachung.de (Postfix) with ESMTPSA id 101896005D; Wed, 16 Jul 2014 19:05:02 +0200 (CEST) Received: by adrastea.totalueberwachung.de (Postfix, from userid 1000) id 6D43E41E3E; Wed, 16 Jul 2014 19:05:01 +0200 (CEST) From: Daniel Willmann To: OpenBSC Mailing List , Osmocom net ML Subject: [osmo-pcu 4/5] bts, tbf: Change the TBF return type of functions to the ul/dl version Date: Wed, 16 Jul 2014 19:04:31 +0200 Message-Id: X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <2207c5e4ef0565ab782196a80cc45dcc458938e4.1405530272.git.daniel@totalueberwachung.de> References: <2207c5e4ef0565ab782196a80cc45dcc458938e4.1405530272.git.daniel@totalueberwachung.de> In-Reply-To: <2207c5e4ef0565ab782196a80cc45dcc458938e4.1405530272.git.daniel@totalueberwachung.de> References: <2207c5e4ef0565ab782196a80cc45dcc458938e4.1405530272.git.daniel@totalueberwachung.de> X-Spam-Score: -0.0 (/) Cc: Daniel Willmann X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org Many functions only ever deal with or return a UL or a DL TBF. Explicitly change the type to reflect which TBF is used where. Ticket: SYS#389 Sponsored-by: On-Waves ehf --- src/bts.cpp | 38 +++++++++++++++++++------------------- src/tbf.cpp | 6 +++--- src/tbf.h | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/bts.cpp b/src/bts.cpp index 68d72f2..8489431 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -417,7 +417,7 @@ int BTS::rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn) int BTS::rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta) { - struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_ul_tbf *tbf; uint8_t trx_no, ts_no = 0; int8_t tfi; /* must be signed */ uint8_t sb = 0; @@ -461,7 +461,7 @@ int BTS::rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta) return -EBUSY; } /* set class to 0, since we don't know the multislot class yet */ - tbf = tbf_alloc(&m_bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 1); + tbf = (gprs_rlcmac_ul_tbf *)tbf_alloc(&m_bts, NULL, GPRS_RLCMAC_UL_TBF, tfi, trx_no, 0, 1); if (!tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n"); /* FIXME: send reject */ @@ -692,7 +692,7 @@ void gprs_rlcmac_pdch::add_paging(struct gprs_rlcmac_paging *pag) */ int gprs_rlcmac_pdch::rcv_data_block_acknowledged(uint8_t *data, uint8_t len, int8_t rssi) { - struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_ul_tbf *tbf; struct rlc_ul_header *rh = (struct rlc_ul_header *)data; switch (len) { @@ -867,24 +867,24 @@ void gprs_rlcmac_pdch::rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *ack_n void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request, uint32_t fn) { - struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_ul_tbf *ul_tbf; + struct gprs_rlcmac_dl_tbf *dl_tbf; struct gprs_rlcmac_sba *sba; int rc; if (request->ID.UnionType) { uint32_t tlli = request->ID.u.TLLI; uint8_t ms_class = 0; - struct gprs_rlcmac_tbf *dl_tbf; uint8_t ta; - tbf = bts()->ul_tbf_by_tlli(tlli); - if (tbf) { + ul_tbf = bts()->ul_tbf_by_tlli(tlli); + if (ul_tbf) { LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from " "TLLI=0x%08x while %s still " "exists. Killing pending DL TBF\n", - tlli, tbf_name(tbf)); - tbf_free(tbf); - tbf = NULL; + tlli, tbf_name(ul_tbf)); + tbf_free(ul_tbf); + ul_tbf = NULL; } if ((dl_tbf = bts()->dl_tbf_by_tlli(tlli))) { @@ -918,34 +918,34 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request, ms_class = Decoding::get_ms_class_by_capability(&request->MS_Radio_Access_capability); if (!ms_class) LOGP(DRLCMAC, LOGL_NOTICE, "MS does not give us a class.\n"); - tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class, tlli, ta, NULL); - if (!tbf) + ul_tbf = tbf_alloc_ul(bts_data(), trx_no(), ms_class, tlli, ta, NULL); + if (!ul_tbf) return; /* set control ts to current MS's TS, until assignment complete */ LOGP(DRLCMAC, LOGL_DEBUG, "Change control TS to %d until assinment is complete.\n", ts_no); - tbf->control_ts = ts_no; + ul_tbf->control_ts = ts_no; /* schedule uplink assignment */ - tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS; + ul_tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS; return; } if (request->ID.u.Global_TFI.UnionType) { int8_t tfi = request->ID.u.Global_TFI.u.DOWNLINK_TFI; - tbf = bts()->dl_tbf_by_tfi(tfi, trx_no()); - if (!tbf) { + dl_tbf = bts()->dl_tbf_by_tfi(tfi, trx_no()); + if (!dl_tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown downlink TFI=%d\n", tfi); return; } } else { int8_t tfi = request->ID.u.Global_TFI.u.UPLINK_TFI; - tbf = bts()->ul_tbf_by_tfi(tfi, trx_no()); - if (!tbf) { + ul_tbf = bts()->ul_tbf_by_tfi(tfi, trx_no()); + if (!ul_tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown uplink TFI=%d\n", tfi); return; } } - LOGP(DRLCMAC, LOGL_ERROR, "RX: [PCU <- BTS] %s FIXME: Packet resource request\n", tbf_name(tbf)); + LOGP(DRLCMAC, LOGL_ERROR, "RX: [PCU <- BTS] %s FIXME: Packet resource request\n", tbf_name(ul_tbf)); } void gprs_rlcmac_pdch::rcv_measurement_report(Packet_Measurement_Report_t *report, uint32_t fn) diff --git a/src/tbf.cpp b/src/tbf.cpp index 39549f1..15301a1 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -214,12 +214,12 @@ int gprs_rlcmac_tbf::handle(struct gprs_rlcmac_bts *bts, return tbf_new_dl_assignment(bts, imsi, tlli, ms_class, data, len); } -struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, +gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, int8_t use_trx, uint8_t ms_class, uint32_t tlli, uint8_t ta, struct gprs_rlcmac_tbf *dl_tbf) { uint8_t trx; - struct gprs_rlcmac_tbf *tbf; + struct gprs_rlcmac_ul_tbf *tbf; int8_t tfi; /* must be signed */ #warning "Copy and paste with tbf_new_dl_assignment" @@ -231,7 +231,7 @@ struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, return NULL; } /* use multislot class of downlink TBF */ - tbf = tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx, ms_class, 0); + tbf = (gprs_rlcmac_ul_tbf *)tbf_alloc(bts, dl_tbf, GPRS_RLCMAC_UL_TBF, tfi, trx, ms_class, 0); if (!tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n"); /* FIXME: send reject */ diff --git a/src/tbf.h b/src/tbf.h index 8464e19..d650021 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -259,7 +259,7 @@ protected: }; -struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, +struct gprs_rlcmac_ul_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts, int8_t use_trx, uint8_t ms_class, uint32_t tlli, uint8_t ta, struct gprs_rlcmac_tbf *dl_tbf);