aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-25 12:21:55 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-03-25 12:21:55 +0100
commitcbb1e70554a08c7d6d1307d68883bc38a92fe4f3 (patch)
tree1f64192cc1bc3c660dcd031217649b41dbb87fd5
parentc4952091223e10d9e99fa035e6942656d233aa16 (diff)
tbf: Insert LLC dummy command if no frame is available
If a BSN is going to be created but there is no frame stored in m_llc, an empty LLC message would be created. This shouldn't happen currently, but this will be a common case, when delayed TBF release is implemented. This commit changes create_new_bsn() to create an LLC dummy command in that case and to put it into the frame buffer. Sponsored-by: On-Waves ehf
-rw-r--r--src/tbf_dl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index c894f5eb..9baa1cd0 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -349,7 +349,23 @@ struct msgb *gprs_rlcmac_dl_tbf::create_new_bsn(const uint32_t fn, const uint8_t
delimiter = data; /* where next length header would be stored */
space = block_data_len - sizeof(*rh);
while (1) {
+ if (m_llc.frame_length() == 0) {
+ /* A header will need to by added, so we just need
+ * space-1 octets */
+ m_llc.put_dummy_frame(space - 1);
+
+ /* It is not clear, when the next real data will
+ * arrive, so request a DL ack/nack now */
+ request_dl_ack();
+
+ LOGP(DRLCMACDL, LOGL_DEBUG,
+ "-- Empty chunk, "
+ "added LLC dummy command of size %d\n",
+ m_llc.frame_length());
+ }
+
chunk = m_llc.chunk_size();
+
/* if chunk will exceed block limit */
if (chunk > space) {
LOGP(DRLCMACDL, LOGL_DEBUG, "-- Chunk with length %d "