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]: rlcmac: Support extending log categories in the future
by laforge 25 Jan '23

25 Jan '23
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 ) Change subject: rlcmac: Support extending log categories in the future ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ic9ba207cafeada1b174f1b085e0d1d9a38c66b0a Gerrit-Change-Number: 31075 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Jan 2023 19:04:47 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: llc: Fix spec references pointing to SNDCP instead of LLC
by laforge 25 Jan '23

25 Jan '23
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31074 ) Change subject: llc: Fix spec references pointing to SNDCP instead of LLC ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31074 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ibe20dfcce937deb83fda2b114133173e47682cf7 Gerrit-Change-Number: 31074 Gerrit-PatchSet: 1 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-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Jan 2023 19:04:22 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: rlcmac: Support extending log categories in the future
by pespin 25 Jan '23

25 Jan '23
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 to look at the new patch set (#2). Change subject: rlcmac: Support extending log categories in the future ...................................................................... rlcmac: Support extending log categories in the future An initial header structure and LOG defines is created in a similar way to those already existing for libosmo-gprs-llc and sndcp. Related: OS#5500 Change-Id: Ic9ba207cafeada1b174f1b085e0d1d9a38c66b0a --- M include/osmocom/gprs/rlcmac/Makefile.am M include/osmocom/gprs/rlcmac/gprs_rlcmac.h A include/osmocom/gprs/rlcmac/rlcmac.h A include/osmocom/gprs/rlcmac/rlcmac_private.h M src/rlcmac/misc.c M src/rlcmac/ts_24_008.c M src/rlcmac/ts_44_018.c M src/rlcmac/ts_44_060.c 8 files changed, 84 insertions(+), 59 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/75/31075/2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ic9ba207cafeada1b174f1b085e0d1d9a38c66b0a Gerrit-Change-Number: 31075 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in libosmo-gprs[master]: rlcmac: Support extending log categories in the future
by Jenkins Builder 25 Jan '23

25 Jan '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 ) Change subject: rlcmac: Support extending log categories in the future ...................................................................... Patch Set 1: (1 comment) File src/rlcmac/misc.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-3023): https://gerrit.osmocom.org/c/libosmo-gprs/+/31075/comment/27accc99_49c6dd94 PS1, Line 30: } adding a line without newline at end of file -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ic9ba207cafeada1b174f1b085e0d1d9a38c66b0a Gerrit-Change-Number: 31075 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Wed, 25 Jan 2023 18:59:32 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: rlcmac: Support extending log categories in the future
by pespin 25 Jan '23

25 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 ) Change subject: rlcmac: Support extending log categories in the future ...................................................................... rlcmac: Support extending log categories in the future An initial header structure and LOG defines is created in a similar way to those already existing for libosmo-gprs-llc and sndcp. Related: OS#5500 Change-Id: Ic9ba207cafeada1b174f1b085e0d1d9a38c66b0a --- M include/osmocom/gprs/rlcmac/Makefile.am M include/osmocom/gprs/rlcmac/gprs_rlcmac.h A include/osmocom/gprs/rlcmac/rlcmac.h A include/osmocom/gprs/rlcmac/rlcmac_private.h M src/rlcmac/misc.c M src/rlcmac/ts_24_008.c M src/rlcmac/ts_44_018.c M src/rlcmac/ts_44_060.c 8 files changed, 85 insertions(+), 60 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/75/31075/1 diff --git a/include/osmocom/gprs/rlcmac/Makefile.am b/include/osmocom/gprs/rlcmac/Makefile.am index ab67d13..0182bfd 100644 --- a/include/osmocom/gprs/rlcmac/Makefile.am +++ b/include/osmocom/gprs/rlcmac/Makefile.am @@ -1,4 +1,9 @@ +noinst_HEADERS = \ + rlcmac_private.h \ + $(NULL) + rlcmac_HEADERS = \ + rlcmac.h \ gprs_rlcmac.h \ $(NULL) diff --git a/include/osmocom/gprs/rlcmac/gprs_rlcmac.h b/include/osmocom/gprs/rlcmac/gprs_rlcmac.h index 2be01b2..a68267d 100644 --- a/include/osmocom/gprs/rlcmac/gprs_rlcmac.h +++ b/include/osmocom/gprs/rlcmac/gprs_rlcmac.h @@ -5433,5 +5433,3 @@ const uint8_t *data, size_t data_len); int osmo_gprs_rlcmac_decode_imm_ass_ro(IA_RestOctets_t *storage, const uint8_t *data, size_t data_len); - -void osmo_gprs_rlcmac_set_log_cat(int cat); diff --git a/include/osmocom/gprs/rlcmac/rlcmac.h b/include/osmocom/gprs/rlcmac/rlcmac.h new file mode 100644 index 0000000..0497643 --- /dev/null +++ b/include/osmocom/gprs/rlcmac/rlcmac.h @@ -0,0 +1,10 @@ +#pragma once + +/* Radio Link Control / Medium Access Control (RLCMAC) definitions from 3GPP TS 44.060 */ + +enum osmo_gprs_rlcmac_log_cat { + OSMO_GPRS_RLCMAC_LOGC_RLCMAC, + _OSMO_GPRS_RLCMAC_LOGC_MAX, +}; + +void osmo_gprs_rlcmac_set_log_cat(enum osmo_gprs_rlcmac_log_cat logc, int logc_num); diff --git a/include/osmocom/gprs/rlcmac/rlcmac_private.h b/include/osmocom/gprs/rlcmac/rlcmac_private.h new file mode 100644 index 0000000..17bc745 --- /dev/null +++ b/include/osmocom/gprs/rlcmac/rlcmac_private.h @@ -0,0 +1,10 @@ +#pragma once + +/* RLCMAC private header */ + +#include <osmocom/gprs/rlcmac/rlcmac.h> + +extern int g_rlcmac_log_cat[_OSMO_GPRS_RLCMAC_LOGC_MAX]; + +#define LOGRLCMAC(lvl, fmt, args...) LOGP(g_rlcmac_log_cat[OSMO_GPRS_RLCMAC_LOGC_RLCMAC], lvl, fmt, ## args) +#define LOGRLCMACC(lvl, fmt, args...) LOGPC(g_rlcmac_log_cat[OSMO_GPRS_RLCMAC_LOGC_RLCMAC], lvl, fmt, ## args) diff --git a/src/rlcmac/misc.c b/src/rlcmac/misc.c index 0aecbfd..da846de 100644 --- a/src/rlcmac/misc.c +++ b/src/rlcmac/misc.c @@ -15,11 +15,16 @@ * GNU General Public License for more details. */ +#include <osmocom/core/utils.h> #include <osmocom/core/logging.h> +#include <osmocom/gprs/rlcmac/rlcmac.h> -int g_log_cat = DLGLOBAL; +int g_rlcmac_log_cat[_OSMO_GPRS_RLCMAC_LOGC_MAX] = { + [0 ... _OSMO_GPRS_RLCMAC_LOGC_MAX - 1] = DLGLOBAL +}; -void osmo_gprs_rlcmac_set_log_cat(int cat) +void osmo_gprs_rlcmac_set_log_cat(enum osmo_gprs_rlcmac_log_cat logc, int logc_num) { - g_log_cat = cat; -} + OSMO_ASSERT(logc < _OSMO_GPRS_RLCMAC_LOGC_MAX); + g_rlcmac_log_cat[logc] = logc_num; +} \ No newline at end of file diff --git a/src/rlcmac/ts_24_008.c b/src/rlcmac/ts_24_008.c index 1d64499..b9e72e0 100644 --- a/src/rlcmac/ts_24_008.c +++ b/src/rlcmac/ts_24_008.c @@ -26,8 +26,7 @@ #include <osmocom/csn1/csn1.h> #include <osmocom/gprs/rlcmac/gprs_rlcmac.h> - -extern int g_log_cat; +#include <osmocom/gprs/rlcmac/rlcmac_private.h> /*< MS Classmark 3 IE >*/ #if 0 @@ -364,7 +363,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0) { - LOGP(g_log_cat, LOGL_NOTICE, "RAcap: Got %d remaining bits unhandled by decoder at the end of bitvec\n", ret); + LOGRLCMAC(LOGL_NOTICE, "RAcap: Got %d remaining bits unhandled by decoder at the end of bitvec\n", ret); ret = 0; } return ret; @@ -384,7 +383,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0 || ret == CSN_ERROR_NEED_MORE_BITS_TO_UNPACK) { - LOGP(g_log_cat, LOGL_ERROR, "Failed to encode MS RA Capability IE: not enough bits " + LOGRLCMAC(LOGL_ERROR, "Failed to encode MS RA Capability IE: not enough bits " "in the output buffer (rc=%d)\n", ret); ret = CSN_ERROR_NEED_MORE_BITS_TO_UNPACK; } diff --git a/src/rlcmac/ts_44_018.c b/src/rlcmac/ts_44_018.c index 48ab5ea..6c0ce0e 100644 --- a/src/rlcmac/ts_44_018.c +++ b/src/rlcmac/ts_44_018.c @@ -26,8 +26,7 @@ #include <osmocom/csn1/csn1.h> #include <osmocom/gprs/rlcmac/gprs_rlcmac.h> - -extern int g_log_cat; +#include <osmocom/gprs/rlcmac/rlcmac_private.h> CSN_DESCR_EXTERN(GPRS_Mobile_Allocation_t); CSN_DESCR_EXTERN(PBCCH_Not_present_t); @@ -648,7 +647,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0) { - LOGP(g_log_cat, LOGL_NOTICE, + LOGRLCMAC(LOGL_NOTICE, "%s: %d remaining bits unhandled by decoder\n", descr_name, ret); ret = 0; diff --git a/src/rlcmac/ts_44_060.c b/src/rlcmac/ts_44_060.c index fb2dd08..5f87c30 100644 --- a/src/rlcmac/ts_44_060.c +++ b/src/rlcmac/ts_44_060.c @@ -30,8 +30,7 @@ #include <osmocom/csn1/csn1.h> #include <osmocom/gprs/rlcmac/gprs_rlcmac.h> - -extern int g_log_cat; +#include <osmocom/gprs/rlcmac/rlcmac_private.h> /* Payload type as defined in TS 44.060 / 10.4.7 */ #define PAYLOAD_TYPE_DATA 0 @@ -4476,12 +4475,12 @@ if (payload_type == PAYLOAD_TYPE_DATA) { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: DATA (0), not implemented\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: DATA (0), not implemented\n"); return CSN_ERROR_GENERAL; } else if (payload_type == PAYLOAD_TYPE_RESERVED) { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); return CSN_ERROR_GENERAL; } @@ -4583,7 +4582,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0) { - LOGP(g_log_cat, LOGL_NOTICE, "%s: Got %d remaining bits unhandled by decoder at the end of bitvec\n", msg_type_name, ret); + LOGRLCMAC(LOGL_NOTICE, "%s: Got %d remaining bits unhandled by decoder at the end of bitvec\n", msg_type_name, ret); ret = 0; } @@ -4608,12 +4607,12 @@ if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: DATA (0), not implemented\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: DATA (0), not implemented\n"); return CSN_ERROR_GENERAL; } else if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_RESERVED) { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); return CSN_ERROR_GENERAL; } /* We can decode the message */ @@ -4795,7 +4794,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0) { - LOGP(g_log_cat, LOGL_NOTICE, "%s: Got %d remaining bits unhandled by decoder at the end of bitvec\n", msg_type_name, ret); + LOGRLCMAC(LOGL_NOTICE, "%s: Got %d remaining bits unhandled by decoder at the end of bitvec\n", msg_type_name, ret); ret = 0; } @@ -4906,7 +4905,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0 || ret == CSN_ERROR_NEED_MORE_BITS_TO_UNPACK) { - LOGP(g_log_cat, LOGL_ERROR, "Failed to encode an Uplink block: not enough bits " + LOGRLCMAC(LOGL_ERROR, "Failed to encode an Uplink block: not enough bits " "in the output buffer (rc=%d)\n", ret); ret = CSN_ERROR_NEED_MORE_BITS_TO_UNPACK; } @@ -4927,12 +4926,12 @@ if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA) { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: DATA (0), not implemented\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: DATA (0), not implemented\n"); return CSN_ERROR_GENERAL; } else if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_RESERVED) { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); return CSN_ERROR_GENERAL; } /* We can encode the message */ @@ -5116,7 +5115,7 @@ LOGPC(DLCSN1, LOGL_INFO, "\n"); if (ret > 0 || ret == CSN_ERROR_NEED_MORE_BITS_TO_UNPACK) { - LOGP(g_log_cat, LOGL_ERROR, "Failed to encode a Downlink block: not enough bits " + LOGRLCMAC(LOGL_ERROR, "Failed to encode a Downlink block: not enough bits " "in the output buffer (rc=%d)\n", ret); ret = CSN_ERROR_NEED_MORE_BITS_TO_UNPACK; } @@ -5138,25 +5137,25 @@ data->CV = bitvec_read_field(vector, &readIndex, 4); data->SI = bitvec_read_field(vector, &readIndex, 1); data->R = bitvec_read_field(vector, &readIndex, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); - LOGPC(g_log_cat, LOGL_NOTICE, "CV = %u ", (unsigned)(data->CV)); - LOGPC(g_log_cat, LOGL_NOTICE, "SI = %u ", (unsigned)(data->SI)); - LOGPC(g_log_cat, LOGL_NOTICE, "R = %u ", (unsigned)(data->R)); + LOGRLCMACC(LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); + LOGRLCMACC(LOGL_NOTICE, "CV = %u ", (unsigned)(data->CV)); + LOGRLCMACC(LOGL_NOTICE, "SI = %u ", (unsigned)(data->SI)); + LOGRLCMACC(LOGL_NOTICE, "R = %u ", (unsigned)(data->R)); // Octet 1 data->spare = bitvec_read_field(vector, &readIndex, 1); data->PI = bitvec_read_field(vector, &readIndex, 1); data->TFI = bitvec_read_field(vector, &readIndex, 5); data->TI = bitvec_read_field(vector, &readIndex, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "spare = %u ", (unsigned)(data->spare)); - LOGPC(g_log_cat, LOGL_NOTICE, "PI = %u ", (unsigned)(data->PI)); - LOGPC(g_log_cat, LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); - LOGPC(g_log_cat, LOGL_NOTICE, "TI = %u ", (unsigned)(data->TI)); + LOGRLCMACC(LOGL_NOTICE, "spare = %u ", (unsigned)(data->spare)); + LOGRLCMACC(LOGL_NOTICE, "PI = %u ", (unsigned)(data->PI)); + LOGRLCMACC(LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); + LOGRLCMACC(LOGL_NOTICE, "TI = %u ", (unsigned)(data->TI)); // Octet 2 data->BSN = bitvec_read_field(vector, &readIndex, 7); data->E_1 = bitvec_read_field(vector, &readIndex, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); - LOGPC(g_log_cat, LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); + LOGRLCMACC(LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); + LOGRLCMACC(LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); if (data->E_1 == 0) // Extension octet follows immediately @@ -5168,37 +5167,37 @@ data->LENGTH_INDICATOR[i] = bitvec_read_field(vector, &readIndex, 6); data->M[i] = bitvec_read_field(vector, &readIndex, 1); data->E[i] = bitvec_read_field(vector, &readIndex, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); - LOGPC(g_log_cat, LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); - LOGPC(g_log_cat, LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); + LOGRLCMACC(LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); + LOGRLCMACC(LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); + LOGRLCMACC(LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); i++; } while((data->M[i-1] == 1)&&(data->E[i-1] == 0)); } if (data->TI == 1) // TLLI field is present { data->TLLI = bitvec_read_field(vector, &readIndex, 32); - LOGPC(g_log_cat, LOGL_NOTICE, "TLLI = %08x ", data->TLLI); + LOGRLCMACC(LOGL_NOTICE, "TLLI = %08x ", data->TLLI); if (data->PI == 1) // PFI is present if TI field indicates presence of TLLI { data->PFI = bitvec_read_field(vector, &readIndex, 7); data->E_2 = bitvec_read_field(vector, &readIndex, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "PFI = %u ", (unsigned)(data->PFI)); - LOGPC(g_log_cat, LOGL_NOTICE, "E_2 = %u ", (unsigned)(data->E_2)); + LOGRLCMACC(LOGL_NOTICE, "PFI = %u ", (unsigned)(data->PFI)); + LOGRLCMACC(LOGL_NOTICE, "E_2 = %u ", (unsigned)(data->E_2)); } } unsigned dataLen = 23 - readIndex/8; - LOGPC(g_log_cat, LOGL_NOTICE, "DATA[%u] = ", dataLen); + LOGRLCMACC(LOGL_NOTICE, "DATA[%u] = ", dataLen); OSMO_ASSERT(dataLen <= 20); for (i = 0; i < dataLen; i++) { data->RLC_DATA[i] = bitvec_read_field(vector, &readIndex, 8); - LOGPC(g_log_cat, LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); + LOGRLCMACC(LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); } - LOGPC(g_log_cat, LOGL_NOTICE, "\n"); + LOGRLCMACC(LOGL_NOTICE, "\n"); } else { - LOGP(g_log_cat, LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); + LOGRLCMAC(LOGL_NOTICE, "Payload Type: RESERVED (3)\n"); return; } } @@ -5215,24 +5214,24 @@ bitvec_write_field(vector, &writeIndex, data->RRBP, 2); bitvec_write_field(vector, &writeIndex, data->SP, 1); bitvec_write_field(vector, &writeIndex, data->USF, 3); - LOGPC(g_log_cat, LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); - LOGPC(g_log_cat, LOGL_NOTICE, "RRBP = %u ", (unsigned)(data->RRBP)); - LOGPC(g_log_cat, LOGL_NOTICE, "SP = %u ", (unsigned)(data->SP)); - LOGPC(g_log_cat, LOGL_NOTICE, "USF = %u ", (unsigned)(data->USF)); + LOGRLCMACC(LOGL_NOTICE, "PAYLOAD_TYPE = %u ", (unsigned)(data->PAYLOAD_TYPE)); + LOGRLCMACC(LOGL_NOTICE, "RRBP = %u ", (unsigned)(data->RRBP)); + LOGRLCMACC(LOGL_NOTICE, "SP = %u ", (unsigned)(data->SP)); + LOGRLCMACC(LOGL_NOTICE, "USF = %u ", (unsigned)(data->USF)); // Octet 1 bitvec_write_field(vector, &writeIndex, data->PR, 2); bitvec_write_field(vector, &writeIndex, data->TFI, 5); bitvec_write_field(vector, &writeIndex, data->FBI, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "PR = %u ", (unsigned)(data->PR)); - LOGPC(g_log_cat, LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); - LOGPC(g_log_cat, LOGL_NOTICE, "FBI = %u ", (unsigned)(data->FBI)); + LOGRLCMACC(LOGL_NOTICE, "PR = %u ", (unsigned)(data->PR)); + LOGRLCMACC(LOGL_NOTICE, "TFI = %u ", (unsigned)(data->TFI)); + LOGRLCMACC(LOGL_NOTICE, "FBI = %u ", (unsigned)(data->FBI)); // Octet 2 bitvec_write_field(vector, &writeIndex, data->BSN, 7); bitvec_write_field(vector, &writeIndex, data->E_1, 1); - LOGPC(g_log_cat, LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); - LOGPC(g_log_cat, LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); + LOGRLCMACC(LOGL_NOTICE, "BSN = %u ", (unsigned)(data->BSN)); + LOGRLCMACC(LOGL_NOTICE, "E_1 = %u ", (unsigned)(data->E_1)); // Octet 3 (optional) if (data->E_1 == 0) @@ -5243,22 +5242,22 @@ bitvec_write_field(vector, &writeIndex, data->LENGTH_INDICATOR[i], 6); bitvec_write_field(vector, &writeIndex, data->M[i], 1); bitvec_write_field(vector, &writeIndex, data->E[i], 1); - LOGPC(g_log_cat, LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); - LOGPC(g_log_cat, LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); - LOGPC(g_log_cat, LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); + LOGRLCMACC(LOGL_NOTICE, "LENGTH_INDICATOR[%u] = %u ", i, (unsigned)(data->LENGTH_INDICATOR[i])); + LOGRLCMACC(LOGL_NOTICE, "M[%u] = %u ", i, (unsigned)(data->M[i])); + LOGRLCMACC(LOGL_NOTICE, "E[%u] = %u ", i, (unsigned)(data->E[i])); i++; } while ((data->M[i-1] == 1) && (data->E[i-1] == 0)); } unsigned dataNumOctets = 23 - writeIndex/8; - LOGPC(g_log_cat, LOGL_NOTICE, "DATA[%u] = ", dataNumOctets); + LOGRLCMACC(LOGL_NOTICE, "DATA[%u] = ", dataNumOctets); OSMO_ASSERT(dataNumOctets <= 20); for (i = 0; i < dataNumOctets; i++) { bitvec_write_field(vector, &writeIndex, data->RLC_DATA[i], 8); - LOGPC(g_log_cat, LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); + LOGRLCMACC(LOGL_NOTICE, "%02x", (unsigned)(data->RLC_DATA[i])); } - LOGPC(g_log_cat, LOGL_NOTICE, "\n"); + LOGRLCMACC(LOGL_NOTICE, "\n"); } } -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31075 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ic9ba207cafeada1b174f1b085e0d1d9a38c66b0a Gerrit-Change-Number: 31075 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmo-gprs[master]: rlcmac: Introduce primitives for SAPs towards higher layers
by pespin 25 Jan '23

25 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31076 ) Change subject: rlcmac: Introduce primitives for SAPs towards higher layers ...................................................................... rlcmac: Introduce primitives for SAPs towards higher layers The GRR primitives and types are kept 1-to-1 ABI compatible to those at libosmo-gprs-llc so that they can be forwarded as pointers. Still, we want to keep the types duplicated in order to avoid having to depend one library on another, since the forwarding of one layer to the other is done by the app and can use whatever it wishes on either side. Related: OS#5500 Change-Id: I1870fa6a264612c5a669bfb832e6e8c0a892cb74 --- M include/osmocom/gprs/rlcmac/Makefile.am M include/osmocom/gprs/rlcmac/rlcmac.h A include/osmocom/gprs/rlcmac/rlcmac_prim.h M include/osmocom/gprs/rlcmac/rlcmac_private.h M src/rlcmac/Makefile.am A src/rlcmac/rlcmac.c A src/rlcmac/rlcmac_prim.c A src/rlcmac/ts_44_064.c 8 files changed, 562 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/76/31076/1 diff --git a/include/osmocom/gprs/rlcmac/Makefile.am b/include/osmocom/gprs/rlcmac/Makefile.am index 0182bfd..db16d94 100644 --- a/include/osmocom/gprs/rlcmac/Makefile.am +++ b/include/osmocom/gprs/rlcmac/Makefile.am @@ -4,6 +4,7 @@ rlcmac_HEADERS = \ rlcmac.h \ + rlcmac_prim.h \ gprs_rlcmac.h \ $(NULL) diff --git a/include/osmocom/gprs/rlcmac/rlcmac.h b/include/osmocom/gprs/rlcmac/rlcmac.h index 0497643..2b5f208 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac.h +++ b/include/osmocom/gprs/rlcmac/rlcmac.h @@ -2,6 +2,33 @@ /* Radio Link Control / Medium Access Control (RLCMAC) definitions from 3GPP TS 44.060 */ +#include <stdint.h> +#include <stddef.h> + +#include <osmocom/core/msgb.h> + +enum osmo_gprs_rlcmac_location { + OSMO_GPRS_RLCMAC_LOCATION_UNSET, + OSMO_GPRS_RLCMAC_LOCATION_MS, + OSMO_GPRS_RLCMAC_LOCATION_PCU, +}; + +/* Section TS 44.064 6.2.3 Service Access Point Identifier (SAPI) */ +enum osmo_gprs_rlcmac_llc_sapi { + OSMO_GPRS_RLCMAC_LLC_SAPI_GMM = 1, + OSMO_GPRS_RLCMAC_LLC_SAPI_TOM2 = 2, + OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP3 = 3, + OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP5 = 5, + OSMO_GPRS_RLCMAC_LLC_SAPI_SMS = 7, + OSMO_GPRS_RLCMAC_LLC_SAPI_TOM8 = 8, + OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP9 = 9, + OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP11 = 11, +}; + +extern const struct value_string osmo_gprs_rlcmac_llc_sapi_names[]; + +int osmo_gprs_rlcmac_init(enum osmo_gprs_rlcmac_location location); + enum osmo_gprs_rlcmac_log_cat { OSMO_GPRS_RLCMAC_LOGC_RLCMAC, _OSMO_GPRS_RLCMAC_LOGC_MAX, diff --git a/include/osmocom/gprs/rlcmac/rlcmac_prim.h b/include/osmocom/gprs/rlcmac/rlcmac_prim.h new file mode 100644 index 0000000..443dede --- /dev/null +++ b/include/osmocom/gprs/rlcmac/rlcmac_prim.h @@ -0,0 +1,115 @@ +#pragma once + +/* GPRS Radio Resource SAP as per: + * 3GPP TS 44.060 4.3 + * 3GPP TS 24.007 9.3 + * 3GPP TS 44.064 7.2.3 + */ + +#include <osmocom/core/prim.h> +#include <osmocom/core/utils.h> +#include <osmocom/gsm/gsm48.h> +#include <osmocom/gprs/rlcmac/rlcmac.h> + +/* TS 24.007 Section 9.3 */ +enum osmo_gprs_rlcmac_prim_sap { + OSMO_GPRS_RLCMAC_SAP_GRR, + OSMO_GPRS_RLCMAC_SAP_GMMRR, +}; + +extern const struct value_string osmo_gprs_rlcmac_prim_sap_names[]; +static inline const char *osmo_gprs_rlcmac_prim_sap_name(enum osmo_gprs_rlcmac_prim_sap val) +{ + return get_value_string(osmo_gprs_rlcmac_prim_sap_names, val); +} + +/* TS 24.007 Section 9.3.1 "Service primitives for GRR-SAP (GSM only)" + * TS 04.64 Section 7.2.3 "LLE - RLC/MAC primitives" (MS side) */ +enum osmo_gprs_rlcmac_grr_prim_type { + OSMO_GPRS_RLCMAC_GRR_DATA, /* Req/Ind: TLLI, LL-PDU, SAPI, Cause, QoS, Radio Prio */ + OSMO_GPRS_RLCMAC_GRR_UNITDATA, /* Req/Ind: TLLI, LL-PDU, SAPI, QoS, Radio Prio */ +}; + +extern const struct value_string osmo_gprs_rlcmac_grr_prim_type_names[]; +static inline const char *osmo_gprs_rlcmac_grr_prim_type_name(enum osmo_gprs_rlcmac_grr_prim_type val) +{ + return get_value_string(osmo_gprs_rlcmac_grr_prim_type_names, val); +} + +/* Parameters for OSMO_GPRS_RLCMAC_GRR_* prims */ +struct osmo_gprs_rlcmac_grr_prim { + /* Common fields */ + uint32_t tlli; + uint8_t *ll_pdu; + size_t ll_pdu_len; + /* Specific fields */ + union { + /* OSMO_GPRS_RLCMAC_GRR_DATA | Req */ + struct { + uint8_t sapi; + uint8_t radio_prio; + uint8_t qos_params[3]; + } data_req; + /* OSMO_GPRS_RLCMAC_GRR_UNITDATA | Req */ + struct { + uint8_t sapi; + uint8_t radio_prio; + uint8_t qos_params[3]; + uint8_t cause; + } unitdata_req; + }; +}; + +/* TS 24.007 Section 9.3.2 "Service primitives for GMMRR-SAP (GSM only)" */ +enum osmo_gprs_rlcmac_gmmrr_prim_type { + OSMO_GPRS_RLCMAC_GMMRR_ASSIGN, /* Req: newTLLI */ + OSMO_GPRS_RLCMAC_GMMRR_PAGE, /* Ind: TLLI */ +}; + +extern const struct value_string osmo_gprs_rlcmac_gmmrr_prim_type_names[]; +static inline const char *osmo_gprs_rlcmac_gmmrr_prim_type_name(enum osmo_gprs_rlcmac_gmmrr_prim_type val) +{ + return get_value_string(osmo_gprs_rlcmac_gmmrr_prim_type_names, val); +} + +/* Parameters for OSMO_GPRS_RLCMAC_GRR_* prims */ +struct osmo_gprs_rlcmac_gmmrr_prim { + /* Common fields (none) */ + union { + /* OSMO_GPRS_RLCMAC_GMMRR_ASSIGN | Req */ + struct { + uint32_t new_tlli; + } assign_req; + /* OSMO_GPRS_RLCMAC_GMMRR_PAGE | Ind */ + struct { + uint32_t tlli; + } page_ind; + }; +}; + +struct osmo_gprs_rlcmac_prim { + struct osmo_prim_hdr oph; + union { + struct osmo_gprs_rlcmac_grr_prim grr; + struct osmo_gprs_rlcmac_gmmrr_prim gmmrr; + }; +}; + +typedef int (*osmo_gprs_rlcmac_prim_up_cb)(struct osmo_gprs_rlcmac_prim *rlcmac_prim, void *up_user_data); +void osmo_gprs_rlcmac_prim_set_up_cb(osmo_gprs_rlcmac_prim_up_cb up_cb, void *up_user_data); + +typedef int (*osmo_gprs_rlcmac_prim_down_cb)(struct osmo_gprs_rlcmac_prim *rlcmac_prim, void *down_user_data); +void osmo_gprs_rlcmac_prim_set_down_cb(osmo_gprs_rlcmac_prim_down_cb down_cb, void *down_user_data); + +int osmo_gprs_rlcmac_prim_upper_down(struct osmo_gprs_rlcmac_prim *rlcmac_prim); +int osmo_gprs_rlcmac_prim_lower_up(struct osmo_gprs_rlcmac_prim *rlcmac_prim); + +const char *osmo_gprs_rlcmac_prim_name(const struct osmo_gprs_rlcmac_prim *rlcmac_prim); + +/* Alloc primitive for GRR SAP: */ +struct osmo_gprs_rlcmac_prim *osmo_gprs_rlcmac_prim_alloc_grr_unitdata_req( + uint32_t tlli, uint8_t *ll_pdu, size_t ll_pdu_len); + +/* Alloc primitive for GMMRR SAP: */ +struct osmo_gprs_rlcmac_prim *osmo_gprs_rlcmac_prim_alloc_gmmrr_asign_req( + uint32_t new_tlli); diff --git a/include/osmocom/gprs/rlcmac/rlcmac_private.h b/include/osmocom/gprs/rlcmac/rlcmac_private.h index 17bc745..fb3ec7a 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac_private.h +++ b/include/osmocom/gprs/rlcmac/rlcmac_private.h @@ -2,9 +2,36 @@ /* RLCMAC private header */ +#include <stdint.h> +#include <stddef.h> + +#include <osmocom/core/msgb.h> + +#include <osmocom/gprs/rlcmac/rlcmac_prim.h> #include <osmocom/gprs/rlcmac/rlcmac.h> extern int g_rlcmac_log_cat[_OSMO_GPRS_RLCMAC_LOGC_MAX]; #define LOGRLCMAC(lvl, fmt, args...) LOGP(g_rlcmac_log_cat[OSMO_GPRS_RLCMAC_LOGC_RLCMAC], lvl, fmt, ## args) #define LOGRLCMACC(lvl, fmt, args...) LOGPC(g_rlcmac_log_cat[OSMO_GPRS_RLCMAC_LOGC_RLCMAC], lvl, fmt, ## args) + +#define msgb_rlcmac_prim(msg) ((struct osmo_gprs_rlcmac_prim *)(msg)->l1h) + +struct gprs_rlcmac_ctx { + enum osmo_gprs_rlcmac_location location; + 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; +}; + +extern struct gprs_rlcmac_ctx *g_ctx; + +/* 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); + +struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_grr_unitdata_ind( + uint32_t tlli, uint8_t *ll_pdu, size_t ll_pdu_len); +struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_gmmrr_page_ind(uint32_t tlli); diff --git a/src/rlcmac/Makefile.am b/src/rlcmac/Makefile.am index 8aa8dc2..2e82e25 100644 --- a/src/rlcmac/Makefile.am +++ b/src/rlcmac/Makefile.am @@ -22,9 +22,12 @@ $(NULL) libosmo_gprs_rlcmac_la_SOURCES = \ + rlcmac.c \ + rlcmac_prim.c \ ts_24_008.c \ ts_44_018.c \ ts_44_060.c \ + ts_44_064.c \ misc.c \ $(NULL) diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c new file mode 100644 index 0000000..faf3489 --- /dev/null +++ b/src/rlcmac/rlcmac.c @@ -0,0 +1,39 @@ +/* GPRS RLCMAC as per 3GPP TS 44.060 */ +/* + * (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 <osmocom/gprs/rlcmac/rlcmac.h> +#include <osmocom/gprs/rlcmac/rlcmac_prim.h> +#include <osmocom/gprs/rlcmac/rlcmac_private.h> + +struct gprs_rlcmac_ctx *g_ctx; + +int osmo_gprs_rlcmac_init(enum osmo_gprs_rlcmac_location location) +{ + OSMO_ASSERT(location == OSMO_GPRS_RLCMAC_LOCATION_MS || location == OSMO_GPRS_RLCMAC_LOCATION_PCU) + + if (g_ctx) + talloc_free(g_ctx); + + g_ctx = talloc_zero(NULL, struct gprs_rlcmac_ctx); + g_ctx->location = location; + + return 0; +} diff --git a/src/rlcmac/rlcmac_prim.c b/src/rlcmac/rlcmac_prim.c new file mode 100644 index 0000000..6a9fa4f --- /dev/null +++ b/src/rlcmac/rlcmac_prim.c @@ -0,0 +1,315 @@ +/* GPRS Radio Resource SAP as per: + * 3GPP TS 44.060 4.3 + * 3GPP TS 24.007 9.3 + * 3GPP TS 44.064 7.2.3 + */ +/* + * (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 <stdint.h> +#include <errno.h> + +#include <osmocom/core/msgb.h> +#include <osmocom/core/utils.h> +#include <osmocom/core/logging.h> +#include <osmocom/crypt/gprs_cipher.h> +#include <osmocom/gsm/gsm_utils.h> + +#include <osmocom/gprs/rlcmac/rlcmac.h> +#include <osmocom/gprs/rlcmac/rlcmac_prim.h> +#include <osmocom/gprs/rlcmac/rlcmac_private.h> + +#define RLCMAC_MSGB_HEADROOM 0 + +const struct value_string osmo_gprs_rlcmac_prim_sap_names[] = { + { OSMO_GPRS_RLCMAC_SAP_GRR, "GRR" }, + { OSMO_GPRS_RLCMAC_SAP_GMMRR, "GMMRR" }, + { 0, NULL } +}; + +const struct value_string osmo_gprs_rlcmac_grr_prim_type_names[] = { + { OSMO_GPRS_RLCMAC_GRR_DATA, "DATA" }, + { OSMO_GPRS_RLCMAC_GRR_UNITDATA, "UNITDATA" }, + { 0, NULL } +}; + +const struct value_string osmo_gprs_rlcmac_gmmrr_prim_type_names[] = { + { OSMO_GPRS_RLCMAC_GMMRR_ASSIGN, "ASSIGN" }, + { OSMO_GPRS_RLCMAC_GMMRR_PAGE, "PAGE" }, + { 0, NULL } +}; + +const char *osmo_gprs_rlcmac_prim_name(const struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + static char name_buf[256]; + const char *sap = osmo_gprs_rlcmac_prim_sap_name(rlcmac_prim->oph.sap); + const char *op = get_value_string(osmo_prim_op_names, rlcmac_prim->oph.operation); + const char *type; + + switch (rlcmac_prim->oph.sap) { + case OSMO_GPRS_RLCMAC_SAP_GRR: + type = osmo_gprs_rlcmac_grr_prim_type_name(rlcmac_prim->oph.primitive); + break; + case OSMO_GPRS_RLCMAC_SAP_GMMRR: + type = osmo_gprs_rlcmac_gmmrr_prim_type_name(rlcmac_prim->oph.primitive); + break; + default: + type = "unsupported-rlcmac-sap"; + } + + snprintf(name_buf, sizeof(name_buf), "%s-%s.%s", sap, type, op); + return name_buf; +} + +static int rlcmac_up_cb_dummy(struct osmo_gprs_rlcmac_prim *rlcmac_prim, void *user_data) +{ + LOGRLCMAC(LOGL_INFO, "rlcmac_up_cb_dummy(%s)\n", osmo_gprs_rlcmac_prim_name(rlcmac_prim)); + return 0; +} + +static int rlcmac_down_cb_dummy(struct osmo_gprs_rlcmac_prim *rlcmac_prim, void *user_data) +{ + LOGRLCMAC(LOGL_INFO, "rlcmac_down_cb_dummy(%s)\n", osmo_gprs_rlcmac_prim_name(rlcmac_prim)); + return 0; +} + +/******************************** + * Primitive allocation: + ********************************/ + +/* allocate a msgb containing a struct osmo_gprs_rlcmac_prim + optional l3 data */ +static struct msgb *gprs_rlcmac_prim_msgb_alloc(unsigned int l3_len) +{ + const int headroom = RLCMAC_MSGB_HEADROOM; + const int size = headroom + sizeof(struct osmo_gprs_rlcmac_prim) + l3_len; + struct msgb *msg = msgb_alloc_headroom(size, headroom, "rlcmac_prim"); + + if (!msg) + return NULL; + + msg->l1h = msgb_put(msg, sizeof(struct osmo_gprs_rlcmac_prim)); + + return msg; +} + +static struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc(enum osmo_gprs_rlcmac_prim_sap sap, + unsigned int type, + enum osmo_prim_operation operation, + unsigned int l3_len) +{ + struct msgb *msg = gprs_rlcmac_prim_msgb_alloc(l3_len); + struct osmo_gprs_rlcmac_prim *rlcmac_prim = msgb_rlcmac_prim(msg); + + osmo_prim_init(&rlcmac_prim->oph, sap, type, operation, msg); + return rlcmac_prim; +} + +static inline +struct osmo_gprs_rlcmac_prim *rlcmac_prim_grr_alloc(enum osmo_gprs_rlcmac_grr_prim_type type, + enum osmo_prim_operation operation, + unsigned int l3_len) +{ + return gprs_rlcmac_prim_alloc(OSMO_GPRS_RLCMAC_SAP_GRR, type, operation, l3_len); +} + +static inline +struct osmo_gprs_rlcmac_prim *rlcmac_prim_gmmrr_alloc(enum osmo_gprs_rlcmac_gmmrr_prim_type type, + enum osmo_prim_operation operation, + unsigned int l3_len) +{ + return gprs_rlcmac_prim_alloc(OSMO_GPRS_RLCMAC_SAP_GMMRR, type, operation, l3_len); +} + +/* 3GPP TS 44.064 7.2.3.2 GRR-UNITDATA.ind (MS):*/ +struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_grr_unitdata_ind( + uint32_t tlli, uint8_t *ll_pdu, + size_t ll_pdu_len) +{ + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + rlcmac_prim = rlcmac_prim_grr_alloc(OSMO_GPRS_RLCMAC_GRR_UNITDATA, PRIM_OP_INDICATION, ll_pdu_len); + rlcmac_prim->grr.tlli = tlli; + rlcmac_prim->grr.ll_pdu = ll_pdu; + rlcmac_prim->grr.ll_pdu_len = ll_pdu_len; + return rlcmac_prim; +} + +/* 3GPP TS 44.064 7.2.3.2 GRR-UL-UNITDATA.req (MS):*/ +struct osmo_gprs_rlcmac_prim *osmo_gprs_rlcmac_prim_alloc_grr_unitdata_req( + uint32_t tlli, uint8_t *ll_pdu, size_t ll_pdu_len) +{ + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + rlcmac_prim = rlcmac_prim_grr_alloc(OSMO_GPRS_RLCMAC_GRR_UNITDATA, PRIM_OP_REQUEST, ll_pdu_len); + rlcmac_prim->grr.tlli = tlli; + rlcmac_prim->grr.ll_pdu = ll_pdu; + rlcmac_prim->grr.ll_pdu_len = ll_pdu_len; + return rlcmac_prim; +} + +/* 3GPP TS 24.007 9.3.2.1 GMMRR-ASSIGN-REQ:*/ +struct osmo_gprs_rlcmac_prim *osmo_gprs_rlcmac_prim_alloc_gmmrr_assign_req(uint32_t new_tlli) +{ + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + rlcmac_prim = rlcmac_prim_gmmrr_alloc(OSMO_GPRS_RLCMAC_GMMRR_ASSIGN, PRIM_OP_REQUEST, 0); + rlcmac_prim->gmmrr.assign_req.new_tlli = new_tlli; + return rlcmac_prim; +} + +/* 3GPP TS 24.007 9.3.2.2 GMMRR-PAGE-IND:*/ +struct osmo_gprs_rlcmac_prim *gprs_rlcmac_prim_alloc_gmmrr_page_ind(uint32_t tlli) +{ + struct osmo_gprs_rlcmac_prim *rlcmac_prim; + rlcmac_prim = rlcmac_prim_gmmrr_alloc(OSMO_GPRS_RLCMAC_GMMRR_PAGE, PRIM_OP_INDICATION, 0); + rlcmac_prim->gmmrr.page_ind.tlli = tlli; + return rlcmac_prim; +} + +int gprs_rlcmac_prim_handle_unsupported(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + LOGRLCMAC(LOGL_ERROR, "Unsupported rlcmac_prim! %s\n", osmo_gprs_rlcmac_prim_name(rlcmac_prim)); + msgb_free(rlcmac_prim->oph.msg); + return -ENOTSUP; +} + +/******************************** + * Handling from/to upper layers: + ********************************/ + +static int rlcmac_prim_handle_grr_data_req(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc = gprs_rlcmac_prim_handle_unsupported(rlcmac_prim); + return rc; +} + +static int rlcmac_prim_handle_grr_unitdata_req(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc = gprs_rlcmac_prim_handle_unsupported(rlcmac_prim); + return rc; +} + +int gprs_rlcmac_prim_call_up_cb(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc; + if (g_ctx->rlcmac_up_cb) + rc = g_ctx->rlcmac_up_cb(rlcmac_prim, g_ctx->rlcmac_up_cb_user_data); + else + rc = rlcmac_up_cb_dummy(rlcmac_prim, g_ctx->rlcmac_up_cb_user_data); + /* Special return value '1' means: do not free */ + if (rc != 1) + msgb_free(rlcmac_prim->oph.msg); + return rc; +} + +static int gprs_rlcmac_prim_grr_upper_down(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc; + + switch (OSMO_PRIM_HDR(&rlcmac_prim->oph)) { + case OSMO_PRIM(OSMO_GPRS_RLCMAC_GRR_DATA, PRIM_OP_REQUEST): + rc = rlcmac_prim_handle_grr_data_req(rlcmac_prim); + break; + case OSMO_PRIM(OSMO_GPRS_RLCMAC_GRR_UNITDATA, PRIM_OP_REQUEST): + rc = rlcmac_prim_handle_grr_unitdata_req(rlcmac_prim); + break; + default: + rc = -ENOTSUP; + } + return rc; +} + +static int rlcmac_prim_handle_gmmrr_assign_req(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc = gprs_rlcmac_prim_handle_unsupported(rlcmac_prim); + return rc; +} + +static int gprs_rlcmac_prim_gmmrr_upper_down(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc; + + switch (OSMO_PRIM_HDR(&rlcmac_prim->oph)) { + case OSMO_PRIM(OSMO_GPRS_RLCMAC_GMMRR_ASSIGN, PRIM_OP_REQUEST): + rc = rlcmac_prim_handle_gmmrr_assign_req(rlcmac_prim); + break; + default: + rc = -ENOTSUP; + } + return rc; +} + +/* RLC/MAC higher layers (RLCMAC) push GRR/GMMRR primitive down to RLC/MAC layer: */ +int osmo_gprs_rlcmac_prim_upper_down(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc; + + LOGRLCMAC(LOGL_INFO, "Rx from upper layers: %s\n", osmo_gprs_rlcmac_prim_name(rlcmac_prim)); + + switch (rlcmac_prim->oph.sap) { + case OSMO_GPRS_RLCMAC_SAP_GRR: + rc = gprs_rlcmac_prim_grr_upper_down(rlcmac_prim); + break; + case OSMO_GPRS_RLCMAC_SAP_GMMRR: + rc = gprs_rlcmac_prim_gmmrr_upper_down(rlcmac_prim); + break; + default: + rc = gprs_rlcmac_prim_handle_unsupported(rlcmac_prim); + } + return rc; +} + +/******************************** + * Handling from/to lower layers: + ********************************/ + +int gprs_rlcmac_prim_call_down_cb(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + int rc; + if (g_ctx->rlcmac_down_cb) + rc = g_ctx->rlcmac_down_cb(rlcmac_prim, g_ctx->rlcmac_down_cb_user_data); + else + rc = rlcmac_down_cb_dummy(rlcmac_prim, g_ctx->rlcmac_down_cb_user_data); + /* Special return value '1' means: do not free */ + if (rc != 1) + msgb_free(rlcmac_prim->oph.msg); + return rc; +} + +int osmo_gprs_rlcmac_prim_lower_up(struct osmo_gprs_rlcmac_prim *rlcmac_prim) +{ + OSMO_ASSERT(g_ctx); + OSMO_ASSERT(rlcmac_prim); + struct msgb *msg = rlcmac_prim->oph.msg; + int rc; + + LOGRLCMAC(LOGL_INFO, "Rx from lower layers: %s\n", osmo_gprs_rlcmac_prim_name(rlcmac_prim)); + + switch (rlcmac_prim->oph.sap) { + // TODO + //case OSMO_GPRS_LLC_SAP_GRR: + // OSMO_ASSERT(g_ctx->location == OSMO_GPRS_LLC_LOCATION_MS); + // rc = gprs_rlcmac_prim_lower_up_grr(rlcmac_prim); + default: + rc = -EINVAL; + } + + /* Special return value '1' means: do not free */ + if (rc != 1) + msgb_free(msg); + return rc; +} diff --git a/src/rlcmac/ts_44_064.c b/src/rlcmac/ts_44_064.c new file mode 100644 index 0000000..5ad9af5 --- /dev/null +++ b/src/rlcmac/ts_44_064.c @@ -0,0 +1,35 @@ +/* GPRS RLC/MAC definitions from TS 44.064 (LLC) */ +/* + * (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 <osmocom/core/utils.h> +#include <osmocom/gprs/rlcmac/rlcmac.h> + +const struct value_string osmo_gprs_rlcmac_llc_sapi_names[] = { + { OSMO_GPRS_RLCMAC_LLC_SAPI_GMM, "GMM" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_TOM2, "TOM2" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP3, "SNDCP3" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP5, "SNDCP5" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_SMS, "SMS" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_TOM8, "TOM8" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP9, "SNDCP9" }, + { OSMO_GPRS_RLCMAC_LLC_SAPI_SNDCP11, "SNDCP11" }, + { 0, NULL } +}; -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31076 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I1870fa6a264612c5a669bfb832e6e8c0a892cb74 Gerrit-Change-Number: 31076 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: netdev: Fix compilation building with --disable-libmnl
by msuraev 25 Jan '23

