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 2024

  • 1 participants
  • 1559 discussions
[M] Change in osmo-gsm-manuals[master]: gsup: Convert PDP-Type IE to PDP-Address IE
by pespin 19 Jan '24

19 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/35628?usp=email ) Change subject: gsup: Convert PDP-Type IE to PDP-Address IE ...................................................................... gsup: Convert PDP-Type IE to PDP-Address IE The previous PDP-Type IE should have been a PDP-Address from the start, since having only PDP-Type with no address is only a specific case (dynamic addressing). This becomes clear by looking at other similar protocols like: * MAP: APN-Configuration IE has servedPartyIP-IP{v4,v6}-Address IEs * Diameter S6b, 3GPP TS 29.272 7.3.35 APN-Configuration contains Served-Party-IP-Address AVPs * Diameter SWx, 3GPP TS 29.273 APN-Configuration. * GTPv1C Ts 29.060 7.7.29 PDP Context containing PDP Address. Since PDP-Type on its own really makes no sense, being it a special case of PDP-Address, let's keep the IE by renaming it (keeping old name too for API backward compat) and extend it to support lengths > 2 bytes. Old implementation of libosmogsm gsup actually ignored lengths > 2 bytes, so we are safe acting against older implementations here, both on the sending and receiving side on the wire. While at it, fix the packetdiag representation, which was already wrong before: * Length is 1 byte, not 2 (this happened probably due to confusion between TS 29.060 EUA and TS 24.008 PDP address, the former TLV being 2 bytes like all of GTP, and TS 24.008 being 1 byte). * The bytes sharing several fields were swapped. Change-Id: Ifb4e44b23d19ea049f03a3602c39f2471ff1bff4 Related: OS#6091 Related: libosmocore.git Change-Id I775ff9c3be165d9f30d6ab55d03f99b6104eadd6 --- M common/chapters/gsup.adoc 1 file changed, 56 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/28/35628/1 diff --git a/common/chapters/gsup.adoc b/common/chapters/gsup.adoc index d9a87ca..eeada52 100644 --- a/common/chapters/gsup.adoc +++ b/common/chapters/gsup.adoc @@ -1105,7 +1105,7 @@ | |PDP Info IEI|<<gsup-iei>>|M|V|1 | |Length of PDP Info IE||M|V|1 |10|PDP Context ID|<<gsup-ie-pdpctxid>>|C|TLV|3 -|11|PDP Type|<<gsup-ie-pdptype>>|C|TLV|4 +|11|PDP Address|<<gsup-ie-pdpaddress>>|C|TLV|4-24 |12|Access Point Name|<<gsup-ie-apn>>|C|TLV|3-102 |13|Quality of Service|<<gsup-ie-qos>>|O|TLV|1-20 |14|PDP-Charging Characteristics|<<gsup-ie-charging>>|O|TLV|4 @@ -1113,11 +1113,14 @@ The conditional IE are mandantory unless mentioned otherwise. -[[gsup-ie-pdptype]] -==== PDP Type +[[gsup-ie-pdpaddress]] +==== PDP Address -The PDP type value consists of 2 octets that are encoded like octet 4-5 of the -End User Address (EUA) defined in 3GPP TS 29.060, 7.7.27. +The value part is encoded like in the Packet data protocol address IE defined +in 3GPP TS 24.008, Chapter 10.5.6.4. +Hence this value also relates to End User Address (EUA) IE defined in 3GPP TS +29.060, 7.7.27. +The PDP type organization value must be set to 'IETF allocated address'. [packetdiag] ---- @@ -1127,21 +1130,24 @@ 0-6: PDP type IEI 7: Res - 8-15: Length (2) - 16-19: Spare - 20-23: PDP type org + 8-15: Length + 16-19: PDP type org + 20-23: Spare 24-31: PDP type number + 32-191: Address (v4|v6|v4+v6) } ---- -The spare bits are left undefined. While 29.060 defines them as '1 1 1 1', there -are MAP traces where these bits are set to '0 0 0 0'. So the receiver shall -ignore these bits. +The spare bits are left undefined. While 3GPP TS 29.060 7.7.27 defines them as +'1 1 1 1', there are MAP traces where these bits are set to '0 0 0 0'. So the +receiver shall ignore these bits. Examples: -* IPv4: PDP type org: 1 (IETF), PDP type number: 0x21 -* IPv6: PDP type org: 1 (IETF), PDP type number: 0x57 +* IPv4: PDP type org: 1 (IETF), PDP type number: 0x21, 0 bytes address (dynamic addressing) +* IPv4: PDP type org: 1 (IETF), PDP type number: 0x21, 4 bytes address +* IPv6: PDP type org: 1 (IETF), PDP type number: 0x57, 16 bytes address +* IPv6: PDP type org: 1 (IETF), PDP type number: 0x8D, 20 bytes address (v4+v6) [[gsup-ie-pdpctxid]] ==== PDP Context ID @@ -1296,7 +1302,7 @@ |0x09|HLR Number|<<gsup-ie-hlr>> |0x0a|Message Class| <<gsup-ie-message-class>> |0x10|PDP Context ID|<<gsup-ie-pdpctxid>> -|0x11|PDP Type|<<gsup-ie-pdptype>> +|0x11|PDP Address|<<gsup-ie-pdptaddress>> |0x12|Access Point Name|<<gsup-ie-apn>> |0x13|QoS|<<gsup-ie-qos>> |0x14|PDP-Charging Characteristics|<<gsup-ie-charging>> -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/35628?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-manuals Gerrit-Branch: master Gerrit-Change-Id: Ifb4e44b23d19ea049f03a3602c39f2471ff1bff4 Gerrit-Change-Number: 35628 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-e1d[master]: Add option to automatically reset RIFO on underrun/overflow
by pespin 19 Jan '24

19 Jan '24
Attention is currently required from: jolly, laforge, manawyrm, tnt. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/34554?usp=email ) Change subject: Add option to automatically reset RIFO on underrun/overflow ...................................................................... Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/34554?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Id7ccbfbdb288990c01f185dec79a1022a68b4748 Gerrit-Change-Number: 34554 Gerrit-PatchSet: 5 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: manawyrm <osmocom.account(a)tbspace.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: manawyrm <osmocom.account(a)tbspace.de> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: tnt <tnt(a)246tNt.com> Gerrit-Comment-Date: Fri, 19 Jan 2024 18:14:04 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in libosmocore[master]: gsup: Deprecate field pdp_type in favour of pdp_type_nr and pdp_type_org
by pespin 19 Jan '24

