lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2023

  • 1 participants
  • 3642 discussions
[M] Change in osmocom-bb[master]: modem: clean up #includes (using include-what-you-use)
by fixeria 03 Mar '23

03 Mar '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31655 ) Change subject: modem: clean up #includes (using include-what-you-use) ...................................................................... modem: clean up #includes (using include-what-you-use) Change-Id: I728f3eea1590f46bef6e0eb4beb9714f6c9a1614 --- M src/host/layer23/src/modem/app_modem.c M src/host/layer23/src/modem/llc.c M src/host/layer23/src/modem/rlcmac.c M src/host/layer23/src/modem/sndcp.c M src/host/layer23/src/modem/vty.c 5 files changed, 39 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/55/31655/1 diff --git a/src/host/layer23/src/modem/app_modem.c b/src/host/layer23/src/modem/app_modem.c index 6fe7c8b..8fa78c1 100644 --- a/src/host/layer23/src/modem/app_modem.c +++ b/src/host/layer23/src/modem/app_modem.c @@ -20,20 +20,27 @@ #include <stdbool.h> #include <stdint.h> +#include <string.h> #include <errno.h> #include <stdio.h> +#include <sys/socket.h> +#include <netinet/in.h> #include <netinet/ip.h> #include <netinet/ip6.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/utils.h> #include <osmocom/core/signal.h> #include <osmocom/core/application.h> #include <osmocom/core/socket.h> #include <osmocom/core/tun.h> +#include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/lapdm.h> #include <osmocom/vty/vty.h> #include <osmocom/bb/common/osmocom_data.h> +#include <osmocom/bb/common/settings.h> #include <osmocom/bb/common/ms.h> #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/l1ctl.h> diff --git a/src/host/layer23/src/modem/llc.c b/src/host/layer23/src/modem/llc.c index 4bb0684..8d9d5bd 100644 --- a/src/host/layer23/src/modem/llc.c +++ b/src/host/layer23/src/modem/llc.c @@ -20,25 +20,23 @@ #include <errno.h> #include <stdint.h> +#include <string.h> #include <stdbool.h> -#include <inttypes.h> +#include <osmocom/core/prim.h> #include <osmocom/core/msgb.h> -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/timer.h> +#include <osmocom/core/utils.h> #include <osmocom/core/talloc.h> -#include <osmocom/core/rate_ctr.h> -#include <osmocom/crypt/kdf.h> -#include <osmocom/gprs/gprs_bssgp.h> -#include <osmocom/gsm/gsm_utils.h> +#include <osmocom/core/logging.h> + +#include <osmocom/gprs/gprs_msgb.h> #include <osmocom/gprs/llc/llc_prim.h> #include <osmocom/gprs/llc/llc.h> #include <osmocom/gprs/rlcmac/rlcmac_prim.h> #include <osmocom/gprs/sndcp/sndcp_prim.h> -#include <osmocom/bb/common/logging.h> -#include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> +#include <osmocom/bb/common/logging.h> #include <osmocom/bb/modem/llc.h> static int modem_llc_handle_ll_gmm(struct osmo_gprs_llc_prim *llc_prim) diff --git a/src/host/layer23/src/modem/rlcmac.c b/src/host/layer23/src/modem/rlcmac.c index 83dcd6c..7cd1ba4 100644 --- a/src/host/layer23/src/modem/rlcmac.c +++ b/src/host/layer23/src/modem/rlcmac.c @@ -21,22 +21,20 @@ #include <errno.h> #include <stdint.h> #include <stdbool.h> -#include <inttypes.h> #include <osmocom/core/msgb.h> -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/timer.h> +#include <osmocom/core/bits.h> +#include <osmocom/core/prim.h> +#include <osmocom/core/utils.h> #include <osmocom/core/talloc.h> -#include <osmocom/core/rate_ctr.h> -#include <osmocom/crypt/kdf.h> -#include <osmocom/gprs/gprs_bssgp.h> +#include <osmocom/core/logging.h> + #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gprs/rlcmac/rlcmac_prim.h> #include <osmocom/gprs/rlcmac/rlcmac.h> #include <osmocom/gprs/llc/llc_prim.h> #include <osmocom/bb/common/logging.h> -#include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> #include <osmocom/bb/modem/rlcmac.h> diff --git a/src/host/layer23/src/modem/sndcp.c b/src/host/layer23/src/modem/sndcp.c index eba8d11..ee5380f 100644 --- a/src/host/layer23/src/modem/sndcp.c +++ b/src/host/layer23/src/modem/sndcp.c @@ -19,18 +19,16 @@ */ #include <stdbool.h> +#include <string.h> #include <stdint.h> #include <errno.h> #include <stdio.h> -#include <netinet/ip.h> -#include <netinet/ip6.h> - #include <osmocom/core/msgb.h> +#include <osmocom/core/prim.h> +#include <osmocom/core/utils.h> #include <osmocom/core/linuxlist.h> -#include <osmocom/core/timer.h> #include <osmocom/core/talloc.h> -#include <osmocom/core/endian.h> #include <osmocom/core/tun.h> #include <osmocom/gprs/llc/llc.h> @@ -38,6 +36,7 @@ #include <osmocom/gprs/sndcp/sndcp_prim.h> #include <osmocom/gprs/sndcp/sndcp.h> +#include <osmocom/bb/common/settings.h> #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> diff --git a/src/host/layer23/src/modem/vty.c b/src/host/layer23/src/modem/vty.c index bd8afd8..e462a23 100644 --- a/src/host/layer23/src/modem/vty.c +++ b/src/host/layer23/src/modem/vty.c @@ -15,15 +15,18 @@ * */ -#include <string.h> #include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> + +#include <osmocom/core/utils.h> +#include <osmocom/core/talloc.h> +#include <osmocom/core/linuxlist.h> #include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> +#include <osmocom/bb/common/settings.h> #include <osmocom/bb/common/vty.h> #include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31655 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I728f3eea1590f46bef6e0eb4beb9714f6c9a1614 Gerrit-Change-Number: 31655 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: modem: get rid of app_data.chan_req, use ms->rrlayer
by fixeria 03 Mar '23

03 Mar '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31653 ) Change subject: modem: get rid of app_data.chan_req, use ms->rrlayer ...................................................................... modem: get rid of app_data.chan_req, use ms->rrlayer Change-Id: I77d0a834a73c511f157c6f1524b9e98df3f4def4 Related: OS#5500 --- M src/host/layer23/src/modem/app_modem.c 1 file changed, 35 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/53/31653/1 diff --git a/src/host/layer23/src/modem/app_modem.c b/src/host/layer23/src/modem/app_modem.c index 17ba59e..3b489d3 100644 --- a/src/host/layer23/src/modem/app_modem.c +++ b/src/host/layer23/src/modem/app_modem.c @@ -60,12 +60,6 @@ static struct { struct osmocom_ms *ms; - - /* TODO: use mobile->rrlayer API instead */ - struct { - bool ref_valid; - struct gsm48_req_ref ref; - } chan_req; } app_data; /* Local network-originated IP packet, needs to be sent via SNDCP/LLC (GPRS) towards GSM network */ @@ -141,6 +135,8 @@ return -ENOTSUP; rr->cr_ra = gen_chan_req(single_block); + memset(&rr->cr_hist[0], 0x00, sizeof(rr->cr_hist)); + LOGP(DRR, LOGL_NOTICE, "Sending CHANNEL REQUEST (0x%02x)\n", rr->cr_ra); l1ctl_tx_rach_req(ms, RSL_CHAN_RACH, 0x00, rr->cr_ra, 0, cs->ccch_mode == CCCH_MODE_COMBINED); @@ -149,6 +145,22 @@ return 0; } +static bool modem_match_req_ref(struct osmocom_ms *ms, + const struct gsm48_req_ref *ref) +{ + struct gsm48_rrlayer *rr = &ms->rrlayer; + + for (unsigned int i = 0; i < ARRAY_SIZE(rr->cr_hist); i++) { + const struct gsm48_cr_hist *hist = &rr->cr_hist[i]; + if (!hist->valid) + continue; + if (memcmp(&hist->ref, ref, sizeof(*ref)) == 0) + return true; + } + + return false; +} + static int handle_si1(struct osmocom_ms *ms, struct msgb *msg) { struct gsm322_cellsel *cs = &ms->cellsel; @@ -291,9 +303,7 @@ if (rr->state != GSM48_RR_ST_CONN_PEND) return 0; - if (!app_data.chan_req.ref_valid) - return 0; - if (memcmp(&ia->req_ref, &app_data.chan_req.ref, sizeof(ia->req_ref))) + if (!modem_match_req_ref(ms, &ia->req_ref)) return 0; if (rsl_dec_chan_nr(ia->chan_desc.chan_nr, &ch_type, &ch_subch, &ch_ts) != 0) { @@ -467,9 +477,12 @@ LOGP(DRSL, LOGL_NOTICE, "Rx RACH.conf (RA=0x%02x, T1=%u, T3=%u, T2=%u)\n", rr->cr_ra, ref->t1, ref->t3_high << 3 | ref->t3_low, ref->t2); - memcpy(&app_data.chan_req.ref, ref, sizeof(*ref)); - app_data.chan_req.ref.ra = rr->cr_ra; - app_data.chan_req.ref_valid = true; + /* shift the CHANNEL REQUEST history buffer */ + memmove(&rr->cr_hist[1], &rr->cr_hist[0], ARRAY_SIZE(rr->cr_hist) - 1); + /* store the new entry */ + rr->cr_hist[0].ref = *ref; + rr->cr_hist[0].ref.ra = rr->cr_ra; + rr->cr_hist[0].valid = 1; return 0; } /* fall-through */ -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31653 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I77d0a834a73c511f157c6f1524b9e98df3f4def4 Gerrit-Change-Number: 31653 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: modem: add test VTY command for sending raw LLC PDUs
by fixeria 03 Mar '23

