bts: Remove the global state gprs_rlcmac_trigger_downlink_assignment

Remove the global state from gprs_rlcmac_trigger_downlink_assignment
and walk up to the pcu_l1_if.cpp where I find the timeout handling
that should be part of the SBA and TBF functionality. In terms of
hierachies things start to be more clear.

There should be the BTS object. That holds the SBA and TBF Controllers
that can allocate TBFs and SBAs and will handle the timeout polling
for a BTS.
This commit is contained in:
Holger Hans Peter Freyther 2013-10-17 12:01:04 +02:00
parent 173a240a7e
commit 344ff48756
4 changed files with 22 additions and 19 deletions

View File

@ -183,7 +183,7 @@ void write_packet_uplink_ack(RlcMacDownlink_t * block, struct gprs_rlcmac_tbf *t
int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_tbf *tbf);
int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf);
int gprs_rlcmac_sba_timeout(struct gprs_rlcmac_sba *sba);
@ -198,10 +198,12 @@ struct msgb *gprs_rlcmac_send_packet_uplink_assignment(
struct msgb *gprs_rlcmac_send_packet_downlink_assignment(
struct gprs_rlcmac_tbf *tbf, uint32_t fn);
void gprs_rlcmac_trigger_downlink_assignment(struct gprs_rlcmac_tbf *tbf,
void gprs_rlcmac_trigger_downlink_assignment(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_tbf *tbf,
struct gprs_rlcmac_tbf *old_tbf, const char *imsi);
int gprs_rlcmac_downlink_ack(struct gprs_rlcmac_tbf *tbf, uint8_t final,
int gprs_rlcmac_downlink_ack(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_tbf *tbf, uint8_t final,
uint8_t ssn, uint8_t *rbb);
int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,

View File

@ -74,7 +74,8 @@ struct rlc_li_field {
} __attribute__ ((packed));
}
static void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf, uint8_t poll,
static void gprs_rlcmac_downlink_assignment(struct gprs_rlcmac_bts *bts,
gprs_rlcmac_tbf *tbf, uint8_t poll,
const char *imsi);
static int gprs_rlcmac_diag(struct gprs_rlcmac_tbf *tbf)
@ -82,7 +83,7 @@ static int gprs_rlcmac_diag(struct gprs_rlcmac_tbf *tbf)
return tbf->rlcmac_diag();
}
int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_tbf *tbf)
int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_bts *bts, struct gprs_rlcmac_tbf *tbf)
{
LOGP(DRLCMAC, LOGL_NOTICE, "Poll timeout for %s TBF=%d\n",
(tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tbf->tfi);
@ -99,8 +100,6 @@ int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_tbf *tbf)
tbf->ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE;
debug_diagram(tbf->diag, "timeout UL-ACK");
if (tbf->state_is(GPRS_RLCMAC_FINISHED)) {
struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
tbf->dir.ul.n3103++;
if (tbf->dir.ul.n3103 == bts->n3103) {
LOGP(DRLCMAC, LOGL_NOTICE,
@ -185,7 +184,7 @@ int gprs_rlcmac_poll_timeout(struct gprs_rlcmac_tbf *tbf)
"for TBF=%d on PCH (IMSI=%s)\n", tbf->tfi,
tbf->dir.dl.imsi);
/* send immediate assignment */
gprs_rlcmac_downlink_assignment(tbf, 0, tbf->dir.dl.imsi);
gprs_rlcmac_downlink_assignment(bts, tbf, 0, tbf->dir.dl.imsi);
tbf->dir.dl.wait_confirm = 1;
}
} else
@ -352,7 +351,7 @@ int gprs_rlcmac_rcv_control_block(bitvec *rlc_block, uint8_t trx, uint8_t ts,
tbf->poll_state = GPRS_RLCMAC_POLL_NONE;
debug_diagram(tbf->diag, "got DL-ACK");
rc = gprs_rlcmac_downlink_ack(tbf,
rc = gprs_rlcmac_downlink_ack(bts, tbf,
ul_control_block->u.Packet_Downlink_Ack_Nack.Ack_Nack_Description.FINAL_ACK_INDICATION,
ul_control_block->u.Packet_Downlink_Ack_Nack.Ack_Nack_Description.STARTING_SEQUENCE_NUMBER,
ul_control_block->u.Packet_Downlink_Ack_Nack.Ack_Nack_Description.RECEIVED_BLOCK_BITMAP);
@ -1479,7 +1478,8 @@ tx_block:
return dl_msg;
}
int gprs_rlcmac_downlink_ack(struct gprs_rlcmac_tbf *tbf, uint8_t final,
int gprs_rlcmac_downlink_ack(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_tbf *tbf, uint8_t final,
uint8_t ssn, uint8_t *rbb)
{
char show_rbb[65], show_v_b[RLC_MAX_SNS + 1];
@ -1618,7 +1618,7 @@ int gprs_rlcmac_downlink_ack(struct gprs_rlcmac_tbf *tbf, uint8_t final,
tbf->state_flags &= GPRS_RLCMAC_FLAG_TO_MASK; /* keep TO flags */
tbf->state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
tbf_update(tbf);
gprs_rlcmac_trigger_downlink_assignment(tbf, tbf, NULL);
gprs_rlcmac_trigger_downlink_assignment(bts, tbf, tbf, NULL);
return 0;
}
@ -1715,10 +1715,10 @@ struct msgb *gprs_rlcmac_send_packet_downlink_assignment(
return msg;
}
static void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf, uint8_t poll,
static void gprs_rlcmac_downlink_assignment(struct gprs_rlcmac_bts *bts,
gprs_rlcmac_tbf *tbf, uint8_t poll,
const char *imsi)
{
struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
int plen;
debug_diagram(tbf->diag, "IMM.ASS (PCH)");
@ -1736,7 +1736,8 @@ static void gprs_rlcmac_downlink_assignment(gprs_rlcmac_tbf *tbf, uint8_t poll,
}
/* depending on the current TBF, we assign on PACCH or AGCH */
void gprs_rlcmac_trigger_downlink_assignment(struct gprs_rlcmac_tbf *tbf,
void gprs_rlcmac_trigger_downlink_assignment(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_tbf *tbf,
struct gprs_rlcmac_tbf *old_tbf, const char *imsi)
{
#ifdef DEBUG_DL_ASS_IDLE
@ -1779,7 +1780,7 @@ void gprs_rlcmac_trigger_downlink_assignment(struct gprs_rlcmac_tbf *tbf,
tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
strncpy(tbf->dir.dl.imsi, imsi, sizeof(tbf->dir.dl.imsi));
/* send immediate assignment */
gprs_rlcmac_downlink_assignment(tbf, 0, imsi);
gprs_rlcmac_downlink_assignment(bts, tbf, 0, imsi);
tbf->dir.dl.wait_confirm = 1;
}
}

View File

@ -523,7 +523,7 @@ static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind)
elapsed = (frame_number + 2715648 - tbf->poll_fn)
% 2715648;
if (elapsed >= 20 && elapsed < 2715400)
gprs_rlcmac_poll_timeout(tbf);
gprs_rlcmac_poll_timeout(gprs_rlcmac_bts, tbf);
}
}
llist_for_each_entry(tbf, &gprs_rlcmac_dl_tbfs, list) {
@ -531,7 +531,7 @@ static int pcu_rx_time_ind(struct gsm_pcu_if_time_ind *time_ind)
elapsed = (frame_number + 2715648 - tbf->poll_fn)
% 2715648;
if (elapsed >= 20 && elapsed < 2715400)
gprs_rlcmac_poll_timeout(tbf);
gprs_rlcmac_poll_timeout(gprs_rlcmac_bts, tbf);
}
}
llist_for_each_entry_safe(sba, sba2, &gprs_rlcmac_sbas, list) {

View File

@ -71,7 +71,7 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
tbf->state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
tbf_update_ms_class(tbf, ms_class);
tbf_update(tbf);
gprs_rlcmac_trigger_downlink_assignment(tbf, tbf, NULL);
gprs_rlcmac_trigger_downlink_assignment(bts, tbf, tbf, NULL);
} else {
/* the TBF exists, so we must write it in the queue
* we prepend lifetime in front of PDU */
@ -177,7 +177,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
* we don't use old_downlink, so the possible uplink is used
* to trigger downlink assignment. if there is no uplink,
* AGCH is used. */
gprs_rlcmac_trigger_downlink_assignment(tbf, old_tbf, imsi);
gprs_rlcmac_trigger_downlink_assignment(bts, tbf, old_tbf, imsi);
/* store IMSI for debugging purpose. TODO: it is more than debugging */
tbf_assign_imsi(tbf, imsi);