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 osmocom-bb[master]: Get rid of openbsc leftover references
by pespin 31 Jan '23

31 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31116 ) Change subject: Get rid of openbsc leftover references ...................................................................... Get rid of openbsc leftover references Get rid of the global variable since it's only used once inside a function anyway. Change-Id: I0b4f536b16f3693ef16de8505036943c3a30b1df --- M src/host/layer23/src/common/main.c M src/host/layer23/src/mobile/main.c 2 files changed, 12 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/16/31116/1 diff --git a/src/host/layer23/src/common/main.c b/src/host/layer23/src/common/main.c index 92a4325..d96e080 100644 --- a/src/host/layer23/src/common/main.c +++ b/src/host/layer23/src/common/main.c @@ -64,14 +64,6 @@ int (*l23_app_exit)(void) = NULL; int quit = 0; -const char *openbsc_copyright = - "%s" - "%s\n" - "License GPLv2+: GNU GPL version 2 or later " - "<http://gnu.org/licenses/gpl.html>\n" - "This is free software: you are free to change and redistribute it.\n" - "There is NO WARRANTY, to the extent permitted by law.\n\n"; - static void print_usage(const char *app) { printf("Usage: %s\n", app); @@ -210,7 +202,12 @@ { struct l23_app_info *app; app = l23_app_info(); - printf(openbsc_copyright, + + printf("%s" + "%s\n" + "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n" + "This is free software: you are free to change and redistribute it.\n" + "There is NO WARRANTY, to the extent permitted by law.\n\n", app && app->copyright ? app->copyright : "", app && app->contribution ? app->contribution : ""); } diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index 881c283..41baaf3 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -74,14 +74,6 @@ const char *debug_default = "DCS:DNB:DPLMN:DRR:DMM:DSIM:DCC:DMNCC:DSS:DLSMS:DPAG:DSUM:DSAP:DGPS:DMOB:DPRIM:DLUA:DGAPK"; -const char *openbsc_copyright = - "%s" - "%s\n" - "License GPLv2+: GNU GPL version 2 or later " - "<http://gnu.org/licenses/gpl.html>\n" - "This is free software: you are free to change and redistribute it.\n" - "There is NO WARRANTY, to the extent permitted by law.\n\n"; - static void print_usage(const char *app) { printf("Usage: %s\n", app); @@ -216,7 +208,12 @@ { struct l23_app_info *app; app = l23_app_info(); - printf(openbsc_copyright, + + printf("%s" + "%s\n" + "License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>\n" + "This is free software: you are free to change and redistribute it.\n" + "There is NO WARRANTY, to the extent permitted by law.\n\n", app && app->copyright ? app->copyright : "", app && app->contribution ? app->contribution : ""); } -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31116 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I0b4f536b16f3693ef16de8505036943c3a30b1df Gerrit-Change-Number: 31116 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-bsc[master]: pcuif_proto: add indication to communicate E1 parameters
by dexter 31 Jan '23

31 Jan '23
dexter has abandoned this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31113 ) Change subject: pcuif_proto: add indication to communicate E1 parameters ...................................................................... Abandoned (see message) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31113 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ia7928489130c1205b06bb9b10de0fb1461843301 Gerrit-Change-Number: 31113 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: abandon
1 0
0 0
Change in osmo-bsc[master]: pcuif_proto: add indication to communicate E1 parameters
by dexter 31 Jan '23

31 Jan '23
Attention is currently required from: laforge, pespin. dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31113 ) Change subject: pcuif_proto: add indication to communicate E1 parameters ...................................................................... Patch Set 1: (4 comments) Commit Message: https://gerrit.osmocom.org/c/osmo-bsc/+/31113/comment/8f0bfb53_dda0c6d6 PS1, Line 10: setup. To avioud duplicate configuration the BSC has to communicate the > "avoid" Done Patchset: PS1: I have fixed the comments now (in both patches). Will post an updated version with the next push. Unfortunately there are two patches like this with the same change ID. One for osmo-bsc, and one for osmo-pcu. This is an error. I will keep the one for osmo-pcu and abandon the one for osmo-bsc. The patch will then be pushed again with a new change ID. File include/osmocom/bsc/pcuif_proto.h: https://gerrit.osmocom.org/c/osmo-bsc/+/31113/comment/1299d256_444bc44e PS1, Line 263: uint8_t pdch_trx_no; > this was not yet changed to trx_nr, why? There are two patches around with the same change id, I have seen it and I will change it. https://gerrit.osmocom.org/c/osmo-bsc/+/31113/comment/d93ee48e_c69b35e4 PS1, Line 264: uint8_t pdch_ts; > this was not yet changed to ts_nr, why? There are two patches around with the same change id, I have seen it and I will change it. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31113 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ia7928489130c1205b06bb9b10de0fb1461843301 Gerrit-Change-Number: 31113 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 31 Jan 2023 11:14:33 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmocom-bb[master]: layer23: Integreate mobile further into l23_app
by pespin 31 Jan '23

