pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33903 )
Change subject: trxcon: trx_if_cmd_poweron(): send CMD POWERON unconditionally
......................................................................
trxcon: trx_if_cmd_poweron(): send CMD POWERON unconditionally
This works-around a race condition happening when the upper layers
are sending L1CTL RESET.req immediately followed by L1CTL FBSB.req.
The problem is that the TRXC logic is considering the transceiver
powered on until a response to CMD POWEROFF is received.
Change-Id: I967ce047eb198f1eaf8446bb4c1f87a98d3de264
Related: OS#5500
---
M src/host/trxcon/src/trx_if.c
1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/03/33903/1
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c
index d98bea2..fad1026 100644
--- a/src/host/trxcon/src/trx_if.c
+++ b/src/host/trxcon/src/trx_if.c
@@ -261,8 +261,10 @@
static int trx_if_cmd_poweron(struct trx_instance *trx)
{
+#if 0
if (trx->powered_up)
return -EAGAIN;
+#endif
return trx_ctrl_cmd(trx, 1, "POWERON", "");
}
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33903
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I967ce047eb198f1eaf8446bb4c1f87a98d3de264
Gerrit-Change-Number: 33903
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33906 )
Change subject: layer23: modem: Avoid direct transition ST_PACKET_TRANSFER->ST_PACKET_IDLE
......................................................................
layer23: modem: Avoid direct transition ST_PACKET_TRANSFER->ST_PACKET_IDLE
Right now the existing code is switching to state IDLE and hence running
grr_st_packet_idle_onenter() which attempts stuff like starting an attach.
This is all done while the L1CTL RESET + FBSB is still in progress. We
should instead wait to receive confirmation from those.
As an easy implementation for now, simply switch to the
GRR_ST_PACKET_NOT_READY state, which will move to GRR_ST_PACKET_IDLE
once it starts receiving CCCH blocks (aka it will already have gone
through L1CTL RESET + FBSB completely).
Change-Id: Ie797b36701d10c6052500c637a08b061bb1e4bd7
---
M src/host/layer23/src/modem/grr.c
1 file changed, 20 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/06/33906/1
diff --git a/src/host/layer23/src/modem/grr.c b/src/host/layer23/src/modem/grr.c
index 2047eef..12d7059 100644
--- a/src/host/layer23/src/modem/grr.c
+++ b/src/host/layer23/src/modem/grr.c
@@ -688,7 +688,7 @@
break;
case GRR_EV_PDCH_RELEASE_REQ:
modem_sync_to_cell(ms);
- osmo_fsm_inst_state_chg(fi, GRR_ST_PACKET_IDLE, 0, 0);
+ osmo_fsm_inst_state_chg(fi, GRR_ST_PACKET_NOT_READY, 0, 0);
break;
default:
OSMO_ASSERT(0);
@@ -717,8 +717,7 @@
},
[GRR_ST_PACKET_TRANSFER] = {
.name = "PACKET_TRANSFER",
- .out_state_mask = S(GRR_ST_PACKET_NOT_READY)
- | S(GRR_ST_PACKET_IDLE),
+ .out_state_mask = S(GRR_ST_PACKET_NOT_READY),
.in_event_mask = S(GRR_EV_PDCH_UL_TBF_CFG_REQ)
| S(GRR_EV_PDCH_DL_TBF_CFG_REQ)
| S(GRR_EV_PDCH_BLOCK_REQ)
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33906
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie797b36701d10c6052500c637a08b061bb1e4bd7
Gerrit-Change-Number: 33906
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: pespin.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33888 )
Change subject: rlcmac: ul_tbf: Move logic selecting proper queue to helper function
......................................................................
Patch Set 2: Code-Review+1
(1 comment)
File src/rlcmac/tbf_ul.c:
https://gerrit.osmocom.org/c/libosmo-gprs/+/33888/comment/5a3a4bc2_aabd96d8
PS1, Line 331: /* Returns the MS/GRE queue unless the UL TBF has entered Countdown Procedure. In that case, it returns the specific frozen queue. */
> very long line
Done
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33888
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Icceaf53048e9662176385b2976e2bc8e3387df71
Gerrit-Change-Number: 33888
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 24 Jul 2023 11:59:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: pespin.
Hello osmith, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/33888
to look at the new patch set (#2).
Change subject: rlcmac: ul_tbf: Move logic selecting proper queue to helper function
......................................................................
rlcmac: ul_tbf: Move logic selecting proper queue to helper function
This clarifies the logic behind selecting the proper queue, and it will
be used further in the future, for instance when recalculating CV once
already in Countdown procedure.
Change-Id: Icceaf53048e9662176385b2976e2bc8e3387df71
---
M src/rlcmac/tbf_ul.c
1 file changed, 26 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/88/33888/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33888
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Icceaf53048e9662176385b2976e2bc8e3387df71
Gerrit-Change-Number: 33888
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/33900 )
Change subject: rlcmac: recalculate CV as needed when already in Countdown procedure
......................................................................
rlcmac: recalculate CV as needed when already in Countdown procedure
Getting out of contention resolution means we may have to update our
calculated CV state because we are no longer sending TLLI.
Same happens if a new tx CS is provided by the network, since different
block size means different CV.
In this commit only code paths for the state where already in Countdown
Procedure are added. If TBF has to enter Countdown Procedure due the
above mentioned changes, it will do so using regular path where a new
RLC block is created.
Related specs: TS 44.060 9.3.1
Related: OS#6018
Change-Id: Ifa2f8415918c10dfc10d23f6ea9bcc47172cd9f0
Change-Id: I6ca88c005060ba1302d46717e45b0d9731d86d8d
---
M include/osmocom/gprs/rlcmac/tbf_ul.h
M src/rlcmac/tbf_ul.c
M src/rlcmac/tbf_ul_fsm.c
3 files changed, 84 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/00/33900/1
diff --git a/include/osmocom/gprs/rlcmac/tbf_ul.h b/include/osmocom/gprs/rlcmac/tbf_ul.h
index 660cf5a..fe9db64 100644
--- a/include/osmocom/gprs/rlcmac/tbf_ul.h
+++ b/include/osmocom/gprs/rlcmac/tbf_ul.h
@@ -52,6 +52,8 @@
struct gprs_rlcmac_ul_tbf *gprs_rlcmac_ul_tbf_alloc(struct gprs_rlcmac_entity *gre);
void gprs_rlcmac_ul_tbf_free(struct gprs_rlcmac_ul_tbf *ul_tbf);
+void gprs_rlcmac_ul_tbf_countdown_proc_update_cv(struct gprs_rlcmac_ul_tbf *ul_tbf);
+
bool gprs_rlcmac_ul_tbf_in_contention_resolution(const struct gprs_rlcmac_ul_tbf *ul_tbf);
unsigned int gprs_rlcmac_ul_tbf_n3104_max(const struct gprs_rlcmac_ul_tbf *ul_tbf);
bool gprs_rlcmac_ul_tbf_have_data(const struct gprs_rlcmac_ul_tbf *ul_tbf);
diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c
index 0fa98ae..369be55 100644
--- a/src/rlcmac/tbf_ul.c
+++ b/src/rlcmac/tbf_ul.c
@@ -243,7 +243,13 @@
gprs_rlcmac_mcs_name(ul_tbf->tx_cs), gprs_rlcmac_mcs_name(tx_cs));
ul_tbf->tx_cs = tx_cs;
- /* TODO: recalculate countdown_state, have to look a TS 44.060 specs on what to do exactly. */
+ /* TS 44.060 9.3.1.2: If in Countdown Procedure state, CV needs to be
+ * recalculated since CS change means also block size change and hence
+ * the new CV != old CV (new CV may be greater or lesser than old CV).
+ * This means CV can go back to 15, but still be in Countdown Procedure,
+ * aka no new enqueued LLC data in the MS is to be transmitted until the
+ * current TBF finishes. */
+ gprs_rlcmac_ul_tbf_countdown_proc_update_cv(ul_tbf);
}
int gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(struct gprs_rlcmac_ul_tbf *ul_tbf,
@@ -517,7 +523,7 @@
static uint8_t gprs_rlcmac_ul_tbf_calculate_cv(const struct gprs_rlcmac_ul_tbf *ul_tbf)
{
struct blk_count_state st;
- const struct gprs_rlcmac_llc_queue *q = ul_tbf->tbf.gre->llc_queue;
+ const struct gprs_rlcmac_llc_queue *q = gprs_rlcmac_ul_tbf_llc_queue(ul_tbf);
unsigned int i, j;
unsigned x;
@@ -572,11 +578,22 @@
ul_tbf->tbf.gre->llc_queue = gprs_rlcmac_llc_queue_alloc(ul_tbf->tbf.gre);
}
-static void gprs_rlcmac_ul_tbf_check_countdown_proc(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_rts_block_ind *bi)
+/* Check if UL TBF needs to enter Countdown Procedure everytime a new RLC/MAC block is to be transmitted */
+static void gprs_rlcmac_ul_tbf_countdown_proc_check_enter(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_rts_block_ind *bi)
{
- if (ul_tbf->countdown_proc.active)
+ if (ul_tbf->countdown_proc.active) {
+ /* This may happen if TBF entered Countdown Procedure state but
+ * later on due to CS change the CV incremented to more than BS_CV_MAX.
+ * In this case we cannot simply decrement the CV each time a
+ * new block is transmitted, but we rather need to keep
+ * calculating it here:
+ */
+ if (ul_tbf->countdown_proc.cv == 15)
+ ul_tbf->countdown_proc.cv = gprs_rlcmac_ul_tbf_calculate_cv(ul_tbf);
return;
+ }
+ /* Not (yet) in Countdown Procedure, check if we need to enter into it */
ul_tbf->countdown_proc.cv = gprs_rlcmac_ul_tbf_calculate_cv(ul_tbf);
if (ul_tbf->countdown_proc.cv < 15) {
if (gprs_rlcmac_ul_tbf_shall_keep_open(ul_tbf, bi)) {
@@ -590,6 +607,18 @@
}
}
+/* Recalculate CV once in Countdown Procedure if conditions change (called by):
+ * - If contention resolution succeeds
+ * - If tx CS requested by network changes
+ */
+void gprs_rlcmac_ul_tbf_countdown_proc_update_cv(struct gprs_rlcmac_ul_tbf *ul_tbf)
+{
+
+ if (!ul_tbf->countdown_proc.active)
+ return;
+ ul_tbf->countdown_proc.cv = gprs_rlcmac_ul_tbf_calculate_cv(ul_tbf);
+}
+
static int create_new_bsn(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_rts_block_ind *bi, enum gprs_rlcmac_coding_scheme cs)
{
const uint16_t bsn = gprs_rlcmac_rlc_ul_window_v_s(ul_tbf->ulw);
@@ -600,7 +629,7 @@
int write_offset = 0;
enum gpr_rlcmac_append_result ar;
- gprs_rlcmac_ul_tbf_check_countdown_proc(ul_tbf, bi);
+ gprs_rlcmac_ul_tbf_countdown_proc_check_enter(ul_tbf, bi);
if (!ul_tbf->llc_tx_msg || msgb_length(ul_tbf->llc_tx_msg) == 0)
gprs_rlcmac_ul_tbf_schedule_next_llc_frame(ul_tbf);
@@ -628,10 +657,17 @@
rdbi->data_len = block_data_len;
rdbi->ti = gprs_rlcmac_ul_tbf_in_contention_resolution(ul_tbf);
- rdbi->cv = ul_tbf->countdown_proc.cv--;
+ rdbi->cv = ul_tbf->countdown_proc.cv;
rdbi->bsn = bsn; /* Block Sequence Number */
rdbi->e = 1; /* Extension bit, maybe set later (1: no extension) */
+ /* Once we enter countdown procedure, simply decrement the counter to
+ * avoid recalculating all the time. */
+ if (ul_tbf->countdown_proc.cv < 15)
+ ul_tbf->countdown_proc.cv--;
+ /* else: It will be updated in next call to
+ gprs_rlcmac_ul_tbf_countdown_proc_check_enter() above */
+
if (rdbi->ti) {
/* Append TLLI: */
if (gprs_rlcmac_mcs_is_gprs(cs))
diff --git a/src/rlcmac/tbf_ul_fsm.c b/src/rlcmac/tbf_ul_fsm.c
index 2265aa4..7639d83 100644
--- a/src/rlcmac/tbf_ul_fsm.c
+++ b/src/rlcmac/tbf_ul_fsm.c
@@ -127,6 +127,20 @@
}
}
+static void _contention_resolution_succeeded(struct gprs_rlcmac_tbf_ul_fsm_ctx *ctx)
+{
+ LOGPFSML(ctx->fi, LOGL_INFO, "Contention resolution succeeded, stop T3166\n");
+ OSMO_ASSERT(ctx->ul_tbf->ul_ass_fsm.ass_type == GPRS_RLCMAC_TBF_UL_ASS_TYPE_1PHASE);
+ OSMO_ASSERT(ctx->fi->T == 3166);
+ osmo_timer_del(&ctx->fi->timer);
+ ctx->fi->T = 0;
+
+ /* TS 44.060 9.3.1.2: If in Countdown Procedure state, CV needs to be recalculated
+ * since TBF is no longer transmitting TLLI in the block, hence 4 more bytes per
+ * block are available. This means the new CV <= old CV. */
+ gprs_rlcmac_ul_tbf_countdown_proc_update_cv(ctx->ul_tbf);
+}
+
/* This one is triggered when packet access procedure fails, which can happen
* either in WAIT_IMM_ASS (ImmAss timeout), FLOW (T3164) or FINISHED (T3164, T3166) */
static void st_new_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
@@ -195,11 +209,7 @@
break;
case GPRS_RLCMAC_TBF_UL_EV_RX_UL_ACK_NACK:
if (gprs_rlcmac_ul_tbf_in_contention_resolution(ctx->ul_tbf)) {
- LOGPFSML(ctx->fi, LOGL_INFO, "Contention resolution succeeded, stop T3166\n");
- OSMO_ASSERT(ctx->ul_tbf->ul_ass_fsm.ass_type == GPRS_RLCMAC_TBF_UL_ASS_TYPE_1PHASE);
- OSMO_ASSERT(fi->T == 3166);
- osmo_timer_del(&fi->timer);
- fi->T = 0;
+ _contention_resolution_succeeded(ctx);
}
/* It's impossible we receive a correct final_ack here, since we didn't
* sent last data (FSM would be in FINISHED state then) */
@@ -224,11 +234,7 @@
case GPRS_RLCMAC_TBF_UL_EV_RX_UL_ACK_NACK:
ctx_ul_ack_nack = (struct tbf_ul_ass_ev_rx_ul_ack_nack *)data;
if (gprs_rlcmac_ul_tbf_in_contention_resolution(ctx->ul_tbf)) {
- LOGPFSML(ctx->fi, LOGL_INFO, "Contention resolution succeeded, stop T3166\n");
- OSMO_ASSERT(ctx->ul_tbf->ul_ass_fsm.ass_type == GPRS_RLCMAC_TBF_UL_ASS_TYPE_1PHASE);
- OSMO_ASSERT(fi->T == 3166);
- osmo_timer_del(&fi->timer);
- fi->T = 0;
+ _contention_resolution_succeeded(ctx);
} else if (fi->T == 3182 && osmo_timer_pending(&fi->timer)) {
/* 9.3.3.3.2 "Upon reception of a PACKET UPLINK ACK/NACK message for this TBF
* the mobile station shall stop timer T3182 for the TBF".
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/33900
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I6ca88c005060ba1302d46717e45b0d9731d86d8d
Gerrit-Change-Number: 33900
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange