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 -----
  • November
  • 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

January 2023

  • 1 participants
  • 2205 discussions
Change in libosmo-gprs[master]: sndcp: Initial libosmo-gprs-sndcp support
by pespin 02 Jan '23

02 Jan '23
Attention is currently required from: pespin. Hello osmith, Jenkins Builder, fixeria, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-gprs/+/30490 to look at the new patch set (#13). Change subject: sndcp: Initial libosmo-gprs-sndcp support ...................................................................... sndcp: Initial libosmo-gprs-sndcp support This commit follows a similar approach to Change-Id I588eb576b2703262f4ab9566ec362920d8390cfd, this time targeting the SNDCP layer, creating a new library for it. This new library depends on headers from libosmo-gprs-llc since the SNDCP spec takes the interface towards lower interfaces from same llc_prim. It doesn't really call any API from the libosmo-gprs-llc library to dispatch the primitive, that's left for the application, so that it can be reused against other implementations. Most of the SNDCP data structures and APIs are kept private and used only internally. The Higher/lower layers are expected to interact with it through the sndcp_prim API. This commit also implements some of the code paths of the public API by means on importing SNDCP code from osmo-sgsn.git commit 57b63875c762a784127a13becd1c2549ca6c5454. The import of code cannot be done in a separate commit since existing code in osmo-sgsn.git is low quality and has tons of layer violations in all directions. Hence, this commit aims at being an initial point of having some working SNDCP stack by means of a few unit tests, but by no means aims to be a total working implementation. Some code paths are missing; bugs are expected at this point. Change-Id: Ie05b5d721cf0a6147ed45c1feb75ad829865252b --- M .checkpatch.conf M Makefile.am M configure.ac M contrib/libosmo-gprs.spec.in M debian/control M include/osmocom/gprs/Makefile.am M include/osmocom/gprs/llc/llc_private.h A include/osmocom/gprs/sndcp/Makefile.am A include/osmocom/gprs/sndcp/comp.h A include/osmocom/gprs/sndcp/dcomp.h A include/osmocom/gprs/sndcp/pcomp.h A include/osmocom/gprs/sndcp/slhc.h A include/osmocom/gprs/sndcp/sndcp.h A include/osmocom/gprs/sndcp/sndcp_prim.h A include/osmocom/gprs/sndcp/sndcp_private.h A include/osmocom/gprs/sndcp/v42bis.h A include/osmocom/gprs/sndcp/v42bis_private.h A include/osmocom/gprs/sndcp/xid.h A libosmo-gprs-sndcp.pc.in M src/Makefile.am A src/sndcp/Makefile.am A src/sndcp/misc.c A src/sndcp/slhc.c A src/sndcp/sndcp.c A src/sndcp/sndcp_comp.c A src/sndcp/sndcp_dcomp.c A src/sndcp/sndcp_pcomp.c A src/sndcp/sndcp_prim.c A src/sndcp/sndcp_xid.c A src/sndcp/v42bis.c M tests/Makefile.am A tests/sndcp/Makefile.am A tests/sndcp/slhc_test.c A tests/sndcp/slhc_test.ok A tests/sndcp/sndcp_prim_test.c A tests/sndcp/sndcp_prim_test.err A tests/sndcp/sndcp_prim_test.ok A tests/sndcp/sndcp_xid_test.c A tests/sndcp/sndcp_xid_test.ok M tests/testsuite.at 40 files changed, 8,774 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/90/30490/13 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/30490 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ie05b5d721cf0a6147ed45c1feb75ad829865252b Gerrit-Change-Number: 30490 Gerrit-PatchSet: 13 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in libosmo-netif[master]: Introduce utils/osmo-amr-inspect program
by pespin 02 Jan '23

02 Jan '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30757 ) Change subject: Introduce utils/osmo-amr-inspect program ...................................................................... Introduce utils/osmo-amr-inspect program This program allows inspecting a list of AMR PDUs in hexstring format present in a text file. This allows easily finding out the properties of the PDU as well as finding potential errors on the data. It also allows forcing decode in different formats (octet-aligned, bandwidth-efficient) in order to detect which may be the correct one. Related: SYS#6161 Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 --- M Makefile.am M configure.ac M contrib/libosmo-netif.spec.in A utils/Makefile.am A utils/osmo-amr-inspect.c 5 files changed, 342 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved Objections: msuraev: I would prefer this is not merged as is diff --git a/Makefile.am b/Makefile.am index 55a650a..0497895 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include src examples tests +SUBDIRS = include src examples utils tests pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libosmo-netif.pc diff --git a/configure.ac b/configure.ac index 5bb0b5c..06eaf6c 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0) +PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 1.7.0) AC_ARG_ENABLE([lapd_examples], [AS_HELP_STRING( @@ -144,6 +145,7 @@ include/osmocom/netif/Makefile src/Makefile examples/Makefile + utils/Makefile tests/Makefile Doxyfile Makefile diff --git a/contrib/libosmo-netif.spec.in b/contrib/libosmo-netif.spec.in index eeda3e6..6dc19ee 100644 --- a/contrib/libosmo-netif.spec.in +++ b/contrib/libosmo-netif.spec.in @@ -26,6 +26,7 @@ BuildRequires: pkgconfig >= 0.20 BuildRequires: pkgconfig(libosmocore) >= 1.7.0 BuildRequires: pkgconfig(libosmogsm) >= 1.7.0 +BuildRequires: pkgconfig(libosmocodec) >= 1.7.0 %description Network interface demuxer library for OsmoCom projects. diff --git a/utils/Makefile.am b/utils/Makefile.am new file mode 100644 index 0000000..5640190 --- /dev/null +++ b/utils/Makefile.am @@ -0,0 +1,19 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include +AM_CFLAGS = \ + -Wall \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOCODEC_CFLAGS) \ + $(LIBOSMOGSM_CFLAGS) \ + $(TALLOC_CFLAGS) \ + $(NULL) + +LDADD = \ + $(LIBOSMOCORE_LIBS) \ + $(LIBOSMOCODEC_LIBS) \ + $(LIBOSMOGSM_LIBS) \ + $(top_builddir)/src/libosmonetif.la \ + $(NULL) + +noinst_PROGRAMS = osmo-amr-inspect + +osmo_amr_inspect_SOURCES = osmo-amr-inspect.c diff --git a/utils/osmo-amr-inspect.c b/utils/osmo-amr-inspect.c new file mode 100644 index 0000000..a677b56 --- /dev/null +++ b/utils/osmo-amr-inspect.c @@ -0,0 +1,319 @@ +/*! \file osmo-amr-inspect.c + * Utility program to inspect AMR payloads */ +/* + * (C) 2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Pau espin Pedrol <pespin(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 General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + */ + +#include <stdio.h> +#include <getopt.h> +#include <errno.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <strings.h> + +#include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> +#include <osmocom/codec/codec.h> +#include <osmocom/netif/amr.h> + +enum force_amr_input_fmt { + FORCE_AMR_INPUT_FMT_AUTO = 0, + FORCE_AMR_INPUT_FMT_OA, + FORCE_AMR_INPUT_FMT_BWE, + FORCE_AMR_INPUT_FMT_ALL, +}; + +static enum force_amr_input_fmt force_fmt = FORCE_AMR_INPUT_FMT_AUTO; +static bool use_color = false; + +static void help(const char *progname) +{ + printf("Usage: %s [-h] [-i filename] [-F (auto|oa|bwe|all)] [-C]\n", + progname); +} + +#define println_color(color, fmt, args ...) \ + do { \ + if (use_color) \ + printf(color fmt OSMO_LOGCOLOR_END "\n", ## args); \ + else \ + printf(fmt "\n", ## args); \ + } while (0) + +#define println_red(fmt, args ...) \ + println_color(OSMO_LOGCOLOR_RED, fmt OSMO_LOGCOLOR_END, ## args) + +#define println_orange(fmt, args ...) \ + println_color(OSMO_LOGCOLOR_YELLOW, fmt OSMO_LOGCOLOR_END, ## args) + +static void inspect_amr_oa(const uint8_t *buf, size_t buf_len) +{ + const struct amr_hdr *hdr = (const struct amr_hdr *)buf; + size_t payload_len = buf_len - sizeof(*hdr); + const uint8_t *payload = hdr->data; + size_t ft_bytes, ft_bits; + printf(" octet-aligned\n"); + printf(" CMR: %u\n", hdr->cmr); + printf(" F: %u\n", hdr->f); + printf(" FT: %u (%s)\n", hdr->ft, osmo_amr_type_name(hdr->ft)); + printf(" Q: %u\n", hdr->q); + printf(" Payload (%lu bytes): %s\n", + buf_len - sizeof(*hdr), osmo_hexdump_nospc(payload, payload_len)); + + if (hdr->f) + println_orange(" WARN: F=%u not supported!", hdr->f); + if (!osmo_amr_ft_valid(hdr->cmr)) + println_red(" ERROR: CMR=%u not valid!", hdr->cmr); + if (!osmo_amr_ft_valid(hdr->ft)) + println_red(" ERROR: FT=%u not valid!", hdr->ft); + if (hdr->pad1 != 0) + println_orange(" WARN: PAD1=0x%x not zero!", hdr->pad1); + if (hdr->pad2 != 0) + println_orange(" WARN: PAD2=0x%x not zero!", hdr->pad2); + ft_bytes = osmo_amr_bytes(hdr->ft); + if (payload_len != ft_bytes) { + println_red(" ERROR: Wrong payload byte-length %lu != exp %lu!", payload_len, ft_bytes); + } else { + ft_bits = osmo_amr_bits(hdr->ft); + if (ft_bits/8 == ft_bytes) { + printf(" Payload has no padding (%lu bits)\n", ft_bits); + } else { + uint8_t last_byte = payload[payload_len - 1]; + uint8_t padding = last_byte & (0xff >> (ft_bits & 3)); + if (padding) + println_orange(" WARN: Payload last byte = 0x%02x has PAD=0x%02x not zero!", last_byte, padding); + } + } +} + +static void inspect_amr_bwe(const uint8_t *buf, size_t buf_len) +{ + const struct amr_hdr_bwe *hdr = (const struct amr_hdr_bwe *)buf; + size_t payload_len_bits = 6 + (buf_len - sizeof(*hdr))*8; + size_t ft_bits; + int rc; + uint8_t buf_oa[buf_len + 1]; + uint8_t ft = (hdr->ft_hi << 1) | hdr->ft_lo; + + printf(" bandwith-efficient\n"); + printf(" CMR: %u\n", hdr->cmr); + printf(" F: %u\n", hdr->f); + printf(" FT: %u (%s)\n", ft, osmo_amr_type_name(ft)); + printf(" Q: %u\n", hdr->q); + printf(" Payload first 6 bits: 0x%02x\n", hdr->data_start); + printf(" Payload continuation (%lu bytes): %s\n", buf_len - sizeof(*hdr), + osmo_hexdump_nospc(buf + sizeof(*hdr), buf_len - sizeof(*hdr))); + + if (hdr->f) + println_orange(" WARN: F=%u not supported!", hdr->f); + if (!osmo_amr_ft_valid(hdr->cmr)) + println_red(" ERROR: CMR=%u not valid!", hdr->cmr); + if (!osmo_amr_ft_valid(ft)) { + println_red(" ERROR: FT=%u not valid!", ft); + return; + } + ft_bits = osmo_amr_bits(ft); + if (ft_bits != payload_len_bits) { + println_red(" ERROR: Wrong payload bits-length %lu != exp %lu! (FT=%u)\n", payload_len_bits, ft_bits, ft); + return; + } + + if (!((AMR_HDR_BWE_LEN_BITS + ft_bits) & 0x03)) { + printf(" Payload has no padding (%lu bits with offset 10)\n", ft_bits); + } else { + uint8_t last_byte = buf[buf_len - 1]; + uint8_t padding = last_byte & (0xff >> ((AMR_HDR_BWE_LEN_BITS + ft_bits) & 0x03)); + if (padding) + println_orange(" WARN: Payload last byte = 0x%02x has PAD=0x%02x not zero!", last_byte, padding); + } + + memcpy(buf_oa, buf, buf_len); + rc = osmo_amr_bwe_to_oa(buf_oa, buf_len, sizeof(buf_oa)); + if (rc < 0) { + println_red(" ERROR: Unable to convert to octet-aligned!"); + return; + } + printf(" Payload (octet-aligned %d bytes): %s", rc, + osmo_hexdump_nospc(buf_oa + sizeof(struct amr_hdr), rc)); +} + +static void inspect_amr(unsigned int i, const uint8_t *buf, size_t buf_len) +{ + bool is_oa; + printf("[%u] Buffer (%lu bytes): %s\n", i, buf_len, osmo_hexdump_nospc(buf, buf_len)); + is_oa = osmo_amr_is_oa(buf, buf_len); + switch (force_fmt) { + case FORCE_AMR_INPUT_FMT_AUTO: + if (is_oa) + inspect_amr_oa(buf, buf_len); + else + inspect_amr_bwe(buf, buf_len); + break; + case FORCE_AMR_INPUT_FMT_OA: + if (!is_oa) + println_orange(" WARN: detected as 'bwe' but forced as 'oa'"); + inspect_amr_oa(buf, buf_len); + break; + case FORCE_AMR_INPUT_FMT_BWE: + if (is_oa) + println_orange(" WARN: detected as 'oa' but forced as 'bwe'"); + inspect_amr_bwe(buf, buf_len); + break; + case FORCE_AMR_INPUT_FMT_ALL: + if (!is_oa) + println_orange(" WARN: detected as 'bwe' but forced as 'oa'"); + inspect_amr_oa(buf, buf_len); + if (is_oa) + println_orange(" WARN: detected as 'oa' but forced as 'bwe'"); + inspect_amr_bwe(buf, buf_len); + break; + default: + OSMO_ASSERT(0); + } + printf("\n"); +} + +static int read_file(const char *filename) +{ + FILE *fp; + char *line = NULL; + size_t len = 0; + ssize_t read; + uint8_t buf[4096]; + int rc = 0; + unsigned int i = 0; + + fp = fopen(filename, "r"); + if (fp == NULL) { + fprintf(stderr, "Failed opening %s: %s\n", filename, strerror(errno)); + return -errno; + } + + while ((read = getline(&line, &len, fp)) != -1) { + if (len & 1) { + fprintf(stderr, "Failed parsing (wrong even length): %s\n", line); + rc = -1; + goto free_ret; + } + if (len > sizeof(buf)*2) { + fprintf(stderr, "Failed parsing (too big): %s\n", line); + rc = -1; + goto free_ret; + } + rc = osmo_hexparse(line, buf, sizeof(buf)); + if (rc < 0) { + fprintf(stderr, "Failed parsing (hexparse error): %s\n", line); + rc = -1; + goto free_ret; + } + if (rc < 2) { + fprintf(stderr, "Too short to be an AMR buffer (%u bytes): %s\n", rc, line); + rc = -1; + goto free_ret; + } + inspect_amr(i, buf, rc); + i++; + } + +free_ret: + fclose(fp); + if (line) + free(line); + return rc; +} + +static int read_stdin(void) +{ + ssize_t rc; + char hex_buf[4096]; + uint8_t buf[2048]; + rc = read(0, hex_buf, sizeof(hex_buf)); + if (rc < 0) { + fprintf(stderr, "Failed reading stdin: %s\n", strerror(errno)); + return -EIO; + } + if (rc == sizeof(hex_buf)) { + fprintf(stderr, "Failed parsing (input too long)\n"); + return -ENOMEM; + } + rc = osmo_hexparse(hex_buf, buf, rc); + if (rc < 0) { + fprintf(stderr, "Failed parsing (hexparse error): %s\n", hex_buf); + return -1; + } + if (rc < 2) { + fprintf(stderr, "Too short to be an AMR buffer (%ld bytes): %s\n", rc, buf); + return -1; + } + inspect_amr(0, buf, rc); + return 0; +} + +int main(int argc, char **argv) +{ + int opt; + char *filename = NULL; + int rc; + + while ((opt = getopt(argc, argv, "i:F:Ch")) != -1) { + switch (opt) { + case 'i': + filename = optarg; + break; + case 'F': + if (strcasecmp(optarg, "auto") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_AUTO; + } else if (strcasecmp(optarg, "oa") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_OA; + } else if (strcasecmp(optarg, "bwe") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_BWE; + } else if (strcasecmp(optarg, "all") == 0) { + force_fmt = FORCE_AMR_INPUT_FMT_ALL; + } else { + help(argv[0]); + exit(1); + } + break; + case 'h': + help(argv[0]); + exit(0); + break; + case 'C': + use_color = true; + break; + default: + break; + } + } + + if (argc > optind) { + fprintf(stderr, "Unsupported positional arguments in command line\n"); + exit(2); + } + + if (filename) { + rc = read_file(filename); + exit(-rc); + } else { + rc = read_stdin(); + exit(-rc); + } + + exit(0); +} -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30757 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 Gerrit-Change-Number: 30757 Gerrit-PatchSet: 7 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmo-netif[master]: Introduce utils/osmo-amr-inspect program
by pespin 02 Jan '23

02 Jan '23
Attention is currently required from: msuraev. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30757 ) Change subject: Introduce utils/osmo-amr-inspect program ...................................................................... Patch Set 7: Code-Review+2 (2 comments) Patchset: PS7: > If you change rpm spec file you should also change debian files to avoid divergence between differen […] There's no need to change the debian file since it simply pulls in libosmocore-dev PS7: Readding +1 from laforge after fixing typo caught by osmith. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30757 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: Iffa6cc2e5391b77e3097d4c3b8d3f5211427dbe2 Gerrit-Change-Number: 30757 Gerrit-PatchSet: 7 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: msuraev <msuraev(a)sysmocom.de> Gerrit-Comment-Date: Mon, 02 Jan 2023 10:51:31 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmo-sgsn[master]: Rename gprs_gb.[c,h] -> gprs_ns.[c,h]
by pespin 02 Jan '23

