aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-08 12:53:16 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-16 10:25:14 +0200
commit47a57f6f869f19704bbb993fc157a86fd0c85e58 (patch)
tree81a749e414cea4a732e1eccd513f5548d87488bb
parent61205a7e6539b3926c3039e8dcabda6aa9b408ef (diff)
pdch: Manage TFIs per direction
Currently a single bit set is used to maintain a set of used TFI without distinguishing between uplink and downlink. Since the namespaces of UL and DL TFI are separate, this implementation is not correct. This commit changes gprs_rlcmac_pdch to use a separate bit set for each direction. It also replace the corresponding conditional fprintf statement in check_tfi_usage (AllocTest.cpp) by an equivalent OSMO_ASSERT. Sponsored-by: On-Waves ehf
-rw-r--r--src/bts.cpp8
-rw-r--r--src/bts.h9
-rw-r--r--tests/alloc/AllocTest.cpp5
-rw-r--r--tests/alloc/AllocTest.err7
4 files changed, 11 insertions, 18 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index b96971db..bd1e025e 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1144,12 +1144,12 @@ void gprs_rlcmac_pdch::attach_tbf(gprs_rlcmac_tbf *tbf)
ul_tbf = static_cast<gprs_rlcmac_ul_tbf *>(tbf);
m_assigned_usf |= 1 << ul_tbf->m_usf[ts_no];
}
- m_assigned_tfi |= 1UL << tbf->tfi();
+ m_assigned_tfi[tbf->direction] |= 1UL << tbf->tfi();
LOGP(DRLCMAC, LOGL_INFO, "PDCH(TS %d, TRX %d): Attaching %s, %d TBFs, "
"USFs = %02x, TFIs = %08x.\n",
ts_no, trx_no(), tbf->name(), m_num_tbfs[tbf->direction],
- m_assigned_usf, m_assigned_tfi);
+ m_assigned_usf, m_assigned_tfi[tbf->direction]);
}
void gprs_rlcmac_pdch::detach_tbf(gprs_rlcmac_tbf *tbf)
@@ -1163,12 +1163,12 @@ void gprs_rlcmac_pdch::detach_tbf(gprs_rlcmac_tbf *tbf)
ul_tbf = static_cast<gprs_rlcmac_ul_tbf *>(tbf);
m_assigned_usf &= ~(1 << ul_tbf->m_usf[ts_no]);
}
- m_assigned_tfi &= ~(1UL << tbf->tfi());
+ m_assigned_tfi[tbf->direction] &= ~(1UL << tbf->tfi());
LOGP(DRLCMAC, LOGL_INFO, "PDCH(TS %d, TRX %d): Detaching %s, %d TBFs, "
"USFs = %02x, TFIs = %08x.\n",
ts_no, trx_no(), tbf->name(), m_num_tbfs[tbf->direction],
- m_assigned_usf, m_assigned_tfi);
+ m_assigned_usf, m_assigned_tfi[tbf->direction]);
}
void gprs_rlcmac_pdch::reserve(enum gprs_rlcmac_tbf_direction dir)
diff --git a/src/bts.h b/src/bts.h
index b9909ce3..b0e88f59 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -77,7 +77,7 @@ struct gprs_rlcmac_pdch {
unsigned num_reserved(enum gprs_rlcmac_tbf_direction dir) const;
uint8_t assigned_usf() const;
- uint32_t assigned_tfi() const;
+ uint32_t assigned_tfi(enum gprs_rlcmac_tbf_direction dir) const;
#endif
uint8_t m_is_enabled; /* TS is enabled */
@@ -109,7 +109,7 @@ private:
uint8_t m_num_tbfs[2];
uint8_t m_num_reserved[2];
uint8_t m_assigned_usf; /* bit set */
- uint32_t m_assigned_tfi; /* bit set */
+ uint32_t m_assigned_tfi[2]; /* bit set */
};
struct gprs_rlcmac_trx {
@@ -343,9 +343,10 @@ inline uint8_t gprs_rlcmac_pdch::assigned_usf() const
return m_assigned_usf;
}
-inline uint32_t gprs_rlcmac_pdch::assigned_tfi() const
+inline uint32_t gprs_rlcmac_pdch::assigned_tfi(
+ enum gprs_rlcmac_tbf_direction dir) const
{
- return m_assigned_tfi;
+ return m_assigned_tfi[dir];
}
inline struct rate_ctr_group *BTS::rate_counters() const
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 9394905e..66bc84f3 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -97,9 +97,8 @@ static void check_tfi_usage(BTS *the_bts)
tbf->trx->trx_no) == tbf);
}
*tbf_var = tbf;
- if (!(pdch->assigned_tfi() & (1 << tbf->tfi())))
- fprintf(stderr, "ERROR: "
- "TFI not marked as used in PDCH\n");
+ OSMO_ASSERT(pdch->assigned_tfi(tbf->direction) &
+ (1 << tbf->tfi()));
}
}
}
diff --git a/tests/alloc/AllocTest.err b/tests/alloc/AllocTest.err
index 34ef7561..2dc99fe1 100644
--- a/tests/alloc/AllocTest.err
+++ b/tests/alloc/AllocTest.err
@@ -20,19 +20,12 @@ No TFI available.
No TFI available.
No TFI available.
No TFI available.
-ERROR: TFI not marked as used in PDCH
No TFI available.
No TFI available.
-ERROR: TFI not marked as used in PDCH
-ERROR: TFI not marked as used in PDCH
-ERROR: TFI not marked as used in PDCH
-ERROR: TFI not marked as used in PDCH
No TFI available.
No TFI available.
-ERROR: TFI not marked as used in PDCH
No TFI available.
No TFI available.
-ERROR: TFI not marked as used in PDCH
No TFI available.
No TFI available.
No TFI available.