[MERGED] osmo-pcu[master]: Move PDCH-related functions into separate files
Harald Welte has submitted this change and it was merged. Change subject: Move PDCH-related functions into separate files .. Move PDCH-related functions into separate files The PDCH class and corresponding functions are rather self-contained and independent from BTS implementation. Let's move them into separate file to make bts.cpp more manageable. As additional benefit it allow us to somewhat untangle all the different cross-dependent includes. Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Related: OS#1539 --- M src/Makefile.am M src/bts.cpp M src/bts.h M src/gprs_bssgp_pcu.cpp M src/gprs_rlcmac_sched.cpp M src/gprs_rlcmac_ts_alloc.cpp M src/osmo-bts-litecell15/lc15_l1_if.c M src/osmo-bts-sysmo/sysmo_l1_if.c M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_vty.c M src/pcu_vty_functions.cpp A src/pdch.cpp A src/pdch.h M src/sba.cpp M src/tbf.cpp 16 files changed, 1,125 insertions(+), 1,020 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/Makefile.am b/src/Makefile.am index 7d2a62e..b2f64f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,6 +54,7 @@ tbf_ul.cpp \ tbf_dl.cpp \ bts.cpp \ + pdch.cpp \ poll_controller.cpp \ encoding.cpp \ sba.cpp \ @@ -85,6 +86,7 @@ mslot_class.h \ tbf.h \ bts.h \ + pdch.h \ poll_controller.h \ encoding.h \ sba.h \ diff --git a/src/bts.cpp b/src/bts.cpp index b0d92f0..47607df 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -29,6 +29,7 @@ #include #include #include +#include extern "C" { #include @@ -825,801 +826,6 @@ return ms; } -/* - * PDCH code below. TODO: move to a separate file - */ - -void gprs_rlcmac_pdch::enable() -{ - /* TODO: Check if there are still allocated resources.. */ - INIT_LLIST_HEAD(&paging_list); - m_is_enabled = 1; -} - -void gprs_rlcmac_pdch::disable() -{ - /* TODO.. kick free_resources once we know the TRX/TS we are on */ - m_is_enabled = 0; -} - -void gprs_rlcmac_pdch::free_resources() -{ - struct gprs_rlcmac_paging *pag; - - /* we are not enabled. there should be no resources */ - if (!is_enabled()) - return; - - /* kick all TBF on slot */ - gprs_rlcmac_tbf::free_all(this); - - /* flush all pending paging messages */ - while ((pag = dequeue_paging())) - talloc_free(pag); - - trx->bts->sba()->free_resources(this); -} - -struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging() -{ - struct gprs_rlcmac_paging *pag; - - if (llist_empty(&paging_list)) - return NULL; - pag = llist_entry(paging_list.next, struct gprs_rlcmac_paging, list); - llist_del(&pag->list); - - return pag; -} - -struct msgb *gprs_rlcmac_pdch::packet_paging_request() -{ - struct gprs_rlcmac_paging *pag; - struct msgb *msg; - unsigned wp = 0, len; - - /* no paging, no message */ - pag = dequeue_paging(); - if (!pag) - return NULL; - - LOGP(DRLCMAC, LOGL_DEBUG, "Scheduling paging\n"); - - /* alloc message */ - msg = msgb_alloc(23, "pag ctrl block"); - if (!msg) { - talloc_free(pag); - return NULL; - } - bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx); - if (!pag_vec) { - msgb_free(msg); - talloc_free(pag); - return NULL; - } - wp = Encoding::write_packet_paging_request(pag_vec); - - /* loop until message is full */ - while (pag) { - /* try to add paging */ - if ((pag->identity_lv[1] & 0x07) == 4) { - /* TMSI */ - LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n", - ntohl(*((uint32_t *)(pag->identity_lv + 1; - len = 1 + 1 + 1 + 32 + 2 + 1; - if (pag->identity_lv[0] != 5) { - LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with " - "MI != 5 octets!\n"); - goto continue_next; - } - } else { - /* MI */ - LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n", - osmo_hexdump(pag->identity_lv + 1, - pag->identity_lv[0])); - len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1; - if (pag->identity_lv[0] > 8) { - LOGP(DRLCMAC, LOGL_ERROR, "Paging with " - "MI > 8 octets!\n"); - goto continue_next; - } - } - if (wp + len > 184
osmo-pcu[master]: Move PDCH-related functions into separate files
Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6053 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Gerrit-PatchSet: 6 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-pcu[master]: Move PDCH-related functions into separate files
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6053 to look at the new patch set (#6). Move PDCH-related functions into separate files The PDCH class and corresponding functions are rather self-contained and independent from BTS implementation. Let's move them into separate file to make bts.cpp more manageable. As additional benefit it allow us to somewhat untangle all the different cross-dependent includes. Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Related: OS#1539 --- M src/Makefile.am M src/bts.cpp M src/bts.h M src/gprs_bssgp_pcu.cpp M src/gprs_rlcmac_sched.cpp M src/gprs_rlcmac_ts_alloc.cpp M src/osmo-bts-litecell15/lc15_l1_if.c M src/osmo-bts-sysmo/sysmo_l1_if.c M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_vty.c M src/pcu_vty_functions.cpp A src/pdch.cpp A src/pdch.h M src/sba.cpp M src/tbf.cpp 16 files changed, 1,125 insertions(+), 1,020 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/6053/6 diff --git a/src/Makefile.am b/src/Makefile.am index 7d2a62e..b2f64f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,6 +54,7 @@ tbf_ul.cpp \ tbf_dl.cpp \ bts.cpp \ + pdch.cpp \ poll_controller.cpp \ encoding.cpp \ sba.cpp \ @@ -85,6 +86,7 @@ mslot_class.h \ tbf.h \ bts.h \ + pdch.h \ poll_controller.h \ encoding.h \ sba.h \ diff --git a/src/bts.cpp b/src/bts.cpp index b0d92f0..47607df 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -29,6 +29,7 @@ #include #include #include +#include extern "C" { #include @@ -825,801 +826,6 @@ return ms; } -/* - * PDCH code below. TODO: move to a separate file - */ - -void gprs_rlcmac_pdch::enable() -{ - /* TODO: Check if there are still allocated resources.. */ - INIT_LLIST_HEAD(&paging_list); - m_is_enabled = 1; -} - -void gprs_rlcmac_pdch::disable() -{ - /* TODO.. kick free_resources once we know the TRX/TS we are on */ - m_is_enabled = 0; -} - -void gprs_rlcmac_pdch::free_resources() -{ - struct gprs_rlcmac_paging *pag; - - /* we are not enabled. there should be no resources */ - if (!is_enabled()) - return; - - /* kick all TBF on slot */ - gprs_rlcmac_tbf::free_all(this); - - /* flush all pending paging messages */ - while ((pag = dequeue_paging())) - talloc_free(pag); - - trx->bts->sba()->free_resources(this); -} - -struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging() -{ - struct gprs_rlcmac_paging *pag; - - if (llist_empty(&paging_list)) - return NULL; - pag = llist_entry(paging_list.next, struct gprs_rlcmac_paging, list); - llist_del(&pag->list); - - return pag; -} - -struct msgb *gprs_rlcmac_pdch::packet_paging_request() -{ - struct gprs_rlcmac_paging *pag; - struct msgb *msg; - unsigned wp = 0, len; - - /* no paging, no message */ - pag = dequeue_paging(); - if (!pag) - return NULL; - - LOGP(DRLCMAC, LOGL_DEBUG, "Scheduling paging\n"); - - /* alloc message */ - msg = msgb_alloc(23, "pag ctrl block"); - if (!msg) { - talloc_free(pag); - return NULL; - } - bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx); - if (!pag_vec) { - msgb_free(msg); - talloc_free(pag); - return NULL; - } - wp = Encoding::write_packet_paging_request(pag_vec); - - /* loop until message is full */ - while (pag) { - /* try to add paging */ - if ((pag->identity_lv[1] & 0x07) == 4) { - /* TMSI */ - LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n", - ntohl(*((uint32_t *)(pag->identity_lv + 1; - len = 1 + 1 + 1 + 32 + 2 + 1; - if (pag->identity_lv[0] != 5) { - LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with " - "MI != 5 octets!\n"); - goto continue_next; - } - } else { - /* MI */ - LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n", - osmo_hexdump(pag->identity_lv + 1, - pag->identity_lv[0])); - len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1; - if (pag->identity_lv[0] > 8) { - LOGP(DRLCMAC, LOGL_ERROR, "Paging with " - "MI > 8 octets!\n"); - goto continue_next; - } - } - if (wp + len > 184) { - LOGP(DRLCMAC, L
osmo-pcu[master]: Move PDCH-related functions into separate files
Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6053 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Gerrit-PatchSet: 5 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-pcu[master]: Move PDCH-related functions into separate files
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6053 to look at the new patch set (#5). Move PDCH-related functions into separate files The PDCH class and corresponding functions are rather self-contained and independent from BTS implementation. Let's move them into separate file to make bts.cpp more manageable. As additional benefit it allow us to somewhat untangle all the different cross-dependent includes. Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683 Related: OS#1539 --- M src/Makefile.am M src/bts.cpp M src/bts.h M src/gprs_bssgp_pcu.cpp M src/gprs_rlcmac_sched.cpp M src/gprs_rlcmac_ts_alloc.cpp M src/osmo-bts-litecell15/lc15_l1_if.c M src/osmo-bts-sysmo/sysmo_l1_if.c M src/osmobts_sock.cpp M src/pcu_l1_if.cpp M src/pcu_vty.c M src/pcu_vty_functions.cpp A src/pdch.cpp A src/pdch.h M src/sba.cpp M src/tbf.cpp 16 files changed, 1,122 insertions(+), 1,020 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/6053/5 diff --git a/src/Makefile.am b/src/Makefile.am index 7d2a62e..b2f64f2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,6 +54,7 @@ tbf_ul.cpp \ tbf_dl.cpp \ bts.cpp \ + pdch.cpp \ poll_controller.cpp \ encoding.cpp \ sba.cpp \ @@ -85,6 +86,7 @@ mslot_class.h \ tbf.h \ bts.h \ + pdch.h \ poll_controller.h \ encoding.h \ sba.h \ diff --git a/src/bts.cpp b/src/bts.cpp index 24be5d4..096d3af 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -29,6 +29,7 @@ #include #include #include +#include extern "C" { #include @@ -841,801 +842,6 @@ return ms; } -/* - * PDCH code below. TODO: move to a separate file - */ - -void gprs_rlcmac_pdch::enable() -{ - /* TODO: Check if there are still allocated resources.. */ - INIT_LLIST_HEAD(&paging_list); - m_is_enabled = 1; -} - -void gprs_rlcmac_pdch::disable() -{ - /* TODO.. kick free_resources once we know the TRX/TS we are on */ - m_is_enabled = 0; -} - -void gprs_rlcmac_pdch::free_resources() -{ - struct gprs_rlcmac_paging *pag; - - /* we are not enabled. there should be no resources */ - if (!is_enabled()) - return; - - /* kick all TBF on slot */ - gprs_rlcmac_tbf::free_all(this); - - /* flush all pending paging messages */ - while ((pag = dequeue_paging())) - talloc_free(pag); - - trx->bts->sba()->free_resources(this); -} - -struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging() -{ - struct gprs_rlcmac_paging *pag; - - if (llist_empty(&paging_list)) - return NULL; - pag = llist_entry(paging_list.next, struct gprs_rlcmac_paging, list); - llist_del(&pag->list); - - return pag; -} - -struct msgb *gprs_rlcmac_pdch::packet_paging_request() -{ - struct gprs_rlcmac_paging *pag; - struct msgb *msg; - unsigned wp = 0, len; - - /* no paging, no message */ - pag = dequeue_paging(); - if (!pag) - return NULL; - - LOGP(DRLCMAC, LOGL_DEBUG, "Scheduling paging\n"); - - /* alloc message */ - msg = msgb_alloc(23, "pag ctrl block"); - if (!msg) { - talloc_free(pag); - return NULL; - } - bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx); - if (!pag_vec) { - msgb_free(msg); - talloc_free(pag); - return NULL; - } - wp = Encoding::write_packet_paging_request(pag_vec); - - /* loop until message is full */ - while (pag) { - /* try to add paging */ - if ((pag->identity_lv[1] & 0x07) == 4) { - /* TMSI */ - LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n", - ntohl(*((uint32_t *)(pag->identity_lv + 1; - len = 1 + 1 + 1 + 32 + 2 + 1; - if (pag->identity_lv[0] != 5) { - LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with " - "MI != 5 octets!\n"); - goto continue_next; - } - } else { - /* MI */ - LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n", - osmo_hexdump(pag->identity_lv + 1, - pag->identity_lv[0])); - len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1; - if (pag->identity_lv[0] > 8) { - LOGP(DRLCMAC, LOGL_ERROR, "Paging with " - "MI > 8 octets!\n"); - goto continue_next; - } - } - if (wp + len > 184) { - LOGP(DRLCMAC, LOGL_DEBUG, "-