Change in osmo-bsc[master]: LCLS: update parameter representation
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/11820/3/src/osmo-bsc/osmo_bsc_lcls.c File src/osmo-bsc/osmo_bsc_lcls.c: https://gerrit.osmocom.org/#/c/11820/3/src/osmo-bsc/osmo_bsc_lcls.c@163 PS3, Line 163: static struct osmo_lcls old_cfg_csc = { 0 }; > I still have the filling this variable being static (aka global) is most > probably wrong, since I gue […] @Max, did you have a look at my comment here? I saw no answer. -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 3 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: osmith Gerrit-Comment-Date: Tue, 18 Dec 2018 17:59:27 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in osmo-bsc[master]: LCLS: update parameter representation
Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. LCLS: update parameter representation * use osmo_lcls struct from libosmocore * use enum values instead of magic numbers Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Related: OS#3659 --- M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_subscr_conn_fsm.c M src/osmo-bsc/osmo_bsc_lcls.c 3 files changed, 15 insertions(+), 21 deletions(-) Approvals: Max: Looks good to me, approved Pau Espin Pedrol: Looks good to me, but someone else must approve Stefan Sperling: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 738bad3..cf34c6f 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -275,8 +275,8 @@ struct { uint8_t global_call_ref[15]; uint8_t global_call_ref_len; /* length of global_call_ref */ - uint8_t config; /* TS 48.008 3.2.2.116 */ - uint8_t control;/* TS 48.008 3.2.2.117 */ + enum gsm0808_lcls_config config;/* TS 48.008 3.2.2.116 */ + enum gsm0808_lcls_control control; /* TS 48.008 3.2.2.117 */ /* LCLS FSM */ struct osmo_fsm_inst *fi; /* pointer to "other" connection, if Call Leg Relocation was successful */ diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index fac0bc0..85e754f 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -883,9 +883,9 @@ return NULL; } - /* initialize to some magic values that indicate "IE not [yet] received" */ - conn->lcls.config = 0xff; - conn->lcls.control = 0xff; + /* indicate "IE not [yet] received" */ + conn->lcls.config = GSM0808_LCLS_CFG_NA; + conn->lcls.control = GSM0808_LCLS_CSC_NA; conn->lcls.fi = osmo_fsm_inst_alloc_child(_fsm, conn->fi, GSCON_EV_LCLS_FAIL); if (!conn->lcls.fi) { osmo_fsm_inst_term(conn->fi, OSMO_FSM_TERM_ERROR, NULL); diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c index cdd6557..622611d 100644 --- a/src/osmo-bsc/osmo_bsc_lcls.c +++ b/src/osmo-bsc/osmo_bsc_lcls.c @@ -156,22 +156,16 @@ return 0; } - -struct lcls_cfg_csc { - enum gsm0808_lcls_config config; - enum gsm0808_lcls_control control; -}; - /* Update the connections LCLS configuration and return old/previous configuration. * \returns (staticallly allocated) old configuration; NULL if new config not supported */ -static struct lcls_cfg_csc *update_lcls_cfg_csc(struct gsm_subscriber_connection *conn, - struct lcls_cfg_csc *new_cfg_csc) +static struct osmo_lcls *update_lcls_cfg_csc(struct gsm_subscriber_connection *conn, +struct osmo_lcls *new_cfg_csc) { - static struct lcls_cfg_csc old_cfg_csc; + static struct osmo_lcls old_cfg_csc = { 0 }; old_cfg_csc.config = conn->lcls.config; old_cfg_csc.control = conn->lcls.control; - if (new_cfg_csc->config != 0xff) { + if (new_cfg_csc->config != GSM0808_LCLS_CFG_NA) { if (!lcls_is_supported_config(new_cfg_csc->config)) return NULL; if (conn->lcls.config != new_cfg_csc->config) { @@ -179,7 +173,7 @@ conn->lcls.config = new_cfg_csc->config; } } - if (new_cfg_csc->control != 0xff) { + if (new_cfg_csc->control != GSM0808_LCLS_CSC_NA) { if (conn->lcls.control != new_cfg_csc->control) { /* TODO: logging */ conn->lcls.control = new_cfg_csc->control; @@ -193,9 +187,9 @@ * unsupported, change into LCLS NOT SUPPORTED state and return -EINVAL. */ static int lcls_handle_cfg_update(struct gsm_subscriber_connection *conn, void *data) { - struct lcls_cfg_csc *new_cfg_csc, *old_cfg_csc; + struct osmo_lcls *new_cfg_csc, *old_cfg_csc; - new_cfg_csc = (struct lcls_cfg_csc *) data; + new_cfg_csc = (struct osmo_lcls *) data; old_cfg_csc = update_lcls_cfg_csc(conn, new_cfg_csc); if (!old_cfg_csc) { osmo_fsm_inst_state_chg(conn->lcls.fi, ST_REQ_LCLS_NOT_SUPP, 0, 0); @@ -208,9 +202,9 @@ void lcls_update_config(struct gsm_subscriber_connection *conn, const uint8_t *config, const uint8_t *control) { - struct lcls_cfg_csc new_cfg = { - .config = 0xff, - .control = 0xff, + struct osmo_lcls new_cfg = { + .config = GSM0808_LCLS_CFG_NA, + .control = GSM0808_LCLS_CSC_NA,
Change in osmo-bsc[master]: LCLS: update parameter representation
Max has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 3 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: osmith Gerrit-Comment-Date: Tue, 18 Dec 2018 17:48:44 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-bsc[master]: LCLS: update parameter representation
Stefan Sperling has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 3: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 3 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: osmith Gerrit-Comment-Date: Tue, 18 Dec 2018 17:43:38 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-bsc[master]: LCLS: update parameter representation
Max has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 3: > Please have a look at it and submit a patch regarding this issue. I will but it's certainly belongs to a different patch. -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 3 Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Thu, 22 Nov 2018 13:36:50 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-bsc[master]: LCLS: update parameter representation
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 3: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/11820/3/src/osmo-bsc/osmo_bsc_lcls.c File src/osmo-bsc/osmo_bsc_lcls.c: https://gerrit.osmocom.org/#/c/11820/3/src/osmo-bsc/osmo_bsc_lcls.c@163 PS3, Line 163: static struct osmo_lcls old_cfg_csc = { 0 }; I still have the filling this variable being static (aka global) is most probably wrong, since I guess we need to keep this status per-conn/subscriber or per-call. Please have a look at it and submit a patch regarding this issue. -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 3 Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Thu, 22 Nov 2018 10:44:43 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-bsc[master]: LCLS: update parameter representation
Max has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Set Ready For Review -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 3 Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Wed, 21 Nov 2018 21:04:08 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-bsc[master]: LCLS: update parameter representation
Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 2: Code-Review-1 (5 comments) https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/bsc_subscr_conn_fsm.c File src/osmo-bsc/bsc_subscr_conn_fsm.c: https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/bsc_subscr_conn_fsm.c@859 PS2, Line 859: /* initialize to some magic values that indicate "IE not [yet] received" */ (could drop the comment up to "indicate") https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c File src/osmo-bsc/osmo_bsc_lcls.c: https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c@164 PS2, Line 164: old_cfg_csc.config = conn->lcls.config; please use a construct like this: old_cfg_csc = (struct old_cfg_csc){ .config = conn->lcls.config, ... }; because that ensures that all struct members are initialized, and that there are no leftovers from a previous call. (because any member that isn't mentioned gets zero-initialized implicitly) https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c@167 PS2, Line 167: if (new_cfg_csc->config != 0xff) { a magic nr left over https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c@175 PS2, Line 175: if (new_cfg_csc->control != 0xff) { another magic nr https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c@192 PS2, Line 192: old_cfg_csc = update_lcls_cfg_csc(conn, new_cfg_csc); unrelated to this particular patch, but how can this make sense if the returned cfg is never used anywhere?? Also I think the naming is weird, since the returned cfg should be the updated one, not the old one? If I'm right about this, could you plz create a new issue and possibly a patch... -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 2 Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Wed, 21 Nov 2018 17:45:34 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-bsc[master]: LCLS: update parameter representation
Max has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c File src/osmo-bsc/osmo_bsc_lcls.c: https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c@163 PS2, Line 163: static struct osmo_lcls old_cfg_csc; > Shouldn't this be per-conn? More like per-call but we're working on per-conn level indeed. Not sure I understand the question though. Could you elaborate? -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 2 Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Tue, 20 Nov 2018 14:09:01 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in osmo-bsc[master]: LCLS: update parameter representation
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/11820 ) Change subject: LCLS: update parameter representation .. Patch Set 2: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c File src/osmo-bsc/osmo_bsc_lcls.c: https://gerrit.osmocom.org/#/c/11820/2/src/osmo-bsc/osmo_bsc_lcls.c@163 PS2, Line 163: static struct osmo_lcls old_cfg_csc; Not directly related to this patch, but: Shouldn't this be per-conn? -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 2 Gerrit-Owner: Max Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Tue, 20 Nov 2018 14:03:49 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-bsc[master]: LCLS: update parameter representation
Max has uploaded this change for review. ( https://gerrit.osmocom.org/11820 Change subject: LCLS: update parameter representation .. LCLS: update parameter representation * use osmo_lcls struct from libosmocore * use enum values instead of magic numbers Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Related: OS#3659 --- M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_subscr_conn_fsm.c M src/osmo-bsc/osmo_bsc_lcls.c 3 files changed, 12 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/20/11820/1 diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 7897fea..6be8b7b 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -275,8 +275,8 @@ struct { uint8_t global_call_ref[15]; uint8_t global_call_ref_len; /* length of global_call_ref */ - uint8_t config; /* TS 48.008 3.2.2.116 */ - uint8_t control;/* TS 48.008 3.2.2.117 */ + enum gsm0808_lcls_config config;/* TS 48.008 3.2.2.116 */ + enum gsm0808_lcls_control control;/* TS 48.008 3.2.2.117 */ /* LCLS FSM */ struct osmo_fsm_inst *fi; /* pointer to "other" connection, if Call Leg Relocation was successful */ diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index bca9e1f..cc32d8a 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -857,8 +857,8 @@ } /* initialize to some magic values that indicate "IE not [yet] received" */ - conn->lcls.config = 0xff; - conn->lcls.control = 0xff; + conn->lcls.config = GSM0808_LCLS_CFG_NA; + conn->lcls.control = GSM0808_LCLS_CSC_NA; conn->lcls.fi = osmo_fsm_inst_alloc_child(_fsm, conn->fi, GSCON_EV_LCLS_FAIL); if (!conn->lcls.fi) { osmo_fsm_inst_term(conn->fi, OSMO_FSM_TERM_ERROR, NULL); diff --git a/src/osmo-bsc/osmo_bsc_lcls.c b/src/osmo-bsc/osmo_bsc_lcls.c index a406643..f457617 100644 --- a/src/osmo-bsc/osmo_bsc_lcls.c +++ b/src/osmo-bsc/osmo_bsc_lcls.c @@ -155,18 +155,12 @@ return 0; } - -struct lcls_cfg_csc { - enum gsm0808_lcls_config config; - enum gsm0808_lcls_control control; -}; - /* Update the connections LCLS configuration and return old/previous configuration. * \returns (staticallly allocated) old configuration; NULL if new config not supported */ -static struct lcls_cfg_csc *update_lcls_cfg_csc(struct gsm_subscriber_connection *conn, - struct lcls_cfg_csc *new_cfg_csc) +static struct osmo_lcls *update_lcls_cfg_csc(struct gsm_subscriber_connection *conn, +struct osmo_lcls *new_cfg_csc) { - static struct lcls_cfg_csc old_cfg_csc; + static struct osmo_lcls old_cfg_csc; old_cfg_csc.config = conn->lcls.config; old_cfg_csc.control = conn->lcls.control; @@ -192,9 +186,9 @@ * unsupported, change into LCLS NOT SUPPORTED state and return -EINVAL. */ static int lcls_handle_cfg_update(struct gsm_subscriber_connection *conn, void *data) { - struct lcls_cfg_csc *new_cfg_csc, *old_cfg_csc; + struct osmo_lcls *new_cfg_csc, *old_cfg_csc; - new_cfg_csc = (struct lcls_cfg_csc *) data; + new_cfg_csc = (struct osmo_lcls *) data; old_cfg_csc = update_lcls_cfg_csc(conn, new_cfg_csc); if (!old_cfg_csc) { osmo_fsm_inst_state_chg(conn->lcls.fi, ST_REQ_LCLS_NOT_SUPP, 0, 0); @@ -207,9 +201,9 @@ void lcls_update_config(struct gsm_subscriber_connection *conn, const uint8_t *config, const uint8_t *control) { - struct lcls_cfg_csc new_cfg = { - .config = 0xff, - .control = 0xff, + struct osmo_lcls new_cfg = { + .config = GSM0808_LCLS_CFG_NA, + .control = GSM0808_LCLS_CSC_NA, }; /* nothing to update, skip it */ if (!config && !control) -- To view, visit https://gerrit.osmocom.org/11820 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I5e962d4fbb24bf1fb2398dc13e142a4a3304d858 Gerrit-Change-Number: 11820 Gerrit-PatchSet: 1 Gerrit-Owner: Max