19 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35626?usp=email ) Change subject: gsup: Deprecate field pdp_type in favour of pdp_type_nr and pdp_type_org ...................................................................... gsup: Deprecate field pdp_type in favour of pdp_type_nr and pdp_type_org Having both fields in an uin16_t integer makes it difficult and confusing for users for no good reason. Let's have separate fields for each of them. The new fields are defined so that they are ABI compatible with previous uin16 field. Change-Id: Ie31c6080c90e468c01186259f2c42621e39b5cc6 --- M TODO-RELEASE M include/osmocom/gsm/gsup.h M src/gsm/gsup.c 3 files changed, 41 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/35626/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index e1d365e..3a0c80c 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -16,3 +16,4 @@ isdn ADD initial implementation of the V.110 Terminal Adapter gsm ABI change add T200 timer states to lapdm_datalink gsm ABI change add UI queue to struct lapdm_datalink +gsm ADD gsup.h: struct osmo_gsup_pdp_info fields pdp_type_nr, pdp_type_org, deprecate pdp_type. diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index 6c23297..49d1264 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -40,6 +40,8 @@ #include <stdint.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/defs.h> +#include <osmocom/core/endian.h> #include <osmocom/gsm/gsup_sms.h> #include <osmocom/gsm/protocol/gsm_23_003.h> #include <osmocom/gsm/protocol/gsm_03_40.h> @@ -260,8 +262,19 @@ struct osmo_gsup_pdp_info { unsigned int context_id; int have_info; - /*! Type of PDP context */ - uint16_t pdp_type; + /*! Type of PDP context, 3GPP TS 29.060, 7.7.27 */ + union { + uint16_t pdp_type OSMO_DEPRECATED("use pdp_type_org and pdp_type_nr instead"); + struct { +#if OSMO_IS_LITTLE_ENDIAN + uint8_t pdp_type_nr; /* enum gsm48_pdp_type_nr */ + uint8_t pdp_type_org; /* enum gsm48_pdp_type_org */ +#elif OSMO_IS_BIG_ENDIAN + uint8_t pdp_type_org; /* enum gsm48_pdp_type_org */ + uint8_t pdp_type_nr; /* enum gsm48_pdp_type_nr */ +#endif + }; + }; /*! APN information, still in encoded form. Can be NULL if no * APN information included */ const uint8_t *apn_enc; diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index 2beff4a..00a9a60 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -152,8 +152,8 @@ case OSMO_GSUP_PDP_TYPE_IE: if (value_len < 2) return -GMM_CAUSE_PROTO_ERR_UNSPEC; - pdp_info->pdp_type = - osmo_decode_big_endian(value, value_len) & 0x0fff; + pdp_info->pdp_type_org = value[0] & 0x0f; + pdp_info->pdp_type_nr = value[1]; break; case OSMO_GSUP_ACCESS_POINT_NAME_IE: @@ -603,11 +603,15 @@ u8 = pdp_info->context_id; msgb_tlv_put(msg, OSMO_GSUP_PDP_CONTEXT_ID_IE, sizeof(u8), &u8); - if (pdp_info->pdp_type) { + if (pdp_info->pdp_type_org == PDP_TYPE_ORG_IETF) { + struct gsm48_pdp_address pdp_addr; + pdp_addr.spare = 0x0f; + pdp_addr.organization = pdp_info->pdp_type_org; + pdp_addr.type = pdp_info->pdp_type_nr; + msgb_tlv_put(msg, OSMO_GSUP_PDP_TYPE_IE, OSMO_GSUP_PDP_TYPE_SIZE, - osmo_encode_big_endian(pdp_info->pdp_type | 0xf000, - OSMO_GSUP_PDP_TYPE_SIZE)); + (const uint8_t *)&pdp_addr); } if (pdp_info->apn_enc) { -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35626?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ie31c6080c90e468c01186259f2c42621e39b5cc6 Gerrit-Change-Number: 35626 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: gsm_04_08_gprs.h: Introduce packed struct gsm48_pdp_address
by pespin 19 Jan '24

19 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35625?usp=email ) Change subject: gsm_04_08_gprs.h: Introduce packed struct gsm48_pdp_address ...................................................................... gsm_04_08_gprs.h: Introduce packed struct gsm48_pdp_address This can be used in several protocols, such as GTP, GSUP, etc. Related: OS#6091 Change-Id: I453ced42dd36df3a6ddb5db67093df5a22cad18c --- M include/osmocom/gsm/protocol/gsm_04_08_gprs.h 1 file changed, 47 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/35625/1 diff --git a/include/osmocom/gsm/protocol/gsm_04_08_gprs.h b/include/osmocom/gsm/protocol/gsm_04_08_gprs.h index 8799d65..9452b27 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08_gprs.h +++ b/include/osmocom/gsm/protocol/gsm_04_08_gprs.h @@ -294,10 +294,11 @@ PDP_S_MODIFY_PENDING, }; -/* Table 10.5.155/3GPP TS 24.008 */ +/* TS 24.008 Table 10.5.155/3GPP */ enum gsm48_pdp_type_org { PDP_TYPE_ORG_ETSI = 0x00, PDP_TYPE_ORG_IETF = 0x01, + PDP_TYPE_ORG_EMPTY = 0x0f, }; enum gsm48_pdp_type_nr { PDP_TYPE_N_ETSI_RESERVED = 0x00, @@ -306,6 +307,39 @@ PDP_TYPE_N_IETF_IPv6 = 0x57, PDP_TYPE_N_IETF_IPv4v6 = 0x8D, }; +/* TS 24.008 10.5.6.4 "Packet data protocol address" value + * Note: This can be reused for 3GPP TS 29.060 7.7.27 "End User Address" + * with minor changes in the values, like spare being 1111 instead. +*/ +struct gsm48_pdp_address { +#if OSMO_IS_LITTLE_ENDIAN +uint8_t organization:4, /* enum gsm48_pdp_type_org */ + spare:4; /* 0000 */ +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ +uint8_t spare:4, organization:4; +#endif +uint8_t type; /* enum gsm48_pdp_type_nr */ + union { + /* PDP_TYPE_ORG_ETSI */ + union { + } etsi; + /* PDP_TYPE_ORG_IETF */ + union { + /* PDP_TYPE_N_IETF_IPv4 */ + uint32_t v4; + + /* PDP_TYPE_N_IETF_IPv6 */ + uint8_t v6[16]; + + /* PDP_TYPE_N_IETF_IPv4v6 */ + struct { + uint32_t v4; + uint8_t v6[16]; + } __attribute__ ((packed)) v4v6; + } ietf; + }; +} __attribute__ ((packed)); /* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */ enum gsm48_qos_reliab_class { -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35625?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I453ced42dd36df3a6ddb5db67093df5a22cad18c Gerrit-Change-Number: 35625 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmocore[master]: gsup: Fail decoding if len of PDP Type IE is less than 2 bytes
by pespin 19 Jan '24

19 Jan '24
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/35624?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: gsup: Fail decoding if len of PDP Type IE is less than 2 bytes ...................................................................... gsup: Fail decoding if len of PDP Type IE is less than 2 bytes As documented in gsup.adoc, this field is expected to be 2 bytes. This is only a intermediate step to showcase the related test scenarios submitting IE with len > 2. The logic will be changed in a follow-up patch when changing the IE to also encode/decode the missing Address part. Change-Id: I0d024a9a4fb10beeff39ac33a9d2ed02f88f4580 --- M src/gsm/gsup.c M tests/gsup/gsup_test.err 2 files changed, 19 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/35624/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35624?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0d024a9a4fb10beeff39ac33a9d2ed02f88f4580 Gerrit-Change-Number: 35624 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in libosmocore[master]: gsup: Convert PDP-Type IE to PDP-Address IE
by pespin 19 Jan '24