31 Jan '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31107 ) Change subject: layer23: Integreate mobile further into l23_app ...................................................................... layer23: Integreate mobile further into l23_app Several functions and data structures in mobile app are refactored to follow more closely the l23_app API and structures. These movements allow starting to use already some shared infrastructure defined under layer23/common. This is not a full migration to l23_app, since mobile still keeps a separate main() with a few extra code. This commit is rather a step towards an eventual merge of mobile's main.cpp into layer23/common/main.c This is a preparation commit to later one adding gsmtap VTY configuration to all l23 apps. Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c --- M src/host/layer23/include/osmocom/bb/mobile/app_mobile.h M src/host/layer23/src/mobile/app_mobile.c M src/host/layer23/src/mobile/main.c M src/host/layer23/src/mobile/vty_interface.c 4 files changed, 165 insertions(+), 91 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h b/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h index 7a3669d..940dbce 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h +++ b/src/host/layer23/include/osmocom/bb/mobile/app_mobile.h @@ -8,9 +8,6 @@ struct osmocom_ms; struct vty; -int l23_app_init(const char *config_file); -int l23_app_exit(void); -int l23_app_work(int *quit); int mobile_delete(struct osmocom_ms *ms, int force); struct osmocom_ms *mobile_new(char *name); int mobile_work(struct osmocom_ms *ms); diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index 285672d..efd3a75 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -29,6 +29,7 @@ #include <osmocom/bb/common/gps.h> #include <osmocom/bb/common/sap_interface.h> #include <osmocom/bb/common/sim.h> +#include <osmocom/bb/common/l23_app.h> #include <osmocom/bb/mobile/gsm48_rr.h> #include <osmocom/bb/mobile/gsm480_ss.h> @@ -43,8 +44,7 @@ #include <osmocom/bb/mobile/gapk_io.h> #include <osmocom/bb/mobile/primitives.h> -#include <osmocom/vty/ports.h> -#include <osmocom/vty/logging.h> +#include <osmocom/vty/vty.h> #include <osmocom/vty/telnet_interface.h> #include <osmocom/core/msgb.h> @@ -58,12 +58,12 @@ extern void *l23_ctx; extern struct llist_head ms_list; -extern int vty_reading; int mncc_recv_internal(struct osmocom_ms *ms, int msg_type, void *arg); int mncc_recv_external(struct osmocom_ms *ms, int msg_type, void *arg); int mncc_recv_dummy(struct osmocom_ms *ms, int msg_type, void *arg); -static int quit; +static int _quit; +extern int quit; /* l23 main */ /* handle ms instance */ int mobile_work(struct osmocom_ms *ms) @@ -381,20 +381,20 @@ case S_GLOBAL_SHUTDOWN: /* force to exit, if signalled */ if (signal_data && *((uint8_t *)signal_data)) - quit = 1; + _quit = 1; llist_for_each_entry_safe(ms, ms2, &ms_list, entity) - mobile_delete(ms, quit); + mobile_delete(ms, _quit); /* quit, after all MS processes are gone */ - quit = 1; + _quit = 1; break; } return 0; } /* global work handler */ -int l23_app_work(int *_quit) +int _mobile_app_work(void) { struct osmocom_ms *ms, *ms2; int work = 0; @@ -424,12 +424,12 @@ } /* return, if a shutdown was scheduled (quit = 1) */ - *_quit = quit; + quit = _quit; return work; } /* global exit */ -int l23_app_exit(void) +int _mobile_app_exit(void) { osmo_signal_unregister_handler(SS_L1CTL, &gsm322_l1_signal, NULL); osmo_signal_unregister_handler(SS_L1CTL, &mobile_signal_cb, NULL); @@ -442,53 +442,10 @@ return 0; } -static struct vty_app_info vty_info = { - .name = "OsmocomBB", - .version = PACKAGE_VERSION, -}; -/* global init */ -int l23_app_init(const char *config_file) +int _mobile_app_start(void) { - struct telnet_connection dummy_conn; - int rc = 0; - - osmo_gps_init(); - -#ifdef WITH_GAPK_IO - /* Init GAPK audio I/O */ - gapk_io_init(); -#endif - - vty_info.tall_ctx = l23_ctx; - vty_init(&vty_info); - logging_vty_add_cmds(); - ms_vty_init(); - dummy_conn.priv = NULL; - vty_reading = 1; - if (config_file != NULL) { - rc = vty_read_config_file(config_file, &dummy_conn); - if (rc < 0) { - LOGP(DMOB, LOGL_FATAL, "Failed to parse the configuration " - "file '%s'\n", config_file); - LOGP(DMOB, LOGL_FATAL, "Please make sure the file " - "'%s' exists, or use an example from " - "'doc/examples/mobile/'\n", config_file); - return rc; - } - LOGP(DMOB, LOGL_INFO, "Using configuration from '%s'\n", config_file); - } - vty_reading = 0; - rc = telnet_init_default(l23_ctx, NULL, OSMO_VTY_PORT_BB); - if (rc < 0) { - LOGP(DMOB, LOGL_FATAL, "Cannot init VTY on %s port %u: %s\n", - vty_get_bind_addr(), OSMO_VTY_PORT_BB, strerror(errno)); - return rc; - } - - osmo_signal_register_handler(SS_GLOBAL, &global_signal_cb, NULL); - osmo_signal_register_handler(SS_L1CTL, &mobile_signal_cb, NULL); - osmo_signal_register_handler(SS_L1CTL, &gsm322_l1_signal, NULL); + int rc; if (llist_empty(&ms_list)) { struct osmocom_ms *ms; @@ -503,16 +460,60 @@ return rc; } - quit = 0; + _quit = 0; return 0; } +/* global init */ +int l23_app_init(void) +{ + l23_app_start = _mobile_app_start; + l23_app_work = _mobile_app_work; + l23_app_exit = _mobile_app_exit; + osmo_gps_init(); + +#ifdef WITH_GAPK_IO + /* Init GAPK audio I/O */ + gapk_io_init(); +#endif + + osmo_signal_register_handler(SS_GLOBAL, &global_signal_cb, NULL); + osmo_signal_register_handler(SS_L1CTL, &mobile_signal_cb, NULL); + osmo_signal_register_handler(SS_L1CTL, &gsm322_l1_signal, NULL); + + return 0; +} + +static int _mobile_vty_init(void) +{ + return ms_vty_init(); +} + +static int l23_cfg_supported(void) +{ + return L23_OPT_TAP | L23_OPT_VTY | L23_OPT_DBG; +} + +static struct vty_app_info _mobile_vty_info = { + .name = "mobile", + .version = PACKAGE_VERSION, +}; + +static struct l23_app_info info = { + .copyright = "Copyright (C) 2010-2015 Andreas Eversberg, Sylvain Munaut, Holger Freyther, Harald Welte\n", + .contribution = "Contributions by Alex Badea, Pablo Neira, Steve Markgraf and others\n", + .cfg_supported = &l23_cfg_supported, + .vty_info = &_mobile_vty_info, + .vty_init = _mobile_vty_init, +}; + struct l23_app_info *l23_app_info(void) { - return NULL; /* TODO: implement mobile as a full l23_app. */ + return &info; } + void mobile_set_started(struct osmocom_ms *ms, bool state) { ms->started = state; diff --git a/src/host/layer23/src/mobile/main.c b/src/host/layer23/src/mobile/main.c index 088e6c9..4627b25 100644 --- a/src/host/layer23/src/mobile/main.c +++ b/src/host/layer23/src/mobile/main.c @@ -19,6 +19,8 @@ #include <osmocom/bb/common/osmocom_data.h> #include <osmocom/bb/common/logging.h> +#include <osmocom/bb/common/l23_app.h> +#include <osmocom/bb/common/vty.h> #include <osmocom/bb/mobile/app_mobile.h> #include <osmocom/core/talloc.h> @@ -27,6 +29,10 @@ #include <osmocom/core/gsmtap.h> #include <osmocom/core/signal.h> #include <osmocom/core/application.h> +#include <osmocom/vty/vty.h> +#include <osmocom/vty/logging.h> +#include <osmocom/vty/telnet_interface.h> +#include <osmocom/vty/ports.h> #include <arpa/inet.h> @@ -42,13 +48,21 @@ #include <time.h> #include <libgen.h> +#include "config.h" + void *l23_ctx = NULL; struct llist_head ms_list; static char *gsmtap_ip = 0; static const char *custom_cfg_file = NULL; struct gsmtap_inst *gsmtap_inst = NULL; +static char *config_file = NULL; char *config_dir = NULL; int daemonize = 0; +int quit = 0; + +int (*l23_app_start)(void) = NULL; +int (*l23_app_work)(void) = NULL; +int (*l23_app_exit)(void) = NULL; int mobile_delete(struct osmocom_ms *ms, int force); int mobile_signal_cb(unsigned int subsys, unsigned int signal, @@ -61,12 +75,12 @@ "DCS:DNB:DPLMN:DRR:DMM:DSIM:DCC:DMNCC:DSS:DLSMS:DPAG:DSUM:DSAP:DGPS:DMOB:DPRIM:DLUA:DGAPK"; const char *openbsc_copyright = - "Copyright (C) 2010-2015 Andreas Eversberg, Sylvain Munaut, Holger Freyther, Harald Welte\n" - "Contributions by Alex Badea, Pablo Neira, Steve Markgraf and others\n\n" + "%s" + "%s\n" "License GPLv2+: GNU GPL version 2 or later " "<http://gnu.org/licenses/gpl.html>\n" "This is free software: you are free to change and redistribute it.\n" - "There is NO WARRANTY, to the extent permitted by law.\n"; + "There is NO WARRANTY, to the extent permitted by law.\n\n"; static void print_usage(const char *app) { @@ -198,13 +212,56 @@ } } -int main(int argc, char **argv) +static void print_copyright(void) { - char *config_file; - int quit = 0; + struct l23_app_info *app; + app = l23_app_info(); + printf(openbsc_copyright, + app && app->copyright ? app->copyright : "", + app && app->contribution ? app->contribution : ""); +} + +static int _vty_init(struct l23_app_info *app) +{ + static struct vty_app_info l23_vty_info = { + .name = "OsmocomBB", + .version = PACKAGE_VERSION, + }; int rc; - printf("%s\n", openbsc_copyright); + OSMO_ASSERT(app->vty_info); + app->vty_info->tall_ctx = l23_ctx; + vty_init(app->vty_info ? : &l23_vty_info); + logging_vty_add_cmds(); + if (app->vty_init) + app->vty_init(); + if (config_file) { + LOGP(DLGLOBAL, LOGL_INFO, "Using configuration from '%s'\n", config_file); + l23_vty_reading = true; + rc = vty_read_config_file(config_file, NULL); + l23_vty_reading = false; + if (rc < 0) { + LOGP(DLGLOBAL, LOGL_FATAL, + "Failed to parse the configuration file '%s'\n", config_file); + return rc; + } + } + rc = telnet_init_default(l23_ctx, NULL, OSMO_VTY_PORT_BB); + if (rc < 0) { + LOGP(DMOB, LOGL_FATAL, "Cannot init VTY on %s port %u: %s\n", + vty_get_bind_addr(), OSMO_VTY_PORT_BB, strerror(errno)); + return rc; + } + return rc; +} + +int main(int argc, char **argv) +{ + int rc; + struct l23_app_info *app; + unsigned int app_supp_opt = 0x00; + + print_copyright(); srand(time(NULL)); @@ -217,21 +274,23 @@ /* Init default stderr logging */ osmo_init_logging2(l23_ctx, &log_info); + rc = l23_app_init(); + if (rc < 0) { + fprintf(stderr, "Failed during l23_app_init()\n"); + exit(1); + } + + app = l23_app_info(); + if (app && app->cfg_supported != NULL) + app_supp_opt = app->cfg_supported(); + + rc = handle_options(argc, argv); if (rc) { /* Abort in case of parsing errors */ fprintf(stderr, "Error in command line options. Exiting.\n"); return 1; } - if (gsmtap_ip) { - gsmtap_inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); - if (!gsmtap_inst) { - fprintf(stderr, "Failed during gsmtap_init()\n"); - exit(1); - } - gsmtap_source_add_sink(gsmtap_inst); - } - if (custom_cfg_file) { /* Use full path provided by user */ config_file = talloc_strdup(l23_ctx, custom_cfg_file); @@ -250,9 +309,27 @@ config_dir = talloc_strdup(l23_ctx, config_file); config_dir = dirname(config_dir); - rc = l23_app_init(config_file); - if (rc) - exit(rc); + if (app_supp_opt & L23_OPT_VTY) { + if (_vty_init(app) < 0) + exit(1); + } + + if (gsmtap_ip) { + gsmtap_inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); + if (!gsmtap_inst) { + fprintf(stderr, "Failed during gsmtap_init()\n"); + exit(1); + } + gsmtap_source_add_sink(gsmtap_inst); + } + + if (l23_app_start) { + rc = l23_app_start(); + if (rc < 0) { + fprintf(stderr, "Failed during l23_app_start()\n"); + exit(1); + } + } signal(SIGINT, sighandler); signal(SIGTSTP, sighandler); @@ -271,7 +348,7 @@ } while (1) { - l23_app_work(&quit); + l23_app_work(); if (quit && llist_empty(&ms_list)) break; osmo_select_main(0); diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c index 3ffdc54..05690ab 100644 --- a/src/host/layer23/src/mobile/vty_interface.c +++ b/src/host/layer23/src/mobile/vty_interface.c @@ -106,12 +106,11 @@ return 0; } -int vty_reading = 0; static int hide_default = 0; static void vty_restart(struct vty *vty, struct osmocom_ms *ms) { - if (vty_reading) + if (l23_vty_reading) return; if (ms->shutdown != MS_SHUTDOWN_NONE) return; @@ -1183,7 +1182,7 @@ } if (!found) { - if (!vty_reading) { + if (!l23_vty_reading) { vty_out(vty, "MS name '%s' does not exits, try " "'ms %s create'%s", argv[0], argv[0], VTY_NEWLINE); @@ -2270,7 +2269,7 @@ struct gsm_support *sup = &ms->support; \ if (!sup->item) { \ vty_out(vty, desc " not supported%s", VTY_NEWLINE); \ - if (vty_reading) \ + if (l23_vty_reading) \ return CMD_SUCCESS; \ return CMD_WARNING; \ } \ @@ -2288,7 +2287,7 @@ struct gsm_support *sup = &ms->support; \ if (!sup->item) { \ vty_out(vty, desc " not supported%s", VTY_NEWLINE); \ - if (vty_reading) \ + if (l23_vty_reading) \ return CMD_SUCCESS; \ return CMD_WARNING; \ } \ @@ -2381,7 +2380,7 @@ set->class_900 = atoi(argv[0]); - if (set->class_900 < sup->class_900 && !vty_reading) + if (set->class_900 < sup->class_900 && !l23_vty_reading) vty_out(vty, "Note: You selected a higher class than supported " " by hardware!%s", VTY_NEWLINE); @@ -2402,7 +2401,7 @@ set->class_850 = atoi(argv[0]); - if (set->class_850 < sup->class_850 && !vty_reading) + if (set->class_850 < sup->class_850 && !l23_vty_reading) vty_out(vty, "Note: You selected a higher class than supported " " by hardware!%s", VTY_NEWLINE); @@ -2423,7 +2422,7 @@ set->class_400 = atoi(argv[0]); - if (set->class_400 < sup->class_400 && !vty_reading) + if (set->class_400 < sup->class_400 && !l23_vty_reading) vty_out(vty, "Note: You selected a higher class than supported " " by hardware!%s", VTY_NEWLINE); @@ -2443,7 +2442,7 @@ set->class_dcs = atoi(argv[0]); if (((set->class_dcs + 1) & 3) < ((sup->class_dcs + 1) & 3) - && !vty_reading) + && !l23_vty_reading) vty_out(vty, "Note: You selected a higher class than supported " " by hardware!%s", VTY_NEWLINE); @@ -2463,7 +2462,7 @@ set->class_pcs = atoi(argv[0]); if (((set->class_pcs + 1) & 3) < ((sup->class_pcs + 1) & 3) - && !vty_reading) + && !l23_vty_reading) vty_out(vty, "Note: You selected a higher class than supported " " by hardware!%s", VTY_NEWLINE); @@ -2489,7 +2488,7 @@ else ch_cap = GSM_CAP_SDCCH; - if (ch_cap > sup->ch_cap && !vty_reading) { + if (ch_cap > sup->ch_cap && !l23_vty_reading) { vty_out(vty, "You selected an higher capability than supported " " by hardware!%s", VTY_NEWLINE); return CMD_WARNING; -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31107 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c Gerrit-Change-Number: 31107 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmocom-bb[master]: layer23: Integreate mobile further into l23_app
by pespin 31 Jan '23

