[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-09 Thread neels
neels has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..

early-IA: use the correct TRX

In early-Immediate-Assignment, the BSC sends the IMM ASS message
directly after it sent the Channel Activation message, and osmo-bts
should cache it until the Channel Activation is complete.

So far the code had a bug: it assumed that the lchan was on the same TRX
where the IMM ASS is transmitted -- but actually, 'trx' refers to the
BCCH channel's TRX, i.e. always c0.

Instead, look up the correct TRX by the ARFCN in the IMM ASS message.

Now, when frequency hopping is enabled, there will be no ARFCN in the
IMM ASS message, hence this fix does not work with frequency hopping.
Related osmo-bsc patch disallows this combination.

(To also support frequency hopping, osmo-bsc would need to modify the
RSL protocol: send the IMM ASS message as a custom IE directly as part
of the Channel Activation. Then it is always possible to correllate the
IMM ASS with a specific trx and lchan, no matter what information it
contains. However, early-IA is a "bad" feature in itself as it
"promotes" having high latency on Abis. It seems unnecessary to do extra
work to also support this odd use case for frequency hopping.)

Related: osmo-bsc I8d375e5155be7b53034d5c0be5566d2f33af5db0
Related: SYS#6655
Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
---
M src/common/rsl.c
1 file changed, 67 insertions(+), 9 deletions(-)

Approvals:
  neels: Looks good to me, approved
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  dexter: Looks good to me, but someone else must approve
  daniel: Looks good to me, but someone else must approve




diff --git a/src/common/rsl.c b/src/common/rsl.c
index b5ec17f..bc2a5ea 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -371,6 +371,16 @@
return true;
 }

+static struct gsm_bts_trx *trx_lookup_by_arfcn(struct llist_head *trx_list, 
uint16_t arfcn)
+{
+   struct gsm_bts_trx *trx;
+   llist_for_each_entry(trx, trx_list, list) {
+   if (trx->arfcn == arfcn)
+   return trx;
+   }
+   return NULL;
+}
+
 static struct gsm_lchan *lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
  const char *log_name)
 {
@@ -1383,18 +1393,33 @@
 * the channel is active. Hence we still wait for the activation, but 
don't need the Abis roundtrip of Activ ACK
 * -> Immediate Assignment via the BSC.
 * If anything is wrong with the sizes or the lchan lookup, behave 
normally, i.e. do not do the RR IA caching,
-* but just send the RR message to the MS as-is. */
+* but just send the RR message to the MS as-is.
+* 'trx' here is the TRX of the BCCH channel. To find the correct TRX 
for the IMM ASS target, we need to look up
+* the ARFCN that is contained in the IMM ASS message. When frequency 
hopping is enabled, there will not be an
+* ARFCN, so we cannot support early-IA with frequency hopping enabled. 
*/
if (msg->len >= sizeof(struct gsm48_imm_ass)) {
struct gsm48_imm_ass *rr_ia = (void*)msg->data;
-   struct gsm_lchan *ia_target_lchan = lchan_lookup(trx, 
rr_ia->chan_desc.chan_nr, "Early IA check: ");
-   if (ia_target_lchan && ia_target_lchan->state != 
LCHAN_S_ACTIVE) {
-   /* Target lchan is not yet active. Cache the IA.
-* If a previous IA is still lingering, free it. */
-   msgb_free(ia_target_lchan->early_rr_ia);
-   ia_target_lchan->early_rr_ia = msg;
+   if (rr_ia->chan_desc.h0.h == 0) {
+   /* hopping is disabled. */
+   struct gsm_bts_trx *ia_target_trx;
+   uint16_t arfcn;
+   arfcn = (rr_ia->chan_desc.h0.arfcn_high << 8) + 
rr_ia->chan_desc.h0.arfcn_low;

-   /* return 1 means: don't msgb_free() the msg */
-   return 1;
+   ia_target_trx = 
trx_lookup_by_arfcn(>bts->trx_list, arfcn);
+   if (ia_target_trx) {
+   /* found the ARFCN's trx */
+   struct gsm_lchan *ia_target_lchan;
+   ia_target_lchan = lchan_lookup(ia_target_trx, 
rr_ia->chan_desc.chan_nr, "Early IA check: ");
+   if (ia_target_lchan && ia_target_lchan->state 
!= LCHAN_S_ACTIVE) {
+   /* Target lchan is not yet active. 
Cache the IA.
+* If a previous IA is still lingering, 
free it. */
+   msgb_free(ia_target_lchan->early_rr_ia);
+   

[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-09 Thread neels
Attention is currently required from: pespin.

neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3: Code-Review+2

(1 comment)

Patchset:

PS1:
> completely untested
we got a response from an undisclosed tester that this patch works well on site 
and is used in production now



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-CC: pespin 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Wed, 10 Jan 2024 07:53:52 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: neels 
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-05 Thread dexter
Attention is currently required from: neels, pespin.

dexter has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Fri, 05 Jan 2024 11:19:15 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-05 Thread daniel
Attention is currently required from: neels, pespin.

daniel has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Fri, 05 Jan 2024 09:28:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-05 Thread laforge
Attention is currently required from: daniel, neels, pespin.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3:

(2 comments)

File src/common/rsl.c:

https://gerrit.osmocom.org/c/osmo-bts/+/35095/comment/2919_90699a0a
PS3, Line 1395: If anything is wrong with the sizes or the lchan lookup, behave 
normally, i.e. do not do the RR IA caching,
> note this ^
Done


https://gerrit.osmocom.org/c/osmo-bts/+/35095/comment/7f3c16f5_8135026b
PS3, Line 1403: /* hopping is disabled. */
> no. […]
Done



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: daniel 
Gerrit-CC: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: pespin 
Gerrit-Attention: daniel 
Gerrit-Comment-Date: Fri, 05 Jan 2024 08:41:50 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels 
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: daniel 
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-05 Thread laforge
Attention is currently required from: daniel, neels, pespin.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: daniel 
Gerrit-CC: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: pespin 
Gerrit-Attention: daniel 
Gerrit-Comment-Date: Fri, 05 Jan 2024 08:41:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2024-01-04 Thread neels
Attention is currently required from: daniel, pespin.

neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3:

(2 comments)

File src/common/rsl.c:

https://gerrit.osmocom.org/c/osmo-bts/+/35095/comment/e0088590_e4803eef
PS3, Line 1395: If anything is wrong with the sizes or the lchan lookup, behave 
normally, i.e. do not do the RR IA caching,
note this ^


https://gerrit.osmocom.org/c/osmo-bts/+/35095/comment/dd2452e3_51857540
PS3, Line 1403: /* hopping is disabled. */
> Ack
no.

You are asking to reject *all* messages that are longer than Imm Ass when 
hopping is enabled. that makes no sense.

This Early IA is a hackish nonstandard feature; it decides to cache a msgb for 
later, when it identifies an Imm Ass that is too early. When hopping is 
enabled, we are unable to do that identification, and we simply never use the 
cache then.

When the cache is not used, we just send the message normally, no error applies.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: daniel 
Gerrit-CC: laforge 
Gerrit-CC: pespin 
Gerrit-Attention: pespin 
Gerrit-Attention: daniel 
Gerrit-Comment-Date: Fri, 05 Jan 2024 02:53:15 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: daniel 
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-12-17 Thread laforge
Attention is currently required from: daniel, neels.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3:

(1 comment)

Patchset:

PS3:
ping? This has been idle 2 weeks; let's ad the error report and get it merged.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: daniel 
Gerrit-CC: laforge 
Gerrit-CC: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: daniel 
Gerrit-Comment-Date: Sun, 17 Dec 2023 10:48:38 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-11-28 Thread pespin
Attention is currently required from: daniel, neels.

pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3:

(1 comment)

File src/common/rsl.c:

https://gerrit.osmocom.org/c/osmo-bts/+/35095/comment/3000b245_8e7cd8de
PS3, Line 1403: /* hopping is disabled. */
> What if hopping is enabled? Should we return an rsl_tx_error_report()
Ack



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: daniel 
Gerrit-CC: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: daniel 
Gerrit-Comment-Date: Tue, 28 Nov 2023 13:08:13 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: daniel 
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-11-24 Thread daniel
Attention is currently required from: neels.

daniel has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 3:

(1 comment)

File src/common/rsl.c:

https://gerrit.osmocom.org/c/osmo-bts/+/35095/comment/606138c9_bf7c0e50
PS3, Line 1403: /* hopping is disabled. */
What if hopping is enabled? Should we return an rsl_tx_error_report()



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: daniel 
Gerrit-Attention: neels 
Gerrit-Comment-Date: Fri, 24 Nov 2023 10:43:14 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-11-22 Thread neels
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email

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


Change subject: early-IA: use the correct TRX
..

early-IA: use the correct TRX

In early-Immediate-Assignment, the BSC sends the IMM ASS message
directly after it sent the Channel Activation message, and osmo-bts
should cache it until the Channel Activation is complete.

So far the code had a bug: it assumed that the lchan was on the same TRX
where the IMM ASS is transmitted -- but actually, 'trx' refers to the
BCCH channel's TRX, i.e. always c0.

Instead, look up the correct TRX by the ARFCN in the IMM ASS message.

Now, when frequency hopping is enabled, there will be no ARFCN in the
IMM ASS message, hence this fix does not work with frequency hopping.
Related osmo-bsc patch disallows this combination.

(To also support frequency hopping, osmo-bsc would need to modify the
RSL protocol: send the IMM ASS message as a custom IE directly as part
of the Channel Activation. Then it is always possible to correllate the
IMM ASS with a specific trx and lchan, no matter what information it
contains. However, early-IA is a "bad" feature in itself as it
"promotes" having high latency on Abis. It seems unnecessary to do extra
work to also support this odd use case for frequency hopping.)

Related: osmo-bsc I8d375e5155be7b53034d5c0be5566d2f33af5db0
Related: SYS#6655
Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
---
M src/common/rsl.c
1 file changed, 67 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/95/35095/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 3
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-11-22 Thread neels
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email

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


Change subject: early-IA: use the correct TRX
..

early-IA: use the correct TRX

In early-Immediate-Assignment, the BSC sends the IMM ASS message
directly after it sent the Channel Activation message, and osmo-bts
should cache it until the Channel Activation is complete.

So far the code had a bug: it assumed that the lchan was on the same TRX
where the IMM ASS is transmitted -- but actually, 'trx' refers to the
BCCH channel's TRX, i.e. always c0.

Instead, look up the correct TRX by the ARFCN in the IMM ASS message.

Now, when frequency hopping is enabled, there will be no ARFCN in the
IMM ASS message, hence this fix does not work with frequency hopping.

(To also support frequency hopping, osmo-bsc would need to modify the
RSL protocol: send the IMM ASS message as a custom IE directly as part
of the Channel Activation. Then it is always possible to correllate the
IMM ASS with a specific trx and lchan, no matter what information it
contains. However, early-IA is a "bad" feature in itself as it
"promotes" having high latency on Abis. It seems unnecessary to do extra
work to also support this odd use case for frequency hopping.)

Related: SYS#6655
Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
---
M src/common/rsl.c
1 file changed, 65 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/95/35095/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 2
Gerrit-Owner: neels 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-11-22 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )

Change subject: early-IA: use the correct TRX
..


Patch Set 1:

(1 comment)

Patchset:

PS1:
completely untested



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Wed, 22 Nov 2023 16:28:48 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in osmo-bts[master]: early-IA: use the correct TRX

2023-11-22 Thread neels
neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email )


Change subject: early-IA: use the correct TRX
..

early-IA: use the correct TRX

Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
---
M src/common/rsl.c
1 file changed, 43 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/95/35095/1

diff --git a/src/common/rsl.c b/src/common/rsl.c
index deeb255..9405c6e 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -371,6 +371,16 @@
return true;
 }

+static struct gsm_bts_trx *trx_lookup_by_arfcn(struct llist_head *trx_list, 
uint16_t arfcn)
+{
+   struct gsm_bts_trx *trx;
+   llist_for_each_entry(trx, trx_list, list) {
+   if (trx->arfcn == arfcn)
+   return trx;
+   }
+   return NULL;
+}
+
 static struct gsm_lchan *lchan_lookup(struct gsm_bts_trx *trx, uint8_t chan_nr,
  const char *log_name)
 {
@@ -1383,18 +1393,33 @@
 * the channel is active. Hence we still wait for the activation, but 
don't need the Abis roundtrip of Activ ACK
 * -> Immediate Assignment via the BSC.
 * If anything is wrong with the sizes or the lchan lookup, behave 
normally, i.e. do not do the RR IA caching,
-* but just send the RR message to the MS as-is. */
+* but just send the RR message to the MS as-is.
+* 'trx' here is the TRX of the BCCH channel. To find the correct TRX 
for the IMM ASS target, we need to look up
+* the ARFCN that is contained in the IMM ASS message. When frequency 
hopping is enabled, there will not be an
+* ARFCN, so we cannot support early-IA with frequency hopping enabled. 
*/
if (msg->len >= sizeof(struct gsm48_imm_ass)) {
struct gsm48_imm_ass *rr_ia = (void*)msg->data;
-   struct gsm_lchan *ia_target_lchan = lchan_lookup(trx, 
rr_ia->chan_desc.chan_nr, "Early IA check: ");
-   if (ia_target_lchan && ia_target_lchan->state != 
LCHAN_S_ACTIVE) {
-   /* Target lchan is not yet active. Cache the IA.
-* If a previous IA is still lingering, free it. */
-   msgb_free(ia_target_lchan->early_rr_ia);
-   ia_target_lchan->early_rr_ia = msg;
+   if (rr_ia->chan_desc.h0.h == 0) {
+   /* hopping is disabled. */
+   struct gsm_bts_trx *ia_target_trx;
+   uint16_t arfcn;
+   arfcn = (rr_ia->chan_desc.h0.arfcn_high << 8) + 
rr_ia->chan_desc.h0.arfcn_low;

-   /* return 1 means: don't msgb_free() the msg */
-   return 1;
+   ia_target_trx = 
trx_lookup_by_arfcn(>bts->trx_list, arfcn);
+   if (ia_target_trx) {
+   /* found the ARFCN's trx */
+   struct gsm_lchan *ia_target_lchan;
+   ia_target_lchan = lchan_lookup(ia_target_trx, 
rr_ia->chan_desc.chan_nr, "Early IA check: ");
+   if (ia_target_lchan && ia_target_lchan->state 
!= LCHAN_S_ACTIVE) {
+   /* Target lchan is not yet active. 
Cache the IA.
+* If a previous IA is still lingering, 
free it. */
+   msgb_free(ia_target_lchan->early_rr_ia);
+   ia_target_lchan->early_rr_ia = msg;
+
+   /* return 1 means: don't msgb_free() 
the msg */
+   return 1;
+   }
+   }
}
}


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/35095?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id9a930e5c67122812b229dc27ea2bfe246b67611
Gerrit-Change-Number: 35095
Gerrit-PatchSet: 1
Gerrit-Owner: neels 
Gerrit-MessageType: newchange