fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/35775?usp=email )


Change subject: WIP: Delay deleting UL TBF until last Pkt Ctrl Ack is fully 
transmitted
......................................................................

WIP: Delay deleting UL TBF until last Pkt Ctrl Ack is fully transmitted

This in turn delays reconfiguring the lower layers (L1CTL-CFG_UL_TBF.req
mask=0x0) until the last block has been transmited.

Change-Id: Ic38b4207623ccbda3b77d4b0a47431c25de95034
---
M src/rlcmac/rlcmac_prim.c
M src/rlcmac/sched.c
M src/rlcmac/tbf_ul_fsm.c
3 files changed, 54 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/75/35775/1

diff --git a/src/rlcmac/rlcmac_prim.c b/src/rlcmac/rlcmac_prim.c
index b8518c0..404d536 100644
--- a/src/rlcmac/rlcmac_prim.c
+++ b/src/rlcmac/rlcmac_prim.c
@@ -646,6 +646,31 @@
        return rc;
 }

+static int rlcmac_prim_handle_l1ctl_pdch_data_cnf(struct osmo_gprs_rlcmac_prim 
*rlcmac_prim)
+{
+       enum osmo_gprs_rlcmac_ul_msg_type msg_type;
+       struct gprs_rlcmac_entity *gre;
+       int rc;
+
+       msg_type = 
get_rlcmac_block_ctrl_type(rlcmac_prim->l1ctl.pdch_data_cnf.data);
+       if (msg_type != OSMO_GPRS_RLCMAC_UL_MSGT_PACKET_CONTROL_ACK)
+               return 0;
+
+       llist_for_each_entry(gre, &g_rlcmac_ctx->gre_list, entry) {
+               if (!gre->ul_tbf)
+                       continue;
+               if 
(!gprs_rlcmac_ul_tbf_waiting_pkt_ctrl_ack_confirmation(gre->ul_tbf,
+                                                                         
rlcmac_prim->l1ctl.pdch_data_cnf.fn,
+                                                                         
rlcmac_prim->l1ctl.pdch_data_cnf.ts_nr))
+                       continue;
+
+               osmo_fsm_inst_dispatch(gre->ul_tbf->state_fsm.fi, 
GPRS_RLCMAC_TBF_UL_EV_TX_COMPL_PKT_CTRL_ACK, NULL);
+               /* gre->ul_tbf is NULL here. */
+               break;
+       }
+       return 0;
+}
+
 static int rlcmac_prim_handle_l1ctl_ccch_ready_ind(struct 
osmo_gprs_rlcmac_prim *rlcmac_prim)
 {
        struct gprs_rlcmac_entity *gre;
@@ -670,6 +695,9 @@
        case OSMO_PRIM(OSMO_GPRS_RLCMAC_L1CTL_PDCH_DATA, PRIM_OP_INDICATION):
                rc = rlcmac_prim_handle_l1ctl_pdch_data_ind(rlcmac_prim);
                break;
+       case OSMO_PRIM(OSMO_GPRS_RLCMAC_L1CTL_PDCH_DATA, PRIM_OP_CONFIRM):
+               rc = rlcmac_prim_handle_l1ctl_pdch_data_cnf(rlcmac_prim);
+               break;
        case OSMO_PRIM(OSMO_GPRS_RLCMAC_L1CTL_CCCH_DATA, PRIM_OP_INDICATION):
                rc = rlcmac_prim_handle_l1ctl_ccch_data_ind(rlcmac_prim);
                break;
diff --git a/src/rlcmac/sched.c b/src/rlcmac/sched.c
index 1620934..877c41d 100644
--- a/src/rlcmac/sched.c
+++ b/src/rlcmac/sched.c
@@ -159,10 +159,11 @@
  * \param[in] bi  RTS block indication information.
  * \param[in] tbfs  TBF candidates having CTRL messages to send, filled in by 
get_ctrl_msg_tbf_candidates()
  * \param[out] tbf_to_free  TBF to free after sending the generated message
+ * TODO: need_block_conf
  */
 static struct msgb *sched_select_ctrl_msg(const struct 
gprs_rlcmac_rts_block_ind *bi,
                                          const struct 
tbf_sched_ctrl_candidates *tbfs,
-                                         struct gprs_rlcmac_tbf **tbf_to_free)
+                                         struct gprs_rlcmac_tbf **tbf_to_free, 
bool *need_block_conf)
 {
        struct msgb *msg = NULL;
        struct gprs_rlcmac_entity *gre;
@@ -171,6 +172,9 @@
        /* No TBF to be freed by default: */
        *tbf_to_free = NULL;

+       /* No TBF needs block conf by default: */
+       *need_block_conf = false;
+
        /* 8.1.2.2 1) (EGPRS) PACKET DOWNLINK ACK/NACK w/ FinalAckInd=1 */
        if (tbfs->poll_dl_ack_final_ack) {
                LOGRLCMAC(LOGL_DEBUG, "(ts=%u,fn=%u,usf=%u) Tx DL ACK/NACK 
FinalAck=1\n",
@@ -207,9 +211,10 @@
        if (tbfs->poll_ul_ack) {
                LOGRLCMAC(LOGL_DEBUG, "(ts=%u,fn=%u,usf=%u) Tx Pkt Control Ack 
(UL ACK/NACK poll)\n",
                          bi->ts, bi->fn, bi->usf);
+               /* This needs to be changed to call a UL TBF API which will 
store at which FN+TN the PKT CTRL ACK was sent. */
                msg = 
gprs_rlcmac_gre_create_pkt_ctrl_ack(ul_tbf_as_tbf(tbfs->poll_ul_ack)->gre);
                /* Last UL message, freeing (after passing msg to lower layers) 
*/
-               *tbf_to_free = ul_tbf_as_tbf(tbfs->poll_ul_ack);
+               //*tbf_to_free = ul_tbf_as_tbf(tbfs->poll_ul_ack);
                return msg;
        }
        if (tbfs->poll_dl_ass) {
@@ -289,6 +294,7 @@
        struct msgb *msg = NULL;
        struct tbf_sched_ctrl_candidates tbf_cand = {0};
        struct gprs_rlcmac_tbf *tbf_to_free;
+       bool need_block_conf;
        struct osmo_gprs_rlcmac_prim *rlcmac_prim_tx;
        int rc = 0;

@@ -296,7 +302,7 @@

        get_ctrl_msg_tbf_candidates(bi, &tbf_cand);

-       if ((msg = sched_select_ctrl_msg(bi, &tbf_cand, &tbf_to_free)))
+       if ((msg = sched_select_ctrl_msg(bi, &tbf_cand, &tbf_to_free, 
&need_block_conf)))
                goto tx_msg;

        if ((msg = sched_select_ul_data_msg(bi)))
@@ -312,6 +318,7 @@
 tx_msg:
        rlcmac_prim_tx = gprs_rlcmac_prim_alloc_l1ctl_pdch_data_req(bi->ts, 
bi->fn, msgb_data(msg), 0);
        rlcmac_prim_tx->l1ctl.pdch_data_req.data_len = msgb_length(msg);
+       rlcmac_prim_tx->l1ctl.pdch_data_req.needs_conf = need_block_conf;
        rc = gprs_rlcmac_prim_call_down_cb(rlcmac_prim_tx);
        msgb_free(msg);
        if (tbf_to_free)
diff --git a/src/rlcmac/tbf_ul_fsm.c b/src/rlcmac/tbf_ul_fsm.c
index 0949ca6..ff801de 100644
--- a/src/rlcmac/tbf_ul_fsm.c
+++ b/src/rlcmac/tbf_ul_fsm.c
@@ -266,8 +266,11 @@
 /* Waiting for scheduler to transmit PKT CTRL ACK for the already received UL 
ACK/NACK FinalAck=1 */
 static void st_releasing(struct osmo_fsm_inst *fi, uint32_t event, void *data)
 {
-       //struct gprs_rlcmac_tbf_ul_fsm_ctx *ctx = (struct 
gprs_rlcmac_tbf_ul_fsm_ctx *)fi->priv;
+       struct gprs_rlcmac_tbf_ul_fsm_ctx *ctx = (struct 
gprs_rlcmac_tbf_ul_fsm_ctx *)fi->priv;
        switch (event) {
+       case GPRS_RLCMAC_TBF_UL_EV_TX_COMPL_PKT_CTRL_ACK:
+               tbf_ul_free(ctx->ul_tbf);
+               break;
        default:
                OSMO_ASSERT(0);
        }

--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35775?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Ic38b4207623ccbda3b77d4b0a47431c25de95034
Gerrit-Change-Number: 35775
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-CC: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to