31 Jan '23
Attention is currently required from: osmith, jolly. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31107 ) Change subject: layer23: Integreate mobile further into l23_app ...................................................................... Patch Set 2: Code-Review+2 (1 comment) Patchset: PS2: Readding +1 from laforge after fixing fixeria's comments. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31107 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c Gerrit-Change-Number: 31107 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Comment-Date: Tue, 31 Jan 2023 11:12:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmocom-bb[master]: layer23: Integreate mobile further into l23_app
by fixeria 31 Jan '23

31 Jan '23
Attention is currently required from: osmith, jolly, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31107 ) Change subject: layer23: Integreate mobile further into l23_app ...................................................................... Patch Set 2: Code-Review+1 (3 comments) File src/host/layer23/src/mobile/app_mobile.c: https://gerrit.osmocom.org/c/osmocom-bb/+/31107/comment/ab176e6f_ece83209 PS1, Line 495: L23_OPT_ARFCN > This one should be removed, because the mobile app does not have -a. […] Done https://gerrit.osmocom.org/c/osmocom-bb/+/31107/comment/09a26181_8338de38 PS1, Line 499: modem > copy-paste Done https://gerrit.osmocom.org/c/osmocom-bb/+/31107/comment/93fb7a41_74c5886c PS1, Line 504: copyright > Copyright (C) 2010-2015 Andreas Eversberg, Sylvain Munaut, Holger Freyther, Harald Welte […] Done -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31107 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I3141b6cb4a0482970f434180ef8dda3af1d4aa0c Gerrit-Change-Number: 31107 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 31 Jan 2023 11:10:57 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: rlcmac: Enqueue LLC PDUs based on RadioPriority and SAPI
by pespin 31 Jan '23

