[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. [cosmetic] re-order hnbgw.c to group code in major blocks Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc --- M src/osmo-hnbgw/hnbgw.c 1 file changed, 203 insertions(+), 173 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 086582e..33353f2 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -47,85 +47,10 @@ {} }; -void g_hnbgw_alloc(void *ctx) -{ - OSMO_ASSERT(!g_hnbgw); - g_hnbgw = talloc_zero(ctx, struct hnbgw); - /* strdup so we can easily talloc_free in the VTY code */ - g_hnbgw->config.iuh_local_ip = talloc_strdup(g_hnbgw, HNBGW_LOCAL_IP_DEFAULT); - g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT; - g_hnbgw->config.log_prefix_hnb_id = true; - - /* Set zero PLMN to detect a missing PLMN when transmitting RESET */ - g_hnbgw->config.plmn = (struct osmo_plmn_id){ 0, 0, false }; - - g_hnbgw->next_ue_ctx_id = 23; - INIT_LLIST_HEAD(_hnbgw->hnb_list); - INIT_LLIST_HEAD(_hnbgw->ue_list); - INIT_LLIST_HEAD(_hnbgw->sccp.users); - - g_hnbgw->mgw_pool = mgcp_client_pool_alloc(g_hnbgw); - g_hnbgw->config.mgcp_client = mgcp_client_conf_alloc(g_hnbgw); - -#if ENABLE_PFCP - g_hnbgw->config.pfcp.remote_port = OSMO_PFCP_PORT; -#endif - - g_hnbgw->sccp.cnpool_iucs = (struct hnbgw_cnpool){ - .domain = DOMAIN_CS, - .pool_name = "iucs", - .peer_name = "msc", - .default_remote_pc = DEFAULT_PC_MSC, - .vty = { - .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, - .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), - }, - .cnlink_ctrg_desc = _ctrg_desc, - - .ctrs = rate_ctr_group_alloc(g_hnbgw, _ctrg_desc, 0), - }; - INIT_LLIST_HEAD(_hnbgw->sccp.cnpool_iucs.cnlinks); - - g_hnbgw->sccp.cnpool_iups = (struct hnbgw_cnpool){ - .domain = DOMAIN_PS, - .pool_name = "iups", - .peer_name = "sgsn", - .default_remote_pc = DEFAULT_PC_SGSN, - .vty = { - .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, - .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), - }, - .cnlink_ctrg_desc = _ctrg_desc, - - .ctrs = rate_ctr_group_alloc(g_hnbgw, _ctrg_desc, 0), - }; - INIT_LLIST_HEAD(_hnbgw->sccp.cnpool_iups.cnlinks); -} - -static struct hnb_context *hnb_context_by_id(uint32_t cid) -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { - if (hnb->id.cid == cid) - return hnb; - } - - return NULL; -} - -struct hnb_context *hnb_context_by_identity_info(const char *identity_info) -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { - if (strcmp(identity_info, hnb->identity_info) == 0) - return hnb; - } - - return NULL; -} +/*** + * UE Context + ***/ struct ue_context *ue_context_by_id(uint32_t id) { @@ -212,6 +137,141 @@ talloc_free(ue); } + +/*** + * HNB Context + ***/ + +/* look-up HNB context by id. Used from CTRL */ +static struct hnb_context *hnb_context_by_id(uint32_t cid) +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { + if (hnb->id.cid == cid) + return hnb; + } + + return NULL; +} + +/* look-up HNB context by identity_info. Used from VTY */ +struct hnb_context *hnb_context_by_identity_info(const char *identity_info) +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { + if (strcmp(identity_info, hnb->identity_info) == 0) + return hnb; + } + + return NULL; +} + +static int hnb_read_cb(struct osmo_stream_srv *conn); +static int hnb_closed_cb(struct osmo_stream_srv *conn); + +static struct hnb_context *hnb_context_alloc(struct osmo_stream_srv_link *link, int new_fd) +{ + struct hnb_context *ctx; + + ctx = talloc_zero(g_hnbgw, struct hnb_context); + if (!ctx) + return NULL; + INIT_LLIST_HEAD(>map_list); + +
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc Gerrit-Change-Number: 36080 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Comment-Date: Fri, 08 Mar 2024 08:57:14 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc Gerrit-Change-Number: 36080 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin Gerrit-Attention: laforge Gerrit-Comment-Date: Thu, 07 Mar 2024 17:35:49 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. Patch Set 2: (1 comment) Patchset: PS1: > Sorry, not now, I have just spent multiple hours > rebasing/weaving/merge-conflict-resolving. […] Fine, just sharing thoughts. -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc Gerrit-Change-Number: 36080 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Attention: laforge Gerrit-Comment-Date: Thu, 07 Mar 2024 17:35:44 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Comment-In-Reply-To: pespin Gerrit-MessageType: comment
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?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: [cosmetic] re-order hnbgw.c to group code in major blocks .. [cosmetic] re-order hnbgw.c to group code in major blocks Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc --- M src/osmo-hnbgw/hnbgw.c 1 file changed, 203 insertions(+), 173 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/80/36080/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc Gerrit-Change-Number: 36080 Gerrit-PatchSet: 2 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Attention: pespin Gerrit-MessageType: newpatchset
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
Attention is currently required from: pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. Patch Set 1: (1 comment) This change is ready for review. Patchset: PS1: > You could even take the chance to split hnb_context to its own file. […] Sorry, not now, I have just spent multiple hours rebasing/weaving/merge-conflict-resolving. That should be done at a time when there's not significant changes piled on top of it. -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc Gerrit-Change-Number: 36080 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Attention: pespin Gerrit-Comment-Date: Thu, 07 Mar 2024 17:25:16 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. Patch Set 1: (1 comment) File src/osmo-hnbgw/hnbgw.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-14663): https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080/comment/8face840_2bd10288 PS1, Line 272: * SCTP Socket / stream handling trailing whitespace -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc Gerrit-Change-Number: 36080 Gerrit-PatchSet: 1 Gerrit-Owner: laforge Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Sat, 24 Feb 2024 11:40:12 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
[L] Change in osmo-hnbgw[master]: [cosmetic] re-order hnbgw.c to group code in major blocks
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36080?usp=email ) Change subject: [cosmetic] re-order hnbgw.c to group code in major blocks .. [cosmetic] re-order hnbgw.c to group code in major blocks Change-Id: Ia7ce60e6f80d10b7712de1aa6d8a30dd61690dcc --- M src/osmo-hnbgw/hnbgw.c 1 file changed, 203 insertions(+), 173 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/80/36080/1 diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 086582e..695822e 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -47,85 +47,10 @@ {} }; -void g_hnbgw_alloc(void *ctx) -{ - OSMO_ASSERT(!g_hnbgw); - g_hnbgw = talloc_zero(ctx, struct hnbgw); - /* strdup so we can easily talloc_free in the VTY code */ - g_hnbgw->config.iuh_local_ip = talloc_strdup(g_hnbgw, HNBGW_LOCAL_IP_DEFAULT); - g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT; - g_hnbgw->config.log_prefix_hnb_id = true; - - /* Set zero PLMN to detect a missing PLMN when transmitting RESET */ - g_hnbgw->config.plmn = (struct osmo_plmn_id){ 0, 0, false }; - - g_hnbgw->next_ue_ctx_id = 23; - INIT_LLIST_HEAD(_hnbgw->hnb_list); - INIT_LLIST_HEAD(_hnbgw->ue_list); - INIT_LLIST_HEAD(_hnbgw->sccp.users); - - g_hnbgw->mgw_pool = mgcp_client_pool_alloc(g_hnbgw); - g_hnbgw->config.mgcp_client = mgcp_client_conf_alloc(g_hnbgw); - -#if ENABLE_PFCP - g_hnbgw->config.pfcp.remote_port = OSMO_PFCP_PORT; -#endif - - g_hnbgw->sccp.cnpool_iucs = (struct hnbgw_cnpool){ - .domain = DOMAIN_CS, - .pool_name = "iucs", - .peer_name = "msc", - .default_remote_pc = DEFAULT_PC_MSC, - .vty = { - .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, - .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), - }, - .cnlink_ctrg_desc = _ctrg_desc, - - .ctrs = rate_ctr_group_alloc(g_hnbgw, _ctrg_desc, 0), - }; - INIT_LLIST_HEAD(_hnbgw->sccp.cnpool_iucs.cnlinks); - - g_hnbgw->sccp.cnpool_iups = (struct hnbgw_cnpool){ - .domain = DOMAIN_PS, - .pool_name = "iups", - .peer_name = "sgsn", - .default_remote_pc = DEFAULT_PC_SGSN, - .vty = { - .nri_bitlen = OSMO_NRI_BITLEN_DEFAULT, - .null_nri_ranges = osmo_nri_ranges_alloc(g_hnbgw), - }, - .cnlink_ctrg_desc = _ctrg_desc, - - .ctrs = rate_ctr_group_alloc(g_hnbgw, _ctrg_desc, 0), - }; - INIT_LLIST_HEAD(_hnbgw->sccp.cnpool_iups.cnlinks); -} - -static struct hnb_context *hnb_context_by_id(uint32_t cid) -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { - if (hnb->id.cid == cid) - return hnb; - } - - return NULL; -} - -struct hnb_context *hnb_context_by_identity_info(const char *identity_info) -{ - struct hnb_context *hnb; - - llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { - if (strcmp(identity_info, hnb->identity_info) == 0) - return hnb; - } - - return NULL; -} +/*** + * UE Context + ***/ struct ue_context *ue_context_by_id(uint32_t id) { @@ -212,6 +137,141 @@ talloc_free(ue); } + +/*** + * HNB Context + ***/ + +/* look-up HNB context by id. Used from CTRL */ +static struct hnb_context *hnb_context_by_id(uint32_t cid) +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { + if (hnb->id.cid == cid) + return hnb; + } + + return NULL; +} + +/* look-up HNB context by identity_info. Used from VTY */ +struct hnb_context *hnb_context_by_identity_info(const char *identity_info) +{ + struct hnb_context *hnb; + + llist_for_each_entry(hnb, _hnbgw->hnb_list, list) { + if (strcmp(identity_info, hnb->identity_info) == 0) + return hnb; + } + + return NULL; +} + +static int hnb_read_cb(struct osmo_stream_srv *conn); +static int hnb_closed_cb(struct osmo_stream_srv *conn); + +static struct hnb_context *hnb_context_alloc(struct osmo_stream_srv_link *link, int new_fd) +{ + struct hnb_context *ctx; + + ctx = talloc_zero(g_hnbgw, struct hnb_context); + if (!ctx) + return NULL; + INIT_LLIST_HEAD(>map_list); + + ctx->conn = osmo_stream_srv_create(g_hnbgw,