[PATCH] osmo-pcu[master]: Update the function immediate assignment for EGPRS

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/.

bhargava_abhyankar gerrit-no-reply at lists.osmocom.org
Tue Jul 26 15:39:37 UTC 2016


Hello Neels Hofmeyr, Jenkins Builder, Holger Freyther,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/431

to look at the new patch set (#3).

Update the function immediate assignment for EGPRS

Encode the EGPRS fields of immediate assignment message in uplink
when EGPRS PACKET CHANNEL REQUEST (11 bit RACH) is received.
The series of patches for 11 bit RACH are dependent on libosmocore
and osmo-bts patches for 11 bit RACH.

Change-Id: Ie5e309156e5dbbb6add74a1b4d257c4ee2332e52
---
M src/bts.cpp
M src/encoding.cpp
M src/encoding.h
M tests/edge/EdgeTest.cpp
4 files changed, 85 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/31/431/3

diff --git a/src/bts.cpp b/src/bts.cpp
index 82924bf..a56b600 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -555,7 +555,7 @@
 	plen = Encoding::write_immediate_assignment(
 		tbf, immediate_assignment, 0, ra, Fn, ta,
 		m_bts.trx[trx_no].arfcn, ts_no, tsc, usf, 0, sb_fn,
-		m_bts.alpha, m_bts.gamma, -1);
+		m_bts.alpha, m_bts.gamma, -1, burst_type, sb);
 
 	if (plen >= 0) {
 		pcu_l1if_tx_agch(immediate_assignment, plen);
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 9f3b31d..2697d62 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -19,9 +19,9 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#include <bts.h>
 #include <encoding.h>
 #include <gprs_rlcmac.h>
-#include <bts.h>
 #include <tbf.h>
 #include <gprs_debug.h>
 
@@ -144,11 +144,71 @@
 	gprs_rlcmac_ul_tbf *tbf,
 	bitvec * dest, unsigned& wp,
 	uint8_t usf, uint32_t fn,
-	uint8_t alpha, uint8_t gamma, int8_t ta_idx)
+	uint8_t alpha, uint8_t gamma, int8_t ta_idx,
+	enum ph_burst_type burst_type, uint16_t ra)
 {
-	LOGP(DRLCMACUL, LOGL_ERROR,
-		"EGPRS Packet Uplink Assignment is not yet implemented\n");
-	return -EINVAL;
+	unsigned int ws_enc = 0;
+	uint8_t extended_ra = 0;
+
+	extended_ra = (ra & 0x1F);
+
+	bitvec_write_field(dest, wp, 1, 2);    /* LH */
+	bitvec_write_field(dest, wp, 0, 2);    /* 0 EGPRS Uplink Assignment */
+	bitvec_write_field(dest, wp, extended_ra, 5);    /* Extended RA */
+	bitvec_write_field(dest, wp, 0, 1);    /* Access technology Request */
+
+	if (tbf == NULL) {
+
+		bitvec_write_field(dest, wp, 0, 1); /* multiblock allocation */
+
+		if (alpha) {
+			bitvec_write_field(dest, wp, 0x1, 1); /* ALPHA =yes */
+			bitvec_write_field(dest, wp, alpha, 4); /* ALPHA */
+		} else {
+			bitvec_write_field(dest, wp, 0x0, 1); /* ALPHA = no */
+		}
+
+		bitvec_write_field(dest, wp, gamma, 5); /* GAMMA power contrl */
+		bitvec_write_field(dest, wp, (fn / (26 * 51)) % 32, 5);/* T1' */
+		bitvec_write_field(dest, wp, fn % 51, 6);              /* T3 */
+		bitvec_write_field(dest, wp, fn % 26, 5);              /* T2 */
+		bitvec_write_field(dest, wp, 0, 2); /* Radio block allocation */
+
+		bitvec_write_field(dest, wp, 0, 1);
+
+	} else {
+
+		ws_enc = (tbf->m_window.ws() - 64) / 32;
+
+		bitvec_write_field(dest, wp, 1, 1);     /* single block alloc */
+		bitvec_write_field(dest, wp, tbf->tfi(), 5);/* TFI assignment */
+		bitvec_write_field(dest, wp, 0, 1);     /* polling bit */
+		bitvec_write_field(dest, wp, 0, 1);     /* constant */
+		bitvec_write_field(dest, wp, usf, 3);   /* USF bit */
+		bitvec_write_field(dest, wp, 0, 1);     /* USF granularity */
+		bitvec_write_field(dest, wp, 0, 1);     /* P0 */
+		/* MCS */
+		bitvec_write_field(dest, wp, tbf->current_cs().to_num()-1, 4);
+		/* tlli channel block */
+		bitvec_write_field(dest, wp, tbf->tlli(), 1);
+		bitvec_write_field(dest, wp, 0, 1);   /* BEP period present */
+		bitvec_write_field(dest, wp, 0, 1);   /* resegmentation */
+		bitvec_write_field(dest, wp, ws_enc, 5);/* egprs window_size */
+
+		if (alpha) {
+			bitvec_write_field(dest, wp, 0x1, 1);   /* ALPHA =yes */
+			bitvec_write_field(dest, wp, alpha, 4); /* ALPHA */
+		} else {
+			bitvec_write_field(dest, wp, 0x0, 1);   /* ALPHA = no */
+		}
+
+		bitvec_write_field(dest, wp, gamma, 5); /* GAMMA power contrl */
+		bitvec_write_field(dest, wp, 0, 1); /* TIMING_ADVANCE_INDEX */
+		bitvec_write_field(dest, wp, 0, 1); /* TBF_STARTING_TIME_FLAG */
+		bitvec_write_field(dest, wp, 0, 1); /* NULL */
+	}
+
+	return 0;
 }
 
 /*
@@ -157,10 +217,10 @@
  */
 int Encoding::write_immediate_assignment(
 	struct gprs_rlcmac_tbf *tbf,
-	bitvec * dest, uint8_t downlink, uint8_t ra,
+	bitvec * dest, uint8_t downlink, uint16_t ra,
 	uint32_t ref_fn, uint8_t ta, uint16_t arfcn, uint8_t ts, uint8_t tsc,
 	uint8_t usf, uint8_t polling, uint32_t fn, uint8_t alpha,
-	uint8_t gamma, int8_t ta_idx)
+	uint8_t gamma, int8_t ta_idx, enum ph_burst_type burst_type, uint8_t sb)
 {
 	unsigned wp = 0;
 	int plen;
@@ -186,7 +246,13 @@
 	bitvec_write_field(dest, wp,arfcn,10); // ARFCN
 
 	//10.5.2.30 Request Reference
-	bitvec_write_field(dest, wp,ra,8);                    // RA
+	if (((burst_type == GSM_L1_BURST_TYPE_ACCESS_1) ||
+		(burst_type == GSM_L1_BURST_TYPE_ACCESS_2))) {
+		bitvec_write_field(dest, wp, 0x7f, 8);  /* RACH value */
+	} else {
+		bitvec_write_field(dest, wp, ra, 8);	/* RACH value */
+	}
+
 	bitvec_write_field(dest, wp,(ref_fn / (26 * 51)) % 32,5); // T1'
 	bitvec_write_field(dest, wp,ref_fn % 51,6);               // T3
 	bitvec_write_field(dest, wp,ref_fn % 26,5);               // T2
@@ -210,10 +276,11 @@
 		rc = write_ia_rest_downlink(as_dl_tbf(tbf), dest, wp,
 			polling, fn,
 			alpha, gamma, ta_idx);
-	else if (as_ul_tbf(tbf) && as_ul_tbf(tbf)->is_egprs_enabled())
+	else if (((burst_type == GSM_L1_BURST_TYPE_ACCESS_1) ||
+			(burst_type == GSM_L1_BURST_TYPE_ACCESS_2)))
 		rc = write_ia_rest_egprs_uplink(as_ul_tbf(tbf), dest, wp,
 			usf, fn,
-			alpha, gamma, ta_idx);
+			alpha, gamma, ta_idx, burst_type, ra);
 	else
 		rc = write_ia_rest_uplink(as_ul_tbf(tbf), dest, wp,
 			usf, fn,
diff --git a/src/encoding.h b/src/encoding.h
index 710de78..ad29c0a 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -40,11 +40,14 @@
 public:
 	static int write_immediate_assignment(
 			struct gprs_rlcmac_tbf *tbf,
-			bitvec * dest, uint8_t downlink, uint8_t ra,
+			bitvec * dest, uint8_t downlink, uint16_t ra,
 			uint32_t ref_fn, uint8_t ta, uint16_t arfcn, uint8_t ts,
 			uint8_t tsc, uint8_t usf, uint8_t polling,
 			uint32_t fn, uint8_t alpha, uint8_t gamma,
-			int8_t ta_idx);
+			int8_t ta_idx,
+			enum ph_burst_type burst_type =
+				GSM_L1_BURST_TYPE_ACCESS_0,
+			uint8_t sb = 1);
 
 	static void write_packet_uplink_assignment(
 			struct gprs_rlcmac_bts *bts,
diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index 807102c..9e0ba11 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -23,7 +23,6 @@
 #include "gprs_debug.h"
 #include "gprs_coding_scheme.h"
 #include "decoding.h"
-#include "encoding.h"
 #include "rlc.h"
 #include "llc.h"
 #include "bts.h"
@@ -36,10 +35,12 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/vty/vty.h>
 #include <osmocom/gprs/protocol/gsm_04_60.h>
+#include <osmocom/gsm/l1sap.h>
 }
 
 #include <errno.h>
 #include <string.h>
+#include "encoding.h"
 
 void *tall_pcu_ctx;
 int16_t spoof_mnc = 0, spoof_mcc = 0;

-- 
To view, visit https://gerrit.osmocom.org/431
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie5e309156e5dbbb6add74a1b4d257c4ee2332e52
Gerrit-PatchSet: 3
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: bhargava_abhyankar <Bhargava.Abhyankar at radisys.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: bhargava_abhyankar <Bhargava.Abhyankar at radisys.com>



More information about the gerrit-log mailing list