19 Jan '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35627?usp=email ) Change subject: gsup: Convert PDP-Type IE to PDP-Address IE ...................................................................... gsup: Convert PDP-Type IE to PDP-Address IE The previous PDP-Type IE should have been a PDP-Address from the start, since having only PDP-Type with no address is only a specific case (dynamic addressing). This becomes clear by looking at other similar protocols like: * MAP: APN-Configuration IE has servedPartyIP-IP{v4,v6}-Address IEs * Diameter S6b, 3GPP TS 29.272 7.3.35 APN-Configuration contains Served-Party-IP-Address AVPs * Diameter SWx, 3GPP TS 29.273 APN-Configuration. * GTPv1C Ts 29.060 7.7.29 PDP Context containing PDP Address. Since PDP-Type on its own really makes no sense, being it a special case of PDP-Address, let's keep the IE by renaming it (keeping old name too for API backward compat) and extend it to support lengths > 2 bytes. Old implementation of libosmogsm gsup actually ignored lengths > 2 bytes, so we are safe acting against older implementations here, both on the sending and receiving side on the wire. The big drawback of this commit is that it breaks ABI compatibility due to adding "struct osmo_sockaddr pdp_address[2];" to struct osmo_gsup_pdp_info, which in turn affects shift of fields in struct osmo_gsup_message. Unfortunately, there's not much that can be done to improve the situation when adding the missing field, due to existing API having the same struct for all messages. Ideally we'd have 1 union with structs per message type inside, this way the ABI break would be far less pronounced. The GSUP test output change is becaue we now accept some of the len>2 cases for PDP-Type/Address IE which were being rejected since a couple commits ago. Related: OS#6091 Change-Id: I775ff9c3be165d9f30d6ab55d03f99b6104eadd6 --- M TODO-RELEASE M include/osmocom/gsm/gsup.h M src/gsm/gsup.c M tests/gsup/gsup_test.err 4 files changed, 139 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/35627/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 3a0c80c..a8e812b 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -17,3 +17,4 @@ gsm ABI change add T200 timer states to lapdm_datalink gsm ABI change add UI queue to struct lapdm_datalink gsm ADD gsup.h: struct osmo_gsup_pdp_info fields pdp_type_nr, pdp_type_org, deprecate pdp_type. +gsm ABI change gsup.h: Add field pdp_address in struct osmo_gsup_pdp_info shifts the struct, and in turn fields in struct osmo_gsup_message. diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h index 49d1264..eabfb0e 100644 --- a/include/osmocom/gsm/gsup.h +++ b/include/osmocom/gsm/gsup.h @@ -42,6 +42,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/defs.h> #include <osmocom/core/endian.h> +#include <osmocom/core/socket.h> #include <osmocom/gsm/gsup_sms.h> #include <osmocom/gsm/protocol/gsm_23_003.h> #include <osmocom/gsm/protocol/gsm_03_40.h> @@ -60,8 +61,6 @@ #define OSMO_GSUP_MAX_MSISDN_LEN 9 #define OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN 43 /* TS 24.008 10.5.4.7 */ -#define OSMO_GSUP_PDP_TYPE_SIZE 2 - /*! Information Element Identifiers for GSUP IEs */ enum osmo_gsup_iei { OSMO_GSUP_IMSI_IE = 0x01, @@ -75,7 +74,8 @@ OSMO_GSUP_HLR_NUMBER_IE = 0x09, OSMO_GSUP_MESSAGE_CLASS_IE = 0x0a, OSMO_GSUP_PDP_CONTEXT_ID_IE = 0x10, - OSMO_GSUP_PDP_TYPE_IE = 0x11, + OSMO_GSUP_PDP_ADDRESS_IE = 0x11, +#define OSMO_GSUP_PDP_TYPE_IE OSMO_GSUP_PDP_ADDRESS_IE /* Backward compat */ OSMO_GSUP_ACCESS_POINT_NAME_IE = 0x12, OSMO_GSUP_PDP_QOS_IE = 0x13, OSMO_GSUP_CHARG_CHAR_IE = 0x14, @@ -275,6 +275,7 @@ #endif }; }; + struct osmo_sockaddr pdp_address[2]; /*! APN information, still in encoded form. Can be NULL if no * APN information included */ const uint8_t *apn_enc; diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index 00a9a60..3daf75c 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -126,6 +126,62 @@ return OSMO_GSUP_TO_MSGT_ERROR(type_in); } +static int decode_pdp_address(const uint8_t *data, size_t data_len, struct osmo_gsup_pdp_info *pdp_info) +{ + const struct gsm48_pdp_address *pdp_addr = (const struct gsm48_pdp_address *)data; + /* Explicitly pre-nitialize them to AF_UNSPEC to signal they are empty: */ + pdp_info->pdp_address[0].u.sa.sa_family = AF_UNSPEC; + pdp_info->pdp_address[1].u.sa.sa_family = AF_UNSPEC; + + if (data_len < 2) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + pdp_info->pdp_type_org = pdp_addr->organization; + pdp_info->pdp_type_nr = pdp_addr->type; + + if (pdp_info->pdp_type_org != PDP_TYPE_ORG_IETF) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + + /* Skip type-org + type-nr for easy calculations below: */ + data_len -= 2; + + switch (pdp_info->pdp_type_nr) { + case PDP_TYPE_N_IETF_IPv4: + if (data_len == 0) + return 0; /* empty, marked as AF_UNSET. */ + if (data_len != sizeof(pdp_addr->ietf.v4)) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + pdp_info->pdp_address[0].u.sa.sa_family = AF_INET; + pdp_info->pdp_address[0].u.sin.sin_addr.s_addr = pdp_addr->ietf.v4; + return 0; + case PDP_TYPE_N_IETF_IPv6: + if (data_len == 0) + return 0; /* empty, marked as AF_UNSET. */ + if (data_len != sizeof(pdp_addr->ietf.v6)) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + pdp_info->pdp_address[0].u.sa.sa_family = AF_INET6; + memcpy(&pdp_info->pdp_address[0].u.sin6.sin6_addr, + pdp_addr->ietf.v6, + sizeof(pdp_addr->ietf.v6)); + return 0; + case PDP_TYPE_N_IETF_IPv4v6: + if (data_len == 0) + return 0; /* empty, marked as AF_UNSET. */ + if (data_len != sizeof(pdp_addr->ietf.v4v6)) + return -GMM_CAUSE_PROTO_ERR_UNSPEC; + pdp_info->pdp_address[0].u.sa.sa_family = AF_INET; + pdp_info->pdp_address[0].u.sin.sin_addr.s_addr = pdp_addr->ietf.v4v6.v4; + pdp_info->pdp_address[1].u.sa.sa_family = AF_INET6; + memcpy(&pdp_info->pdp_address[1].u.sin6.sin6_addr, + pdp_addr->ietf.v4v6.v6, + sizeof(pdp_addr->ietf.v4v6.v6)); + return 0; + default: + /* reserved, both pdp_info->pdp_address are preinitialied to AF_UNSET. */ + return 0; + } +} + static int decode_pdp_info(uint8_t *data, size_t data_len, struct osmo_gsup_pdp_info *pdp_info) { @@ -149,11 +205,9 @@ pdp_info->context_id = osmo_decode_big_endian(value, value_len); break; - case OSMO_GSUP_PDP_TYPE_IE: - if (value_len < 2) - return -GMM_CAUSE_PROTO_ERR_UNSPEC; - pdp_info->pdp_type_org = value[0] & 0x0f; - pdp_info->pdp_type_nr = value[1]; + case OSMO_GSUP_PDP_ADDRESS_IE: + if ((rc = decode_pdp_address(value, value_len, pdp_info)) < 0) + return rc; break; case OSMO_GSUP_ACCESS_POINT_NAME_IE: @@ -359,7 +413,7 @@ switch (iei) { case OSMO_GSUP_IMSI_IE: - case OSMO_GSUP_PDP_TYPE_IE: + case OSMO_GSUP_PDP_ADDRESS_IE: case OSMO_GSUP_ACCESS_POINT_NAME_IE: case OSMO_GSUP_SRES_IE: case OSMO_GSUP_KC_IE: @@ -605,12 +659,42 @@ if (pdp_info->pdp_type_org == PDP_TYPE_ORG_IETF) { struct gsm48_pdp_address pdp_addr; + uint8_t pdp_addr_len = 2; pdp_addr.spare = 0x0f; pdp_addr.organization = pdp_info->pdp_type_org; pdp_addr.type = pdp_info->pdp_type_nr; - msgb_tlv_put(msg, OSMO_GSUP_PDP_TYPE_IE, - OSMO_GSUP_PDP_TYPE_SIZE, + switch (pdp_info->pdp_type_nr) { + case PDP_TYPE_N_IETF_IPv4: + if (pdp_info->pdp_address[0].u.sa.sa_family == AF_INET) { + pdp_addr.ietf.v4 = pdp_info->pdp_address[0].u.sin.sin_addr.s_addr; + pdp_addr_len += sizeof(pdp_addr.ietf.v4); + } + break; + case PDP_TYPE_N_IETF_IPv6: + if (pdp_info->pdp_address[0].u.sa.sa_family == AF_INET6) { + memcpy(pdp_addr.ietf.v6, + &pdp_info->pdp_address[0].u.sin6.sin6_addr, + sizeof(pdp_addr.ietf.v6)); + pdp_addr_len += sizeof(pdp_addr.ietf.v6); + } + break; + case PDP_TYPE_N_IETF_IPv4v6: + if (pdp_info->pdp_address[0].u.sa.sa_family == AF_INET) { + pdp_addr.ietf.v4v6.v4 = pdp_info->pdp_address[0].u.sin.sin_addr.s_addr; + pdp_addr_len += sizeof(pdp_addr.ietf.v4v6.v4); + } + if (pdp_info->pdp_address[0].u.sa.sa_family == AF_INET6) { + memcpy(pdp_addr.ietf.v4v6.v6, + &pdp_info->pdp_address[1].u.sin6.sin6_addr, + sizeof(pdp_addr.ietf.v4v6.v6)); + pdp_addr_len += sizeof(pdp_addr.ietf.v4v6.v6); + } + break; + } + + msgb_tlv_put(msg, OSMO_GSUP_PDP_ADDRESS_IE, + pdp_addr_len, (const uint8_t *)&pdp_addr); } diff --git a/tests/gsup/gsup_test.err b/tests/gsup/gsup_test.err index fc3c86e..73a0776 100644 --- a/tests/gsup/gsup_test.err +++ b/tests/gsup/gsup_test.err @@ -164,7 +164,7 @@ message 2: tested 21248 modifications, 2577 parse failures message 3: tested 2816 modifications, 510 parse failures message 4: tested 3584 modifications, 770 parse failures - message 5: tested 20736 modifications, 4028 parse failures + message 5: tested 20736 modifications, 4517 parse failures message 6: tested 3584 modifications, 771 parse failures message 7: tested 3584 modifications, 770 parse failures message 8: tested 2816 modifications, 510 parse failures -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35627?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I775ff9c3be165d9f30d6ab55d03f99b6104eadd6 Gerrit-Change-Number: 35627 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-e1d[master]: Add option to automatically reset RIFO on underrun/overflow
by jolly 19 Jan '24