31 Jan '23
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31098 ) Change subject: rlcmac: Enqueue LLC PDUs based on RadioPriority and SAPI ...................................................................... rlcmac: Enqueue LLC PDUs based on RadioPriority and SAPI llc_queue and codel code has been taken from osmo-pcu.git 6a5b1b1f3ef83f87a9df1d4511e22f59039e11ed and have been refactored to fit in libosmo-gprs (removed llc_pdu structs, reworked struct types being enqueued, etc.). Support for queues based on radio_prio has also been added. Related: OS#5500 Change-Id: Icdaa046fb6a71367f10beee16dcf9a5b7b61022e --- M include/osmocom/gprs/rlcmac/Makefile.am A include/osmocom/gprs/rlcmac/codel.h A include/osmocom/gprs/rlcmac/gre.h A include/osmocom/gprs/rlcmac/llc_queue.h M include/osmocom/gprs/rlcmac/rlcmac.h M include/osmocom/gprs/rlcmac/rlcmac_private.h M src/rlcmac/Makefile.am A src/rlcmac/codel.c A src/rlcmac/gre.c A src/rlcmac/llc_queue.c M src/rlcmac/rlcmac.c M src/rlcmac/rlcmac_prim.c 12 files changed, 716 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/include/osmocom/gprs/rlcmac/Makefile.am b/include/osmocom/gprs/rlcmac/Makefile.am index db16d94..b8ff1e0 100644 --- a/include/osmocom/gprs/rlcmac/Makefile.am +++ b/include/osmocom/gprs/rlcmac/Makefile.am @@ -1,4 +1,7 @@ noinst_HEADERS = \ + codel.h \ + gre.h \ + llc_queue.h \ rlcmac_private.h \ $(NULL) diff --git a/include/osmocom/gprs/rlcmac/codel.h b/include/osmocom/gprs/rlcmac/codel.h new file mode 100644 index 0000000..0314f11 --- /dev/null +++ b/include/osmocom/gprs/rlcmac/codel.h @@ -0,0 +1,96 @@ +/* codel.h + * + * This is an implementation of the CoDel algorithm based on the reference + * pseudocode (see http://queue.acm.org/appendices/codel.html) + * Instead of abstracting the queue itself, the following implementation + * provides a time stamp based automaton. The main work is done by a single + * decision function which updates the state and tells whether to pass or to + * drop a packet after it has been taken from the queue. + * + * Copyright (C) 2015-2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Jacob Erlbeck <jerlbeck(a)sysmocom.de> + * + * 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. + */ + +#pragma once + +#include <time.h> + +/* Spec default values */ +#define GPRS_CODEL_DEFAULT_INTERVAL_MS 100 +#define GPRS_CODEL_DEFAULT_MAXPACKET 512 + +struct gprs_codel { + int dropping; + unsigned count; + struct timespec first_above_time; + struct timespec drop_next; + struct timespec target; + struct timespec interval; + unsigned maxpacket; +}; + +/*! + * \brief Decide about packet drop and update CoDel state + * + * This function takes timing information and decides whether the packet in + * question should be dropped in order to keep related queue in a 'good' state. + * The function is meant to be called when the packet is dequeued. + * + * The CoDel state is updated by this function. + * + * \param state A pointer to the CoDel state of this queue + * \param recv The time when the packet has entered the queue, + * use NULL if dequeueing was not possible because the queue is + * empty + * \param now The current (dequeueing) time + * \param bytes The number of bytes currently stored in the queue (-1 if + * unknown) + * + * \return != 0 if the packet should be dropped, 0 otherwise + */ +int gprs_codel_control(struct gprs_codel *state, const struct timespec *recv, + const struct timespec *now, int bytes); + +/*! + * \brief Initialise CoDel state + * + * This function initialises the CoDel state object. It sets the interval time + * to the default value (GPRS_CODEL_DEFAULT_INTERVAL_MS). + * + * \param state A pointer to the CoDel state of this queue + */ +void gprs_codel_init(struct gprs_codel *state); + +/*! + * \brief Set interval time + * + * This function changes the interval time. + * The target time is derived from the interval time as proposed in the spec + * (5% of interval time). + * + * \param state A pointer to the CoDel state of this queue + * \param interval_ms The initial interval in ms to be used (<= 0 selects the + * default value) + */ +void gprs_codel_set_interval(struct gprs_codel *state, int interval_ms); + +/*! + * \brief Set max packet size + * + * This function changes the maxpacket value. If no more than this number of + * bytes are still stored in the queue, no dropping will be done. + * + * \param state A pointer to the CoDel state of this queue + * \param maxpacket The value in bytes + */ +void gprs_codel_set_maxpacket(struct gprs_codel *state, int maxpacket); diff --git a/include/osmocom/gprs/rlcmac/gre.h b/include/osmocom/gprs/rlcmac/gre.h new file mode 100644 index 0000000..ea50ddb --- /dev/null +++ b/include/osmocom/gprs/rlcmac/gre.h @@ -0,0 +1,25 @@ +/* GPRS RLC/MAC Entity (one per MS) */ +#pragma once + +#include <osmocom/gprs/rlcmac/rlcmac.h> +#include <osmocom/gprs/rlcmac/llc_queue.h> + +struct gprs_rlcmac_ul_tbf; + +struct gprs_rlcmac_entity { + struct llist_head entry; /* item in (struct gprs_rlcmac_ctx)->gre_list */ + uint32_t tlli; + + struct gprs_rlcmac_llc_queue *llc_queue; + + struct gprs_rlcmac_ul_tbf *ul_tbf; +}; + +struct gprs_rlcmac_entity *gprs_rlcmac_entity_alloc(uint32_t tlli); +void gprs_rlcmac_entity_free(struct gprs_rlcmac_entity *gre); + +int gprs_rlcmac_entity_llc_enqueue(struct gprs_rlcmac_entity *gre, uint8_t *ll_pdu, unsigned int ll_pdu_len, + enum osmo_gprs_rlcmac_llc_sapi sapi, uint8_t radio_prio); + +#define LOGGRE(gre, level, fmt, args...) \ + LOGRLCMAC(level, "GRE(%08x) " fmt, (gre)->tlli, ## args) diff --git a/include/osmocom/gprs/rlcmac/llc_queue.h b/include/osmocom/gprs/rlcmac/llc_queue.h new file mode 100644 index 0000000..7e941fb --- /dev/null +++ b/include/osmocom/gprs/rlcmac/llc_queue.h @@ -0,0 +1,62 @@ +#pragma once + +#include <stdint.h> +#include <string.h> +#include <time.h> + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/msgb.h> + +#include <osmocom/gprs/rlcmac/codel.h> +#include <osmocom/gprs/rlcmac/rlcmac_prim.h> +#include <osmocom/gprs/rlcmac/rlcmac.h> + +struct gprs_rlcmac_entity; + +/* Highet/Lowest radio priority (biggest number) as per 3GPP TS 24.008 version 16.7.0 Release 16 section 10.5.7.2: + * "All other values are interpreted as priority level 4 by this version of the protocol." */ +#define _GPRS_RLCMAC_RADIO_PRIO_HIGHEST 1 +#define _GPRS_RLCMAC_RADIO_PRIO_LOWEST 4 +/* Normalize 0..N-1 (to be used in arrays): */ +#define RADIO_PRIO_NORM(radio_prio) ((radio_prio) - _GPRS_RLCMAC_RADIO_PRIO_HIGHEST) + +enum gprs_rlcmac_llc_queue_sapi_prio { /* lowest value has highest prio */ + GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_GMM = 0, /* SAPI 1 */ + GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_TOM_SMS, /* SAPI 2,7,8 */ + GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_OTHER, /* Other SAPIs */ + _GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_SIZE /* used to calculate size of enum */ +}; + +struct gprs_llc_prio_queue { + struct gprs_codel codel_state; + struct llist_head queue; /* queued LLC DL data. See enum gprs_rlcmac_llc_queue_prio. */ +}; + +struct gprs_rlcmac_llc_queue { + struct gprs_rlcmac_entity *gre; /* backpointer */ + uint32_t avg_queue_delay; /* Average delay of data going through the queue */ + size_t queue_size; + size_t queue_octets; + bool use_codel; + struct gprs_llc_prio_queue pq[RADIO_PRIO_NORM(_GPRS_RLCMAC_RADIO_PRIO_LOWEST) + 1][_GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_SIZE]; /* queued LLC DL data. See enum gprs_rlcmac_llc_queue_prio. */ +}; + +struct gprs_rlcmac_llc_queue *gprs_rlcmac_llc_queue_alloc(struct gprs_rlcmac_entity *gre); +void gprs_rlcmac_llc_queue_free(struct gprs_rlcmac_llc_queue *q); +void gprs_rlcmac_llc_queue_clear(struct gprs_rlcmac_llc_queue *q); + +void gprs_rlcmac_llc_queue_set_codel_params(struct gprs_rlcmac_llc_queue *q, bool use, unsigned int interval_msec); + +int gprs_rlcmac_llc_queue_enqueue(struct gprs_rlcmac_llc_queue *q, uint8_t *ll_pdu, unsigned int ll_pdu_len, + enum osmo_gprs_rlcmac_llc_sapi sapi, uint8_t radio_prio); +struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q); + +static inline size_t gprs_rlcmac_llc_queue_size(const struct gprs_rlcmac_llc_queue *q) +{ + return q->queue_size; +} + +static inline size_t gprs_rlcmac_llc_queue_octets(const struct gprs_rlcmac_llc_queue *q) +{ + return q->queue_octets; +} diff --git a/include/osmocom/gprs/rlcmac/rlcmac.h b/include/osmocom/gprs/rlcmac/rlcmac.h index 2b5f208..e433a08 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac.h +++ b/include/osmocom/gprs/rlcmac/rlcmac.h @@ -35,3 +35,4 @@ }; void osmo_gprs_rlcmac_set_log_cat(enum osmo_gprs_rlcmac_log_cat logc, int logc_num); +int osmo_gprs_rlcmac_set_codel_params(bool use, unsigned int interval_msec); diff --git a/include/osmocom/gprs/rlcmac/rlcmac_private.h b/include/osmocom/gprs/rlcmac/rlcmac_private.h index fb3ec7a..26284c1 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac_private.h +++ b/include/osmocom/gprs/rlcmac/rlcmac_private.h @@ -18,16 +18,27 @@ #define msgb_rlcmac_prim(msg) ((struct osmo_gprs_rlcmac_prim *)(msg)->l1h) struct gprs_rlcmac_ctx { - enum osmo_gprs_rlcmac_location location; + struct { + enum osmo_gprs_rlcmac_location location; + struct { + bool use; + uint32_t interval_msec; + } codel; + } cfg; osmo_gprs_rlcmac_prim_up_cb rlcmac_up_cb; void *rlcmac_up_cb_user_data; osmo_gprs_rlcmac_prim_down_cb rlcmac_down_cb; void *rlcmac_down_cb_user_data; + + struct llist_head gre_list; /* contains (struct gprs_rlcmac_entity)->entry */ }; extern struct gprs_rlcmac_ctx *g_ctx; +/* rlcmac.c */ +struct gprs_rlcmac_entity *gprs_rlcmac_find_entity_by_tlli(uint32_t tlli); + /* rlcmac_prim.c */ int gprs_rlcmac_prim_call_up_cb(struct osmo_gprs_rlcmac_prim *rlcmac_prim); int gprs_rlcmac_prim_call_down_cb(struct osmo_gprs_rlcmac_prim *rlcmac_prim); diff --git a/src/rlcmac/Makefile.am b/src/rlcmac/Makefile.am index 2e82e25..47e88b6 100644 --- a/src/rlcmac/Makefile.am +++ b/src/rlcmac/Makefile.am @@ -22,6 +22,9 @@ $(NULL) libosmo_gprs_rlcmac_la_SOURCES = \ + codel.c \ + gre.c \ + llc_queue.c \ rlcmac.c \ rlcmac_prim.c \ ts_24_008.c \ diff --git a/src/rlcmac/codel.c b/src/rlcmac/codel.c new file mode 100644 index 0000000..a6e331e --- /dev/null +++ b/src/rlcmac/codel.c @@ -0,0 +1,175 @@ +/* codel.c + * + * Copyright (C) 2015-2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Jacob Erlbeck <jerlbeck(a)sysmocom.de> + * + * 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 <stdint.h> +#include <stdlib.h> +#include <math.h> + +#include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> +#include <osmocom/core/timer_compat.h> +#include <osmocom/gprs/rlcmac/codel.h> +#include <osmocom/gprs/rlcmac/rlcmac_private.h> + +static void control_law(struct gprs_codel *state, struct timespec *delta) +{ + /* 256 / sqrt(x), limited to 255 */ + static uint8_t inv_sqrt_tab[] = {255, + 255, 181, 147, 128, 114, 104, 96, 90, 85, 80, 77, 73, 71, 68, + 66, 64, 62, 60, 58, 57, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, + 45, 45, 44, 43, 43, 42, 42, 41, 40, 40, 39, 39, 39, 38, 38, 37, + 37, 36, 36, 36, 35, 35, 35, 34, 34, 34, 33, 33, 33, 33, 32, 32, + 32, 32, 31, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 29, 29, 28, + 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, + 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17 + }; + uint_fast32_t delta_usecs; + uint_fast32_t inv_sqrt; + div_t q; + + if (state->count >= ARRAY_SIZE(inv_sqrt_tab)) + inv_sqrt = 16; + else + inv_sqrt = inv_sqrt_tab[state->count]; + + /* delta = state->interval / sqrt(count) */ + delta_usecs = state->interval.tv_sec * 1000000 + state->interval.tv_nsec/1000; + delta_usecs = delta_usecs * inv_sqrt / 256; + + q = div(delta_usecs, 1000000); + delta->tv_sec = q.quot; + delta->tv_nsec = q.rem * 1000; +} + +void gprs_codel_init(struct gprs_codel *state) +{ + static const struct gprs_codel init_state = {0}; + + *state = init_state; + gprs_codel_set_interval(state, -1); + gprs_codel_set_maxpacket(state, -1); +} + +void gprs_codel_set_interval(struct gprs_codel *state, int interval_ms) +{ + div_t q; + + if (interval_ms <= 0) + interval_ms = GPRS_CODEL_DEFAULT_INTERVAL_MS; + + q = div(interval_ms, 1000); + state->interval.tv_sec = q.quot; + state->interval.tv_nsec = q.rem * 1000000; + + /* target ~ 5% of interval */ + q = div(interval_ms * 13 / 256, 1000); + state->target.tv_sec = q.quot; + state->target.tv_nsec = q.rem * 1000000; +} + +void gprs_codel_set_maxpacket(struct gprs_codel *state, int maxpacket) +{ + + if (maxpacket < 0) + maxpacket = GPRS_CODEL_DEFAULT_MAXPACKET; + + state->maxpacket = maxpacket; +} + +/* + * This is an broken up variant of the algorithm being described in + * http://queue.acm.org/appendices/codel.html + */ +int gprs_codel_control(struct gprs_codel *state, const struct timespec *recv, + const struct timespec *now, int bytes) +{ + struct timespec sojourn_time; + struct timespec delta; + + if (recv == NULL) + goto stop_dropping; + + timespecsub(now, recv, &sojourn_time); + + if (timespeccmp(&sojourn_time, &state->target, <)) + goto stop_dropping; + + if (bytes >= 0 && (unsigned)bytes <= state->maxpacket) + goto stop_dropping; + + if (!timespecisset(&state->first_above_time)) { + timespecadd(now, &state->interval, &state->first_above_time); + goto not_ok_to_drop; + } + + if (timespeccmp(now, &state->first_above_time, <)) + goto not_ok_to_drop; + + /* Ok to drop */ + + if (!state->dropping) { + int recently = 0; + int in_drop_cycle = 0; + if (timespecisset(&state->drop_next)) { + timespecsub(now, &state->drop_next, &delta); + in_drop_cycle = timespeccmp(&delta, &state->interval, <); + recently = in_drop_cycle; + } + if (!recently) { + timespecsub(now, &state->first_above_time, &delta); + recently = !timespeccmp(&delta, &state->interval, <); + }; + if (!recently) + return 0; + + state->dropping = 1; + + if (in_drop_cycle && state->count > 2) + state->count -= 2; + else + state->count = 1; + + state->drop_next = *now; + } else { + if (timespeccmp(now, &state->drop_next, <)) + return 0; + + state->count += 1; + } + + control_law(state, &delta); + timespecadd(&state->drop_next, &delta, &state->drop_next); + + LOGRLCMAC(LOGL_INFO, + "CoDel decided to drop packet, window = %d.%03dms, count = %d\n", + (int)delta.tv_sec, (int)(delta.tv_nsec / 1000000), state->count); + + return 1; + +stop_dropping: + timespecclear(&state->first_above_time); +not_ok_to_drop: + state->dropping = 0; + return 0; +} diff --git a/src/rlcmac/gre.c b/src/rlcmac/gre.c new file mode 100644 index 0000000..7acd4f6 --- /dev/null +++ b/src/rlcmac/gre.c @@ -0,0 +1,75 @@ +/* GPRS RLC/MAC Entity (one per MS) */ +/* + * (C) 2023 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 <stdbool.h> + +#include <osmocom/gprs/rlcmac/rlcmac.h> +#include <osmocom/gprs/rlcmac/rlcmac_prim.h> +#include <osmocom/gprs/rlcmac/rlcmac_private.h> +#include <osmocom/gprs/rlcmac/gre.h> + +struct gprs_rlcmac_entity *gprs_rlcmac_entity_alloc(uint32_t tlli) +{ + struct gprs_rlcmac_entity *gre; + + gre = talloc_zero(g_ctx, struct gprs_rlcmac_entity); + if (!gre) + return NULL; + + gre->llc_queue = gprs_rlcmac_llc_queue_alloc(gre); + if (!gre->llc_queue) + goto err_free_gre; + gprs_rlcmac_llc_queue_set_codel_params(gre->llc_queue, + g_ctx->cfg.codel.use, + g_ctx->cfg.codel.interval_msec); + + gre->tlli = tlli; + llist_add_tail(&gre->entry, &g_ctx->gre_list); + + return gre; + +err_free_gre: + talloc_free(gre); + return NULL; +} + +void gprs_rlcmac_entity_free(struct gprs_rlcmac_entity *gre) +{ + if (!gre) + return; + gprs_rlcmac_llc_queue_free(gre->llc_queue); + llist_del(&gre->entry); + talloc_free(gre); +} + +int gprs_rlcmac_entity_llc_enqueue(struct gprs_rlcmac_entity *gre, uint8_t *ll_pdu, unsigned int ll_pdu_len, + enum osmo_gprs_rlcmac_llc_sapi sapi, uint8_t radio_prio) +{ + int rc; + rc = gprs_rlcmac_llc_queue_enqueue(gre->llc_queue, ll_pdu, ll_pdu_len, + sapi, radio_prio); + if (rc < 0) + return rc; + + /* TODO: here a new UL TBF will be created if not available yet */ + + return rc; +} diff --git a/src/rlcmac/llc_queue.c b/src/rlcmac/llc_queue.c new file mode 100644 index 0000000..1422f1f --- /dev/null +++ b/src/rlcmac/llc_queue.c @@ -0,0 +1,212 @@ +/* llc_queue.c + * + * Copyright (C) 2012 Ivan Klyuchnikov + * Copyright (C) 2012 Andreas Eversberg <jolly(a)eversberg.eu> + * Copyright (C) 2013 by Holger Hans Peter Freyther + * Copyright (C) 2023 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * + * 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 <osmocom/core/msgb.h> +#include <osmocom/core/logging.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/timer_compat.h> +#include <osmocom/gprs/rlcmac/rlcmac_private.h> +#include <osmocom/gprs/rlcmac/llc_queue.h> +#include <osmocom/gprs/rlcmac/gre.h> + +struct llc_queue_entry_hdr { + struct timespec recv_time; +}; + +struct gprs_rlcmac_llc_queue *gprs_rlcmac_llc_queue_alloc(struct gprs_rlcmac_entity *gre) +{ + struct gprs_rlcmac_llc_queue *q; + uint32_t i, j; + + q = talloc_zero(gre, struct gprs_rlcmac_llc_queue); + if (!q) + return NULL; + + q->gre = gre; + q->queue_size = 0; + q->queue_octets = 0; + q->avg_queue_delay = 0; + for (i = 0; i < ARRAY_SIZE(q->pq); i++) { + for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) { + INIT_LLIST_HEAD(&q->pq[i][j].queue); + gprs_codel_init(&q->pq[i][j].codel_state); + } + } + + return q; +} + +void gprs_rlcmac_llc_queue_free(struct gprs_rlcmac_llc_queue *q) +{ + talloc_free(q); +} + +void gprs_rlcmac_llc_queue_set_codel_params(struct gprs_rlcmac_llc_queue *q, bool use, unsigned int interval_msec) +{ + unsigned int i, j; + + q->use_codel = use; + + if (!q->use_codel) + return; + + for (i = 0; i < ARRAY_SIZE(q->pq); i++) + for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) + gprs_codel_set_interval(&q->pq[i][j].codel_state, interval_msec); +} + +static enum gprs_rlcmac_llc_queue_sapi_prio gprs_rlcmac_llc_sapi2prio(enum osmo_gprs_rlcmac_llc_sapi sapi) +{ + switch (sapi) { + case OSMO_GPRS_RLCMAC_LLC_SAPI_GMM: + return GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_GMM; + case OSMO_GPRS_RLCMAC_LLC_SAPI_TOM2: + case OSMO_GPRS_RLCMAC_LLC_SAPI_SMS: + case OSMO_GPRS_RLCMAC_LLC_SAPI_TOM8: + return GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_TOM_SMS; + default: + return GPRS_RLCMAC_LLC_QUEUE_SAPI_PRIO_OTHER; + } +} + +int gprs_rlcmac_llc_queue_enqueue(struct gprs_rlcmac_llc_queue *q, uint8_t *ll_pdu, unsigned int ll_pdu_len, + enum osmo_gprs_rlcmac_llc_sapi sapi, uint8_t radio_prio) +{ + struct llc_queue_entry_hdr *ehdr; + enum gprs_rlcmac_llc_queue_sapi_prio sapi_prio; + struct msgb *msg; + + /* Trim to expected values 1..4, (3GPP TS 24.008) 10.5.7.2 */ + if (radio_prio < _GPRS_RLCMAC_RADIO_PRIO_HIGHEST) + radio_prio = _GPRS_RLCMAC_RADIO_PRIO_HIGHEST; + else if (radio_prio > _GPRS_RLCMAC_RADIO_PRIO_LOWEST) + radio_prio = _GPRS_RLCMAC_RADIO_PRIO_LOWEST; + + sapi_prio = gprs_rlcmac_llc_sapi2prio(sapi); + + msg = msgb_alloc_headroom(sizeof(*ehdr) + ll_pdu_len, 0, "llc_queue_msg"); + msg->l1h = msgb_put(msg, sizeof(*ehdr)); + ehdr = (struct llc_queue_entry_hdr *)msg->l1h; + + osmo_clock_gettime(CLOCK_MONOTONIC, &ehdr->recv_time); + + if (ll_pdu_len) { + msg->l2h = msgb_put(msg, ll_pdu_len); + memcpy(msg->l2h, ll_pdu, ll_pdu_len); + } else { + msg->l2h = NULL; + } + + msgb_enqueue(&q->pq[RADIO_PRIO_NORM(radio_prio)][sapi_prio].queue, msg); + q->queue_size += 1; + q->queue_octets += ll_pdu_len; + + return 0; +} + +void gprs_rlcmac_llc_queue_clear(struct gprs_rlcmac_llc_queue *q) +{ + struct msgb *msg; + unsigned int i, j; + + for (i = 0; i < ARRAY_SIZE(q->pq); i++) { + for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) { + while ((msg = msgb_dequeue(&q->pq[i][j].queue))) + msgb_free(msg); + } + } + + q->queue_size = 0; + q->queue_octets = 0; +} + +#define ALPHA 0.5f + +static struct msgb *gprs_rlcmac_llc_queue_pick_msg(struct gprs_rlcmac_llc_queue *q, struct gprs_llc_prio_queue **prioq) +{ + struct msgb *msg; + struct timespec tv_now, tv_result; + uint32_t lifetime; + unsigned int i, j; + const struct llc_queue_entry_hdr *ehdr; + + for (i = 0; i < ARRAY_SIZE(q->pq); i++) { + for (j = 0; j < ARRAY_SIZE(q->pq[i]); j++) { + if ((msg = msgb_dequeue(&q->pq[i][j].queue))) { + *prioq = &q->pq[i][j]; + goto found; + } + } + } + return NULL; + +found: + ehdr = msgb_l1(msg); + + q->queue_size -= 1; + q->queue_octets -= msgb_l2len(msg); + + /* take the second time */ + osmo_clock_gettime(CLOCK_MONOTONIC, &tv_now); + timespecsub(&tv_now, &ehdr->recv_time, &tv_result); + + lifetime = tv_result.tv_sec*1000 + tv_result.tv_nsec/1000000; + q->avg_queue_delay = q->avg_queue_delay * ALPHA + lifetime * (1-ALPHA); + + return msg; +} + +struct msgb *gprs_rlcmac_llc_queue_dequeue(struct gprs_rlcmac_llc_queue *q) +{ + struct msgb *msg; + struct timespec tv_now; + uint32_t octets = 0, frames = 0; + struct gprs_llc_prio_queue *prioq; + const struct llc_queue_entry_hdr *ehdr; + + osmo_clock_gettime(CLOCK_MONOTONIC, &tv_now); + + while ((msg = gprs_rlcmac_llc_queue_pick_msg(q, &prioq))) { + ehdr = msgb_l1(msg); + if (q->use_codel) { + int bytes = gprs_rlcmac_llc_queue_octets(q); + if (gprs_codel_control(&prioq->codel_state, &ehdr->recv_time, &tv_now, bytes)) { + /* Drop frame: */ + frames++; + octets += msg->len; + msgb_free(msg); + /* rate_ctr_inc(CTR_LLC_FRAME_DROPPED); */ + } + } + + /* dequeue current msg */ + break; + } + + if (frames > 0) { + LOGGRE(q->gre, LOGL_NOTICE, "Discarding %u LLC PDUs (%u octets) due to codel algo, " + "new_queue_size=%zu\n", frames, octets, gprs_rlcmac_llc_queue_size(q)); + } + + msgb_pull_to_l2(msg); + + return msg; +} diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c index faf3489..13a3e84 100644 --- a/src/rlcmac/rlcmac.c +++ b/src/rlcmac/rlcmac.c @@ -19,9 +19,14 @@ * */ +#include <stdbool.h> + #include <osmocom/gprs/rlcmac/rlcmac.h> #include <osmocom/gprs/rlcmac/rlcmac_prim.h> #include <osmocom/gprs/rlcmac/rlcmac_private.h> +#include <osmocom/gprs/rlcmac/gre.h> + +#define GPRS_CODEL_SLOW_INTERVAL_MS 4000 struct gprs_rlcmac_ctx *g_ctx; @@ -33,7 +38,36 @@ talloc_free(g_ctx); g_ctx = talloc_zero(NULL, struct gprs_rlcmac_ctx); - g_ctx->location = location; + g_ctx->cfg.location = location; + g_ctx->cfg.codel.use = true; + g_ctx->cfg.codel.interval_msec = GPRS_CODEL_SLOW_INTERVAL_MS; + INIT_LLIST_HEAD(&g_ctx->gre_list); return 0; } + +/*! Set CoDel parameters used in the Tx queue of LLC PDUs waiting to be transmitted. + * \param[in] use Whether to enable or disable use of CoDel algo. + * \param[in] interval_msec Interval at which CoDel triggers, in milliseconds. (0 = use default interval value) + * \returns 0 on success; negative on error. + */ +int osmo_gprs_rlcmac_set_codel_params(bool use, unsigned int interval_msec) +{ + if (interval_msec == 0) + interval_msec = GPRS_CODEL_SLOW_INTERVAL_MS; + + g_ctx->cfg.codel.use = use; + g_ctx->cfg.codel.interval_msec = interval_msec; + return 0; +} + +struct gprs_rlcmac_entity *gprs_rlcmac_find_entity_by_tlli(uint32_t tlli) +{ + struct gprs_rlcmac_entity *gre; + + llist_for_each_entry(gre, &g_ctx->gre_list, entry) { + if (gre->tlli == tlli) + return gre; + } + return NULL; +} diff --git a/src/rlcmac/rlcmac_prim.c b/src/rlcmac/rlcmac_prim.c index 1d5dcc9..23de05d 100644 --- a/src/rlcmac/rlcmac_prim.c +++ b/src/rlcmac/rlcmac_prim.c @@ -35,6 +35,7 @@ #include <osmocom/gprs/rlcmac/rlcmac.h> #include <osmocom/gprs/rlcmac/rlcmac_prim.h> #include <osmocom/gprs/rlcmac/rlcmac_private.h> +#include <osmocom/gprs/rlcmac/gre.h> #define RLCMAC_MSGB_HEADROOM 0 @@ -213,7 +214,22 @@ static int rlcmac_prim_handle_grr_unitdata_req(struct osmo_gprs_rlcmac_prim *rlcmac_prim) { - int rc = gprs_rlcmac_prim_handle_unsupported(rlcmac_prim); + struct gprs_rlcmac_entity *gre; + int rc; + + gre = gprs_rlcmac_find_entity_by_tlli(rlcmac_prim->grr.tlli); + if (!gre) { + LOGRLCMAC(LOGL_INFO, "TLLI=0x%08x not found, creating entity on the fly\n", + rlcmac_prim->grr.tlli); + gre = gprs_rlcmac_entity_alloc(rlcmac_prim->grr.tlli); + } + OSMO_ASSERT(gre); + + rc = gprs_rlcmac_entity_llc_enqueue(gre, + rlcmac_prim->grr.ll_pdu, + rlcmac_prim->grr.ll_pdu_len, + rlcmac_prim->grr.unitdata_req.sapi, + rlcmac_prim->grr.unitdata_req.radio_prio); return rc; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31098 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Icdaa046fb6a71367f10beee16dcf9a5b7b61022e Gerrit-Change-Number: 31098 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: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmo-gprs[master]: rlcmac: Enqueue LLC PDUs based on RadioPriority and SAPI
by pespin 31 Jan '23

