summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/common/l1ctl.c
diff options
context:
space:
mode:
authorAndreas.Eversberg <jolly@eversberg.eu>2010-10-12 08:26:48 +0000
committerAndreas.Eversberg <jolly@eversberg.eu>2010-10-12 08:26:48 +0000
commit6d4915b91b13fa879e0dd75d2c275e82b5a5634c (patch)
treee385c97e0fecc0591ec6d7f17bf3925ec2fae258 /src/host/layer23/src/common/l1ctl.c
parent86f4d80b7ffab98efeb8fb28b393d743de897806 (diff)
[layer23] Implementation of signal loss criteria as defined in TS 05.08
There are two criterions for lossing a signal, idle mode and dedicated mode. A counter counts down when a frame is dropped, and counts up when a valid frame is received on certain channel. The loss criterion is reached, if the counter reaches 0. The values added to / removed from the counter and the limits depend on the process.
Diffstat (limited to 'src/host/layer23/src/common/l1ctl.c')
-rw-r--r--src/host/layer23/src/common/l1ctl.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index be84bf95..0b25008e 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -160,7 +160,51 @@ static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg)
meas->berr += dl->num_biterr;
meas->rxlev += dl->rx_level;
- if (dl->num_biterr) {
+ /* counting loss criteria */
+ if (!(dl->link_id & 0x40)) {
+ switch (chan_type) {
+ case RSL_CHAN_PCH_AGCH:
+ if (!meas->ds_fail)
+ break;
+ if (dl->fire_crc >= 2)
+ meas->dsc -= 4;
+ else
+ meas->dsc += 1;
+ if (meas->dsc > meas->ds_fail)
+ meas->dsc = meas->ds_fail;
+ if (meas->dsc < meas->ds_fail)
+ printf("LOSS counter for CCCH %d\n", meas->dsc);
+ if (meas->dsc > 0)
+ break;
+ meas->ds_fail = 0;
+ dispatch_signal(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
+ break;
+ }
+ } else {
+ switch (chan_type) {
+ case RSL_CHAN_Bm_ACCHs:
+ case RSL_CHAN_Lm_ACCHs:
+ case RSL_CHAN_SDCCH4_ACCH:
+ case RSL_CHAN_SDCCH8_ACCH:
+ if (!meas->rl_fail)
+ break;
+ if (dl->fire_crc >= 2)
+ meas->s -= 1;
+ else
+ meas->s += 2;
+ if (meas->s > meas->rl_fail)
+ meas->s = meas->rl_fail;
+ if (meas->s < meas->rl_fail)
+ printf("LOSS counter for ACCH %d\n", meas->s);
+ if (meas->s > 0)
+ break;
+ meas->rl_fail = 0;
+ dispatch_signal(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
+ break;
+ }
+ }
+
+ if (dl->fire_crc >= 2) {
printf("Dropping frame with %u bit errors\n", dl->num_biterr);
LOGP(DL1C, LOGL_NOTICE, "Dropping frame with %u bit errors\n",
dl->num_biterr);
@@ -266,8 +310,6 @@ int l1ctl_tx_fbsb_req(struct osmocom_ms *ms, uint16_t arfcn,
if (!msg)
return -1;
- memset(&ms->meas, 0, sizeof(ms->meas));
-
req = (struct l1ctl_fbsb_req *) msgb_put(msg, sizeof(*req));
req->band_arfcn = htons(osmo_make_band_arfcn(ms, arfcn));
req->timeout = htons(timeout);
@@ -399,8 +441,6 @@ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn,
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (arfcn=%u, "
"chan_nr=0x%02x)\n", band_arfcn, chan_nr);
- memset(&ms->meas, 0, sizeof(ms->meas));
-
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
ul->chan_nr = chan_nr;
ul->link_id = 0;
@@ -430,8 +470,6 @@ int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn,
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Est Req (maio=%u, hsn=%u, "
"chan_nr=0x%02x)\n", maio, hsn, chan_nr);
- memset(&ms->meas, 0, sizeof(ms->meas));
-
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
ul->chan_nr = chan_nr;
ul->link_id = 0;
@@ -522,8 +560,6 @@ int l1ctl_tx_dm_rel_req(struct osmocom_ms *ms)
LOGP(DL1C, LOGL_INFO, "Tx Dedic.Mode Rel Req\n");
- memset(&ms->meas, 0, sizeof(ms->meas));
-
ul = (struct l1ctl_info_ul *) msgb_put(msg, sizeof(*ul));
return osmo_send_l1(ms, msg);