19 Jan '24
Attention is currently required from: laforge, manawyrm, pespin, tnt. jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/34554?usp=email ) Change subject: Add option to automatically reset RIFO on underrun/overflow ...................................................................... Patch Set 5: (3 comments) File src/octoi/e1oip.c: https://gerrit.osmocom.org/c/osmo-e1d/+/34554/comment/0535f333_57d548f7 PS4, Line 278: int32_t d = fn32+i - iline->e1t.rifo.next_out_fn; > missing space between "fn32+i". […] fixed the missing space the wraparound is intended here (fn32 and netx_out_fn) are both 32 bits unsigned. the result is always the positive delay. https://gerrit.osmocom.org/c/osmo-e1d/+/34554/comment/5f2d8b2d_c7a5a45a PS4, Line 279: iline->e1t.delay += d; > do you account for overflow/wrapround here? the sum of delays (40000 measurements * maximum delay) is far below the range of 32 bits. File src/octoi/frame_rifo.c: https://gerrit.osmocom.org/c/osmo-e1d/+/34554/comment/aec8c2e8_9de892ad PS4, Line 111: { > wrong place for "{" char. This is not part of my patch (see latest patchset). -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/34554?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Id7ccbfbdb288990c01f185dec79a1022a68b4748 Gerrit-Change-Number: 34554 Gerrit-PatchSet: 5 Gerrit-Owner: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: manawyrm <osmocom.account(a)tbspace.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: manawyrm <osmocom.account(a)tbspace.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: tnt <tnt(a)246tNt.com> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 19 Jan 2024 17:30:01 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: mobile: rename tch_send_voice_{msg,frame}() functions
by fixeria 19 Jan '24