03 Mar '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31657 ) Change subject: modem: add test VTY command for sending raw LLC PDUs ...................................................................... modem: add test VTY command for sending raw LLC PDUs Change-Id: I14f58e715d77a1b1cb40fdd3ddd09084360f2274 Related: OS#5500 --- M src/host/layer23/src/modem/vty.c 1 file changed, 83 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/57/31657/1 diff --git a/src/host/layer23/src/modem/vty.c b/src/host/layer23/src/modem/vty.c index b8e0e2d..4fa8e1d 100644 --- a/src/host/layer23/src/modem/vty.c +++ b/src/host/layer23/src/modem/vty.c @@ -23,6 +23,9 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/linuxlist.h> +#include <osmocom/gprs/llc/llc.h> +#include <osmocom/gprs/llc/llc_prim.h> + #include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> @@ -56,6 +59,7 @@ #define MS_NAME_DESC "Name of MS (see \"show ms\")\n" #define TEST_CMD_DESC "Testing commands for developers\n" #define GRR_CMDG_DESC "GPRS RR specific commands\n" +#define LLC_CMDG_DESC "GPRS LLC specific commands\n" /* testing commands */ DEFUN_HIDDEN(test_grr_tx_chan_req, @@ -81,6 +85,73 @@ return CMD_SUCCESS; } +DEFUN_HIDDEN(test_llc_unitdata_req_hexpdu, + test_llc_unitdata_req_hexpdu_cmd, + "test MS_NAME llc unitdata-req <0x00-0xffffffff> SAPI HEXSTRING", + TEST_CMD_DESC MS_NAME_DESC LLC_CMDG_DESC + "Enqueue an LLC UNITDATA.req for transmission\n" + "TLLI (Temporary Logical Link Identifier) value to be used\n" + "SAPI value to be used (for example, GMM, SMS, SNDCP3)\n" + "LLC PDU as a hexstring (up to 512 octets)\n") +{ + struct osmo_gprs_llc_prim *llc_prim; + struct osmocom_ms *ms; + uint8_t buf[512]; + int tlli, sapi, pdu_len; + + if ((ms = l23_vty_get_ms(argv[0], vty)) == NULL) + return CMD_WARNING; + + if (osmo_str_to_int(&tlli, argv[1], 0, 0, 0xffffff) < 0) + return CMD_WARNING; + sapi = get_string_value(osmo_gprs_llc_sapi_names, argv[2]); + if (sapi < 0) + return CMD_WARNING; + pdu_len = osmo_hexparse(argv[3], &buf[0], sizeof(buf)); + if (pdu_len < 0) + return CMD_WARNING; + + llc_prim = osmo_gprs_llc_prim_alloc_ll_unitdata_req(tlli, sapi, &buf[0], pdu_len); + if (osmo_gprs_llc_prim_upper_down(llc_prim) != 0) { + vty_out(vty, "Failed to enqueue an LLC PDU%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + +static uint8_t pdu_gmmm_attach_req[] = { + 0x08, 0x01, 0x02, 0xe5, 0xe0, 0x01, 0x0a, 0x00, 0x05, 0xf4, 0xf4, 0x3c, 0xec, 0x71, 0x32, 0xf4, + 0x07, 0x00, 0x05, 0x00, 0x17, 0x19, 0x33, 0x43, 0x2b, 0x37, 0x15, 0x9e, 0xf9, 0x88, 0x79, 0xcb, + 0xa2, 0x8c, 0x66, 0x21, 0xe7, 0x26, 0x88, 0xb1, 0x98, 0x87, 0x9c, 0x00, 0x17, 0x05, +}; + +/* TODO: remove this command once we have the GMM layer implemented */ +DEFUN_HIDDEN(test_llc_unitdata_req_gmm_attch, + test_llc_unitdata_req_gmm_attch_cmd, + "test MS_NAME llc unitdata-req gmm-attach-req", + TEST_CMD_DESC MS_NAME_DESC LLC_CMDG_DESC + "Enqueue an LLC UNITDATA.req for transmission\n" + "Hard-coded GMM Attach Request (SAPI=GMM, TLLI=0xe1c5d364)\n") +{ + struct osmo_gprs_llc_prim *llc_prim; + const uint32_t tlli = 0xe1c5d364; + struct osmocom_ms *ms; + + if ((ms = l23_vty_get_ms(argv[0], vty)) == NULL) + return CMD_WARNING; + + llc_prim = osmo_gprs_llc_prim_alloc_ll_unitdata_req(tlli, OSMO_GPRS_LLC_SAPI_GMM, + &pdu_gmmm_attach_req[0], + sizeof(pdu_gmmm_attach_req)); + if (osmo_gprs_llc_prim_upper_down(llc_prim) != 0) { + vty_out(vty, "Failed to enqueue an LLC PDU%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + /* per APN config */ DEFUN(cfg_ms_apn, cfg_ms_apn_cmd, "apn APN_NAME", "Configure an APN\n" @@ -262,6 +333,8 @@ return rc; install_element_ve(&l23_show_ms_cmd); install_element_ve(&test_grr_tx_chan_req_cmd); + install_element_ve(&test_llc_unitdata_req_hexpdu_cmd); + install_element_ve(&test_llc_unitdata_req_gmm_attch_cmd); install_element(CONFIG_NODE, &l23_cfg_ms_cmd); install_element(MS_NODE, &cfg_ms_apn_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31657 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I14f58e715d77a1b1cb40fdd3ddd09084360f2274 Gerrit-Change-Number: 31657 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: modem: add test VTY command to send CHANNEL REQUEST
by fixeria 03 Mar '23