02 Jan '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30786 ) Change subject: Rename gprs_gb.[c,h] -> gprs_ns.[c,h] ...................................................................... Rename gprs_gb.[c,h] -> gprs_ns.[c,h] All remaining code in that file is NS protocol related, hence let's rename it so that we end up with one file per protocol in the Gb stack. Change-Id: I8312c8a70d60cab48764950c5b57ca02964e9db2 --- M include/osmocom/sgsn/Makefile.am R include/osmocom/sgsn/gprs_ns.h M src/sgsn/Makefile.am R src/sgsn/gprs_ns.c M src/sgsn/gprs_sndcp.c M src/sgsn/sgsn_libgtp.c M src/sgsn/sgsn_main.c M src/sgsn/sgsn_vty.c M tests/sgsn/Makefile.am 9 files changed, 7 insertions(+), 7 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/osmocom/sgsn/Makefile.am b/include/osmocom/sgsn/Makefile.am index 3b1f840..64ba16f 100644 --- a/include/osmocom/sgsn/Makefile.am +++ b/include/osmocom/sgsn/Makefile.am @@ -3,12 +3,12 @@ crc24.h \ debug.h \ gprs_bssgp.h \ - gprs_gb.h \ gprs_gmm.h \ gprs_gmm_fsm.h \ gprs_gmm_attach.h \ gprs_mm_state_gb_fsm.h \ gprs_mm_state_iu_fsm.h \ + gprs_ns.h \ gprs_llc.h \ gprs_llc_xid.h \ gprs_ranap.h \ diff --git a/include/osmocom/sgsn/gprs_gb.h b/include/osmocom/sgsn/gprs_ns.h similarity index 100% rename from include/osmocom/sgsn/gprs_gb.h rename to include/osmocom/sgsn/gprs_ns.h diff --git a/src/sgsn/Makefile.am b/src/sgsn/Makefile.am index 8bc5ccb..f97d2ba 100644 --- a/src/sgsn/Makefile.am +++ b/src/sgsn/Makefile.am @@ -41,11 +41,11 @@ osmo_sgsn_SOURCES = \ gprs_bssgp.c \ - gprs_gb.c \ gprs_gmm_attach.c \ gprs_gmm.c \ gprs_gmm_fsm.c \ gprs_mm_state_gb_fsm.c \ + gprs_ns.c \ gprs_sgsn.c \ gprs_sm.c \ gprs_sndcp.c \ diff --git a/src/sgsn/gprs_gb.c b/src/sgsn/gprs_ns.c similarity index 100% rename from src/sgsn/gprs_gb.c rename to src/sgsn/gprs_ns.c diff --git a/src/sgsn/gprs_sndcp.c b/src/sgsn/gprs_sndcp.c index 3b9d28a..a0c35bf 100644 --- a/src/sgsn/gprs_sndcp.c +++ b/src/sgsn/gprs_sndcp.c @@ -32,7 +32,7 @@ #include <osmocom/gprs/gprs_bssgp.h> #include <osmocom/sgsn/debug.h> -#include <osmocom/sgsn/gprs_gb.h> +#include <osmocom/sgsn/gprs_ns.h> #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/gprs_sndcp.h> diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c index caab953..a2d0c7a 100644 --- a/src/sgsn/sgsn_libgtp.c +++ b/src/sgsn/sgsn_libgtp.c @@ -45,7 +45,7 @@ #include <osmocom/sgsn/signal.h> #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/sgsn.h> -#include <osmocom/sgsn/gprs_gb.h> +#include <osmocom/sgsn/gprs_ns.h> #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/gprs_sgsn.h> #include <osmocom/sgsn/gprs_gmm.h> diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c index 77797b9..b744310 100644 --- a/src/sgsn/sgsn_main.c +++ b/src/sgsn/sgsn_main.c @@ -61,7 +61,7 @@ #include <osmocom/sgsn/gprs_llc.h> #include <osmocom/sgsn/gprs_gmm.h> #include <osmocom/sgsn/gprs_ranap.h> -#include <osmocom/sgsn/gprs_gb.h> +#include <osmocom/sgsn/gprs_ns.h> #include <osmocom/sgsn/gprs_bssgp.h> #include <osmocom/ctrl/control_if.h> diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index db76c35..7a94f79 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -35,7 +35,7 @@ #include <osmocom/sgsn/debug.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/gprs/gprs_ns2.h> -#include <osmocom/sgsn/gprs_gb.h> +#include <osmocom/sgsn/gprs_ns.h> #include <osmocom/sgsn/gprs_gmm.h> #include <osmocom/sgsn/gprs_bssgp.h> #include <osmocom/sgsn/gprs_sgsn.h> diff --git a/tests/sgsn/Makefile.am b/tests/sgsn/Makefile.am index 5a01903..6d8fb76 100644 --- a/tests/sgsn/Makefile.am +++ b/tests/sgsn/Makefile.am @@ -49,7 +49,7 @@ sgsn_test_LDADD = \ $(top_builddir)/src/sgsn/gprs_bssgp.o \ $(top_builddir)/src/sgsn/gprs_llc.o \ - $(top_builddir)/src/sgsn/gprs_gb.o \ + $(top_builddir)/src/sgsn/gprs_ns.o \ $(top_builddir)/src/sgsn/gprs_sndcp.o \ $(top_builddir)/src/sgsn/gprs_gmm_attach.o \ $(top_builddir)/src/sgsn/gprs_gmm.o \ -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30786 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I8312c8a70d60cab48764950c5b57ca02964e9db2 Gerrit-Change-Number: 30786 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-sgsn[master]: Move some functions gprs_gb.[c,h] -> gprs_gmm.[c,h]
by pespin 02 Jan '23