25 Jan '23
Attention is currently required from: pespin. msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31071 ) Change subject: netdev: Fix compilation building with --disable-libmnl ...................................................................... Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31071 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I62bdea075afb9e0cc2bbcec6dd3a930e8f7bbc40 Gerrit-Change-Number: 31071 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Jan 2023 18:09:37 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: configure --enable-libmnl: Add libmnl to libosmocore.pc.in Requires
by msuraev 25 Jan '23

25 Jan '23
Attention is currently required from: pespin. msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31072 ) Change subject: configure --enable-libmnl: Add libmnl to libosmocore.pc.in Requires ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31072 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I8ad8418ada95e79bb6079f34c6b57817c6f6ab11 Gerrit-Change-Number: 31072 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Jan 2023 18:06:05 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmo-gprs[master]: llc: Fix spec references pointing to SNDCP instead of LLC
by msuraev 25 Jan '23

25 Jan '23
Attention is currently required from: pespin. msuraev has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/31074 ) Change subject: llc: Fix spec references pointing to SNDCP instead of LLC ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/31074 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ibe20dfcce937deb83fda2b114133173e47682cf7 Gerrit-Change-Number: 31074 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 25 Jan 2023 18:04:57 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: gprs_ns2_fr: use osmo_netdev to monitor and operate network device
by daniel 25 Jan '23

25 Jan '23
Attention is currently required from: laforge, pespin, lynxis lazus. daniel has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31069 ) Change subject: gprs_ns2_fr: use osmo_netdev to monitor and operate network device ...................................................................... Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31069 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ib0e499e09c50135a5c4a361332d6120f660a1a45 Gerrit-Change-Number: 31069 Gerrit-PatchSet: 5 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Wed, 25 Jan 2023 17:19:31 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • ...
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.