Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-22 Thread Max
Max has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13355 )

Change subject: trxcon: use static helper to prepare FBSB
..

trxcon: use static helper to prepare FBSB

Use static helper to prepare l1ctl_fbsb_conf - this simplifies
fbsb-related functions and make difference between timer callback and
regular response more obvious.

Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
---
M src/host/trxcon/l1ctl.c
1 file changed, 15 insertions(+), 12 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 8145936..97c2496 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -151,6 +151,19 @@
return dl;
 }

+/* Fill in FBSB payload: BSIC and sync result */
+static struct l1ctl_fbsb_conf *fbsb_conf_make(struct msgb *msg, uint8_t 
result, uint8_t bsic)
+{
+   struct l1ctl_fbsb_conf *conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, 
sizeof(*conf));
+
+   LOGP(DL1C, LOGL_DEBUG, "Send FBSB Conf (result=%u, bsic=%u)\n", result, 
bsic);
+
+   conf->result = result;
+   conf->bsic = bsic;
+
+   return conf;
+}
+
 int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result,
struct l1ctl_info_dl *dl_info, uint8_t bsic)
 {
@@ -161,16 +174,10 @@
if (msg == NULL)
return -ENOMEM;

-   LOGP(DL1C, LOGL_DEBUG, "Send FBSB Conf (result=%u, bsic=%u)\n",
-   result, bsic);
-
put_dl_info_hdr(msg, dl_info);
talloc_free(dl_info);

-   /* Fill in FBSB payload: BSIC and sync result */
-   conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, sizeof(*conf));
-   conf->result = result;
-   conf->bsic = bsic;
+   conf = fbsb_conf_make(msg, result, bsic);

/* FIXME: set proper value */
conf->initial_freq_err = 0;
@@ -287,7 +294,6 @@
 static void fbsb_timer_cb(void *data)
 {
struct l1ctl_link *l1l = (struct l1ctl_link *) data;
-   struct l1ctl_fbsb_conf *conf;
struct l1ctl_info_dl *dl;
struct msgb *msg;

@@ -302,10 +308,7 @@
/* Fill in current ARFCN */
dl->band_arfcn = htons(l1l->trx->band_arfcn);

-   /* Fill in FBSB payload: BSIC and sync result */
-   conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, sizeof(*conf));
-   conf->result = 255;
-   conf->bsic = 0;
+   fbsb_conf_make(msg, 255, 0);

/* Ask SCH handler not to send L1CTL_FBSB_CONF anymore */
l1l->fbsb_conf_sent = true;

--
To view, visit https://gerrit.osmocom.org/13355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 3
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: osmith 


Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-21 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13355 )

Change subject: trxcon: use static helper to prepare FBSB
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 3
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Thu, 21 Mar 2019 17:40:56 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-21 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13355 )

Change subject: trxcon: use static helper to prepare FBSB
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 2
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Thu, 21 Mar 2019 15:48:50 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-21 Thread Max
Max has posted comments on this change. ( https://gerrit.osmocom.org/13355 )

Change subject: trxcon: use static helper to prepare FBSB
..


Patch Set 2:

(3 comments)

https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c
File src/host/trxcon/l1ctl.c:

https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c@304
PS1, Line 304: l1l->trx->band_arfcn
> This is not an ARFCN itself, but ARFCN + band (and some other flags), so: 
> band_arfcn &~ ARFCN_FLAG_M […]
Done


https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c@367
PS1, Line 367: LOGL_INFO,
> This message is more related to LOGL_INFO.
Done


https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c@367
PS1, Line 367: LOGP
> And please do this in a separate change, as this one states "trxcon: use 
> static helper to prepare FB […]
Done



--
To view, visit https://gerrit.osmocom.org/13355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 2
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Thu, 21 Mar 2019 15:06:07 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-21 Thread Max
Hello dexter, Vadim Yanitskiy, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/13355

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

Change subject: trxcon: use static helper to prepare FBSB
..

trxcon: use static helper to prepare FBSB

Use static helper to prepare l1ctl_fbsb_conf - this simplifies
fbsb-related functions and make difference between timer callback and
regular response more obvious.

Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
---
M src/host/trxcon/l1ctl.c
1 file changed, 15 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/55/13355/2
--
To view, visit https://gerrit.osmocom.org/13355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 2
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: osmith 


Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-21 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/13355 )

Change subject: trxcon: use static helper to prepare FBSB
..


Patch Set 1: Code-Review-1

(3 comments)

https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c
File src/host/trxcon/l1ctl.c:

https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c@304
PS1, Line 304: l1l->trx->band_arfcn
This is not an ARFCN itself, but ARFCN + band (and some other flags), so: 
band_arfcn &~ ARFCN_FLAG_MASK. Otherwise you would see garbage in some cases.


https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c@367
PS1, Line 367: LOGP
And please do this in a separate change, as this one states "trxcon: use static 
helper to prepare FBSB".


https://gerrit.osmocom.org/#/c/13355/1/src/host/trxcon/l1ctl.c@367
PS1, Line 367: LOGL_NOTICE
This message is more related to LOGL_INFO.



--
To view, visit https://gerrit.osmocom.org/13355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 1
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 21 Mar 2019 13:09:34 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon: use static helper to prepare FBSB

2019-03-21 Thread Max
Max has uploaded this change for review. ( https://gerrit.osmocom.org/13355


Change subject: trxcon: use static helper to prepare FBSB
..

trxcon: use static helper to prepare FBSB

Use static helper to prepare l1ctl_fbsb_conf - this simplifies
fbsb-related functions and make difference between timer callback and
regular response more obvious.

Change-Id: I43832d6a912a32ea5795ed0110981e0b714a7a61
---
M src/host/trxcon/l1ctl.c
1 file changed, 17 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/55/13355/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 0541f58..d445f39 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -151,6 +151,19 @@
return dl;
 }

+/* Fill in FBSB payload: BSIC and sync result */
+static struct l1ctl_fbsb_conf *fbsb_conf_make(struct msgb *msg, uint8_t 
result, uint8_t bsic)
+{
+   struct l1ctl_fbsb_conf *conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, 
sizeof(*conf));
+
+   LOGP(DL1C, LOGL_DEBUG, "Send FBSB Conf (result=%u, bsic=%u)\n", result, 
bsic);
+
+   conf->result = result;
+   conf->bsic = bsic;
+
+   return conf;
+}
+
 int l1ctl_tx_fbsb_conf(struct l1ctl_link *l1l, uint8_t result,
struct l1ctl_info_dl *dl_info, uint8_t bsic)
 {
@@ -161,16 +174,10 @@
if (msg == NULL)
return -ENOMEM;

-   LOGP(DL1C, LOGL_DEBUG, "Send FBSB Conf (result=%u, bsic=%u)\n",
-   result, bsic);
-
add_info_dl(msg, dl_info);
talloc_free(dl_info);

-   /* Fill in FBSB payload: BSIC and sync result */
-   conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, sizeof(*conf));
-   conf->result = result;
-   conf->bsic = bsic;
+   conf = fbsb_conf_make(msg, result, bsic);

/* FIXME: set proper value */
conf->initial_freq_err = 0;
@@ -287,7 +294,6 @@
 static void fbsb_timer_cb(void *data)
 {
struct l1ctl_link *l1l = (struct l1ctl_link *) data;
-   struct l1ctl_fbsb_conf *conf;
struct l1ctl_info_dl *dl;
struct msgb *msg;

@@ -295,17 +301,14 @@
if (msg == NULL)
return;

-   LOGP(DL1C, LOGL_DEBUG, "Send FBSB Conf (result=255, bsic=0)\n");
+   LOGP(DL1C, LOGL_NOTICE, "FBSB timer fired for ARFCN %u\n", 
l1l->trx->band_arfcn);

dl = add_info_dl(msg, NULL);

/* Fill in current ARFCN */
dl->band_arfcn = htons(l1l->trx->band_arfcn);

-   /* Fill in FBSB payload: BSIC and sync result */
-   conf = (struct l1ctl_fbsb_conf *) msgb_put(msg, sizeof(*conf));
-   conf->result = 255;
-   conf->bsic = 0;
+   fbsb_conf_make(msg, 255, 0);

/* Ask SCH handler not to send L1CTL_FBSB_CONF anymore */
l1l->fbsb_conf_sent = true;
@@ -361,6 +364,7 @@
/* Start FBSB expire timer */
l1l->fbsb_timer.data = l1l;
l1l->fbsb_timer.cb = fbsb_timer_cb;
+   LOGP(DL1C, LOGL_NOTICE, "Starting FBSB timer %uus\n", timeout * 
FRAME_DURATION_uS);
osmo_timer_schedule(>fbsb_timer, 0,
timeout * FRAME_DURATION_uS);


--
To view, visit https://gerrit.osmocom.org/13355
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: I43832d6a912a32ea5795ed0110981e0b714a7a61
Gerrit-Change-Number: 13355
Gerrit-PatchSet: 1
Gerrit-Owner: Max