Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3157

to look at the new patch set (#2).

Move DL assignment to TBF-DL

This function does not really belongs to BTS and it heavily relies on
direct access to TBF-DL members anyway.

Change-Id: I04584103018675a2f35cfb565473bfd81a208d7c
Closes: OS#1540
---
M src/bts.cpp
M src/bts.h
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
5 files changed, 38 insertions(+), 39 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/57/3157/2

diff --git a/src/bts.cpp b/src/bts.cpp
index 21d5b17..5f7d9e8 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -768,40 +768,6 @@
        return sb;
 }
 
-/* depending on the current TBF, we assign on PACCH or AGCH */
-void BTS::trigger_dl_ass(
-       struct gprs_rlcmac_dl_tbf *dl_tbf,
-       struct gprs_rlcmac_tbf *old_tbf)
-{
-       /* stop pending timer */
-       dl_tbf->stop_timer();
-
-       /* check for downlink tbf:  */
-       if (old_tbf) {
-               LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment on "
-                       "PACCH, because %s exists\n", tbf_name(old_tbf));
-               old_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS;
-
-               old_tbf->was_releasing = 
old_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
-
-               /* change state */
-               dl_tbf->set_state(GPRS_RLCMAC_ASSIGN);
-               if (!(dl_tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
-                       dl_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
-               /* start timer */
-               tbf_timer_start(dl_tbf, 0, Tassign_pacch);
-       } else {
-               LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment for %s on 
PCH, no TBF exist (IMSI=%s)\n", tbf_name(dl_tbf), dl_tbf->imsi());
-               dl_tbf->was_releasing = 
dl_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
-               /* change state */
-               dl_tbf->set_state(GPRS_RLCMAC_ASSIGN);
-               dl_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
-               /* send immediate assignment */
-               dl_tbf->bts->snd_dl_ass(dl_tbf, 0, dl_tbf->imsi());
-               dl_tbf->m_wait_confirm = 1;
-       }
-}
-
 void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi)
 {
        int plen;
diff --git a/src/bts.h b/src/bts.h
index 7983fa2..f742def 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -354,7 +354,6 @@
        int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit,
                enum ph_burst_type burst_type);
 
-       void trigger_dl_ass(gprs_rlcmac_dl_tbf *tbf, gprs_rlcmac_tbf *old_tbf);
        void snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi);
 
        GprsMsStorage &ms_store();
@@ -478,7 +477,6 @@
        /* list of downlink TBFs */
        LListHead<gprs_rlcmac_tbf> m_dl_tbfs;
 
-private:
        /* disable copying to avoid slicing */
        BTS(const BTS&);
        BTS& operator=(const BTS&);
diff --git a/src/tbf.cpp b/src/tbf.cpp
index fa67e41..b2acb11 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -992,7 +992,7 @@
 
                                dl_tbf->update();
 
-                               dl_tbf->bts->trigger_dl_ass(dl_tbf, dl_tbf);
+                               dl_tbf->trigger_ass(dl_tbf);
                        } else
                                LOGP(DRLCMAC, LOGL_NOTICE, "%s Continue flow 
after "
                                        "IMM.ASS confirm\n", tbf_name(dl_tbf));
@@ -1280,7 +1280,7 @@
 
        LOGP(DRLCMAC, LOGL_DEBUG, "%s Trigger downlink assignment on PACCH\n",
                tbf_name(this));
-       bts->trigger_dl_ass(new_tbf, this);
+       new_tbf->trigger_ass(this);
 
        return 0;
 }
diff --git a/src/tbf.h b/src/tbf.h
index dba6dbd..cd8d694 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -423,6 +423,7 @@
        int rcvd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb);
        int rcvd_dl_ack(uint8_t final_ack, unsigned first_bsn, struct bitvec 
*rbb);
        struct msgb *create_dl_acked_block(uint32_t fn, uint8_t ts);
+       void trigger_ass(struct gprs_rlcmac_tbf *old_tbf);
        void clear_poll_timeout_flag();
        bool handle_ack_nack();
        void request_dl_ack();
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index a894789..375d642 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -167,7 +167,7 @@
         * we don't use old_downlink, so the possible uplink is used
         * to trigger downlink assignment. if there is no uplink,
         * AGCH is used. */
-       dl_tbf->bts->trigger_dl_ass(dl_tbf, old_ul_tbf);
+       dl_tbf->trigger_ass(old_ul_tbf);
        *tbf = dl_tbf;
        return 0;
 }
@@ -486,6 +486,40 @@
        return create_dl_acked_block(fn, ts, bsn, bsn2);
 }
 
+/* depending on the current TBF, we assign on PACCH or AGCH */
+void gprs_rlcmac_dl_tbf::trigger_ass(struct gprs_rlcmac_tbf *old_tbf)
+{
+       /* stop pending timer */
+       stop_timer();
+
+       /* check for downlink tbf:  */
+       if (old_tbf) {
+               LOGP(DRLCMACDL, LOGL_DEBUG, "Send dowlink assignment on PACCH, 
because %s exists\n", tbf_name(old_tbf));
+               old_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS;
+               old_tbf->was_releasing = 
old_tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE);
+
+               /* change state */
+               set_state(GPRS_RLCMAC_ASSIGN);
+               if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
+                       state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
+
+               /* start timer */
+               tbf_timer_start(this, 0, Tassign_pacch);
+       } else {
+               LOGP(DRLCMACDL, LOGL_DEBUG, "Send dowlink assignment for %s on 
PCH, no TBF exist (IMSI=%s)\n",
+                    tbf_name(this), imsi());
+               was_releasing = state_is(GPRS_RLCMAC_WAIT_RELEASE);
+
+               /* change state */
+               set_state(GPRS_RLCMAC_ASSIGN);
+               state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
+
+               /* send immediate assignment */
+               bts->snd_dl_ass(this, 0, imsi());
+               m_wait_confirm = 1;
+       }
+}
+
 void gprs_rlcmac_dl_tbf::schedule_next_frame()
 {
        struct msgb *msg;

-- 
To view, visit https://gerrit.osmocom.org/3157
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I04584103018675a2f35cfb565473bfd81a208d7c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to