19 Jan '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35580?usp=email ) Change subject: mobile: rename tch_send_voice_{msg,frame}() functions ...................................................................... mobile: rename tch_send_voice_{msg,frame}() functions These functions can also be used for sending data frames (CSD). Change-Id: Ib55b4405847f2efb583f3a379ff4b6929d6d6c5b Related: OS#4396 --- M src/host/layer23/include/osmocom/bb/mobile/tch.h M src/host/layer23/src/mobile/gapk_io.c M src/host/layer23/src/mobile/gsm48_cc.c M src/host/layer23/src/mobile/tch.c 4 files changed, 21 insertions(+), 9 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/mobile/tch.h b/src/host/layer23/include/osmocom/bb/mobile/tch.h index e796ddb..b99b834 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/tch.h +++ b/src/host/layer23/include/osmocom/bb/mobile/tch.h @@ -19,5 +19,5 @@ int tch_init(struct osmocom_ms *ms); int tch_serve_ms(struct osmocom_ms *ms); -int tch_send_voice_msg(struct osmocom_ms *ms, struct msgb *msg); -int tch_send_voice_frame(struct osmocom_ms *ms, const struct gsm_data_frame *frame); +int tch_send_msg(struct osmocom_ms *ms, struct msgb *msg); +int tch_send_mncc_frame(struct osmocom_ms *ms, const struct gsm_data_frame *frame); diff --git a/src/host/layer23/src/mobile/gapk_io.c b/src/host/layer23/src/mobile/gapk_io.c index 3dab46d..4699bae 100644 --- a/src/host/layer23/src/mobile/gapk_io.c +++ b/src/host/layer23/src/mobile/gapk_io.c @@ -550,7 +550,7 @@ &state->tch_ul_fb_len); /* Push a voice frame to the lower layers */ - tch_send_voice_msg(ms, tch_msg); + tch_send_msg(ms, tch_msg); work |= 1; } diff --git a/src/host/layer23/src/mobile/gsm48_cc.c b/src/host/layer23/src/mobile/gsm48_cc.c index c253cb6..94b81cb 100644 --- a/src/host/layer23/src/mobile/gsm48_cc.c +++ b/src/host/layer23/src/mobile/gsm48_cc.c @@ -2045,7 +2045,7 @@ case GSM_TCHH_FRAME: case GSM_TCH_FRAME_AMR: case GSM_BAD_FRAME: - return tch_send_voice_frame(ms, arg); + return tch_send_mncc_frame(ms, arg); case MNCC_LCHAN_MODIFY: return 0; case MNCC_FRAME_RECV: diff --git a/src/host/layer23/src/mobile/tch.c b/src/host/layer23/src/mobile/tch.c index 0b9142e..adeaad5 100644 --- a/src/host/layer23/src/mobile/tch.c +++ b/src/host/layer23/src/mobile/tch.c @@ -86,7 +86,7 @@ /* Remove the DL info header */ msgb_pull_to_l2(msg); /* Send voice frame back */ - return tch_send_voice_msg(ms, msg); + return tch_send_msg(ms, msg); case TCH_VOICE_IOH_MNCC_SOCK: return tch_forward_mncc(ms, msg); case TCH_VOICE_IOH_GAPK: @@ -127,14 +127,14 @@ } /* Send an Uplink voice frame to the lower layers */ -int tch_send_voice_msg(struct osmocom_ms *ms, struct msgb *msg) +int tch_send_msg(struct osmocom_ms *ms, struct msgb *msg) { /* Forward to RR */ return gsm48_rr_tx_traffic(ms, msg); } -/* tch_send_voice_msg() wrapper accepting an MNCC structure */ -int tch_send_voice_frame(struct osmocom_ms *ms, const struct gsm_data_frame *frame) +/* tch_send_msg() wrapper accepting an MNCC structure */ +int tch_send_mncc_frame(struct osmocom_ms *ms, const struct gsm_data_frame *frame) { struct msgb *nmsg; int len; @@ -163,7 +163,7 @@ nmsg->l2h = msgb_put(nmsg, len); memcpy(nmsg->l2h, frame->data, len); - return tch_send_voice_msg(ms, nmsg); + return tch_send_msg(ms, nmsg); } int tch_serve_ms(struct osmocom_ms *ms) -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35580?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ib55b4405847f2efb583f3a379ff4b6929d6d6c5b Gerrit-Change-Number: 35580 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in osmocom-bb[master]: mobile: init/deinit GAPK I/O based on CC transaction events
by fixeria 19 Jan '24