02 Jan '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30785 ) Change subject: Move some functions gprs_gb.[c,h] -> gprs_gmm.[c,h] ...................................................................... Move some functions gprs_gb.[c,h] -> gprs_gmm.[c,h] This leaves only NS protocol related code in gprs_gb.[c,h], which will be renamed to gprs_ns.[c,h] in a follow up patch. Change-Id: I3dcbe1d0f75cb91ec8b700e239e2ba16fff030a2 --- M include/osmocom/sgsn/gprs_gb.h M include/osmocom/sgsn/gprs_gmm.h M src/sgsn/gprs_gb.c M src/sgsn/gprs_gmm.c M src/sgsn/gprs_sndcp.c 5 files changed, 55 insertions(+), 55 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/osmocom/sgsn/gprs_gb.h b/include/osmocom/sgsn/gprs_gb.h index e39ebc6..235b118 100644 --- a/include/osmocom/sgsn/gprs_gb.h +++ b/include/osmocom/sgsn/gprs_gb.h @@ -5,10 +5,5 @@ #include <osmocom/core/msgb.h> #include <osmocom/sgsn/gprs_llc.h> -int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, - bool drop_cipherable); -/* Has to be called whenever any PDU (signaling, data, ...) has been received */ -void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg); - /* called by the ns layer */ int gprs_ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx); diff --git a/include/osmocom/sgsn/gprs_gmm.h b/include/osmocom/sgsn/gprs_gmm.h index e2b17d2..0d04280 100644 --- a/include/osmocom/sgsn/gprs_gmm.h +++ b/include/osmocom/sgsn/gprs_gmm.h @@ -28,6 +28,11 @@ int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli, uint8_t suspend_ref); +int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, + bool drop_cipherable); +/* Has to be called whenever any PDU (signaling, data, ...) has been received */ +void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg); + time_t gprs_max_time_to_idle(void); int gsm48_tx_gmm_id_req(struct sgsn_mm_ctx *mm, uint8_t id_type); diff --git a/src/sgsn/gprs_gb.c b/src/sgsn/gprs_gb.c index 703223f..b676917 100644 --- a/src/sgsn/gprs_gb.c +++ b/src/sgsn/gprs_gb.c @@ -31,59 +31,9 @@ #include "bscconfig.h" -#include <osmocom/sgsn/gprs_mm_state_gb_fsm.h> #include <osmocom/sgsn/gprs_sgsn.h> -#include <osmocom/sgsn/gprs_gmm.h> -#include <osmocom/sgsn/gprs_sm.h> #include <osmocom/sgsn/debug.h> -/* Has to be called whenever any PDU (signaling, data, ...) has been received */ -void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg) { - msgid2mmctx(mmctx, msg); - if (mmctx->gb.llme) - osmo_fsm_inst_dispatch(mmctx->gb.mm_state_fsm, E_MM_PDU_RECEPTION, NULL); -} - -/* Main entry point for incoming 04.08 GPRS messages from Gb */ -int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, - bool drop_cipherable) -{ - struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); - uint8_t pdisc = gsm48_hdr_pdisc(gh); - struct sgsn_mm_ctx *mmctx; - struct gprs_ra_id ra_id; - int rc = -EINVAL; - - bssgp_parse_cell_id(&ra_id, msgb_bcid(msg)); - mmctx = sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &ra_id); - if (mmctx) { - rate_ctr_inc(rate_ctr_group_get_ctr(mmctx->ctrg, GMM_CTR_PKTS_SIG_IN)); - mmctx->gb.llme = llme; - gprs_gb_recv_pdu(mmctx, msg); - } - - /* MMCTX can be NULL */ - - switch (pdisc) { - case GSM48_PDISC_MM_GPRS: - rc = gsm0408_rcv_gmm(mmctx, msg, llme, drop_cipherable); - break; - case GSM48_PDISC_SM_GPRS: - rc = gsm0408_rcv_gsm(mmctx, msg, llme); - break; - default: - LOGMMCTXP(LOGL_NOTICE, mmctx, - "Unknown GSM 04.08 discriminator 0x%02x: %s\n", - pdisc, osmo_hexdump((uint8_t *)gh, msgb_l3len(msg))); - /* FIXME: return status message */ - break; - } - - /* MMCTX can be invalid */ - - return rc; -} - void gprs_ns_prim_status_cb(struct osmo_gprs_ns2_prim *nsp) { switch (nsp->u.status.cause) { diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index c2bf7a3..6aa479b 100644 --- a/src/sgsn/gprs_gmm.c +++ b/src/sgsn/gprs_gmm.c @@ -60,6 +60,7 @@ #include <osmocom/sgsn/signal.h> #include <osmocom/sgsn/gprs_sndcp.h> #include <osmocom/sgsn/gprs_ranap.h> +#include <osmocom/sgsn/gprs_sm.h> #include <pdp.h> @@ -2313,3 +2314,51 @@ osmo_fsm_inst_dispatch(mmctx->gmm_fsm, E_GMM_RESUME, NULL); return 0; } + +/* Has to be called whenever any PDU (signaling, data, ...) has been received */ +void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg) +{ + msgid2mmctx(mmctx, msg); + if (mmctx->gb.llme) + osmo_fsm_inst_dispatch(mmctx->gb.mm_state_fsm, E_MM_PDU_RECEPTION, NULL); +} + +/* Main entry point for incoming 04.08 GPRS messages from Gb */ +int gsm0408_gprs_rcvmsg_gb(struct msgb *msg, struct gprs_llc_llme *llme, + bool drop_cipherable) +{ + struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg); + uint8_t pdisc = gsm48_hdr_pdisc(gh); + struct sgsn_mm_ctx *mmctx; + struct gprs_ra_id ra_id; + int rc = -EINVAL; + + bssgp_parse_cell_id(&ra_id, msgb_bcid(msg)); + mmctx = sgsn_mm_ctx_by_tlli(msgb_tlli(msg), &ra_id); + if (mmctx) { + rate_ctr_inc(rate_ctr_group_get_ctr(mmctx->ctrg, GMM_CTR_PKTS_SIG_IN)); + mmctx->gb.llme = llme; + gprs_gb_recv_pdu(mmctx, msg); + } + + /* MMCTX can be NULL */ + + switch (pdisc) { + case GSM48_PDISC_MM_GPRS: + rc = gsm0408_rcv_gmm(mmctx, msg, llme, drop_cipherable); + break; + case GSM48_PDISC_SM_GPRS: + rc = gsm0408_rcv_gsm(mmctx, msg, llme); + break; + default: + LOGMMCTXP(LOGL_NOTICE, mmctx, + "Unknown GSM 04.08 discriminator 0x%02x: %s\n", + pdisc, osmo_hexdump((uint8_t *)gh, msgb_l3len(msg))); + /* FIXME: return status message */ + break; + } + + /* MMCTX can be invalid */ + + return rc; +} diff --git a/src/sgsn/gprs_sndcp.c b/src/sgsn/gprs_sndcp.c index 83aec0c..3b9d28a 100644 --- a/src/sgsn/gprs_sndcp.c +++ b/src/sgsn/gprs_sndcp.c @@ -41,6 +41,7 @@ #include <osmocom/sgsn/gprs_sndcp_pcomp.h> #include <osmocom/sgsn/gprs_sndcp_dcomp.h> #include <osmocom/sgsn/gprs_sndcp_comp.h> +#include <osmocom/sgsn/gprs_gmm.h> #define DEBUG_IP_PACKETS 0 /* 0=Disabled, 1=Enabled */ -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30785 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I3dcbe1d0f75cb91ec8b700e239e2ba16fff030a2 Gerrit-Change-Number: 30785 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-sgsn[master]: Create new specific file for BSSGP code
by pespin 02 Jan '23

