From 554a835e906419ff5b4b773b3a723a3fa2e15611 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Wed, 9 Dec 2015 17:39:56 +0100 Subject: [PATCH] edge: Use a single PDCH rcv_data_block method for GPRS and EGPRS Currently GPRS is handled by the old code path while EGPRS already uses the unified functions. The rcv_block_egprs is basically not specific to EGPRS and just needs minor modifications to handle GPRS. This commit turns gprs_rlcmac_pdch::rcv_block_egprs into a unified rcv_data_block method and uses it for GPRS, too. Note that the logging messages of the new parser are different. Sponsored-by: On-Waves ehf --- src/bts.cpp | 33 ++++++++++-------- src/bts.h | 2 +- tests/tbf/TbfTest.err | 81 +++++++++++++++++++++++-------------------- 3 files changed, 63 insertions(+), 53 deletions(-) diff --git a/src/bts.cpp b/src/bts.cpp index fdbcfdeb..54cf6b2e 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1159,7 +1159,7 @@ int gprs_rlcmac_pdch::rcv_block(uint8_t *data, uint8_t len, uint32_t fn, return rcv_block_gprs(data, fn, meas, cs); if (cs.isEgprs()) - return rcv_block_egprs(data, fn, meas, cs); + return rcv_data_block(data, fn, meas, cs); bts()->decode_error(); LOGP(DRLCMACUL, LOGL_ERROR, "Unsupported coding scheme %s\n", @@ -1167,7 +1167,7 @@ int gprs_rlcmac_pdch::rcv_block(uint8_t *data, uint8_t len, uint32_t fn, return -EINVAL; } -int gprs_rlcmac_pdch::rcv_block_egprs(uint8_t *data, uint32_t fn, +int gprs_rlcmac_pdch::rcv_data_block(uint8_t *data, uint32_t fn, struct pcu_l1_meas *meas, GprsCodingScheme cs) { int rc; @@ -1178,19 +1178,22 @@ int gprs_rlcmac_pdch::rcv_block_egprs(uint8_t *data, uint32_t fn, /* These are always data blocks, since EGPRS still uses CS-1 for * control blocks (see 44.060, section 10.3, 1st par.) */ - if (!bts()->bts_data()->egprs_enabled) { - LOGP(DRLCMACUL, LOGL_ERROR, - "Got %s RLC block but EGPRS is not enabled\n", - cs.name()); - return -EINVAL; - } + if (cs.isEgprs()) { + if (!bts()->bts_data()->egprs_enabled) { + LOGP(DRLCMACUL, LOGL_ERROR, + "Got %s RLC block but EGPRS is not enabled\n", + cs.name()); + return -EINVAL; + } - if (!cs.isEgprsGmsk()) { - LOGP(DRLCMACUL, LOGL_ERROR, - "Got %s RLC block but EGPRS is not implemented for 8PSK yet\n", - cs.name()); - bts()->decode_error(); - return -EINVAL; + if (!cs.isEgprsGmsk()) { + LOGP(DRLCMACUL, LOGL_ERROR, + "Got %s RLC block but EGPRS is not implemented " + "for 8PSK yet\n", + cs.name()); + bts()->decode_error(); + return -EINVAL; + } } rc = Decoding::rlc_parse_ul_data_header(&rlc_dec, data, cs); @@ -1231,7 +1234,7 @@ int gprs_rlcmac_pdch::rcv_block_gprs(uint8_t *data, uint32_t fn, switch (payload) { case GPRS_RLCMAC_DATA_BLOCK: - rc = rcv_data_block_acknowledged_gprs(data, len, meas); + rc = rcv_data_block(data, fn, meas, cs); break; case GPRS_RLCMAC_CONTROL_BLOCK: block = bitvec_alloc(len); diff --git a/src/bts.h b/src/bts.h index 51df5a3e..4867ac00 100644 --- a/src/bts.h +++ b/src/bts.h @@ -66,7 +66,7 @@ struct gprs_rlcmac_pdch { struct pcu_l1_meas *meas); int rcv_block_gprs(uint8_t *data, uint32_t fn, struct pcu_l1_meas *meas, GprsCodingScheme cs); - int rcv_block_egprs(uint8_t *data, uint32_t fn, + int rcv_data_block(uint8_t *data, uint32_t fn, struct pcu_l1_meas *meas, GprsCodingScheme cs); gprs_rlcmac_bts *bts_data() const; diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 9655830f..27c5fe31 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -1394,18 +1394,18 @@ TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 03 8b 29 07 00 c8 00 10 0b 2b 2b 2b 2b 2b 2b 2b Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) -Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. -Modifying MS object, UL TLLI: 0x00000000 -> 0xf1223344, not yet confirmed -TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=0, BSN=0, SPB=0, PI=0, E=1, TI=1, bitoffs=24 - BSN 0 storing in window (0..63) +Decoded premier TLLI=0x00000000 of UL DATA TFI=0. +Modifying MS object, UL TLLI: 0x00000000 -> 0xf1223344, not yet confirmed - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 -- Length after skipping TLLI: 16 -TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame that fits precisely in last block: len=16 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 4, length=16, is_complete=1 +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 LLC [PCU -> SGSN] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) len=16 No bctx - No gaps in received block, last block: BSN=0 CV=0 @@ -1485,14 +1485,15 @@ RX: [PCU <- BTS] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) Packet Control A TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)', TA=7 Got MS: TLLI = 0xf1223344, TA = 7 @@ -1565,14 +1566,15 @@ RX: [PCU <- BTS] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) Packet Control A TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)', TA=7 ********** TBF starts here ********** @@ -1691,14 +1693,15 @@ RX: [PCU <- BTS] TBF(TFI=1 TLLI=0xf5667788 DIR=UL STATE=ASSIGN) Packet Control A TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=1 TLLI=0xf5667788 DIR=UL STATE=ASSIGN) TBF(TFI=1 TLLI=0xf5667788 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=1, CPS=0, RSB=0, rc=184 UL DATA TFI=1 received (V(Q)=0 .. V(R)=0) TBF(TFI=1 TLLI=0xf5667788 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=1 TLLI=0xf5667788 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 Old MS: TLLI = 0xf1223344, TA = 7, IMSI = 0011223344, LLC = 0 There is a new MS object for the same MS: (0xf1223344, '0011223344') -> (0xf5667788, '') @@ -1757,14 +1760,15 @@ RX: [PCU <- BTS] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) Packet Control A TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)', TA=7 ********** TBF starts here ********** @@ -1863,14 +1867,15 @@ Send dowlink assignment on PACCH, because TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=NULL) changes state from NULL to ASSIGN TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) starting timer 0. Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 New MS: TLLI = 0xf1223344, TA = 7, IMSI = 0011223344, LLC = 2 Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654218 block=8 data=47 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b @@ -1920,14 +1925,15 @@ RX: [PCU <- BTS] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) Packet Control A TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)', TA=7 ********** TBF starts here ********** @@ -1988,8 +1994,12 @@ TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 ra TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) TX: START Immediate Assignment Uplink (AGCH) Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 0f 00 00 03 8b ed 07 00 c8 00 10 0b 2b 2b 2b 2b 2b 2b 2b Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) -Decoded premier TLLI=0xf1223344 of UL DATA TFI=0. +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=0, BSN=0, SPB=0, PI=0, E=1, TI=1, bitoffs=24 +- BSN 0 storing in window (0..63) +Decoded premier TLLI=0x00000000 of UL DATA TFI=0. Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Attaching TBF to MS object, TLLI = 0x00000000, TBF = TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=ASSIGN) Modifying MS object, TLLI = 0x00000000, IMSI '' -> '0011223344' @@ -1997,15 +2007,11 @@ Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1 Clearing MS object, TLLI: 0xf1223344, IMSI: '0011223344' Modifying MS object, UL TLLI: 0x00000000 -> 0xf1223344, not yet confirmed Destroying MS object, TLLI = 0x00000000 -TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending -- BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 -- Length after skipping TLLI: 16 -TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame that fits precisely in last block: len=16 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 4, length=16, is_complete=1 +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) complete UL frame len=16 LLC [PCU -> SGSN] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) len=16 No bctx - No gaps in received block, last block: BSN=0 CV=0 @@ -2061,14 +2067,15 @@ RX: [PCU <- BTS] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) Packet Control A TBF: [DOWNLINK] UPLINK ASSIGNED TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW Got RLC block, coding scheme: CS-1, length: 23 (23)) +Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184 UL DATA TFI=0 received (V(Q)=0 .. V(R)=0) TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending +TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW): Got CS-1 RLC data block: CV=15, BSN=0, SPB=0, PI=0, E=1, TI=0, bitoffs=24 - BSN 0 storing in window (0..63) - Raising V(R) to 1 - Taking block 0 out, raising V(Q) to 1 -- Assembling frames: (len=23) --- Frame 1 starts at offset 0 -- Data length after length fields: 20 +- Assembling frames: (len=20) +-- Frame 1 starts at offset 0, length=20, is_complete=0 - No gaps in received block, last block: BSN=0 CV=15 Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)', TA=7 ********** TBF starts here **********