From 8b8485680a4551b83e3ca5a5d1c34c1c74c3297d Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Tue, 2 Oct 2018 01:54:24 +0700 Subject: layer23/app_ccch_scan.c: omit dummy (fill) frames In some conditions it's required to maintain continuous burst transmission (e.g. on C0). If there is nothing to transmit at a given moment, either a LAPDm func=UI fill frame, or a "dummy" Paging Request is used. In case of 'ccch_scan' application, they are useless. Let's detect and omit them. Change-Id: I6ccecb1a78bdac3e467bdc14b7a01afbe17aa53c --- src/host/layer23/src/misc/app_ccch_scan.c | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/host/layer23/src/misc/app_ccch_scan.c b/src/host/layer23/src/misc/app_ccch_scan.c index 3a55226a..88a2bef3 100644 --- a/src/host/layer23/src/misc/app_ccch_scan.c +++ b/src/host/layer23/src/misc/app_ccch_scan.c @@ -376,11 +376,43 @@ static int gsm48_rx_paging_p3(struct msgb *msg, struct osmocom_ms *ms) return 0; } +/* Dummy Paging Request 1 with "no identity" */ +static const uint8_t paging_fill[] = { + 0x15, 0x06, 0x21, 0x00, 0x01, 0xf0, 0x2b, + /* The rest part may be randomized */ +}; + +/* LAPDm func=UI fill frame (for the BTS side) */ +static const uint8_t lapdm_fill[] = { + 0x03, 0x03, 0x01, 0x2b, + /* The rest part may be randomized */ +}; + +/* TODO: share / generalize this code */ +static bool is_fill_frame(struct msgb *msg) +{ + size_t l2_len = msgb_l3len(msg); + uint8_t *l2 = msgb_l3(msg); + + OSMO_ASSERT(l2_len == GSM_MACBLOCK_LEN); + + if (!memcmp(l2, paging_fill, sizeof(paging_fill))) + return true; + if (!memcmp(l2, lapdm_fill, sizeof(lapdm_fill))) + return true; + + return false; +} + int gsm48_rx_ccch(struct msgb *msg, struct osmocom_ms *ms) { struct gsm48_system_information_type_header *sih = msgb_l3(msg); int rc = 0; + /* Skip dummy (fill) frames */ + if (is_fill_frame(msg)) + return 0; + if (sih->rr_protocol_discriminator != GSM48_PDISC_RR) LOGP(DRR, LOGL_ERROR, "PCH pdisc (%s) != RR\n", gsm48_pdisc_name(sih->rr_protocol_discriminator)); -- cgit v1.2.3