19 Jan '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35579?usp=email ) Change subject: mobile: init/deinit GAPK I/O based on CC transaction events ...................................................................... mobile: init/deinit GAPK I/O based on CC transaction events Change-Id: I28f87f6a6de673611aa02a24e8985aee23d4498b Related: OS#4396 --- M src/host/layer23/include/osmocom/bb/common/ms.h M src/host/layer23/include/osmocom/bb/mobile/gapk_io.h M src/host/layer23/include/osmocom/bb/mobile/tch.h M src/host/layer23/src/mobile/app_mobile.c M src/host/layer23/src/mobile/gapk_io.c M src/host/layer23/src/mobile/gsm48_rr.c M src/host/layer23/src/mobile/tch.c 7 files changed, 265 insertions(+), 122 deletions(-) Approvals: fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve diff --git a/src/host/layer23/include/osmocom/bb/common/ms.h b/src/host/layer23/include/osmocom/bb/common/ms.h index f08e977..0b3e13c 100644 --- a/src/host/layer23/include/osmocom/bb/common/ms.h +++ b/src/host/layer23/include/osmocom/bb/common/ms.h @@ -103,8 +103,7 @@ struct osmobb_ms_gmm_layer gmmlayer; struct osmo_fsm_inst *grr_fi; - /* Audio I/O */ - struct gapk_io_state *gapk_io; + struct tch_state *tch_state; void *lua_state; int lua_cb_ref; diff --git a/src/host/layer23/include/osmocom/bb/mobile/gapk_io.h b/src/host/layer23/include/osmocom/bb/mobile/gapk_io.h index 3a02e64..b9f1bc5 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/gapk_io.h +++ b/src/host/layer23/include/osmocom/bb/mobile/gapk_io.h @@ -3,6 +3,7 @@ #ifdef WITH_GAPK_IO #include <stdint.h> +#include <stdbool.h> #include <osmocom/gapk/procqueue.h> #include <osmocom/gapk/codecs.h> @@ -31,13 +32,16 @@ unsigned int tch_ul_fb_len; }; -void gapk_io_init(void); - -int gapk_io_init_ms(struct osmocom_ms *ms, enum osmo_gapk_codec_type codec); -int gapk_io_init_ms_chan(struct osmocom_ms *ms, uint8_t ch_type, uint8_t ch_mode); -int gapk_io_clean_up_ms(struct osmocom_ms *ms); +struct gapk_io_state * +gapk_io_state_alloc(struct osmocom_ms *ms, + enum osmo_gapk_codec_type codec); +struct gapk_io_state * +gapk_io_state_alloc_mode_rate(struct osmocom_ms *ms, + enum gsm48_chan_mode ch_mode, + bool full_rate); +void gapk_io_state_free(struct gapk_io_state *state); void gapk_io_enqueue_dl(struct gapk_io_state *state, struct msgb *msg); -int gapk_io_serve_ms(struct osmocom_ms *ms); +int gapk_io_serve_ms(struct osmocom_ms *ms, struct gapk_io_state *state); #endif /* WITH_GAPK_IO */ diff --git a/src/host/layer23/include/osmocom/bb/mobile/tch.h b/src/host/layer23/include/osmocom/bb/mobile/tch.h index 0e81769..e796ddb 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/tch.h +++ b/src/host/layer23/include/osmocom/bb/mobile/tch.h @@ -4,6 +4,20 @@ struct gsm_data_frame; struct msgb; +struct tch_state { + bool is_voice; /* voice (true) or data (false) */ + union { + struct tch_voice_state { + enum tch_voice_io_handler handler; + struct gapk_io_state *gapk_io; + } voice; + struct tch_data_state { + enum tch_data_io_handler handler; + } data; + }; +}; + int tch_init(struct osmocom_ms *ms); +int tch_serve_ms(struct osmocom_ms *ms); int tch_send_voice_msg(struct osmocom_ms *ms, struct msgb *msg); int tch_send_voice_frame(struct osmocom_ms *ms, const struct gsm_data_frame *frame); diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c index e2ef56a..453990e 100644 --- a/src/host/layer23/src/mobile/app_mobile.c +++ b/src/host/layer23/src/mobile/app_mobile.c @@ -42,7 +42,6 @@ #include <osmocom/bb/mobile/app_mobile.h> #include <osmocom/bb/mobile/mncc.h> #include <osmocom/bb/mobile/tch.h> -#include <osmocom/bb/mobile/gapk_io.h> #include <osmocom/bb/mobile/primitives.h> #include <osmocom/vty/vty.h> @@ -82,10 +81,7 @@ w |= gsm322_cs_dequeue(ms); w |= gsm_sim_job_dequeue(ms); w |= mncc_dequeue(ms); -#ifdef WITH_GAPK_IO - if (ms->gapk_io != NULL) - w |= gapk_io_serve_ms(ms); -#endif + w |= tch_serve_ms(ms); if (w) work = 1; } while (w); @@ -200,12 +196,6 @@ return -EBUSY; } -#ifdef WITH_GAPK_IO - /* Clean up GAPK state, if preset */ - if (ms->gapk_io != NULL) - gapk_io_clean_up_ms(ms); -#endif - gsm322_exit(ms); gsm48_mm_exit(ms); gsm48_rr_exit(ms); @@ -494,11 +484,6 @@ 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); diff --git a/src/host/layer23/src/mobile/gapk_io.c b/src/host/layer23/src/mobile/gapk_io.c index 9a97639..3dab46d 100644 --- a/src/host/layer23/src/mobile/gapk_io.c +++ b/src/host/layer23/src/mobile/gapk_io.c @@ -316,29 +316,26 @@ * processing queues (chains), and deallocates the memory. * Should be called when a voice call is finished... */ -int gapk_io_clean_up_ms(struct osmocom_ms *ms) +void gapk_io_state_free(struct gapk_io_state *state) { struct msgb *msg; - if (ms->gapk_io == NULL) - return 0; + if (state == NULL) + return; /* Flush TCH frame I/O buffers */ - while ((msg = msgb_dequeue(&ms->gapk_io->tch_dl_fb))) + while ((msg = msgb_dequeue(&state->tch_dl_fb))) msgb_free(msg); - while ((msg = msgb_dequeue(&ms->gapk_io->tch_ul_fb))) + while ((msg = msgb_dequeue(&state->tch_ul_fb))) msgb_free(msg); /* Destroy both audio I/O chains */ - if (ms->gapk_io->pq_source) - osmo_gapk_pq_destroy(ms->gapk_io->pq_source); - if (ms->gapk_io->pq_sink) - osmo_gapk_pq_destroy(ms->gapk_io->pq_sink); + if (state->pq_source != NULL) + osmo_gapk_pq_destroy(state->pq_source); + if (state->pq_sink != NULL) + osmo_gapk_pq_destroy(state->pq_sink); - talloc_free(ms->gapk_io); - ms->gapk_io = NULL; - - return 0; + talloc_free(state); } /** @@ -386,31 +383,31 @@ * and prepares both processing queues (chains). * Should be called when a voice call is initiated... */ -int gapk_io_init_ms(struct osmocom_ms *ms, enum osmo_gapk_codec_type codec) +struct gapk_io_state * +gapk_io_state_alloc(struct osmocom_ms *ms, + enum osmo_gapk_codec_type codec) { const struct osmo_gapk_format_desc *phy_fmt_desc; const struct osmo_gapk_codec_desc *codec_desc; - struct gsm_settings *set = &ms->settings; + const struct gsm_settings *set = &ms->settings; enum osmo_gapk_format_type phy_fmt; struct gapk_io_state *state; int rc = 0; LOGP(DGAPK, LOGL_NOTICE, "Initialize GAPK I/O\n"); - OSMO_ASSERT(ms->gapk_io == NULL); - /* Make sure that the chosen codec has description */ codec_desc = osmo_gapk_codec_get_from_type(codec); if (codec_desc == NULL) { LOGP(DGAPK, LOGL_ERROR, "Invalid codec type 0x%02x\n", codec); - return -EINVAL; + return NULL; } /* Make sure that the chosen codec is supported */ if (codec_desc->codec_encode == NULL || codec_desc->codec_decode == NULL) { LOGP(DGAPK, LOGL_ERROR, "Codec '%s' is not supported by GAPK\n", codec_desc->name); - return -ENOTSUP; + return NULL; } switch (set->tch_voice.io_format) { @@ -423,20 +420,20 @@ default: LOGP(DGAPK, LOGL_ERROR, "Unhandled I/O format %s\n", tch_voice_io_format_name(set->tch_voice.io_format)); - return -ENOTSUP; + return NULL; } phy_fmt_desc = osmo_gapk_fmt_get_from_type(phy_fmt); if (phy_fmt_desc == NULL) { LOGP(DGAPK, LOGL_ERROR, "Failed to pick the PHY specific " "frame format for codec '%s'\n", codec_desc->name); - return -EINVAL; + return NULL; } state = talloc_zero(ms, struct gapk_io_state); if (state == NULL) { LOGP(DGAPK, LOGL_ERROR, "Failed to allocate memory\n"); - return -ENOMEM; + return NULL; } /* Init TCH frame I/O buffers */ @@ -469,76 +466,41 @@ talloc_free(state); LOGP(DGAPK, LOGL_ERROR, "Failed to initialize GAPK I/O\n"); - return rc; + return NULL; } - /* Init pointers */ - ms->gapk_io = state; - LOGP(DGAPK, LOGL_NOTICE, "GAPK I/O initialized for MS '%s', codec '%s'\n", ms->name, codec_desc->name); - return 0; + return state; } -/** - * Wrapper around gapk_io_init_ms(), that maps both - * given GSM 04.08 channel type (HR/FR) and channel - * mode to a codec from 'osmo_gapk_codec_type' enum, - * checks if a mapped codec is supported by GAPK, - * and finally calls the wrapped function. - */ -int gapk_io_init_ms_chan(struct osmocom_ms *ms, - uint8_t ch_type, uint8_t ch_mode) +/* gapk_io_init_ms() wrapper, selecting a codec based on channel mode and rate */ +struct gapk_io_state * +gapk_io_state_alloc_mode_rate(struct osmocom_ms *ms, + enum gsm48_chan_mode ch_mode, + bool full_rate) { enum osmo_gapk_codec_type codec; - /* Map GSM 04.08 channel mode to GAPK codec type */ switch (ch_mode) { case GSM48_CMODE_SPEECH_V1: /* FR or HR */ - if (ch_type == RSL_CHAN_Bm_ACCHs) - codec = CODEC_FR; - else - codec = CODEC_HR; + codec = full_rate ? CODEC_FR : CODEC_HR; break; - case GSM48_CMODE_SPEECH_EFR: codec = CODEC_EFR; break; - case GSM48_CMODE_SPEECH_AMR: codec = CODEC_AMR; break; - - /* Signalling or CSD, do nothing */ - case GSM48_CMODE_DATA_14k5: - case GSM48_CMODE_DATA_12k0: - case GSM48_CMODE_DATA_6k0: - case GSM48_CMODE_DATA_3k6: - case GSM48_CMODE_SIGN: - return 0; default: LOGP(DGAPK, LOGL_ERROR, "Unhandled channel mode 0x%02x (%s)\n", ch_mode, get_value_string(gsm48_chan_mode_names, ch_mode)); - return -EINVAL; + return NULL; } - return gapk_io_init_ms(ms, codec); -} - -/** - * Performs basic initialization of GAPK library, - * setting the talloc root context and a logging category. - * Should be called during the application initialization... - */ -void gapk_io_init(void) -{ - /* Init logging subsystem */ - osmo_gapk_log_init(DGAPK); - - /* Make RAWPCM format info easy to access */ - rawpcm_fmt = osmo_gapk_fmt_get_from_type(FMT_RAWPCM_S16LE); + return gapk_io_state_alloc(ms, codec); } void gapk_io_enqueue_dl(struct gapk_io_state *state, struct msgb *msg) @@ -554,9 +516,8 @@ } /* Serves both UL/DL TCH frame I/O buffers */ -int gapk_io_serve_ms(struct osmocom_ms *ms) +int gapk_io_serve_ms(struct osmocom_ms *ms, struct gapk_io_state *state) { - struct gapk_io_state *state = ms->gapk_io; int work = 0; /** @@ -596,3 +557,16 @@ return work; } + +/** + * Performs basic initialization of GAPK library, + * setting the talloc root context and a logging category. + */ +static __attribute__((constructor)) void gapk_io_init(void) +{ + /* Init logging subsystem */ + osmo_gapk_log_init(DGAPK); + + /* Make RAWPCM format info easy to access */ + rawpcm_fmt = osmo_gapk_fmt_get_from_type(FMT_RAWPCM_S16LE); +} diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 46a143c..4d879d6 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -125,7 +125,6 @@ #include <osmocom/bb/common/utils.h> #include <osmocom/bb/common/settings.h> -#include <osmocom/bb/mobile/gapk_io.h> #include <osmocom/bb/mobile/vty.h> #include <osmocom/bb/mobile/gsm48_rr.h> @@ -515,10 +514,6 @@ memset(&rr->cd_now, 0, sizeof(rr->cd_now)); /* reset ciphering */ rr->cipher_on = 0; -#ifdef WITH_GAPK_IO - /* clean-up GAPK state */ - gapk_io_clean_up_ms(rr->ms); -#endif /* reset audio mode */ /* tell cell selection process to return to idle mode * NOTE: this must be sent unbuffered, because it will @@ -573,10 +568,6 @@ gsm48_rr_render_ma(ms, &rr->cd_now, ma, &ma_len); /* activate channel */ gsm48_rr_activate_channel(ms, &rr->cd_now, ma, ma_len); -#ifdef WITH_GAPK_IO - /* clean-up GAPK state */ - gapk_io_clean_up_ms(rr->ms); -#endif return; } } @@ -4432,15 +4423,6 @@ && ch_type != RSL_CHAN_Lm_ACCHs) return -ENOTSUP; -#ifdef WITH_GAPK_IO - /* Poke GAPK audio back-end, if it is chosen */ - if (ms->settings.tch_voice.io_handler == TCH_VOICE_IOH_GAPK) { - int rc = gapk_io_init_ms_chan(ms, ch_type, mode); - if (rc) - return rc; - } -#endif - /* Apply indicated channel mode */ LOGP(DRR, LOGL_INFO, "setting TCH mode to %s, audio mode to %d, tch flags to %d\n", get_value_string(gsm48_chan_mode_names, mode), rr->audio_mode, tch_flags); @@ -4984,12 +4966,6 @@ if (cause) return gsm48_rr_tx_ass_fail(ms, cause, RSL_MT_DATA_REQ); -#ifdef WITH_GAPK_IO - /* Poke GAPK audio back-end, if it is chosen */ - if (ms->settings.tch_voice.io_handler == TCH_VOICE_IOH_GAPK) - gapk_io_init_ms_chan(ms, ch_type, cda->mode); -#endif - #ifdef TEST_FREQUENCY_MOD LOGP(DRR, LOGL_INFO, " TESTING: frequency modify ASS.CMD\n"); before_time = 1; diff --git a/src/host/layer23/src/mobile/tch.c b/src/host/layer23/src/mobile/tch.c index f6530fb..0b9142e 100644 --- a/src/host/layer23/src/mobile/tch.c +++ b/src/host/layer23/src/mobile/tch.c @@ -1,7 +1,7 @@ /* * (C) 2010 by Andreas Eversberg <jolly(a)eversberg.eu> * (C) 2017-2018 by Vadim Yanitskiy <axilirator(a)gmail.com> - * (C) 2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * (C) 2022-2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * * All Rights Reserved * @@ -21,8 +21,10 @@ #include <errno.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/signal.h> #include <osmocom/codec/codec.h> +#include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/protocol/gsm_08_58.h> #include <osmocom/bb/common/logging.h> @@ -31,6 +33,7 @@ #include <osmocom/bb/mobile/gapk_io.h> #include <osmocom/bb/mobile/mncc.h> #include <osmocom/bb/mobile/mncc_sock.h> +#include <osmocom/bb/mobile/transaction.h> #include <osmocom/bb/mobile/tch.h> /* Forward a Downlink voice frame to the external MNCC handler */ @@ -76,7 +79,9 @@ /* Receive a Downlink voice frame from the lower layers */ static int tch_recv_voice(struct osmocom_ms *ms, struct msgb *msg) { - switch (ms->settings.tch_voice.io_handler) { + struct tch_state *state = ms->tch_state; + + switch (state->voice.handler) { case TCH_VOICE_IOH_LOOPBACK: /* Remove the DL info header */ msgb_pull_to_l2(msg); @@ -87,8 +92,8 @@ case TCH_VOICE_IOH_GAPK: #ifdef WITH_GAPK_IO /* Enqueue a frame to the DL TCH buffer */ - if (ms->gapk_io != NULL) - gapk_io_enqueue_dl(ms->gapk_io, msg); + if (state->voice.gapk_io != NULL) + gapk_io_enqueue_dl(state->voice.gapk_io, msg); else msgb_free(msg); break; @@ -102,6 +107,25 @@ return 0; } +/* Receive a Downlink traffic (voice/data) frame from the lower layers */ +static int tch_recv_cb(struct osmocom_ms *ms, struct msgb *msg) +{ + struct tch_state *state = ms->tch_state; + int rc = 0; + + if (state == NULL) { + msgb_free(msg); + return 0; + } + + if (state->is_voice) + rc = tch_recv_voice(ms, msg); + else /* TODO: tch_recv_data() */ + msgb_free(msg); + + return rc; +} + /* Send an Uplink voice frame to the lower layers */ int tch_send_voice_msg(struct osmocom_ms *ms, struct msgb *msg) { @@ -142,10 +166,167 @@ return tch_send_voice_msg(ms, nmsg); } +int tch_serve_ms(struct osmocom_ms *ms) +{ + struct tch_state *state = ms->tch_state; + + if (state == NULL) + return 0; + if (state->is_voice) { +#ifdef WITH_GAPK_IO + if (state->voice.handler == TCH_VOICE_IOH_GAPK) + return gapk_io_serve_ms(ms, state->voice.gapk_io); +#endif + } + + return 0; +} + +static int tch_state_init_voice(struct osmocom_ms *ms, + struct tch_voice_state *state) +{ + const struct gsm48_rr_cd *cd = &ms->rrlayer.cd_now; + + switch (state->handler) { +#ifdef WITH_GAPK_IO + case TCH_VOICE_IOH_GAPK: + if ((cd->chan_nr & RSL_CHAN_NR_MASK) == RSL_CHAN_Bm_ACCHs) + state->gapk_io = gapk_io_state_alloc_mode_rate(ms, cd->mode, true); + else /* RSL_CHAN_Lm_ACCHs */ + state->gapk_io = gapk_io_state_alloc_mode_rate(ms, cd->mode, false); + if (state->gapk_io == NULL) + return -1; + break; +#endif + default: + break; + } + + return 0; +} + +static void tch_state_free_voice(struct tch_voice_state *state) +{ + switch (state->handler) { +#ifdef WITH_GAPK_IO + case TCH_VOICE_IOH_GAPK: + gapk_io_state_free(state->gapk_io); + break; +#endif + default: + break; + } +} + +static void tch_trans_cstate_active_cb(struct gsm_trans *trans) +{ + struct osmocom_ms *ms = trans->ms; + struct tch_state *state; + enum gsm48_chan_mode ch_mode; + + if (ms->tch_state != NULL) + return; /* TODO: handle modify? */ + + state = talloc_zero(ms, struct tch_state); + OSMO_ASSERT(state != NULL); + + ch_mode = ms->rrlayer.cd_now.mode; + switch (ch_mode) { + case GSM48_CMODE_SPEECH_V1: + case GSM48_CMODE_SPEECH_EFR: + case GSM48_CMODE_SPEECH_AMR: + state->is_voice = true; + state->voice.handler = ms->settings.tch_voice.io_handler; + if (tch_state_init_voice(ms, &state->voice) != 0) + goto exit_free; + break; + case GSM48_CMODE_DATA_14k5: + case GSM48_CMODE_DATA_12k0: + case GSM48_CMODE_DATA_6k0: + case GSM48_CMODE_DATA_3k6: +#if 0 + state->is_voice = false; + state->data.handler = ms->settings.tch_data.io_handler; + /* TODO: tch_state_init_data() */ + if (tch_state_init_data(ms, &state->data) != 0) + goto exit_free; + break; +#endif + case GSM48_CMODE_SIGN: + default: + LOGP(DL1C, LOGL_ERROR, "Unhandled channel mode %s\n", + get_value_string(gsm48_chan_mode_names, ch_mode)); +exit_free: + talloc_free(state); + return; + } + + ms->tch_state = state; +} + +static void tch_trans_free_cb(struct gsm_trans *trans) +{ + struct osmocom_ms *ms = trans->ms; + struct tch_state *state = ms->tch_state; + + if (state == NULL) + return; + if (state->is_voice) + tch_state_free_voice(&state->voice); +#if 0 + else /* TODO: tch_state_free_data() */ + tch_state_free_data(&state->data); +#endif + + talloc_free(state); + ms->tch_state = NULL; +} + +static void tch_trans_state_chg_cb(struct gsm_trans *trans) +{ + switch (trans->cc.state) { + case GSM_CSTATE_ACTIVE: + tch_trans_cstate_active_cb(trans); + break; + case GSM_CSTATE_NULL: + tch_trans_free_cb(trans); + break; + } +} + +/* a call-back for CC (Call Control) transaction related events */ +static int tch_trans_signal_cb(unsigned int subsys, unsigned int signal, + void *handler_data, void *signal_data) +{ + struct gsm_trans *trans = signal_data; + + OSMO_ASSERT(subsys == SS_L23_TRANS); + OSMO_ASSERT(trans != NULL); + + /* we only care about CC transactions here */ + if (trans->protocol != GSM48_PDISC_CC) + return 0; + + switch ((enum osmobb_l23_trans_sig)signal) { + case S_L23_CC_TRANS_ALLOC: + break; + case S_L23_CC_TRANS_FREE: + tch_trans_free_cb(trans); + break; + case S_L23_CC_TRANS_STATE_CHG: + tch_trans_state_chg_cb(trans); + break; + } + + return 0; +} + /* Initialize the TCH router */ int tch_init(struct osmocom_ms *ms) { - ms->l1_entity.l1_traffic_ind = tch_recv_voice; + ms->l1_entity.l1_traffic_ind = &tch_recv_cb; + + osmo_signal_register_handler(SS_L23_TRANS, &tch_trans_signal_cb, ms); return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35579?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I28f87f6a6de673611aa02a24e8985aee23d4498b Gerrit-Change-Number: 35579 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy(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
[S] Change in osmocom-bb[master]: mobile: store MNCC Bearer Capability in CC transaction
by fixeria 19 Jan '24