31 Jan '23
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31098 ) Change subject: rlcmac: Enqueue LLC PDUs based on RadioPriority and SAPI ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31098 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Icdaa046fb6a71367f10beee16dcf9a5b7b61022e Gerrit-Change-Number: 31098 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: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 31 Jan 2023 11:08:52 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmocom-bb[master]: trxcon: move AMR mode setting to l1sched_lchan_set_amr_cfg()
by pespin 31 Jan '23

31 Jan '23
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31115 ) Change subject: trxcon: move AMR mode setting to l1sched_lchan_set_amr_cfg() ...................................................................... Patch Set 1: (1 comment) File src/host/trxcon/src/trxcon_fsm.c: https://gerrit.osmocom.org/c/osmocom-bb/+/31115/comment/9aa60d0f_004ca7b3 PS1, Line 453: l1sched_lchan_set_amr_cfg(lchan, > I think a better idea would be to validate AMR params before trying to apply them here. […] whatever, what I mean is that you are changing the behavior here silently, marking stuff as applied which wasn't before. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31115 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ia9504d6194a4aac6256f7d4caf73eb42bb58563e Gerrit-Change-Number: 31115 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: Tue, 31 Jan 2023 11:08:27 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in osmocom-bb[master]: trxcon: move AMR mode setting to l1sched_lchan_set_amr_cfg()
by fixeria 31 Jan '23

31 Jan '23
Attention is currently required from: pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/31115 ) Change subject: trxcon: move AMR mode setting to l1sched_lchan_set_amr_cfg() ...................................................................... Patch Set 1: (1 comment) File src/host/trxcon/src/trxcon_fsm.c: https://gerrit.osmocom.org/c/osmocom-bb/+/31115/comment/dbc93846_5e8450ca PS1, Line 453: l1sched_lchan_set_amr_cfg(lchan, > I think a better idea would be to validate AMR params before trying to apply them here. […] Checking codecs_bitmask != 0 should be enough. Some additional checks e.g. number of bits set <= 4 can be added too. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31115 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ia9504d6194a4aac6256f7d4caf73eb42bb58563e Gerrit-Change-Number: 31115 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Tue, 31 Jan 2023 11:08:12 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • ...
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.