03 Mar '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31656 ) Change subject: modem: add test VTY command to send CHANNEL REQUEST ...................................................................... modem: add test VTY command to send CHANNEL REQUEST Do not call grr_tx_chan_req() unconditionally from grr_rx_bcch(). Add a special (hidden, expert mode) VTY command for that. Change-Id: I049a8d7f58ae9703d06dff235973ba376702c873 Related: OS#5500 --- M src/host/layer23/include/osmocom/bb/modem/grr.h M src/host/layer23/src/modem/grr.c M src/host/layer23/src/modem/vty.c 3 files changed, 52 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/56/31656/1 diff --git a/src/host/layer23/include/osmocom/bb/modem/grr.h b/src/host/layer23/include/osmocom/bb/modem/grr.h index 208dbb1..1f2b08c 100644 --- a/src/host/layer23/include/osmocom/bb/modem/grr.h +++ b/src/host/layer23/include/osmocom/bb/modem/grr.h @@ -1,6 +1,12 @@ #pragma once +#include <stdbool.h> +#include <stdint.h> + struct msgb; +struct osmocom_ms; struct lapdm_entity; int modem_grr_rslms_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx); +int modem_grr_tx_chan_req(struct osmocom_ms *ms, uint8_t chan_req); +uint8_t modem_grr_gen_chan_req(bool single_block); diff --git a/src/host/layer23/src/modem/grr.c b/src/host/layer23/src/modem/grr.c index e46f77d..b22832e 100644 --- a/src/host/layer23/src/modem/grr.c +++ b/src/host/layer23/src/modem/grr.c @@ -47,7 +47,7 @@ #include <l1ctl_proto.h> /* Generate an 8-bit CHANNEL REQUEST message as per 3GPP TS 44.018, 9.1.8 */ -static uint8_t grr_gen_chan_req(bool single_block) +uint8_t modem_grr_gen_chan_req(bool single_block) { uint8_t rnd = (uint8_t)rand(); @@ -76,7 +76,7 @@ return false; } -static int grr_tx_chan_req(struct osmocom_ms *ms, bool single_block) +int modem_grr_tx_chan_req(struct osmocom_ms *ms, uint8_t chan_req) { struct gsm322_cellsel *cs = &ms->cellsel; struct gsm48_rrlayer *rr = &ms->rrlayer; @@ -88,7 +88,7 @@ if (!cs->sel_si.gprs.supported) return -ENOTSUP; - rr->cr_ra = grr_gen_chan_req(single_block); + rr->cr_ra = chan_req; memset(&rr->cr_hist[0], 0x00, sizeof(rr->cr_hist)); LOGP(DRR, LOGL_NOTICE, "Sending CHANNEL REQUEST (0x%02x)\n", rr->cr_ra); @@ -209,10 +209,6 @@ LOGP(DRR, LOGL_INFO, "BCCH message (type=0x%02x): %s\n", si_type, gsm48_rr_msg_name(si_type)); - /* HACK: request an Uplink TBF here (one phase access) */ - if (ms->rrlayer.state == GSM48_RR_ST_IDLE) - grr_tx_chan_req(ms, false); - switch (si_type) { case GSM48_MT_RR_SYSINFO_1: return grr_handle_si1(ms, msg); diff --git a/src/host/layer23/src/modem/vty.c b/src/host/layer23/src/modem/vty.c index e462a23..b8e0e2d 100644 --- a/src/host/layer23/src/modem/vty.c +++ b/src/host/layer23/src/modem/vty.c @@ -30,6 +30,7 @@ #include <osmocom/bb/common/vty.h> #include <osmocom/bb/common/apn.h> #include <osmocom/bb/common/ms.h> +#include <osmocom/bb/modem/grr.h> #include <osmocom/bb/modem/vty.h> static struct cmd_node apn_node = { @@ -52,6 +53,34 @@ return vty->node; } +#define MS_NAME_DESC "Name of MS (see \"show ms\")\n" +#define TEST_CMD_DESC "Testing commands for developers\n" +#define GRR_CMDG_DESC "GPRS RR specific commands\n" + +/* testing commands */ +DEFUN_HIDDEN(test_grr_tx_chan_req, + test_grr_tx_chan_req_cmd, + "test MS_NAME grr tx-chan-req (1phase|2phase)", + TEST_CMD_DESC MS_NAME_DESC GRR_CMDG_DESC + "Send a CHANNEL REQUEST (RACH) to the network\n" + "One-phase packet access (011110xx or 01111x0x or 01111xx0)\n" + "Two-phase (single block) packet access (01110xxx)\n") +{ + struct osmocom_ms *ms; + uint8_t chan_req; + + if ((ms = l23_vty_get_ms(argv[0], vty)) == NULL) + return CMD_WARNING; + + chan_req = modem_grr_gen_chan_req(argv[1][0] == '2'); + if (modem_grr_tx_chan_req(ms, chan_req) != 0) { + vty_out(vty, "Failed to send a CHANNEL REQUEST%s", VTY_NEWLINE); + return CMD_WARNING; + } + + return CMD_SUCCESS; +} + /* per APN config */ DEFUN(cfg_ms_apn, cfg_ms_apn_cmd, "apn APN_NAME", "Configure an APN\n" @@ -232,6 +261,7 @@ if ((rc = l23_vty_init(config_write, NULL)) < 0) return rc; install_element_ve(&l23_show_ms_cmd); + install_element_ve(&test_grr_tx_chan_req_cmd); install_element(CONFIG_NODE, &l23_cfg_ms_cmd); install_element(MS_NODE, &cfg_ms_apn_cmd); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31656 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I049a8d7f58ae9703d06dff235973ba376702c873 Gerrit-Change-Number: 31656 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmocom-bb[master]: modem: move GRR specific code into its own file
by fixeria 03 Mar '23

