pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/30623 )


Change subject: Pass gprs_rlcmac_pdch to create_dl_acked_block()
......................................................................

Pass gprs_rlcmac_pdch to create_dl_acked_block()

This allows having full TS information, not only ts_no, which will be
needed later on followup patches.

Change-Id: I1efccb32c5afa4fe62233bf114ea95b6fbbe1a06
---
M src/gprs_rlcmac_sched.cpp
M src/tbf_dl.cpp
M src/tbf_dl.h
M tests/tbf/TbfTest.cpp
4 files changed, 17 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/23/30623/1

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 87a3733..0a72e3b 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -278,7 +278,6 @@
        struct msgb *msg = NULL;
        struct gprs_rlcmac_dl_tbf *tbf, *prio_tbf = NULL;
        enum tbf_dl_prio prio, max_prio = DL_PRIO_NONE;
-       uint8_t ts = pdch->ts_no;

        uint8_t i, tfi, prio_tfi;
        int age;
@@ -334,7 +333,7 @@
                /* next TBF to handle resource is the next one */
                pdch->next_dl_tfi = (prio_tfi + 1) & 31;
                /* generate DL data block */
-               msg = prio_tbf->create_dl_acked_block(fn, ts, req_mcs_kind);
+               msg = prio_tbf->create_dl_acked_block(fn, pdch, req_mcs_kind);
                *is_egprs = prio_tbf->is_egprs_enabled();
        }

diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 16dc47b..9214aae 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -391,7 +391,7 @@
  * Create DL data block
  * The messages are fragmented and forwarded as data blocks.
  */
-struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(uint32_t fn, uint8_t 
ts, enum mcs_kind req_mcs_kind)
+struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(uint32_t fn, const 
struct gprs_rlcmac_pdch *pdch, enum mcs_kind req_mcs_kind)
 {
        int bsn, bsn2 = -1;
        bool may_combine;
@@ -406,7 +406,7 @@
        if (may_combine)
                bsn2 = take_next_bsn(fn, bsn, req_mcs_kind, &may_combine);

-       return create_dl_acked_block(fn, ts, bsn, bsn2);
+       return create_dl_acked_block(fn, pdch, bsn, bsn2);
 }

 /* old_tbf (UL TBF or DL TBF) will send a Pkt Dl Ass on PACCH to assign tbf.
@@ -621,7 +621,7 @@
 }

 struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
-                               const uint32_t fn, const uint8_t ts,
+                               const uint32_t fn, const struct 
gprs_rlcmac_pdch *pdch,
                                int index, int index2)
 {
        uint8_t *msg_data;
@@ -803,12 +803,12 @@
                                  POLL_ACK_AFTER_FRAMES);
                }

-               rc = check_polling(fn, ts, &new_poll_fn, &rrbp);
+               rc = check_polling(fn, pdch->ts_no, &new_poll_fn, &rrbp);
                if (rc >= 0) {
-                       set_polling(new_poll_fn, ts, PDCH_ULC_POLL_DL_ACK);
+                       set_polling(new_poll_fn, pdch->ts_no, 
PDCH_ULC_POLL_DL_ACK);
                        LOGPTBFDL(this, LOGL_DEBUG,
                                  "Scheduled DL Acknowledgement polling on 
PACCH (FN=%d, TS=%d)\n",
-                                 new_poll_fn, ts);
+                                 new_poll_fn, pdch->ts_no);

                        m_tx_counter = 0;
                        /* start timer whenever we send the final block */
@@ -828,7 +828,7 @@

                        LOGPTBFDL(this, LOGL_INFO,
                                  "Scheduled Ack/Nack polling on FN=%d, 
TS=%d\n",
-                                 new_poll_fn, ts);
+                                 new_poll_fn, pdch->ts_no);
                }
        }

diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index 2fc4f5f..4fdfbed 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -48,7 +48,8 @@
        gprs_rlc_window *window();

        int rcvd_dl_ack(bool final_ack, unsigned first_bsn, struct bitvec *rbb);
-       struct msgb *create_dl_acked_block(uint32_t fn, uint8_t ts, enum 
mcs_kind req_mcs_kind = EGPRS);
+       struct msgb *create_dl_acked_block(uint32_t fn, const gprs_rlcmac_pdch 
*pdch,
+                                          enum mcs_kind req_mcs_kind = EGPRS);

        void request_dl_ack();
        bool need_poll_for_dl_ack_nack() const;
@@ -100,8 +101,8 @@
                          bool *may_combine);
        bool restart_bsn_cycle();
        int create_new_bsn(const uint32_t fn, enum CodingScheme cs);
-       struct msgb *create_dl_acked_block(const uint32_t fn, const uint8_t ts,
-                                       int index, int index2 = -1);
+       struct msgb *create_dl_acked_block(const uint32_t fn, const struct 
gprs_rlcmac_pdch *pdch,
+                                          int index, int index2 = -1);
        int update_window(unsigned first_bsn, const struct bitvec *rbb);
        int rcvd_dl_final_ack();
        bool dl_window_stalled() const;
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index ba357e3..6d57843 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -535,6 +535,7 @@
 {
        the_pcu = prepare_pcu();
        struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
+       struct gprs_rlcmac_pdch *pdch;
        uint8_t ts_no = 4;
        uint8_t ms_class = 45;
        int rc = 0;
@@ -554,6 +555,7 @@
        fprintf(stderr, "=== start %s ===\n", __func__);

        setup_bts(bts, ts_no);
+       pdch = &bts->trx[0].pdch[ts_no];
        /* keep the MS object 10 seconds */
        OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2030, 10, OSMO_TDEF_S) == 
0);

@@ -612,7 +614,7 @@
        };

        while (ms_dl_tbf(ms)->have_data()) {
-               msg = ms_dl_tbf(ms)->create_dl_acked_block(fn += 4, ts_no);
+               msg = ms_dl_tbf(ms)->create_dl_acked_block(fn += 4, pdch);
                fprintf(stderr, "MSG = %s\n", msgb_hexdump(msg));
                if (!msgb_eq_data_print(msg, exp[expected_data - 1], 
GSM_MACBLOCK_LEN))
                        fprintf(stderr, "%s failed at %u\n", __func__, 
expected_data);
@@ -2865,7 +2867,7 @@
        } while(0)

 #define MAKE_ACKED(m, tbf, fn, cs, check_unacked) do {                 \
-               m = tbf->create_dl_acked_block(fn, tbf->control_ts->ts_no);     
\
+               m = tbf->create_dl_acked_block(fn, tbf->control_ts);    \
                OSMO_ASSERT(m);                                         \
                if (check_unacked)                                      \
                        CHECK_UNACKED(tbf, cs, 0);                      \
@@ -2940,7 +2942,7 @@

        NACK(dl_tbf, 0);

-       msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts->ts_no);
+       msg = dl_tbf->create_dl_acked_block(fn, dl_tbf->control_ts);
        egprs2 = (struct gprs_rlc_dl_header_egprs_2 *) msg->data;

        /* Table 10.4.8a.3.1 of 44.060 */

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/30623
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I1efccb32c5afa4fe62233bf114ea95b6fbbe1a06
Gerrit-Change-Number: 30623
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to