diff options
author | Max <msuraev@sysmocom.de> | 2016-02-18 17:48:07 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-02-22 13:57:54 +0100 |
commit | cb20c83323da485ff392ccffa7ec75de8e2ffede (patch) | |
tree | b264da57ab4287ef5c0f1ae6dc754f9b13b38728 | |
parent | 94bb3769f36c8b64c5dc196f02f22994543997d2 (diff) |
Fix ocmo-bts-octphy interaction with OsmoPCU
Previously osmo-bts-octphy have not provided in-band presence
information which cause off-by-one errors and misinterpretation of
ph_data_ind by PCU. This fixed now by adding support for explicitly
passing PH-DATA presence info. Corresponding check and in-band passing
of presence information are removed.
Note: this requires libosmocore version with osmo_ph_pres_info_type
support integrated.
[hfreyther/max: Remove + 1 from the decoded length]
-rw-r--r-- | include/osmo-bts/pcuif_proto.h | 2 | ||||
-rw-r--r-- | include/osmo-bts/scheduler_backend.h | 2 | ||||
-rw-r--r-- | src/common/l1sap.c | 5 | ||||
-rw-r--r-- | src/common/scheduler.c | 3 | ||||
-rw-r--r-- | src/osmo-bts-octphy/l1_if.c | 1 | ||||
-rw-r--r-- | src/osmo-bts-trx/scheduler_trx.c | 16 |
6 files changed, 15 insertions, 14 deletions
diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index 9d740ac1..f4bda36f 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -1,7 +1,7 @@ #ifndef _PCUIF_PROTO_H #define _PCUIF_PROTO_H -#define PCU_IF_VERSION 0x05 +#define PCU_IF_VERSION 0x06 /* msg_type */ #define PCU_IF_MSG_DATA_REQ 0x00 /* send data to given channel */ diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h index 9f663cdd..16142509 100644 --- a/include/osmo-bts/scheduler_backend.h +++ b/include/osmo-bts/scheduler_backend.h @@ -42,7 +42,7 @@ struct msgb *_sched_dequeue_prim(struct l1sched_trx *l1t, int8_t tn, uint32_t fn enum trx_chan_type chan); int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t *l2, uint8_t l2_len, float rssi); + enum trx_chan_type chan, uint8_t *l2, uint8_t l2_len, float rssi, enum osmo_ph_pres_info_type presence_info); int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len); diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 80560348..ac398d35 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -744,6 +744,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx, uint8_t tn; uint32_t fn; int8_t rssi; + enum osmo_ph_pres_info_type pr_info = data_ind->pdch_presence_info; rssi = data_ind->rssi; chan_nr = data_ind->chan_nr; @@ -767,11 +768,11 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx, return 0; } /* drop incomplete UL block */ - if (data[0] != 7) + if (pr_info != PRES_INFO_BOTH) return 0; /* PDTCH / PACCH frame handling */ pcu_tx_data_ind(&trx->ts[tn], 0, fn, 0 /* ARFCN */, - L1SAP_FN2MACBLOCK(fn), data + 1, len - 1, rssi); + L1SAP_FN2MACBLOCK(fn), data, len, rssi); return 0; } diff --git a/src/common/scheduler.c b/src/common/scheduler.c index e9d2423a..07c2e12f 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -268,7 +268,7 @@ found_msg: } int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, - enum trx_chan_type chan, uint8_t *l2, uint8_t l2_len, float rssi) + enum trx_chan_type chan, uint8_t *l2, uint8_t l2_len, float rssi, enum osmo_ph_pres_info_type presence_info) { struct msgb *msg; struct osmo_phsap_prim *l1sap; @@ -284,6 +284,7 @@ int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, l1sap->u.data.link_id = trx_chan_desc[chan].link_id; l1sap->u.data.fn = fn; l1sap->u.data.rssi = (int8_t) (rssi); + l1sap->u.data.pdch_presence_info = presence_info; msg->l2h = msgb_put(msg, l2_len); if (l2_len) memcpy(msg->l2h, l2, l2_len); diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c index 3215aa19..781d5898 100644 --- a/src/osmo-bts-octphy/l1_if.c +++ b/src/osmo-bts-octphy/l1_if.c @@ -1032,6 +1032,7 @@ static int handle_ph_data_ind(struct octphy_hdl *fl1, l1sap->u.data.chan_nr = chan_nr; l1sap->u.data.fn = fn; l1sap->u.data.rssi = rssi; + l1sap->u.data.pdch_presence_info = PRES_INFO_BOTH; /* FIXME: consider EDGE support */ l1sap_up(trx, l1sap); diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 15c05e8d..d92d8db6 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -190,7 +190,7 @@ got_msg: l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn, 456, 456, -110, 0); - _sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0, -110); + _sched_compose_ph_data_ind(l1t, tn, 0, chan, NULL, 0, -110, PRES_INFO_INVALID); } } @@ -841,7 +841,7 @@ int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn, n_errors, n_bits_total, *rssi_sum / *rssi_num, *toa_sum / *toa_num); - return _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, l2, l2_len, *rssi_sum / *rssi_num); + return _sched_compose_ph_data_ind(l1t, tn, *first_fn, chan, l2, l2_len, *rssi_sum / *rssi_num, PRES_INFO_UNKNOWN); } int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, @@ -856,7 +856,7 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, uint8_t *rssi_num = &chan_state->rssi_num; float *toa_sum = &chan_state->toa_sum; uint8_t *toa_num = &chan_state->toa_num; - uint8_t l2[54+1]; + uint8_t l2[54]; int n_errors, n_bits_total; int rc; @@ -906,7 +906,7 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, *mask = 0x0; /* decode */ - rc = pdtch_decode(l2 + 1, *bursts_p, NULL, &n_errors, &n_bits_total); + rc = pdtch_decode(l2, *bursts_p, NULL, &n_errors, &n_bits_total); /* Send uplnk measurement information to L2 */ l1if_process_meas_res(l1t->trx, tn, fn, trx_chan_desc[chan].chan_nr | tn, @@ -919,10 +919,8 @@ int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, return 0; } - l2[0] = 7; /* valid frame */ - return _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 3) % GSM_HYPERFRAME, chan, - l2, rc + 1, *rssi_sum / *rssi_num); + l2, rc, *rssi_sum / *rssi_num, PRES_INFO_BOTH); } int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, @@ -1038,7 +1036,7 @@ int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, /* FACCH */ if (rc == GSM_MACBLOCK_LEN) { _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 7) % GSM_HYPERFRAME, chan, - tch_data + amr, GSM_MACBLOCK_LEN, rssi); + tch_data + amr, GSM_MACBLOCK_LEN, rssi, PRES_INFO_UNKNOWN); bfi: if (rsl_cmode == RSL_CMOD_SPD_SPEECH) { /* indicate bad frame */ @@ -1204,7 +1202,7 @@ int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn, chan_state->ul_ongoing_facch = 1; _sched_compose_ph_data_ind(l1t, tn, (fn + GSM_HYPERFRAME - 10 - ((fn % 26) >= 19)) % GSM_HYPERFRAME, chan, - tch_data + amr, GSM_MACBLOCK_LEN, rssi); + tch_data + amr, GSM_MACBLOCK_LEN, rssi, PRES_INFO_UNKNOWN); bfi: if (rsl_cmode == RSL_CMOD_SPD_SPEECH) { /* indicate bad frame */ |