03 Mar '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31654 ) Change subject: modem: move GRR specific code into its own file ...................................................................... modem: move GRR specific code into its own file Change-Id: I25caa0bd01e3d090803512f5b13cad58439f44f8 Related: OS#5500 --- M src/host/layer23/include/osmocom/bb/modem/Makefile.am A src/host/layer23/include/osmocom/bb/modem/grr.h M src/host/layer23/src/modem/Makefile.am M src/host/layer23/src/modem/app_modem.c A src/host/layer23/src/modem/grr.c 5 files changed, 475 insertions(+), 418 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/54/31654/1 diff --git a/src/host/layer23/include/osmocom/bb/modem/Makefile.am b/src/host/layer23/include/osmocom/bb/modem/Makefile.am index 4acb21b..b2e3059 100644 --- a/src/host/layer23/include/osmocom/bb/modem/Makefile.am +++ b/src/host/layer23/include/osmocom/bb/modem/Makefile.am @@ -1,5 +1,6 @@ noinst_HEADERS = \ modem.h \ + grr.h \ llc.h \ rlcmac.h \ sndcp.h \ diff --git a/src/host/layer23/include/osmocom/bb/modem/grr.h b/src/host/layer23/include/osmocom/bb/modem/grr.h new file mode 100644 index 0000000..208dbb1 --- /dev/null +++ b/src/host/layer23/include/osmocom/bb/modem/grr.h @@ -0,0 +1,6 @@ +#pragma once + +struct msgb; +struct lapdm_entity; + +int modem_grr_rslms_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx); diff --git a/src/host/layer23/src/modem/Makefile.am b/src/host/layer23/src/modem/Makefile.am index 7ce71dc..500b031 100644 --- a/src/host/layer23/src/modem/Makefile.am +++ b/src/host/layer23/src/modem/Makefile.am @@ -18,6 +18,7 @@ modem_SOURCES = \ $(top_srcdir)/src/common/main.c \ app_modem.c \ + grr.c \ llc.c \ rlcmac.c \ sndcp.c \ diff --git a/src/host/layer23/src/modem/app_modem.c b/src/host/layer23/src/modem/app_modem.c index 3b489d3..6fe7c8b 100644 --- a/src/host/layer23/src/modem/app_modem.c +++ b/src/host/layer23/src/modem/app_modem.c @@ -33,26 +33,18 @@ #include <osmocom/core/tun.h> #include <osmocom/vty/vty.h> -#include <osmocom/gsm/rsl.h> -#include <osmocom/gsm/tlv.h> -#include <osmocom/gsm/gsm48_ie.h> -#include <osmocom/gsm/gsm48.h> -#include <osmocom/gsm/protocol/gsm_04_08.h> -#include <osmocom/gprs/rlcmac/csn1_defs.h> -#include <osmocom/gprs/rlcmac/rlcmac_prim.h> - #include <osmocom/bb/common/osmocom_data.h> #include <osmocom/bb/common/ms.h> #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/l1ctl.h> #include <osmocom/bb/common/l23_app.h> #include <osmocom/bb/common/l1l2_interface.h> -#include <osmocom/bb/common/sysinfo.h> #include <osmocom/bb/common/apn.h> #include <osmocom/bb/modem/rlcmac.h> #include <osmocom/bb/modem/llc.h> #include <osmocom/bb/modem/sndcp.h> #include <osmocom/bb/modem/vty.h> +#include <osmocom/bb/modem/grr.h> #include <l1ctl_proto.h> @@ -108,414 +100,6 @@ return rc; } -/* Generate a 8-bit CHANNEL REQUEST message as per 3GPP TS 44.018, 9.1.8 */ -static uint8_t gen_chan_req(bool single_block) -{ - uint8_t rnd = (uint8_t)rand(); - - if (single_block) /* 01110xxx */ - return 0x70 | (rnd & 0x07); - - /* 011110xx or 01111x0x or 01111xx0 */ - if ((rnd & 0x07) == 0x07) - return 0x78; - return 0x78 | (rnd & 0x07); -} - -static int modem_tx_chan_req(struct osmocom_ms *ms, bool single_block) -{ - struct gsm322_cellsel *cs = &ms->cellsel; - struct gsm48_rrlayer *rr = &ms->rrlayer; - - OSMO_ASSERT(rr->state == GSM48_RR_ST_IDLE); - - if (!cs->sel_si.si1 || !cs->sel_si.si13) - return -EAGAIN; - if (!cs->sel_si.gprs.supported) - return -ENOTSUP; - - rr->cr_ra = gen_chan_req(single_block); - memset(&rr->cr_hist[0], 0x00, sizeof(rr->cr_hist)); - - LOGP(DRR, LOGL_NOTICE, "Sending CHANNEL REQUEST (0x%02x)\n", rr->cr_ra); - l1ctl_tx_rach_req(ms, RSL_CHAN_RACH, 0x00, rr->cr_ra, 0, - cs->ccch_mode == CCCH_MODE_COMBINED); - - rr->state = GSM48_RR_ST_CONN_PEND; - return 0; -} - -static bool modem_match_req_ref(struct osmocom_ms *ms, - const struct gsm48_req_ref *ref) -{ - struct gsm48_rrlayer *rr = &ms->rrlayer; - - for (unsigned int i = 0; i < ARRAY_SIZE(rr->cr_hist); i++) { - const struct gsm48_cr_hist *hist = &rr->cr_hist[i]; - if (!hist->valid) - continue; - if (memcmp(&hist->ref, ref, sizeof(*ref)) == 0) - return true; - } - - return false; -} - -static int handle_si1(struct osmocom_ms *ms, struct msgb *msg) -{ - struct gsm322_cellsel *cs = &ms->cellsel; - int rc; - - if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) - return -EINVAL; - if (!memcmp(&cs->sel_si.si1_msg[0], msgb_l3(msg), msgb_l3len(msg))) - return 0; /* this message is already handled */ - - rc = gsm48_decode_sysinfo1(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); - if (rc != 0) { - LOGP(DRR, LOGL_ERROR, "Failed to decode SI1 message\n"); - return rc; - } - - return 0; -} - -static int handle_si3(struct osmocom_ms *ms, struct msgb *msg) -{ - struct gsm322_cellsel *cs = &ms->cellsel; - int rc; - - if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) - return -EINVAL; - if (!memcmp(&cs->sel_si.si3_msg[0], msgb_l3(msg), msgb_l3len(msg))) - return 0; /* this message is already handled */ - - rc = gsm48_decode_sysinfo3(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); - if (rc != 0) { - LOGP(DRR, LOGL_ERROR, "Failed to decode SI3 message\n"); - return rc; - } - - if (cs->ccch_mode == CCCH_MODE_NONE) { - if (cs->sel_si.ccch_conf == RSL_BCCH_CCCH_CONF_1_C) - cs->ccch_mode = CCCH_MODE_COMBINED; - else - cs->ccch_mode = CCCH_MODE_NON_COMBINED; - l1ctl_tx_ccch_mode_req(ms, cs->ccch_mode); - } - - if (!cs->sel_si.gprs.supported) { - LOGP(DRR, LOGL_NOTICE, "SI3 Rest Octets IE contains no GPRS Indicator\n"); - return 0; - } - - LOGP(DRR, LOGL_NOTICE, "Found GPRS Indicator (RA Colour %u, SI13 on BCCH %s)\n", - cs->sel_si.gprs.ra_colour, cs->sel_si.gprs.si13_pos ? "Ext" : "Norm"); - - return 0; -} - -static int handle_si4(struct osmocom_ms *ms, struct msgb *msg) -{ - struct gsm322_cellsel *cs = &ms->cellsel; - int rc; - - if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) - return -EINVAL; - if (!memcmp(&cs->sel_si.si4_msg[0], msgb_l3(msg), msgb_l3len(msg))) - return 0; /* this message is already handled */ - - rc = gsm48_decode_sysinfo4(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); - if (rc != 0) { - LOGP(DRR, LOGL_ERROR, "Failed to decode SI4 message\n"); - return rc; - } - - if (!cs->sel_si.gprs.supported) { - LOGP(DRR, LOGL_NOTICE, "SI4 Rest Octets IE contains no GPRS Indicator\n"); - return 0; - } - - LOGP(DRR, LOGL_NOTICE, "Found GPRS Indicator (RA Colour %u, SI13 on BCCH %s)\n", - cs->sel_si.gprs.ra_colour, cs->sel_si.gprs.si13_pos ? "Ext" : "Norm"); - - return 0; -} - -static int handle_si13(struct osmocom_ms *ms, struct msgb *msg) -{ - struct osmo_gprs_rlcmac_prim *rlcmac_prim; - struct gsm322_cellsel *cs = &ms->cellsel; - int rc; - - if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) - return -EINVAL; - if (!memcmp(&cs->sel_si.si13_msg[0], msgb_l3(msg), msgb_l3len(msg))) - return 0; /* this message is already handled */ - - rc = gsm48_decode_sysinfo13(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); - if (rc != 0) - return rc; - - /* Forward SI13 to RLC/MAC layer */ - rlcmac_prim = osmo_gprs_rlcmac_prim_alloc_l1ctl_ccch_data_ind(0 /* TODO: fn */, msgb_l3(msg)); - rc = osmo_gprs_rlcmac_prim_lower_up(rlcmac_prim); - return rc; -} - -static int modem_rx_bcch(struct osmocom_ms *ms, struct msgb *msg) -{ - const struct gsm48_system_information_type_header *si_hdr = msgb_l3(msg); - const uint8_t si_type = si_hdr->system_information; - - LOGP(DRR, LOGL_INFO, "BCCH message (type=0x%02x): %s\n", - si_type, gsm48_rr_msg_name(si_type)); - - /* HACK: request an Uplink TBF here (one phase access) */ - if (ms->rrlayer.state == GSM48_RR_ST_IDLE) - modem_tx_chan_req(ms, false); - - switch (si_type) { - case GSM48_MT_RR_SYSINFO_1: - return handle_si1(ms, msg); - case GSM48_MT_RR_SYSINFO_3: - return handle_si3(ms, msg); - case GSM48_MT_RR_SYSINFO_4: - return handle_si4(ms, msg); - case GSM48_MT_RR_SYSINFO_13: - return handle_si13(ms, msg); - default: - return 0; - }; -} - -static int modem_rx_imm_ass(struct osmocom_ms *ms, struct msgb *msg) -{ - const struct gsm48_imm_ass *ia = msgb_l3(msg); - struct gsm48_rrlayer *rr = &ms->rrlayer; - uint8_t ch_type, ch_subch, ch_ts; - int rc; - struct osmo_gprs_rlcmac_prim *rlcmac_prim; - - /* Discard CS channel assignment */ - if ((ia->page_mode >> 4) == 0) - return 0; - - if (rr->state != GSM48_RR_ST_CONN_PEND) - return 0; - if (!modem_match_req_ref(ms, &ia->req_ref)) - return 0; - - if (rsl_dec_chan_nr(ia->chan_desc.chan_nr, &ch_type, &ch_subch, &ch_ts) != 0) { - LOGP(DRR, LOGL_ERROR, - "%s(): rsl_dec_chan_nr(chan_nr=0x%02x) failed\n", - __func__, ia->chan_desc.chan_nr); - return -EINVAL; - } - - if (!ia->chan_desc.h0.h) { - /* Non-hopping */ - uint16_t arfcn; - - arfcn = ia->chan_desc.h0.arfcn_low | (ia->chan_desc.h0.arfcn_high << 8); - - LOGP(DRR, LOGL_INFO, "GSM48 IMM ASS (ra=0x%02x, chan_nr=0x%02x, " - "ARFCN=%u, TS=%u, SS=%u, TSC=%u)\n", ia->req_ref.ra, - ia->chan_desc.chan_nr, arfcn, ch_ts, ch_subch, - ia->chan_desc.h0.tsc); - - l1ctl_tx_dm_est_req_h0(ms, arfcn, - RSL_CHAN_OSMO_PDCH | ch_ts, - ia->chan_desc.h0.tsc, GSM48_CMODE_SIGN, 0); - } else { - /* Hopping */ - uint8_t ma_len = 0; - uint8_t maio, hsn; - uint16_t ma[64]; - - hsn = ia->chan_desc.h1.hsn; - maio = ia->chan_desc.h1.maio_low | (ia->chan_desc.h1.maio_high << 2); - - LOGP(DRR, LOGL_INFO, "GSM48 IMM ASS (ra=0x%02x, chan_nr=0x%02x, " - "HSN=%u, MAIO=%u, TS=%u, SS=%u, TSC=%u)\n", ia->req_ref.ra, - ia->chan_desc.chan_nr, hsn, maio, ch_ts, ch_subch, - ia->chan_desc.h1.tsc); - - for (unsigned int i = 1, j = 0; i <= 1024; i++) { - unsigned int arfcn = i & 1023; - unsigned int k; - - if (~ms->cellsel.sel_si.freq[arfcn].mask & 0x01) - continue; - - k = ia->mob_alloc_len - (j >> 3) - 1; - if (ia->mob_alloc[k] & (1 << (j & 7))) - ma[ma_len++] = arfcn; - j++; - } - - l1ctl_tx_dm_est_req_h1(ms, maio, hsn, &ma[0], ma_len, - RSL_CHAN_OSMO_PDCH | ch_ts, - ia->chan_desc.h1.tsc, GSM48_CMODE_SIGN, 0); - } - - rlcmac_prim = osmo_gprs_rlcmac_prim_alloc_l1ctl_ccch_data_ind(0 /* TODO: fn */, (uint8_t *)ia); - rc = osmo_gprs_rlcmac_prim_lower_up(rlcmac_prim); - if (rc < 0) - return rc; - - rr->state = GSM48_RR_ST_DEDICATED; - 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(const struct msgb *msg) -{ - const uint8_t *l2 = msgb_l3(msg); - - if (!memcmp(l2, paging_fill, sizeof(paging_fill))) - return true; - if (!memcmp(l2, lapdm_fill, sizeof(lapdm_fill))) - return true; - - return false; -} - -static int modem_rx_ccch(struct osmocom_ms *ms, struct msgb *msg) -{ - const struct gsm48_system_information_type_header *sih = msgb_l3(msg); - - /* Skip frames with wrong length */ - if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) { - LOGP(DRR, LOGL_ERROR, "Rx CCCH message with odd length=%u: %s\n", - msgb_l3len(msg), msgb_hexdump_l3(msg)); - return -EINVAL; - } - - /* 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)); - } - - switch (sih->system_information) { - case GSM48_MT_RR_IMM_ASS: - return modem_rx_imm_ass(ms, msg); - default: - return 0; - } -} - -static int modem_rx_rslms_rll_ud(struct osmocom_ms *ms, struct msgb *msg) -{ - const struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); - struct tlv_parsed tv; - - DEBUGP(DRSL, "RSLms UNIT DATA IND chan_nr=0x%02x link_id=0x%02x\n", - rllh->chan_nr, rllh->link_id); - - if (rsl_tlv_parse(&tv, rllh->data, msgb_l2len(msg) - sizeof(*rllh)) < 0) { - LOGP(DRSL, LOGL_ERROR, "%s(): rsl_tlv_parse() failed\n", __func__); - return -EINVAL; - } - - if (!TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) { - LOGP(DRSL, LOGL_ERROR, "UNIT_DATA_IND without L3 INFO ?!?\n"); - return -EINVAL; - } - - msg->l3h = (uint8_t *)TLVP_VAL(&tv, RSL_IE_L3_INFO); - - switch (rllh->chan_nr) { - case RSL_CHAN_PCH_AGCH: - return modem_rx_ccch(ms, msg); - case RSL_CHAN_BCCH: - return modem_rx_bcch(ms, msg); - default: - return 0; - } -} - -static int modem_rx_rslms_rll(struct osmocom_ms *ms, struct msgb *msg) -{ - const struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); - - switch (rllh->c.msg_type) { - case RSL_MT_UNIT_DATA_IND: - return modem_rx_rslms_rll_ud(ms, msg); - default: - LOGP(DRSL, LOGL_NOTICE, "Unhandled RSLms RLL message " - "(msg_type 0x%02x)\n", rllh->c.msg_type); - return -EINVAL; - } -} - -static int modem_rx_rslms_cchan(struct osmocom_ms *ms, struct msgb *msg) -{ - const struct abis_rsl_cchan_hdr *ch = msgb_l2(msg); - struct gsm48_rrlayer *rr = &ms->rrlayer; - - switch (ch->c.msg_type) { - case RSL_MT_CHAN_CONF: /* RACH.conf */ - if (rr->state == GSM48_RR_ST_CONN_PEND) { - const struct gsm48_req_ref *ref = (void *)&ch->data[1]; - LOGP(DRSL, LOGL_NOTICE, - "Rx RACH.conf (RA=0x%02x, T1=%u, T3=%u, T2=%u)\n", - rr->cr_ra, ref->t1, ref->t3_high << 3 | ref->t3_low, ref->t2); - /* shift the CHANNEL REQUEST history buffer */ - memmove(&rr->cr_hist[1], &rr->cr_hist[0], ARRAY_SIZE(rr->cr_hist) - 1); - /* store the new entry */ - rr->cr_hist[0].ref = *ref; - rr->cr_hist[0].ref.ra = rr->cr_ra; - rr->cr_hist[0].valid = 1; - return 0; - } - /* fall-through */ - default: - LOGP(DRSL, LOGL_NOTICE, "Unhandled RSLms CCHAN message " - "(msg_type 0x%02x)\n", ch->c.msg_type); - return -EINVAL; - } -} - -static int modem_rslms_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx) -{ - const struct abis_rsl_common_hdr *rslh = msgb_l2(msg); - int rc; - - switch (rslh->msg_discr & 0xfe) { - case ABIS_RSL_MDISC_RLL: - rc = modem_rx_rslms_rll((struct osmocom_ms *)ctx, msg); - break; - case ABIS_RSL_MDISC_COM_CHAN: - rc = modem_rx_rslms_cchan((struct osmocom_ms *)ctx, msg); - break; - default: - LOGP(DRSL, LOGL_NOTICE, "Unhandled RSLms message " - "(msg_discr 0x%02x)\n", rslh->msg_discr); - rc = -EINVAL; - break; - } - - msgb_free(msg); - return rc; -} - void layer3_app_reset(void) { memset(&app_data, 0x00, sizeof(app_data)); @@ -584,7 +168,7 @@ } osmo_signal_register_handler(SS_L1CTL, &signal_cb, NULL); - lapdm_channel_set_l3(&app_data.ms->lapdm_channel, &modem_rslms_cb, app_data.ms); + lapdm_channel_set_l3(&app_data.ms->lapdm_channel, &modem_grr_rslms_cb, app_data.ms); return 0; } diff --git a/src/host/layer23/src/modem/grr.c b/src/host/layer23/src/modem/grr.c new file mode 100644 index 0000000..e46f77d --- /dev/null +++ b/src/host/layer23/src/modem/grr.c @@ -0,0 +1,455 @@ +/* + * (C) 2022-2023 by sysmocom - s.m.f.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/lienses/>. + * + */ + +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include <osmocom/core/msgb.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> + +#include <osmocom/gsm/rsl.h> +#include <osmocom/gsm/tlv.h> +#include <osmocom/gsm/lapdm.h> +#include <osmocom/gsm/gsm48.h> +#include <osmocom/gsm/gsm48_ie.h> +#include <osmocom/gsm/protocol/gsm_04_08.h> +#include <osmocom/gsm/protocol/gsm_08_58.h> +#include <osmocom/gprs/rlcmac/rlcmac_prim.h> + +#include <osmocom/bb/common/logging.h> +#include <osmocom/bb/common/sysinfo.h> +#include <osmocom/bb/common/l1ctl.h> +#include <osmocom/bb/common/ms.h> + +#include <osmocom/bb/mobile/gsm322.h> +#include <osmocom/bb/mobile/gsm48_rr.h> + +#include <l1ctl_proto.h> + +/* Generate an 8-bit CHANNEL REQUEST message as per 3GPP TS 44.018, 9.1.8 */ +static uint8_t grr_gen_chan_req(bool single_block) +{ + uint8_t rnd = (uint8_t)rand(); + + if (single_block) /* 01110xxx */ + return 0x70 | (rnd & 0x07); + + /* 011110xx or 01111x0x or 01111xx0 */ + if ((rnd & 0x07) == 0x07) + return 0x78; + return 0x78 | (rnd & 0x07); +} + +static bool grr_match_req_ref(struct osmocom_ms *ms, + const struct gsm48_req_ref *ref) +{ + struct gsm48_rrlayer *rr = &ms->rrlayer; + + for (unsigned int i = 0; i < ARRAY_SIZE(rr->cr_hist); i++) { + const struct gsm48_cr_hist *hist = &rr->cr_hist[i]; + if (!hist->valid) + continue; + if (memcmp(&hist->ref, ref, sizeof(*ref)) == 0) + return true; + } + + return false; +} + +static int grr_tx_chan_req(struct osmocom_ms *ms, bool single_block) +{ + struct gsm322_cellsel *cs = &ms->cellsel; + struct gsm48_rrlayer *rr = &ms->rrlayer; + + OSMO_ASSERT(rr->state == GSM48_RR_ST_IDLE); + + if (!cs->sel_si.si1 || !cs->sel_si.si13) + return -EAGAIN; + if (!cs->sel_si.gprs.supported) + return -ENOTSUP; + + rr->cr_ra = grr_gen_chan_req(single_block); + memset(&rr->cr_hist[0], 0x00, sizeof(rr->cr_hist)); + + LOGP(DRR, LOGL_NOTICE, "Sending CHANNEL REQUEST (0x%02x)\n", rr->cr_ra); + l1ctl_tx_rach_req(ms, RSL_CHAN_RACH, 0x00, rr->cr_ra, 0, + cs->ccch_mode == CCCH_MODE_COMBINED); + + rr->state = GSM48_RR_ST_CONN_PEND; + return 0; +} + +static int grr_handle_si1(struct osmocom_ms *ms, struct msgb *msg) +{ + struct gsm322_cellsel *cs = &ms->cellsel; + int rc; + + if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) + return -EINVAL; + if (!memcmp(&cs->sel_si.si1_msg[0], msgb_l3(msg), msgb_l3len(msg))) + return 0; /* this message is already handled */ + + rc = gsm48_decode_sysinfo1(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); + if (rc != 0) { + LOGP(DRR, LOGL_ERROR, "Failed to decode SI1 message\n"); + return rc; + } + + return 0; +} + +static int grr_handle_si3(struct osmocom_ms *ms, struct msgb *msg) +{ + struct gsm322_cellsel *cs = &ms->cellsel; + int rc; + + if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) + return -EINVAL; + if (!memcmp(&cs->sel_si.si3_msg[0], msgb_l3(msg), msgb_l3len(msg))) + return 0; /* this message is already handled */ + + rc = gsm48_decode_sysinfo3(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); + if (rc != 0) { + LOGP(DRR, LOGL_ERROR, "Failed to decode SI3 message\n"); + return rc; + } + + if (cs->ccch_mode == CCCH_MODE_NONE) { + if (cs->sel_si.ccch_conf == RSL_BCCH_CCCH_CONF_1_C) + cs->ccch_mode = CCCH_MODE_COMBINED; + else + cs->ccch_mode = CCCH_MODE_NON_COMBINED; + l1ctl_tx_ccch_mode_req(ms, cs->ccch_mode); + } + + if (!cs->sel_si.gprs.supported) { + LOGP(DRR, LOGL_NOTICE, "SI3 Rest Octets IE contains no GPRS Indicator\n"); + return 0; + } + + LOGP(DRR, LOGL_NOTICE, "Found GPRS Indicator (RA Colour %u, SI13 on BCCH %s)\n", + cs->sel_si.gprs.ra_colour, cs->sel_si.gprs.si13_pos ? "Ext" : "Norm"); + + return 0; +} + +static int grr_handle_si4(struct osmocom_ms *ms, struct msgb *msg) +{ + struct gsm322_cellsel *cs = &ms->cellsel; + int rc; + + if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) + return -EINVAL; + if (!memcmp(&cs->sel_si.si4_msg[0], msgb_l3(msg), msgb_l3len(msg))) + return 0; /* this message is already handled */ + + rc = gsm48_decode_sysinfo4(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); + if (rc != 0) { + LOGP(DRR, LOGL_ERROR, "Failed to decode SI4 message\n"); + return rc; + } + + if (!cs->sel_si.gprs.supported) { + LOGP(DRR, LOGL_NOTICE, "SI4 Rest Octets IE contains no GPRS Indicator\n"); + return 0; + } + + LOGP(DRR, LOGL_NOTICE, "Found GPRS Indicator (RA Colour %u, SI13 on BCCH %s)\n", + cs->sel_si.gprs.ra_colour, cs->sel_si.gprs.si13_pos ? "Ext" : "Norm"); + + return 0; +} + +static int grr_handle_si13(struct osmocom_ms *ms, struct msgb *msg) +{ + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + struct gsm322_cellsel *cs = &ms->cellsel; + int rc; + + if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) + return -EINVAL; + if (!memcmp(&cs->sel_si.si13_msg[0], msgb_l3(msg), msgb_l3len(msg))) + return 0; /* this message is already handled */ + + rc = gsm48_decode_sysinfo13(&cs->sel_si, msgb_l3(msg), msgb_l3len(msg)); + if (rc != 0) + return rc; + + /* Forward SI13 to RLC/MAC layer */ + rlcmac_prim = osmo_gprs_rlcmac_prim_alloc_l1ctl_ccch_data_ind(0 /* TODO: fn */, msgb_l3(msg)); + rc = osmo_gprs_rlcmac_prim_lower_up(rlcmac_prim); + return rc; +} + +static int grr_rx_bcch(struct osmocom_ms *ms, struct msgb *msg) +{ + const struct gsm48_system_information_type_header *si_hdr = msgb_l3(msg); + const uint8_t si_type = si_hdr->system_information; + + LOGP(DRR, LOGL_INFO, "BCCH message (type=0x%02x): %s\n", + si_type, gsm48_rr_msg_name(si_type)); + + /* HACK: request an Uplink TBF here (one phase access) */ + if (ms->rrlayer.state == GSM48_RR_ST_IDLE) + grr_tx_chan_req(ms, false); + + switch (si_type) { + case GSM48_MT_RR_SYSINFO_1: + return grr_handle_si1(ms, msg); + case GSM48_MT_RR_SYSINFO_3: + return grr_handle_si3(ms, msg); + case GSM48_MT_RR_SYSINFO_4: + return grr_handle_si4(ms, msg); + case GSM48_MT_RR_SYSINFO_13: + return grr_handle_si13(ms, msg); + default: + return 0; + }; +} + +static int grr_rx_imm_ass(struct osmocom_ms *ms, struct msgb *msg) +{ + const struct gsm48_imm_ass *ia = msgb_l3(msg); + struct gsm48_rrlayer *rr = &ms->rrlayer; + uint8_t ch_type, ch_subch, ch_ts; + int rc; + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + + /* Discard CS channel assignment */ + if ((ia->page_mode >> 4) == 0) + return 0; + + if (rr->state != GSM48_RR_ST_CONN_PEND) + return 0; + if (!grr_match_req_ref(ms, &ia->req_ref)) + return 0; + + if (rsl_dec_chan_nr(ia->chan_desc.chan_nr, &ch_type, &ch_subch, &ch_ts) != 0) { + LOGP(DRR, LOGL_ERROR, + "%s(): rsl_dec_chan_nr(chan_nr=0x%02x) failed\n", + __func__, ia->chan_desc.chan_nr); + return -EINVAL; + } + + if (!ia->chan_desc.h0.h) { + /* Non-hopping */ + uint16_t arfcn; + + arfcn = ia->chan_desc.h0.arfcn_low | (ia->chan_desc.h0.arfcn_high << 8); + + LOGP(DRR, LOGL_INFO, "GSM48 IMM ASS (ra=0x%02x, chan_nr=0x%02x, " + "ARFCN=%u, TS=%u, SS=%u, TSC=%u)\n", ia->req_ref.ra, + ia->chan_desc.chan_nr, arfcn, ch_ts, ch_subch, + ia->chan_desc.h0.tsc); + + l1ctl_tx_dm_est_req_h0(ms, arfcn, + RSL_CHAN_OSMO_PDCH | ch_ts, + ia->chan_desc.h0.tsc, GSM48_CMODE_SIGN, 0); + } else { + /* Hopping */ + uint8_t ma_len = 0; + uint8_t maio, hsn; + uint16_t ma[64]; + + hsn = ia->chan_desc.h1.hsn; + maio = ia->chan_desc.h1.maio_low | (ia->chan_desc.h1.maio_high << 2); + + LOGP(DRR, LOGL_INFO, "GSM48 IMM ASS (ra=0x%02x, chan_nr=0x%02x, " + "HSN=%u, MAIO=%u, TS=%u, SS=%u, TSC=%u)\n", ia->req_ref.ra, + ia->chan_desc.chan_nr, hsn, maio, ch_ts, ch_subch, + ia->chan_desc.h1.tsc); + + for (unsigned int i = 1, j = 0; i <= 1024; i++) { + unsigned int arfcn = i & 1023; + unsigned int k; + + if (~ms->cellsel.sel_si.freq[arfcn].mask & 0x01) + continue; + + k = ia->mob_alloc_len - (j >> 3) - 1; + if (ia->mob_alloc[k] & (1 << (j & 7))) + ma[ma_len++] = arfcn; + j++; + } + + l1ctl_tx_dm_est_req_h1(ms, maio, hsn, &ma[0], ma_len, + RSL_CHAN_OSMO_PDCH | ch_ts, + ia->chan_desc.h1.tsc, GSM48_CMODE_SIGN, 0); + } + + rlcmac_prim = osmo_gprs_rlcmac_prim_alloc_l1ctl_ccch_data_ind(0 /* TODO: fn */, (uint8_t *)ia); + rc = osmo_gprs_rlcmac_prim_lower_up(rlcmac_prim); + if (rc < 0) + return rc; + + rr->state = GSM48_RR_ST_DEDICATED; + 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(const struct msgb *msg) +{ + const uint8_t *l2 = msgb_l3(msg); + + if (!memcmp(l2, paging_fill, sizeof(paging_fill))) + return true; + if (!memcmp(l2, lapdm_fill, sizeof(lapdm_fill))) + return true; + + return false; +} + +static int grr_rx_ccch(struct osmocom_ms *ms, struct msgb *msg) +{ + const struct gsm48_system_information_type_header *sih = msgb_l3(msg); + + /* Skip frames with wrong length */ + if (msgb_l3len(msg) != GSM_MACBLOCK_LEN) { + LOGP(DRR, LOGL_ERROR, "Rx CCCH message with odd length=%u: %s\n", + msgb_l3len(msg), msgb_hexdump_l3(msg)); + return -EINVAL; + } + + /* 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)); + } + + switch (sih->system_information) { + case GSM48_MT_RR_IMM_ASS: + return grr_rx_imm_ass(ms, msg); + default: + return 0; + } +} + +static int grr_rx_rslms_rll_ud(struct osmocom_ms *ms, struct msgb *msg) +{ + const struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); + struct tlv_parsed tv; + + DEBUGP(DRSL, "RSLms UNIT DATA IND chan_nr=0x%02x link_id=0x%02x\n", + rllh->chan_nr, rllh->link_id); + + if (rsl_tlv_parse(&tv, rllh->data, msgb_l2len(msg) - sizeof(*rllh)) < 0) { + LOGP(DRSL, LOGL_ERROR, "%s(): rsl_tlv_parse() failed\n", __func__); + return -EINVAL; + } + + if (!TLVP_PRESENT(&tv, RSL_IE_L3_INFO)) { + LOGP(DRSL, LOGL_ERROR, "UNIT_DATA_IND without L3 INFO ?!?\n"); + return -EINVAL; + } + + msg->l3h = (uint8_t *)TLVP_VAL(&tv, RSL_IE_L3_INFO); + + switch (rllh->chan_nr) { + case RSL_CHAN_PCH_AGCH: + return grr_rx_ccch(ms, msg); + case RSL_CHAN_BCCH: + return grr_rx_bcch(ms, msg); + default: + return 0; + } +} + +static int grr_rx_rslms_rll(struct osmocom_ms *ms, struct msgb *msg) +{ + const struct abis_rsl_rll_hdr *rllh = msgb_l2(msg); + + switch (rllh->c.msg_type) { + case RSL_MT_UNIT_DATA_IND: + return grr_rx_rslms_rll_ud(ms, msg); + default: + LOGP(DRSL, LOGL_NOTICE, "Unhandled RSLms RLL message " + "(msg_type 0x%02x)\n", rllh->c.msg_type); + return -EINVAL; + } +} + +static int grr_rx_rslms_cchan(struct osmocom_ms *ms, struct msgb *msg) +{ + const struct abis_rsl_cchan_hdr *ch = msgb_l2(msg); + struct gsm48_rrlayer *rr = &ms->rrlayer; + + switch (ch->c.msg_type) { + case RSL_MT_CHAN_CONF: /* RACH.conf */ + if (rr->state == GSM48_RR_ST_CONN_PEND) { + const struct gsm48_req_ref *ref = (void *)&ch->data[1]; + LOGP(DRSL, LOGL_NOTICE, + "Rx RACH.conf (RA=0x%02x, T1=%u, T3=%u, T2=%u)\n", + rr->cr_ra, ref->t1, ref->t3_high << 3 | ref->t3_low, ref->t2); + /* shift the CHANNEL REQUEST history buffer */ + memmove(&rr->cr_hist[1], &rr->cr_hist[0], ARRAY_SIZE(rr->cr_hist) - 1); + /* store the new entry */ + rr->cr_hist[0].ref = *ref; + rr->cr_hist[0].ref.ra = rr->cr_ra; + rr->cr_hist[0].valid = 1; + return 0; + } + /* fall-through */ + default: + LOGP(DRSL, LOGL_NOTICE, "Unhandled RSLms CCHAN message " + "(msg_type 0x%02x)\n", ch->c.msg_type); + return -EINVAL; + } +} + +int modem_grr_rslms_cb(struct msgb *msg, struct lapdm_entity *le, void *ctx) +{ + const struct abis_rsl_common_hdr *rslh = msgb_l2(msg); + int rc; + + switch (rslh->msg_discr & 0xfe) { + case ABIS_RSL_MDISC_RLL: + rc = grr_rx_rslms_rll((struct osmocom_ms *)ctx, msg); + break; + case ABIS_RSL_MDISC_COM_CHAN: + rc = grr_rx_rslms_cchan((struct osmocom_ms *)ctx, msg); + break; + default: + LOGP(DRSL, LOGL_NOTICE, "Unhandled RSLms message " + "(msg_discr 0x%02x)\n", rslh->msg_discr); + rc = -EINVAL; + break; + } + + msgb_free(msg); + return rc; +} -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31654 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I25caa0bd01e3d090803512f5b13cad58439f44f8 Gerrit-Change-Number: 31654 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-pcu[master]: pcu_l1_if: get rid of strange paging group calculation
by dexter 03 Mar '23

