tfi: The tfi_alloc doesn't allocate anything, rename the function

Call things by what they do and this function doesn't allocate
anything but it is searching for the first unallocated tbf index.
This commit is contained in:
Holger Hans Peter Freyther 2013-08-24 21:16:55 +02:00 committed by Ivan Kluchnikov
parent 9d938388f6
commit d6bd91e4e5
4 changed files with 7 additions and 5 deletions

View File

@ -233,7 +233,7 @@ static int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp)
}
// Create new TBF (any TRX)
tfi = tfi_alloc(the_pcu.bts, GPRS_RLCMAC_DL_TBF, &trx, use_trx);
tfi = tfi_find_free(the_pcu.bts, GPRS_RLCMAC_DL_TBF, &trx, use_trx);
if (tfi < 0) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource\n");
/* FIXME: send reject */

View File

@ -2,6 +2,7 @@
*
* Copyright (C) 2012 Ivan Klyuchnikov
* Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu>
* Copyright (C) 2013 by Holger Hans Peter Freyther
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -176,7 +177,7 @@ void debug_diagram(int diag, const char *format, ...)
/* FIXME: spread ressources over multiple TRX. Also add option to use same
* TRX in case of existing TBF for TLLI in the other direction. */
/* search for free TFI and return TFI, TRX */
int tfi_alloc(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,
int tfi_find_free(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,
uint8_t *_trx, int8_t use_trx)
{
struct gprs_rlcmac_pdch *pdch;

View File

@ -1,6 +1,7 @@
/* gprs_rlcmac.h
*
* Copyright (C) 2012 Ivan Klyuchnikov
* Copyright (C) 2013 by Holger Hans Peter Freyther
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -309,7 +310,7 @@ int sba_alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta);
struct gprs_rlcmac_sba *sba_find(uint8_t trx, uint8_t ts, uint32_t fn);
int tfi_alloc(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,
int tfi_find_free(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,
uint8_t *_trx, int8_t use_trx);
struct gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,

View File

@ -239,7 +239,7 @@ static struct gprs_rlcmac_tbf *alloc_ul_tbf(int8_t use_trx, uint8_t ms_class,
uint8_t tfi;
/* create new TBF, use sme TRX as DL TBF */
tfi = tfi_alloc(bts, GPRS_RLCMAC_UL_TBF, &trx, use_trx);
tfi = tfi_find_free(bts, GPRS_RLCMAC_UL_TBF, &trx, use_trx);
if (tfi < 0) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH ressource\n");
/* FIXME: send reject */
@ -1174,7 +1174,7 @@ int gprs_rlcmac_rcv_rach(uint8_t ra, uint32_t Fn, int16_t qta)
"(AGCH)\n");
} else {
// Create new TBF
tfi = tfi_alloc(bts, GPRS_RLCMAC_UL_TBF, &trx, -1);
tfi = tfi_find_free(bts, GPRS_RLCMAC_UL_TBF, &trx, -1);
if (tfi < 0) {
LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH ressource\n");
/* FIXME: send reject */