19 Jan '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35578?usp=email ) Change subject: mobile: store MNCC Bearer Capability in CC transaction ...................................................................... mobile: store MNCC Bearer Capability in CC transaction We will need to know the current Bearer Capability of a CC transaction in the upcoming patches adding CSD support. Change-Id: Ifc3ecf832a552c65444f49711ac836b6cd984715 Related: OS#4396 --- M src/host/layer23/include/osmocom/bb/mobile/transaction.h M src/host/layer23/src/mobile/gsm48_cc.c 2 files changed, 33 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve diff --git a/src/host/layer23/include/osmocom/bb/mobile/transaction.h b/src/host/layer23/include/osmocom/bb/mobile/transaction.h index 103ae4e..c1e9429 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/transaction.h +++ b/src/host/layer23/include/osmocom/bb/mobile/transaction.h @@ -38,6 +38,7 @@ int T308_second; /* used to send release again */ struct osmo_timer_list timer; struct gsm_mncc msg; /* stores setup/disconnect/release message */ + struct gsm_mncc_bearer_cap *bcap; } cc; struct { /* current supp.serv. state */ diff --git a/src/host/layer23/src/mobile/gsm48_cc.c b/src/host/layer23/src/mobile/gsm48_cc.c index 9ed2971..c253cb6 100644 --- a/src/host/layer23/src/mobile/gsm48_cc.c +++ b/src/host/layer23/src/mobile/gsm48_cc.c @@ -43,6 +43,8 @@ uint32_t callref, int location, int value); static int gsm48_cc_tx_disconnect(struct gsm_trans *trans, void *arg); static int gsm48_cc_tx_connect_ack(struct gsm_trans *trans, void *arg); +static void gsm48_cc_trans_bcap_update(struct gsm_trans *trans, + const struct gsm_mncc *mncc); /* * init @@ -187,6 +189,8 @@ struct gsm48_cclayer *cc = &ms->cclayer; struct msgb *msg; + gsm48_cc_trans_bcap_update(trans, mncc); + if (trans) LOGP(DCC, LOGL_INFO, "(ms %s ti %x) Sending '%s' to MNCC.\n", ms->name, trans->transaction_id, @@ -370,6 +374,9 @@ { gsm48_stop_cc_timer(trans); + talloc_free(trans->cc.bcap); + trans->cc.bcap = NULL; + /* disable audio distribution */ if (trans->ms->mncc_entity.ref == trans->callref) trans->ms->mncc_entity.ref = 0; @@ -385,6 +392,16 @@ new_cc_state(trans, GSM_CSTATE_NULL); } +static void gsm48_cc_trans_bcap_update(struct gsm_trans *trans, + const struct gsm_mncc *mncc) +{ + if (~mncc->fields & MNCC_F_BEARER_CAP) + return; + if (trans->cc.bcap == NULL) + trans->cc.bcap = talloc(trans, struct gsm_mncc_bearer_cap); + memcpy(trans->cc.bcap, &mncc->bearer_cap, sizeof(mncc->bearer_cap)); +} + /* release MM connection, go NULL state, free transaction */ static int gsm48_rel_null_free(struct gsm_trans *trans) { @@ -2020,6 +2037,8 @@ } } + gsm48_cc_trans_bcap_update(trans, data); + switch (msg_type) { case GSM_TCHF_FRAME: case GSM_TCHF_FRAME_EFR: -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35578?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ifc3ecf832a552c65444f49711ac836b6cd984715 Gerrit-Change-Number: 35578 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • ...
  • 156
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.