03 Mar '23
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31650 ) Change subject: pcu_l1_if: get rid of strange paging group calculation ...................................................................... pcu_l1_if: get rid of strange paging group calculation The PCU uses a 16 bit integer value as paging group which does in fact realls resamble the paging group. Instead it encodes the last three digits of the IMSI from which the paging group can be calculated. The value is then eventually converted back to Ascii-digits and then sent over the PCU-IF interface. Lets get rid of this wired conversion and use the IMSI directly. Change-Id: I40d7fc14c9591b3de091e425faaf325421c70a0e --- M src/bts.cpp M src/gprs_bssgp_pcu.c M src/gprs_ms.c M src/gprs_ms.h M src/gprs_rlcmac.cpp M src/gprs_rlcmac.h M src/pcu_l1_if.cpp M src/pcu_l1_if.h 8 files changed, 33 insertions(+), 60 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/50/31650/1 diff --git a/src/bts.cpp b/src/bts.cpp index 504ba27..524961d 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1131,7 +1131,7 @@ if (the_pcu->pcu_if_version >= 0x0b) pcu_l1if_tx_pch_dt(bts, immediate_assignment, plen, tbf->imsi(), tbf->tlli()); else - pcu_l1if_tx_pch(bts, immediate_assignment, plen, ms_paging_group(tbf_ms(tbf))); + pcu_l1if_tx_pch(bts, immediate_assignment, plen, tbf->imsi()); } bitvec_free(immediate_assignment); diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c index f441437..656342e 100644 --- a/src/gprs_bssgp_pcu.c +++ b/src/gprs_bssgp_pcu.c @@ -289,7 +289,6 @@ struct osmo_mobile_identity mi_imsi; struct osmo_mobile_identity paging_mi; struct gprs_rlcmac_bts *bts; - uint16_t pgroup; int rc; rate_ctr_inc(rate_ctr_group_get_ctr(the_pcu->bssgp.ctrs, SGSN_CTR_RX_PAGING_PS)); @@ -304,11 +303,6 @@ LOGP(DBSSGP, LOGL_NOTICE, "Failed to parse IMSI IE (rc=%d)\n", rc); return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg); } - pgroup = imsi2paging_group(mi_imsi.imsi); - if (pgroup > 999) { - LOGP(DBSSGP, LOGL_NOTICE, "Failed to compute IMSI %s paging group\n", mi_imsi.imsi); - return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg); - } if ((rc = get_paging_ps_mi(&paging_mi, tp)) > 0) return bssgp_tx_status((enum gprs_bssgp_cause) rc, NULL, msg); @@ -320,7 +314,7 @@ bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS_ALREADY); continue; } - if (gprs_rlcmac_paging_request(bts, &paging_mi, pgroup) < 0) + if (gprs_rlcmac_paging_request(bts, &paging_mi, mi_imsi.imsi) < 0) continue; bts_pch_timer_start(bts, &paging_mi, mi_imsi.imsi); } diff --git a/src/gprs_ms.c b/src/gprs_ms.c index eb76fa2..7ecaae4 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -577,18 +577,6 @@ tbf_update_state_fsm_name(dl_tbf_as_tbf(ms->dl_tbf)); } -uint16_t ms_paging_group(struct GprsMs *ms) -{ - uint16_t pgroup; - if (!ms_imsi_is_valid(ms)) - return 0; /* 000 is the special "all paging" group */ - if ((pgroup = imsi2paging_group(ms_imsi(ms))) > 999) { - LOGPMS(ms, DRLCMAC, LOGL_ERROR, "IMSI to paging group failed!\n"); - return 0; - } - return pgroup; -} - void ms_set_ta(struct GprsMs *ms, uint8_t ta_) { if (ta_ == ms->ta) diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 835ff18..9b957ac 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -131,7 +131,6 @@ void ms_set_tlli(struct GprsMs *ms, uint32_t tlli); bool ms_confirm_tlli(struct GprsMs *ms, uint32_t tlli); void ms_set_imsi(struct GprsMs *ms, const char *imsi); -uint16_t ms_paging_group(struct GprsMs *ms); void ms_update_l1_meas(struct GprsMs *ms, const struct pcu_l1_meas *meas); diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp index 1ea0872..ea7fb9a 100644 --- a/src/gprs_rlcmac.cpp +++ b/src/gprs_rlcmac.cpp @@ -29,7 +29,7 @@ extern void *tall_pcu_ctx; int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, - uint16_t pgroup) + const char *imsi) { if (log_check_level(DRLCMAC, LOGL_NOTICE)) { char str[64]; @@ -44,7 +44,7 @@ return -1; } bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS); - pcu_l1if_tx_pch(bts, paging_request, plen, pgroup); + pcu_l1if_tx_pch(bts, paging_request, plen, imsi); bitvec_free(paging_request); return 0; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 22a33b4..43f5095 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -100,7 +100,7 @@ extern "C" { #endif -int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, uint16_t pgroup); +int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, const char *imsi); #ifdef __cplusplus } #endif diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index a1755e1..4f61533 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -60,8 +60,6 @@ extern void *tall_pcu_ctx; -#define PAGING_GROUP_LEN 3 - struct e1_ccu_conn_pars { struct llist_head entry; @@ -79,27 +77,6 @@ * when it is needed. */ static LLIST_HEAD(e1_ccu_table); -/* returns [0,999] on success, > 999 on error */ -uint16_t imsi2paging_group(const char* imsi) -{ - uint16_t pgroup = 0; - size_t len; - - len = (imsi != NULL) ? strlen(imsi) : 0; - if (len < PAGING_GROUP_LEN) - return 0xFFFF; - imsi += len - PAGING_GROUP_LEN; - - while (*imsi != '\0') { - if (!isdigit(*imsi)) - return 0xFFFF; - pgroup *= 10; - pgroup += *imsi - '0'; - imsi++; - } - return pgroup; -} - /* * PCU messages */ @@ -287,24 +264,24 @@ pcu_tx_data_req(bts, 0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, sizeof(data)); } -void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, uint16_t pgroup) +#define IMSI_DIGITS_FOR_PAGING 3 +void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi) { - uint8_t data[PAGING_GROUP_LEN + GSM_MACBLOCK_LEN]; - int i; + uint8_t data[IMSI_DIGITS_FOR_PAGING + GSM_MACBLOCK_LEN]; - /* prepend paging group */ - for (i = 0; i < PAGING_GROUP_LEN; i++) { - data[PAGING_GROUP_LEN - 1 - i] = '0' + (char)(pgroup % 10); - pgroup = pgroup / 10; - } - OSMO_ASSERT(pgroup == 0); + /* Without IMSI the BTS/BSC is unable to calculate the paging group */ + if (strlen(imsi) < IMSI_DIGITS_FOR_PAGING) + return; + + /* prepend last three IMSI digits from which BTS/BSC will calculate the paging group */ + memcpy(data, imsi+strlen(imsi)-IMSI_DIGITS_FOR_PAGING, IMSI_DIGITS_FOR_PAGING); /* block provided by upper layer comes without first byte (plen), * prepend it manually: */ - OSMO_ASSERT(sizeof(data) >= PAGING_GROUP_LEN + 1 + block->data_len); + OSMO_ASSERT(sizeof(data) >= IMSI_DIGITS_FOR_PAGING + 1 + block->data_len); data[3] = (plen << 2) | 0x01; - bitvec_pack(block, data + PAGING_GROUP_LEN + 1); + bitvec_pack(block, data + IMSI_DIGITS_FOR_PAGING + 1); if (the_pcu->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH)) gsmtap_send(the_pcu->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, data + 3, GSM_MACBLOCK_LEN); diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index 43018f6..eb63423 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -149,7 +149,7 @@ uint8_t *data, size_t data_len); void pcu_l1if_tx_agch(struct gprs_rlcmac_bts *bts, bitvec *block, int len); -void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, uint16_t pgroup); +void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi); void pcu_l1if_tx_pch_dt(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi, uint32_t tlli); #endif @@ -177,7 +177,6 @@ uint8_t len, uint32_t fn, struct pcu_l1_meas *meas); void pcu_rx_block_time(struct gprs_rlcmac_bts *bts, uint16_t arfcn, uint32_t fn, uint8_t ts_no); -uint16_t imsi2paging_group(const char* imsi); int pcu_l1if_get_e1_ccu_conn_pars(struct gsm_e1_subslot **e1_subslot, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr); -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31650 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I40d7fc14c9591b3de091e425faaf325421c70a0e Gerrit-Change-Number: 31650 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[XL] Change in osmo-pcu[master]: support for Ericsson RBS E1 CCU
by dexter 03 Mar '23

03 Mar '23
Attention is currently required from: neels, laforge, dexter. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-pcu/+/31176 to look at the new patch set (#19). Change subject: support for Ericsson RBS E1 CCU ...................................................................... support for Ericsson RBS E1 CCU Ericsson RBS series BTSs do not have a built in PCU. Rather than having the PCU on board the PCU is co-located to the BSC in those cases. Just like the MGW the PCU would connect to the CCU (Channel Coding Unit) via E1 line. The PCU is connected via an unix domain socket (pcu_sock) to the BSC to receive RACH requests and to control Paging and TBF assignment. This patch adds all the required functionality to run an Ercisson RBS in GPRS/EGPRS mode. It supports 16k I.460 E1 subslots and full 64k E1 timeslots (recommended) Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d Related: OS#5198 --- M configure.ac M src/Makefile.am A src/ericsson-rbs/er_ccu_descr.h A src/ericsson-rbs/er_ccu_if.c A src/ericsson-rbs/er_ccu_if.h A src/ericsson-rbs/er_ccu_l1_if.c A src/ericsson-rbs/er_ccu_l1_if.h M src/gprs_debug.c M src/gprs_debug.h M src/pcu_l1_if.cpp M src/pcu_l1_if.h 11 files changed, 1,155 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/76/31176/19 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31176 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d Gerrit-Change-Number: 31176 Gerrit-PatchSet: 19 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in osmo-pcu[master]: bts: add IMMEDIATE ASSIGNMENT via PCH transmission
by dexter 03 Mar '23

03 Mar '23
Attention is currently required from: neels, pespin, fixeria. Hello Jenkins Builder, laforge, fixeria, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-pcu/+/31145 to look at the new patch set (#21). Change subject: bts: add IMMEDIATE ASSIGNMENT via PCH transmission ...................................................................... bts: add IMMEDIATE ASSIGNMENT via PCH transmission In situations where the PCU is co-located to the BSC, the IMMEDIATE ASSIGNMENT for downlink TBFs must be sent via RSL and the BSC also must instruct the BTS to transmit the IMMEDIATE ASSIGNMENT via PCH instead of AGCH. Eventually the BSC must sent a confirmation message (follow-up patch) where the TLLI is used as an identifer. This new method will eventually replace the previous method that uses the MAC block as an identifier. To remain compatible with older versions of osmo-bsc, we will keep the old method until osmo-bts is migrated as well. This patch also requires new features to be added to the PCU socket interface the version number of the protocol is incremented from 0x0a to 0x0b. Version 0x0a will remain compatible and use the old method, while version 0x0b will use the new method introduced with this patch. Change-Id: I2a78651593323e8b9627c39918d949a33497b70f Related: OS#5198 --- M include/osmocom/pcu/pcuif_proto.h M src/bts.cpp M src/gprs_pcu.h M src/pcu_l1_if.cpp M src/pcu_l1_if.h 5 files changed, 76 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/45/31145/21 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31145 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I2a78651593323e8b9627c39918d949a33497b70f Gerrit-Change-Number: 31145 Gerrit-PatchSet: 21 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in osmo-pcu[master]: bts: add IMMEDIATE ASSIGNMENT via PCH transmission
by dexter 03 Mar '23

03 Mar '23
Attention is currently required from: neels, pespin, fixeria. dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31145 ) Change subject: bts: add IMMEDIATE ASSIGNMENT via PCH transmission ...................................................................... Patch Set 21: (5 comments) File include/osmocom/pcu/pcuif_proto.h: https://gerrit.osmocom.org/c/osmo-pcu/+/31145/comment/2d227f65_b8c6e8be PS17, Line 280: uint8_t pgroup[3]; > I think we should transfer the whole IMSI to osmo-bsc. […] Done File src/bts.h: https://gerrit.osmocom.org/c/osmo-pcu/+/31145/comment/ac835003_0c0765ba PS19, Line 284: bool use_dt_confirm; > I think it would be best to simply drop this bool, and explicitly check against received info_ind PC […] Done File src/bts.cpp: https://gerrit.osmocom.org/c/osmo-pcu/+/31145/comment/725827c8_9040d97c PS17, Line 1134: pcu_l1if_tx_pch(bts, immediate_assignment, plen, ms_paging_group(tbf_ms(tbf))); > Agree with the first part: Add the new message sending the whole IMSi and keep the backward compatib […] Ack File src/pcu_l1_if.cpp: https://gerrit.osmocom.org/c/osmo-pcu/+/31145/comment/770424d8_84967c35 PS19, Line 298: pgroup > Thats wired. Since we are now sending the full IMSI this patch needs to be upgraded. https://gerrit.osmocom.org/c/osmo-pcu/+/31145/comment/e54eec27_261b1b2e PS19, Line 769: LOGP(DL1IF, LOGL_NOTICE, "selected IMMEDIATE assignment confirmation method (MAC block as reference) is deprecated. OS#5927\n"); > I think in here simply state that "PCUIF version 10 is deprecated" would be more interesting. Done -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31145 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I2a78651593323e8b9627c39918d949a33497b70f Gerrit-Change-Number: 31145 Gerrit-PatchSet: 21 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 03 Mar 2023 15:40:50 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-pcu[master]: pcu_l1_if_phy: support multiple BTS (in theory)
by dexter 03 Mar '23

03 Mar '23
Attention is currently required from: pespin, fixeria. dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31649 ) Change subject: pcu_l1_if_phy: support multiple BTS (in theory) ...................................................................... Patch Set 5: (1 comment) File src/pcu_l1_if.cpp: https://gerrit.osmocom.org/c/osmo-pcu/+/31649/comment/f47c6867_f029588c PS4, Line 735: LOGP(DL1IF, LOGL_ERROR, "more then one BTS regsitered at this PCU. This PCU has only been tested with one BTS! OS#5930\n"); > More than Done -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31649 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I33518cbbe83f7f8c071afa5e995d30930099ba92 Gerrit-Change-Number: 31649 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 03 Mar 2023 15:30:57 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • ...
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.