02 Jan '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30784 ) Change subject: Create new specific file for BSSGP code ...................................................................... Create new specific file for BSSGP code Right now there's no much code there since the related code is totally entangled with the LLC one. This will eventually change in the future when we switch to use libosmo-gprs. Hence, this commit is a preparation to have already some place to put new BSSGP specific code in the future. Change-Id: I816396ab5ccb86032bbc21b41a959934a7768780 --- M include/osmocom/sgsn/Makefile.am A include/osmocom/sgsn/gprs_bssgp.h M include/osmocom/sgsn/gprs_gb.h M src/sgsn/Makefile.am A src/sgsn/gprs_bssgp.c M src/sgsn/gprs_gb.c M src/sgsn/sgsn_libgtp.c M src/sgsn/sgsn_main.c M src/sgsn/sgsn_vty.c M tests/sgsn/Makefile.am 10 files changed, 118 insertions(+), 69 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/sgsn/Makefile.am b/include/osmocom/sgsn/Makefile.am index 515c79c..3b1f840 100644 --- a/include/osmocom/sgsn/Makefile.am +++ b/include/osmocom/sgsn/Makefile.am @@ -2,6 +2,7 @@ common.h \ crc24.h \ debug.h \ + gprs_bssgp.h \ gprs_gb.h \ gprs_gmm.h \ gprs_gmm_fsm.h \ diff --git a/include/osmocom/sgsn/gprs_bssgp.h b/include/osmocom/sgsn/gprs_bssgp.h new file mode 100644 index 0000000..0feaa97 --- /dev/null +++ b/include/osmocom/sgsn/gprs_bssgp.h @@ -0,0 +1,12 @@ +#pragma once + +#include <osmocom/core/msgb.h> + +/* Called by bssgp layer when a prim is received from lower layers. */ +int sgsn_bssgp_rx_prim(struct osmo_prim_hdr *oph); + +/* called by the bssgp layer to send NS PDUs */ +int sgsn_bssgp_dispatch_ns_unitdata_req_cb(void *ctx, struct msgb *msg); + +/* page a MS in its routing area */ +int sgsn_bssgp_page_ps_ra(struct sgsn_mm_ctx *mmctx); diff --git a/include/osmocom/sgsn/gprs_gb.h b/include/osmocom/sgsn/gprs_gb.h index 9162367..e39ebc6 100644 --- a/include/osmocom/sgsn/gprs_gb.h +++ b/include/osmocom/sgsn/gprs_gb.h @@ -10,11 +10,5 @@ /* Has to be called whenever any PDU (signaling, data, ...) has been received */ void gprs_gb_recv_pdu(struct sgsn_mm_ctx *mmctx, const struct msgb *msg); -/* page a MS in its routing area */ -int gprs_gb_page_ps_ra(struct sgsn_mm_ctx *mmctx); - -/* called by the bssgp layer to send NS PDUs */ -int gprs_gb_send_cb(void *ctx, struct msgb *msg); - /* called by the ns layer */ int gprs_ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx); diff --git a/src/sgsn/Makefile.am b/src/sgsn/Makefile.am index 9e4a342..8bc5ccb 100644 --- a/src/sgsn/Makefile.am +++ b/src/sgsn/Makefile.am @@ -40,6 +40,7 @@ $(NULL) osmo_sgsn_SOURCES = \ + gprs_bssgp.c \ gprs_gb.c \ gprs_gmm_attach.c \ gprs_gmm.c \ diff --git a/src/sgsn/gprs_bssgp.c b/src/sgsn/gprs_bssgp.c new file mode 100644 index 0000000..d6bd25f --- /dev/null +++ b/src/sgsn/gprs_bssgp.c @@ -0,0 +1,94 @@ +/* GPRS BSSGP protocol implementation as per 3GPP TS 08.18 */ + +/* (C) 2010 by Harald Welte <laforge(a)gnumonks.org> + * (C) 2010 by On-Waves + * (C) 2022 by sysmocom - s.f.m.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/licenses/>. + * + */ +#include <osmocom/core/prim.h> +#include <osmocom/core/rate_ctr.h> + +#include <osmocom/gprs/gprs_bssgp.h> +#include <osmocom/gprs/gprs_ns2.h> + +#include <osmocom/sgsn/gprs_llc.h> +#include <osmocom/sgsn/gprs_gmm.h> +#include <osmocom/sgsn/sgsn_rim.h> + +/* call-back function for the BSSGP protocol */ +int sgsn_bssgp_rx_prim(struct osmo_prim_hdr *oph) +{ + struct osmo_bssgp_prim *bp; + bp = container_of(oph, struct osmo_bssgp_prim, oph); + + switch (oph->sap) { + case SAP_BSSGP_LL: + switch (oph->primitive) { + case PRIM_BSSGP_UL_UD: + return gprs_llc_rcvmsg(oph->msg, bp->tp); + } + break; + case SAP_BSSGP_GMM: + switch (oph->primitive) { + case PRIM_BSSGP_GMM_SUSPEND: + return gprs_gmm_rx_suspend(bp->ra_id, bp->tlli); + case PRIM_BSSGP_GMM_RESUME: + return gprs_gmm_rx_resume(bp->ra_id, bp->tlli, + bp->u.resume.suspend_ref); + } + break; + case SAP_BSSGP_NM: + break; + case SAP_BSSGP_RIM: + return sgsn_rim_rx_from_gb(bp, oph->msg); + } + return 0; +} + +int sgsn_bssgp_page_ps_ra(struct sgsn_mm_ctx *mmctx) +{ + struct bssgp_paging_info pinfo; + int rc; + + /* FIXME: page whole routing area, not only the last known cell */ + + /* initiate PS PAGING procedure */ + memset(&pinfo, 0, sizeof(pinfo)); + pinfo.mode = BSSGP_PAGING_PS; + pinfo.scope = BSSGP_PAGING_BVCI; + pinfo.bvci = mmctx->gb.bvci; + pinfo.imsi = mmctx->imsi; + pinfo.ptmsi = &mmctx->p_tmsi; + pinfo.drx_params = mmctx->drx_parms; + pinfo.qos[0] = 0; // FIXME + rc = bssgp_tx_paging(mmctx->gb.nsei, 0, &pinfo); + rate_ctr_inc(rate_ctr_group_get_ctr(mmctx->ctrg, GMM_CTR_PAGING_PS)); + + return rc; +} + +/* called by the bssgp layer to send NS PDUs */ +int sgsn_bssgp_dispatch_ns_unitdata_req_cb(void *ctx, struct msgb *msg) +{ + struct gprs_ns2_inst *nsi = (struct gprs_ns2_inst *) ctx; + struct osmo_gprs_ns2_prim nsp = {}; + nsp.nsei = msgb_nsei(msg); + nsp.bvci = msgb_bvci(msg); + osmo_prim_init(&nsp.oph, SAP_NS, GPRS_NS2_PRIM_UNIT_DATA, PRIM_OP_REQUEST, msg); + return gprs_ns2_recv_prim(nsi, &nsp.oph); +} diff --git a/src/sgsn/gprs_gb.c b/src/sgsn/gprs_gb.c index 96157a0..703223f 100644 --- a/src/sgsn/gprs_gb.c +++ b/src/sgsn/gprs_gb.c @@ -84,40 +84,6 @@ return rc; } - -int gprs_gb_page_ps_ra(struct sgsn_mm_ctx *mmctx) -{ - struct bssgp_paging_info pinfo; - int rc; - - /* FIXME: page whole routing area, not only the last known cell */ - - /* initiate PS PAGING procedure */ - memset(&pinfo, 0, sizeof(pinfo)); - pinfo.mode = BSSGP_PAGING_PS; - pinfo.scope = BSSGP_PAGING_BVCI; - pinfo.bvci = mmctx->gb.bvci; - pinfo.imsi = mmctx->imsi; - pinfo.ptmsi = &mmctx->p_tmsi; - pinfo.drx_params = mmctx->drx_parms; - pinfo.qos[0] = 0; // FIXME - rc = bssgp_tx_paging(mmctx->gb.nsei, 0, &pinfo); - rate_ctr_inc(rate_ctr_group_get_ctr(mmctx->ctrg, GMM_CTR_PAGING_PS)); - - return rc; -} - -/* called by the bssgp layer to send NS PDUs */ -int gprs_gb_send_cb(void *ctx, struct msgb *msg) -{ - struct gprs_ns2_inst *nsi = (struct gprs_ns2_inst *) ctx; - struct osmo_gprs_ns2_prim nsp = {}; - nsp.nsei = msgb_nsei(msg); - nsp.bvci = msgb_bvci(msg); - osmo_prim_init(&nsp.oph, SAP_NS, GPRS_NS2_PRIM_UNIT_DATA, PRIM_OP_REQUEST, msg); - return gprs_ns2_recv_prim(nsi, &nsp.oph); -} - void gprs_ns_prim_status_cb(struct osmo_gprs_ns2_prim *nsp) { switch (nsp->u.status.cause) { diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c index 033637d..caab953 100644 --- a/src/sgsn/sgsn_libgtp.c +++ b/src/sgsn/sgsn_libgtp.c @@ -57,6 +57,7 @@ #include <osmocom/sgsn/gprs_mm_state_gb_fsm.h> #include <osmocom/sgsn/gtp_mme.h> #include <osmocom/sgsn/sgsn_rim.h> +#include <osmocom/sgsn/gprs_bssgp.h> #include <gtp.h> #include <pdp.h> @@ -781,7 +782,7 @@ LOGMMCTXP(LOGL_INFO, mm, "Paging MS in GMM state %s, MM state %s\n", osmo_fsm_inst_state_name(mm->gmm_fsm), osmo_fsm_inst_state_name(mm->gb.mm_state_fsm)); - gprs_gb_page_ps_ra(mm); + sgsn_bssgp_page_ps_ra(mm); /* FIXME: queue the packet we received from GTP */ break; diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c index c775922..77797b9 100644 --- a/src/sgsn/sgsn_main.c +++ b/src/sgsn/sgsn_main.c @@ -62,6 +62,7 @@ #include <osmocom/sgsn/gprs_gmm.h> #include <osmocom/sgsn/gprs_ranap.h> #include <osmocom/sgsn/gprs_gb.h> +#include <osmocom/sgsn/gprs_bssgp.h> #include <osmocom/ctrl/control_if.h> #include <osmocom/ctrl/ports.h> @@ -97,34 +98,11 @@ struct sgsn_instance *sgsn; -/* call-back function for the BSSGP protocol */ +/* call-back function for the BSSGP protocol. + * Must be left here so that we can add a new one in tests/sgsn_test */ int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx) { - struct osmo_bssgp_prim *bp; - bp = container_of(oph, struct osmo_bssgp_prim, oph); - - switch (oph->sap) { - case SAP_BSSGP_LL: - switch (oph->primitive) { - case PRIM_BSSGP_UL_UD: - return gprs_llc_rcvmsg(oph->msg, bp->tp); - } - break; - case SAP_BSSGP_GMM: - switch (oph->primitive) { - case PRIM_BSSGP_GMM_SUSPEND: - return gprs_gmm_rx_suspend(bp->ra_id, bp->tlli); - case PRIM_BSSGP_GMM_RESUME: - return gprs_gmm_rx_resume(bp->ra_id, bp->tlli, - bp->u.resume.suspend_ref); - } - break; - case SAP_BSSGP_NM: - break; - case SAP_BSSGP_RIM: - return sgsn_rim_rx_from_gb(bp, oph->msg); - } - return 0; + return sgsn_bssgp_rx_prim(oph); } static void signal_handler(int signum) @@ -434,7 +412,7 @@ exit(1); } sgsn->cfg.nsi = sgsn_nsi; - bssgp_set_bssgp_callback(gprs_gb_send_cb, sgsn_nsi); + bssgp_set_bssgp_callback(sgsn_bssgp_dispatch_ns_unitdata_req_cb, sgsn_nsi); gprs_llc_init("/usr/local/lib/osmocom/crypt/"); sgsn_rate_ctr_init(); diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index 0929f1f..db76c35 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -37,6 +37,7 @@ #include <osmocom/gprs/gprs_ns2.h> #include <osmocom/sgsn/gprs_gb.h> #include <osmocom/sgsn/gprs_gmm.h> +#include <osmocom/sgsn/gprs_bssgp.h> #include <osmocom/sgsn/gprs_sgsn.h> #include <osmocom/sgsn/gtp_mme.h> #include <osmocom/sgsn/vty.h> @@ -1284,7 +1285,7 @@ return CMD_WARNING; } - gprs_gb_page_ps_ra(mm); + sgsn_bssgp_page_ps_ra(mm); return CMD_SUCCESS; } diff --git a/tests/sgsn/Makefile.am b/tests/sgsn/Makefile.am index bd8e19c..5a01903 100644 --- a/tests/sgsn/Makefile.am +++ b/tests/sgsn/Makefile.am @@ -47,6 +47,7 @@ $(NULL) sgsn_test_LDADD = \ + $(top_builddir)/src/sgsn/gprs_bssgp.o \ $(top_builddir)/src/sgsn/gprs_llc.o \ $(top_builddir)/src/sgsn/gprs_gb.o \ $(top_builddir)/src/sgsn/gprs_sndcp.o \ -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30784 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I816396ab5ccb86032bbc21b41a959934a7768780 Gerrit-Change-Number: 30784 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: msuraev <msuraev(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-sgsn[master]: Rename gprs_gb.[c,h] -> gprs_ns.[c,h]
by pespin 02 Jan '23

