Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11303 ) Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. gsm_08_58.h: Introduce struct abis_rsl_chan_nr It will allow to make code handling chan_nr values more easier to read and less prone to errors. union is used to be able to get the full octet in case we need to pass it somewhere else or encode it. An extra union is used in struct abis_rsl_common_hdr and others to allow using fields directly while keeping API compatibility. Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 --- M include/osmocom/gsm/protocol/gsm_08_58.h 1 file changed, 32 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h index c7a7d8a..cd28caf 100644 --- a/include/osmocom/gsm/protocol/gsm_08_58.h +++ b/include/osmocom/gsm/protocol/gsm_08_58.h @@ -31,6 +31,26 @@ * @{ * \file gsm_08_58.h */ +/* Channel Number 9.3.1 */ +union abis_rsl_chan_nr { +#if OSMO_IS_BIG_ENDIAN + uint8_t cbits:5, + tn:3; +#elif OSMO_IS_LITTLE_ENDIAN + uint8_t tn:3, + cbits:5; +#endif + uint8_t chan_nr; +} __attribute__ ((packed)); +#define ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs0x01 +#define ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(ss)(0x02 + (ss)) +#define ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(ss) (0x04 + (ss)) +#define ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(ss) (0x08 + (ss)) +#define ABIS_RSL_CHAN_NR_CBITS_BCCH0x10 +#define ABIS_RSL_CHAN_NR_CBITS_RACH0x11 +#define ABIS_RSL_CHAN_NR_CBITS_PCH_AGCH0x12 +#define ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH 0x18 /*< non-standard, for dyn TS */ + /* Link Identifier 9.3.2 */ union abis_rsl_link_id { #if OSMO_IS_BIG_ENDIAN @@ -60,7 +80,10 @@ struct abis_rsl_rll_hdr { struct abis_rsl_common_hdr c; uint8_t ie_chan;/*!< \ref RSL_IE_CHAN_NR (tag) */ - uint8_t chan_nr;/*!< RSL channel number (value) */ + union { + uint8_t chan_nr; /* API backward compat */ + union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ + }; uint8_t ie_link_id; /*!< \ref RSL_IE_LINK_IDENT (tag) */ union { uint8_t link_id; /* API backward compat */ @@ -73,7 +96,10 @@ struct abis_rsl_dchan_hdr { struct abis_rsl_common_hdr c; uint8_t ie_chan;/*!< \ref RSL_IE_CHAN_NR (tag) */ - uint8_t chan_nr;/*!< RSL channel number (value) */ + union { + uint8_t chan_nr; /* API backward compat */ + union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ + }; uint8_t data[0];/*!< message payload data */ } __attribute__ ((packed)); @@ -81,7 +107,10 @@ struct abis_rsl_cchan_hdr { struct abis_rsl_common_hdr c; uint8_t ie_chan;/*!< \ref RSL_IE_CHAN_NR (tag) */ - uint8_t chan_nr;/*!< RSL channel number (value) */ + union { + uint8_t chan_nr; /* API backward compat */ + union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ + }; uint8_t data[0];/*!< message payload data */ } __attribute__ ((packed)); -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 3 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Neels Hofmeyr Gerrit-CC: Vadim Yanitskiy
Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/11303 ) Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. Patch Set 2: (2 comments) https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h File include/osmocom/gsm/protocol/gsm_08_58.h: https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h@45 PS2, Line 45: ACCHs 0x01 > It's strange, it didn't look aligned in my editor, but it did during git show. in git's patch output, the first char in each line is a diff indicator (+,-,space), so a line that has no tabs in it always appears one space further right than a line with tabs. Also tabs might snap to a different column in the diff output. https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h@85 PS2, Line 85: union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ (before this, the comment was spaced by tab; I don't like that, but I guess it should stay consistent to above anyway. same below.) -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 2 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Neels Hofmeyr Gerrit-CC: Vadim Yanitskiy Gerrit-Comment-Date: Wed, 17 Oct 2018 14:22:13 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/11303 ) Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. Patch Set 2: (1 comment) > Would be probably good to see some basic test coverage, > to make sure that we don't break anything by this change... How can we break anything with this change? It's not changing any logic, old code keeps working same way. It's only new ways to get/set information for new code. https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h File include/osmocom/gsm/protocol/gsm_08_58.h: https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h@45 PS2, Line 45: ACCHs 0x01 > let's make it aligned? It's strange, it didn't look aligned in my editor, but it did during git show. -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 2 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Vadim Yanitskiy Gerrit-Comment-Date: Mon, 15 Oct 2018 16:08:11 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Vadim Yanitskiy has posted comments on this change. ( https://gerrit.osmocom.org/11303 ) Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. Patch Set 2: Would be probably good to see some basic test coverage, to make sure that we don't break anything by this change... -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 2 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Vadim Yanitskiy Gerrit-Comment-Date: Mon, 15 Oct 2018 15:50:50 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Vadim Yanitskiy has posted comments on this change. ( https://gerrit.osmocom.org/11303 ) Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. Patch Set 2: (2 comments) https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h File include/osmocom/gsm/protocol/gsm_08_58.h: https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h@45 PS2, Line 45: ACCHs 0x01 let's make it aligned? https://gerrit.osmocom.org/#/c/11303/2/include/osmocom/gsm/protocol/gsm_08_58.h@51 PS2, Line 51: AGCH 0x12 same here -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 2 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Vadim Yanitskiy Gerrit-Comment-Date: Mon, 15 Oct 2018 15:49:25 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/11303 ) Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Comment-Date: Wed, 10 Oct 2018 20:43:44 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_chan_nr
Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11303 Change subject: gsm_08_58.h: Introduce struct abis_rsl_chan_nr .. gsm_08_58.h: Introduce struct abis_rsl_chan_nr It will allow to make code handling chan_nr values more easier to read and less prone to errors. union is used to be able to get the full octet in case we need to pass it somewhere else or encode it. An extra union is used in struct abis_rsl_common_hdr and others to allow using fields directly while keeping API compatibility. Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 --- M include/osmocom/gsm/protocol/gsm_08_58.h 1 file changed, 32 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/11303/1 diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h index c7a7d8a..cd28caf 100644 --- a/include/osmocom/gsm/protocol/gsm_08_58.h +++ b/include/osmocom/gsm/protocol/gsm_08_58.h @@ -31,6 +31,26 @@ * @{ * \file gsm_08_58.h */ +/* Channel Number 9.3.1 */ +union abis_rsl_chan_nr { +#if OSMO_IS_BIG_ENDIAN + uint8_t cbits:5, + tn:3; +#elif OSMO_IS_LITTLE_ENDIAN + uint8_t tn:3, + cbits:5; +#endif + uint8_t chan_nr; +} __attribute__ ((packed)); +#define ABIS_RSL_CHAN_NR_CBITS_Bm_ACCHs0x01 +#define ABIS_RSL_CHAN_NR_CBITS_Lm_ACCHs(ss)(0x02 + (ss)) +#define ABIS_RSL_CHAN_NR_CBITS_SDCCH4_ACCH(ss) (0x04 + (ss)) +#define ABIS_RSL_CHAN_NR_CBITS_SDCCH8_ACCH(ss) (0x08 + (ss)) +#define ABIS_RSL_CHAN_NR_CBITS_BCCH0x10 +#define ABIS_RSL_CHAN_NR_CBITS_RACH0x11 +#define ABIS_RSL_CHAN_NR_CBITS_PCH_AGCH0x12 +#define ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH 0x18 /*< non-standard, for dyn TS */ + /* Link Identifier 9.3.2 */ union abis_rsl_link_id { #if OSMO_IS_BIG_ENDIAN @@ -60,7 +80,10 @@ struct abis_rsl_rll_hdr { struct abis_rsl_common_hdr c; uint8_t ie_chan;/*!< \ref RSL_IE_CHAN_NR (tag) */ - uint8_t chan_nr;/*!< RSL channel number (value) */ + union { + uint8_t chan_nr; /* API backward compat */ + union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ + }; uint8_t ie_link_id; /*!< \ref RSL_IE_LINK_IDENT (tag) */ union { uint8_t link_id; /* API backward compat */ @@ -73,7 +96,10 @@ struct abis_rsl_dchan_hdr { struct abis_rsl_common_hdr c; uint8_t ie_chan;/*!< \ref RSL_IE_CHAN_NR (tag) */ - uint8_t chan_nr;/*!< RSL channel number (value) */ + union { + uint8_t chan_nr; /* API backward compat */ + union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ + }; uint8_t data[0];/*!< message payload data */ } __attribute__ ((packed)); @@ -81,7 +107,10 @@ struct abis_rsl_cchan_hdr { struct abis_rsl_common_hdr c; uint8_t ie_chan;/*!< \ref RSL_IE_CHAN_NR (tag) */ - uint8_t chan_nr;/*!< RSL channel number (value) */ + union { + uint8_t chan_nr; /* API backward compat */ + union abis_rsl_chan_nr chan_nr_fields; /*!< RSL channel number (value) */ + }; uint8_t data[0];/*!< message payload data */ } __attribute__ ((packed)); -- To view, visit https://gerrit.osmocom.org/11303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Icd6822021207270a00106c50f8ca6b93c1250df9 Gerrit-Change-Number: 11303 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol