[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

2023-12-02 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/33532?usp=email )

Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
..

mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

While it is correct to use the band indicator from SI1 rest octets,
it may only be applied for ARFCN values in the range 512..810.

The function gsm_refer_pcs() is used to determine, if the cell (which
'talks' about ARFCNs) refers to them PCS or DCS channels. It returns
true, if it refers to PCS, but this only means that ARFCNs in the range
512..810 are PCS channels, not all ARFCNs.

The new function gsm_arfcn_refer_pcs() is used to add the PCS flag to an
ARFCN, if the given cell refers to PCS and the given ARFCN is in the PCS
range 512..810.

Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Related: OS#6078
---
M src/host/layer23/include/osmocom/bb/common/sysinfo.h
M src/host/layer23/src/common/sysinfo.c
M src/host/layer23/src/mobile/gsm322.c
M src/host/layer23/src/mobile/gsm48_rr.c
4 files changed, 71 insertions(+), 41 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  jolly: Looks good to me, approved




diff --git a/src/host/layer23/include/osmocom/bb/common/sysinfo.h 
b/src/host/layer23/include/osmocom/bb/common/sysinfo.h
index 9efb248..c31cf9d 100644
--- a/src/host/layer23/include/osmocom/bb/common/sysinfo.h
+++ b/src/host/layer23/include/osmocom/bb/common/sysinfo.h
@@ -71,7 +71,7 @@
/* si1 rest */
uint8_t nch;
uint8_t nch_position;
-   uint8_t band_ind; /* set for DCS */
+   boolband_ind; /* set for DCS */

/* si3 rest */
uint8_t sp;
@@ -181,7 +181,8 @@
 };

 char *gsm_print_arfcn(uint16_t arfcn);
-uint8_t gsm_refer_pcs(uint16_t arfcn, const struct gsm48_sysinfo *s);
+bool gsm_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo *cell_s);
+uint16_t gsm_arfcn_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo 
*cell_s, uint16_t arfcn);
 int gsm48_sysinfo_dump(const struct gsm48_sysinfo *s, uint16_t arfcn,
   void (*print)(void *, const char *, ...),
   void *priv, uint8_t *freq_map);
diff --git a/src/host/layer23/src/common/sysinfo.c 
b/src/host/layer23/src/common/sysinfo.c
index f541c85..7fdc6ff 100644
--- a/src/host/layer23/src/common/sysinfo.c
+++ b/src/host/layer23/src/common/sysinfo.c
@@ -50,20 +50,35 @@
return text;
 }

-/* check if the cell 'talks' about DCS (0) or PCS (1) */
-uint8_t gsm_refer_pcs(uint16_t arfcn, const struct gsm48_sysinfo *s)
+/* Check if the cell 'talks' about DCS (false) or PCS (true) */
+bool gsm_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo *cell_s)
 {
/* If ARFCN is PCS band, the cell refers to PCS */
-   if ((arfcn & ARFCN_PCS))
-   return 1;
+   if ((cell_arfcn & ARFCN_PCS))
+   return true;

/* If no SI1 is available, we assume DCS. Be sure to call this
 * function only if SI 1 is available. */
-   if (!s->si1)
+   if (!cell_s->si1)
return 0;

/* If band indicator indicates PCS band, the cell refers to PCSThe  */
-   return s->band_ind;
+   return cell_s->band_ind;
+}
+
+/* Change the given ARFCN to PCS ARFCN, if it is in the PCS channel range and 
the cell refers to PCS band. */
+uint16_t gsm_arfcn_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo 
*cell_s, uint16_t arfcn)
+{
+   /* If ARFCN is not one of the overlapping channel of PCS and DCS. */
+   if (arfcn < 512 && arfcn > 810)
+   return arfcn;
+
+   /* If the 'cell' does not refer to PCS. */
+   if (!gsm_refer_pcs(cell_arfcn, cell_s))
+   return arfcn;
+
+   /* The ARFCN is PCS, because the ARFCN is in the PCS range and the cell 
refers to it. */
+   return arfcn | ARFCN_PCS;
 }

 int gsm48_sysinfo_dump(const struct gsm48_sysinfo *s, uint16_t arfcn,
@@ -541,10 +556,7 @@
s->nch_position = bitvec_get_uint(, 5);
} else
s->nch = 0;
-   if (bitvec_get_bit_high() == H)
-   s->band_ind = 1;
-   else
-   s->band_ind = 0;
+   s->band_ind = (bitvec_get_bit_high() == H);

return 0;
 }
diff --git a/src/host/layer23/src/mobile/gsm322.c 
b/src/host/layer23/src/mobile/gsm322.c
index 35811d3..3d0cc77 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -2419,7 +2419,8 @@
struct gsm322_cellsel *cs = >cellsel;
struct gsm48_sysinfo *s;
struct gsm322_ba_list *ba = NULL;
-   int i, refer_pcs;
+   int i;
+   bool refer_pcs;
uint8_t 

[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

2023-12-01 Thread jolly
Attention is currently required from: laforge.

jolly has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/33532?usp=email )

Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
..


Patch Set 4: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Gerrit-Change-Number: 33532
Gerrit-PatchSet: 4
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: jolly 
Gerrit-Reviewer: laforge 
Gerrit-Attention: laforge 
Gerrit-Comment-Date: Fri, 01 Dec 2023 10:09:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

2023-11-30 Thread fixeria
Attention is currently required from: jolly, laforge.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/33532?usp=email )

Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
..


Patch Set 4: Code-Review+1

(1 comment)

Patchset:

PS4: 
The `uint8_t` to `bool` change makes this patch harder to read, ideally this 
should be done separately . Other than that, looks good to me.



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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Gerrit-Change-Number: 33532
Gerrit-PatchSet: 4
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: jolly 
Gerrit-Reviewer: laforge 
Gerrit-Attention: jolly 
Gerrit-Attention: laforge 
Gerrit-Comment-Date: Thu, 30 Nov 2023 18:00:34 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

2023-11-27 Thread laforge
Attention is currently required from: jolly.

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

Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
..


Patch Set 4: Code-Review+1


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Gerrit-Change-Number: 33532
Gerrit-PatchSet: 4
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly 
Gerrit-Reviewer: laforge 
Gerrit-Attention: jolly 
Gerrit-Comment-Date: Mon, 27 Nov 2023 16:30:37 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

2023-11-27 Thread jolly
Attention is currently required from: laforge.

jolly has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/33532?usp=email )

Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
..


Patch Set 3:

(1 comment)

File src/host/layer23/src/common/sysinfo.c:

https://gerrit.osmocom.org/c/osmocom-bb/+/33532/comment/a4d829a1_03ba1e69
PS2, Line 65: (arfcn >= 512 && arfcn <= 810)
> Yes this makes it simpler.
Done



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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Gerrit-Change-Number: 33532
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly 
Gerrit-Attention: laforge 
Gerrit-Comment-Date: Mon, 27 Nov 2023 08:28:25 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly 
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

2023-11-24 Thread jolly
Attention is currently required from: jolly, laforge.

jolly has uploaded a new patch set (#3) to the change originally created by 
laforge. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33532?usp=email )

The following approvals got outdated and were removed:
Code-Review-1 by jolly, Verified+1 by Jenkins Builder


Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
..

mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810

While it is correct to use the band indicator from SI1 rest octets,
it may only be applied for ARFCN values in the range 512..810.

The function gsm_refer_pcs() is used to determine, if the cell (which
'talks' about ARFCNs) refers to them PCS or DCS channels. It returns
true, if it refers to PCS, but this only means that ARFCNs in the range
512..810 are PCS channels, not all ARFCNs.

The new function gsm_arfcn_refer_pcs() is used to add the PCS flag to an
ARFCN, if the given cell refers to PCS and the given ARFCN is in the PCS
range 512..810.

Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Related: OS#6078
---
M src/host/layer23/include/osmocom/bb/common/sysinfo.h
M src/host/layer23/src/common/sysinfo.c
M src/host/layer23/src/mobile/gsm322.c
M src/host/layer23/src/mobile/gsm48_rr.c
4 files changed, 71 insertions(+), 41 deletions(-)


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007
Gerrit-Change-Number: 33532
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly 
Gerrit-Attention: jolly 
Gerrit-Attention: laforge 
Gerrit-MessageType: newpatchset