02 Jan '23
Attention is currently required from: osmith, fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30786 ) Change subject: Rename gprs_gb.[c,h] -> gprs_ns.[c,h] ...................................................................... Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30786 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I8312c8a70d60cab48764950c5b57ca02964e9db2 Gerrit-Change-Number: 30786 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: msuraev <msuraev(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 02 Jan 2023 10:48:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-sgsn[master]: Move some functions gprs_gb.[c,h] -> gprs_gmm.[c,h]
by pespin 02 Jan '23

02 Jan '23
Attention is currently required from: osmith, fixeria, msuraev. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30785 ) Change subject: Move some functions gprs_gb.[c,h] -> gprs_gmm.[c,h] ...................................................................... Patch Set 5: Code-Review+2 (1 comment) Patchset: PS5: Readding +2 after fixing empty line -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30785 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I3dcbe1d0f75cb91ec8b700e239e2ba16fff030a2 Gerrit-Change-Number: 30785 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: msuraev <msuraev(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: msuraev <msuraev(a)sysmocom.de> Gerrit-Comment-Date: Mon, 02 Jan 2023 10:48:09 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-sgsn[master]: Create new specific file for BSSGP code
by pespin 02 Jan '23

02 Jan '23
Attention is currently required from: osmith, fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/30784 ) Change subject: Create new specific file for BSSGP code ...................................................................... Patch Set 4: Code-Review+2 (1 comment) Patchset: PS4: Re-adding +2 after fixing typo -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/30784 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: I816396ab5ccb86032bbc21b41a959934a7768780 Gerrit-Change-Number: 30784 Gerrit-PatchSet: 4 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: msuraev <msuraev(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 02 Jan 2023 10:47:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gsm48_ie: gsm48_decode_freq_list(): make 'cd' argument const
by pespin 02 Jan '23

02 Jan '23
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30808 ) Change subject: gsm48_ie: gsm48_decode_freq_list(): make 'cd' argument const ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30808 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ide9110b984d3302aec6b439c563eb10e2dcdec9e Gerrit-Change-Number: 30808 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Mon, 02 Jan 2023 10:45:57 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.