ms: Get the set of slots currently active

This commits adds methods to GprsMs and gprs_rlcmac_tbf to retrieve
the slots that are actively used.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2015-06-30 09:18:30 +02:00
parent 23f93a15ca
commit 617c7127f4
4 changed files with 66 additions and 0 deletions

View File

@ -538,6 +538,32 @@ int GprsMs::first_common_ts() const
return -1;
}
uint8_t GprsMs::dl_slots() const
{
uint8_t slots = 0;
if (m_dl_tbf)
slots |= m_dl_tbf->dl_slots();
if (m_ul_tbf)
slots |= m_ul_tbf->dl_slots();
return slots;
}
uint8_t GprsMs::ul_slots() const
{
uint8_t slots = 0;
if (m_dl_tbf)
slots |= m_dl_tbf->ul_slots();
if (m_ul_tbf)
slots |= m_ul_tbf->ul_slots();
return slots;
}
void GprsMs::set_reserved_slots(gprs_rlcmac_trx *trx,
uint8_t ul_slots, uint8_t dl_slots)
{

View File

@ -80,6 +80,8 @@ public:
uint8_t current_cs_dl() const;
int first_common_ts() const;
uint8_t dl_slots() const;
uint8_t ul_slots() const;
uint8_t reserved_dl_slots() const;
uint8_t reserved_ul_slots() const;
gprs_rlcmac_trx *current_trx() const;

View File

@ -935,6 +935,42 @@ uint8_t gprs_rlcmac_tbf::tsc() const
return trx->pdch[first_ts].tsc;
}
uint8_t gprs_rlcmac_tbf::dl_slots() const
{
uint8_t slots = 0;
size_t i;
if (direction == GPRS_RLCMAC_UL_TBF)
return 0;
for (i = 0; i < ARRAY_SIZE(pdch); i += 1)
if (pdch[i])
slots |= 1 << i;
return slots;
}
uint8_t gprs_rlcmac_tbf::ul_slots() const
{
uint8_t slots = 0;
size_t i;
if (direction == GPRS_RLCMAC_DL_TBF) {
if (control_ts < 8)
slots |= 1 << control_ts;
if (first_common_ts < 8)
slots |= 1 << first_common_ts;
return slots;
}
for (i = 0; i < ARRAY_SIZE(pdch); i += 1)
if (pdch[i])
slots |= 1 << i;
return slots;
}
void tbf_print_vty_info(struct vty *vty, struct llist_head *ltbf)
{
gprs_rlcmac_tbf *tbf = llist_pods_entry(ltbf, gprs_rlcmac_tbf);

View File

@ -158,6 +158,8 @@ struct gprs_rlcmac_tbf {
const gprs_llc_queue *llc_queue() const;
time_t created_ts() const;
uint8_t dl_slots() const;
uint8_t ul_slots() const;
/* attempt to make things a bit more fair */
void rotate_in_list();