edge: Add m_egprs_enabled and related methods to TBF

Add the following methods to gprs_rlcmac_tbf:
  - is_egprs_enabled
  - enable_egprs
  - disable_egprs

Also show the value of the flag in name() by displaying "EGPRS" if
it is set.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2015-11-27 16:17:40 +01:00
parent 76d767cbe8
commit 5643f35fb4
2 changed files with 27 additions and 3 deletions

View File

@ -74,7 +74,8 @@ gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir) :
m_ms(NULL),
m_ta(0),
m_ms_class(0),
m_ms_list(this)
m_ms_list(this),
m_egprs_enabled(false)
{
/* The classes of these members do not have proper constructors yet.
* Just set them to 0 like talloc_zero did */
@ -1060,10 +1061,11 @@ const char *gprs_rlcmac_tbf::name() const
return "(no TBF)";
snprintf(m_name_buf, sizeof(m_name_buf) - 1,
"TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s)",
"TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s%s)",
m_tfi, tlli(),
direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL",
state_name()
state_name(),
is_egprs_enabled() ? " EGPRS" : ""
);
m_name_buf[sizeof(m_name_buf) - 1] = '\0';
return m_name_buf;

View File

@ -164,6 +164,11 @@ struct gprs_rlcmac_tbf {
uint8_t dl_slots() const;
uint8_t ul_slots() const;
/* EGPRS */
bool is_egprs_enabled() const;
void enable_egprs();
void disable_egprs();
/* attempt to make things a bit more fair */
void rotate_in_list();
@ -246,6 +251,7 @@ protected:
private:
LListHead<gprs_rlcmac_tbf> m_ms_list;
bool m_egprs_enabled;
mutable char m_name_buf[60];
};
@ -315,6 +321,21 @@ inline time_t gprs_rlcmac_tbf::created_ts() const
return m_created_ts;
}
inline bool gprs_rlcmac_tbf::is_egprs_enabled() const
{
return m_egprs_enabled;
}
inline void gprs_rlcmac_tbf::enable_egprs()
{
m_egprs_enabled = true;
}
inline void gprs_rlcmac_tbf::disable_egprs()
{
m_egprs_enabled = false;
}
struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
gprs_rlcmac_dl_tbf(BTS *bts);
@ -339,6 +360,7 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf {
int frames_since_last_drain(unsigned fn) const;
bool keep_open(unsigned fn) const;
int release();
void enable_egprs();
bool is_control_ts(uint8_t ts) const {
return ts == control_ts;