This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/11251
Change subject: layer23/common: move signal loss criteria to L23SAP
......................................................................
layer23/common: move signal loss criteria to L23SAP
Change-Id: Ib70bf9104cf3b5489413dd90819fd4955ec16f95
---
M src/host/layer23/src/common/l1ctl.c
M src/host/layer23/src/common/l23sap.c
2 files changed, 83 insertions(+), 67 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/51/11251/1
diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c
index 4346da9..a08fac2 100644
--- a/src/host/layer23/src/common/l1ctl.c
+++ b/src/host/layer23/src/common/l1ctl.c
@@ -122,8 +122,6 @@
{
struct l1ctl_info_dl *dl;
struct l1ctl_data_ind *ccch;
- struct rx_meas_stat *meas = &ms->meas;
- uint8_t chan_type, chan_ts, chan_ss;
struct gsm_time tm;
if (msgb_l1len(msg) < sizeof(*dl)) {
@@ -138,76 +136,11 @@
ccch = (struct l1ctl_data_ind *) msg->l2h;
gsm_fn2gsmtime(&tm, ntohl(dl->frame_nr));
- rsl_dec_chan_nr(dl->chan_nr, &chan_type, &chan_ss, &chan_ts);
DEBUGP(DL1C, "%s (%.4u/%.2u/%.2u) %d dBm: %s\n",
rsl_chan_nr_str(dl->chan_nr), tm.t1, tm.t2, tm.t3,
(int)dl->rx_level-110,
osmo_hexdump(ccch->data, sizeof(ccch->data)));
- meas->last_fn = ntohl(dl->frame_nr);
- meas->frames++;
- meas->snr += dl->snr;
- meas->berr += dl->num_biterr;
- meas->rxlev += dl->rx_level;
-
- /* counting loss criteria */
- if (!(dl->link_id & 0x40)) {
- switch (chan_type) {
- case RSL_CHAN_PCH_AGCH:
- /* only look at one CCCH frame in each 51 multiframe.
- * FIXME: implement DRX
- * - select correct paging block that is for us.
- * - initialize ds_fail according to BS_PA_MFRMS.
- */
- if ((dl->frame_nr % 51) != 6)
- break;
- 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)
- LOGP(DL1C, LOGL_INFO, "LOSS counter for CCCH %d\n", meas->dsc);
- if (meas->dsc > 0)
- break;
- meas->ds_fail = 0;
- osmo_signal_dispatch(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)
- LOGP(DL1C, LOGL_NOTICE, "LOSS counter for ACCH %d\n", meas->s);
- if (meas->s > 0)
- break;
- meas->rl_fail = 0;
- osmo_signal_dispatch(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
- break;
- }
- }
-
- if (dl->fire_crc >= 2) {
- LOGP(DL1C, LOGL_NOTICE, "Dropping frame with %u bit errors\n",
- dl->num_biterr);
- msgb_free(msg);
- return 0;
- }
-
/* Send it up towards LAPDm via L23SAP */
return l23sap_data_ind(ms, msg);
}
diff --git a/src/host/layer23/src/common/l23sap.c b/src/host/layer23/src/common/l23sap.c
index a34f515..fbdc75c 100644
--- a/src/host/layer23/src/common/l23sap.c
+++ b/src/host/layer23/src/common/l23sap.c
@@ -2,6 +2,7 @@
* L23SAP (L2&3 Service Access Point), an interface between
* L1 implementation and the upper layers (i.e. L2&3).
*
+ * (C) 2010 by Andreas Eversberg <jolly at eversberg.eu>
* (C) 2011 by Harald Welte <laforge at gnumonks.org>
* (C) 2018 by Vadim Yanitskiy <axilirator at gmail.com>
*
@@ -34,6 +35,7 @@
#include <osmocom/core/logging.h>
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/gsmtap.h>
+#include <osmocom/core/signal.h>
#include <osmocom/core/prim.h>
#include <osmocom/core/msgb.h>
@@ -47,6 +49,81 @@
extern struct gsmtap_inst *gsmtap_inst;
+static int l23sap_check_dl_loss(struct osmocom_ms *ms,
+ struct l1ctl_info_dl *dl)
+{
+ struct rx_meas_stat *meas = &ms->meas;
+ uint8_t chan_type, chan_ts, chan_ss;
+
+ /* Update measurements */
+ meas->last_fn = ntohl(dl->frame_nr);
+ meas->frames++;
+ meas->snr += dl->snr;
+ meas->berr += dl->num_biterr;
+ meas->rxlev += dl->rx_level;
+
+ rsl_dec_chan_nr(dl->chan_nr, &chan_type, &chan_ss, &chan_ts);
+
+ /* counting loss criteria */
+ if (!(dl->link_id & 0x40)) {
+ switch (chan_type) {
+ case RSL_CHAN_PCH_AGCH:
+ /* only look at one CCCH frame in each 51 multiframe.
+ * FIXME: implement DRX
+ * - select correct paging block that is for us.
+ * - initialize ds_fail according to BS_PA_MFRMS.
+ */
+ if ((dl->frame_nr % 51) != 6)
+ break;
+ 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)
+ LOGP(DL23SAP, LOGL_INFO, "LOSS counter for CCCH %d\n", meas->dsc);
+ if (meas->dsc > 0)
+ break;
+ meas->ds_fail = 0;
+ osmo_signal_dispatch(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)
+ LOGP(DL23SAP, LOGL_NOTICE, "LOSS counter for ACCH %d\n", meas->s);
+ if (meas->s > 0)
+ break;
+ meas->rl_fail = 0;
+ osmo_signal_dispatch(SS_L1CTL, S_L1CTL_LOSS_IND, ms);
+ break;
+ }
+ }
+
+ if (dl->fire_crc >= 2) {
+ LOGP(DL23SAP, LOGL_NOTICE, "Dropping frame with %u bit "
+ "errors\n", dl->num_biterr);
+ return -EBADMSG;
+ }
+
+ return 0;
+}
+
int l23sap_gsmtap_data_ind(struct osmocom_ms *ms, struct msgb *msg)
{
struct l1ctl_info_dl *dl = (struct l1ctl_info_dl *) msg->l1h;
@@ -102,6 +179,12 @@
struct osmo_phsap_prim pp;
struct lapdm_entity *le;
+ /* Check for decoding errors (path loss) */
+ if (l23sap_check_dl_loss(ms, dl)) {
+ msgb_free(msg);
+ return 0;
+ }
+
/* Init a new DATA IND primitive */
osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_DATA,
PRIM_OP_INDICATION, msg);
--
To view, visit https://gerrit.osmocom.org/11251
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib70bf9104cf3b5489413dd90819fd4955ec16f95
Gerrit-Change-Number: 11251
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181006/9c7ac1fc/attachment.htm>