[MERGED] osmo-bts[master]: split scheduler_mframe.c from scheduler.c

2018-02-26 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: split scheduler_mframe.c from scheduler.c
..


split scheduler_mframe.c from scheduler.c

There are use cases for the multiframe scheduler tables outside the
context of the entire scheduler. Let's prepare for that.

Related: OS#2978
Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
---
M include/osmo-bts/scheduler.h
M src/common/Makefile.am
M src/common/scheduler.c
A src/common/scheduler_mframe.c
M src/osmo-bts-trx/Makefile.am
M src/osmo-bts-virtual/Makefile.am
6 files changed, 857 insertions(+), 818 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 11a30fd..4d34315 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -188,7 +188,37 @@
 /* \brief close all logical channels and reset timeslots */
 void trx_sched_reset(struct l1sched_trx *l1t);
 
+
+/* frame structures */
+struct trx_sched_frame {
+   /*! \brief downlink TRX channel type */
+   enum trx_chan_type  dl_chan;
+   /*! \brief downlink block ID */
+   uint8_t dl_bid;
+   /*! \brief uplink TRX channel type */
+   enum trx_chan_type  ul_chan;
+   /*! \brief uplink block ID */
+   uint8_t ul_bid;
+};
+
+/* multiframe structure */
+struct trx_sched_multiframe {
+   /*! \brief physical channel config (channel combination) */
+   enum gsm_phys_chan_config   pchan;
+   /*! \brief applies to which timeslots? */
+   uint8_t slotmask;
+   /*! \brief repeats how many frames */
+   uint8_t period;
+   /*! \brief pointer to scheduling structure */
+   const struct trx_sched_frame*frames;
+   /*! \brief human-readable name */
+   const char  *name;
+};
+
+int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn);
+
 /*! Determine if given frame number contains SACCH (true) or other (false) 
burst */
 bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool 
uplink);
+extern const struct trx_sched_multiframe trx_sched_multiframes[];
 
 #endif /* TRX_SCHEDULER_H */
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 67f3e80..113ff2f 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -12,6 +12,6 @@
   load_indication.c pcu_sock.c handover.c msg_utils.c \
   tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \
   l1sap.c cbch.c power_control.c main.c phy_link.c \
-  dtx_dl_amr_fsm.c
+  dtx_dl_amr_fsm.c scheduler_mframe.c
 
 libl1sched_a_SOURCES = scheduler.c
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e6e7eaf..90de09c 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -565,821 +565,6 @@
return rts_tch_common(l1t, tn, fn, chan, ((fn % 26) >> 2) & 1);
 }
 
-/*
- * multiframe structure
- */
-
-/* frame structures */
-struct trx_sched_frame {
-   /*! \brief downlink TRX channel type */
-   enum trx_chan_type  dl_chan;
-   /*! \brief downlink block ID */
-   uint8_t dl_bid;
-   /*! \brief uplink TRX channel type */
-   enum trx_chan_type  ul_chan;
-   /*! \brief uplink block ID */
-   uint8_t ul_bid;
-};
-
-static const struct trx_sched_frame frame_bcch[51] = {
-/* dl_chan dl_bid  ul_chan ul_bid */
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_BCCH, 0,  TRXC_RACH,  0 }, { TRXC_BCCH,   1,  
TRXC_RACH,  0 }, { TRXC_BCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_BCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH, 

osmo-bts[master]: split scheduler_mframe.c from scheduler.c

2018-02-26 Thread Harald Welte

Patch Set 5: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
Gerrit-PatchSet: 5
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: split scheduler_mframe.c from scheduler.c

2018-02-26 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6852

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

split scheduler_mframe.c from scheduler.c

There are use cases for the multiframe scheduler tables outside the
context of the entire scheduler. Let's prepare for that.

Related: OS#2978
Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
---
M include/osmo-bts/scheduler.h
M src/common/Makefile.am
M src/common/scheduler.c
A src/common/scheduler_mframe.c
M src/osmo-bts-trx/Makefile.am
M src/osmo-bts-virtual/Makefile.am
6 files changed, 857 insertions(+), 818 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/52/6852/5

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 11a30fd..4d34315 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -188,7 +188,37 @@
 /* \brief close all logical channels and reset timeslots */
 void trx_sched_reset(struct l1sched_trx *l1t);
 
+
+/* frame structures */
+struct trx_sched_frame {
+   /*! \brief downlink TRX channel type */
+   enum trx_chan_type  dl_chan;
+   /*! \brief downlink block ID */
+   uint8_t dl_bid;
+   /*! \brief uplink TRX channel type */
+   enum trx_chan_type  ul_chan;
+   /*! \brief uplink block ID */
+   uint8_t ul_bid;
+};
+
+/* multiframe structure */
+struct trx_sched_multiframe {
+   /*! \brief physical channel config (channel combination) */
+   enum gsm_phys_chan_config   pchan;
+   /*! \brief applies to which timeslots? */
+   uint8_t slotmask;
+   /*! \brief repeats how many frames */
+   uint8_t period;
+   /*! \brief pointer to scheduling structure */
+   const struct trx_sched_frame*frames;
+   /*! \brief human-readable name */
+   const char  *name;
+};
+
+int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn);
+
 /*! Determine if given frame number contains SACCH (true) or other (false) 
burst */
 bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool 
uplink);
+extern const struct trx_sched_multiframe trx_sched_multiframes[];
 
 #endif /* TRX_SCHEDULER_H */
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 67f3e80..113ff2f 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -12,6 +12,6 @@
   load_indication.c pcu_sock.c handover.c msg_utils.c \
   tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \
   l1sap.c cbch.c power_control.c main.c phy_link.c \
-  dtx_dl_amr_fsm.c
+  dtx_dl_amr_fsm.c scheduler_mframe.c
 
 libl1sched_a_SOURCES = scheduler.c
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e6e7eaf..90de09c 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -565,821 +565,6 @@
return rts_tch_common(l1t, tn, fn, chan, ((fn % 26) >> 2) & 1);
 }
 
-/*
- * multiframe structure
- */
-
-/* frame structures */
-struct trx_sched_frame {
-   /*! \brief downlink TRX channel type */
-   enum trx_chan_type  dl_chan;
-   /*! \brief downlink block ID */
-   uint8_t dl_bid;
-   /*! \brief uplink TRX channel type */
-   enum trx_chan_type  ul_chan;
-   /*! \brief uplink block ID */
-   uint8_t ul_bid;
-};
-
-static const struct trx_sched_frame frame_bcch[51] = {
-/* dl_chan dl_bid  ul_chan ul_bid */
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_BCCH, 0,  TRXC_RACH,  0 }, { TRXC_BCCH,   1,  
TRXC_RACH,  0 }, { TRXC_BCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_BCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   

osmo-bts[master]: split scheduler_mframe.c from scheduler.c

2018-02-23 Thread Vadim Yanitskiy

Patch Set 3:

Seems, the libl1sched should be linked against libbts this way.
This would solve the problem.

But in general, I am wondering about moving the multiframe
structures to libosmogsm...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: split scheduler_mframe.c from scheduler.c

2018-02-23 Thread Harald Welte

Review at  https://gerrit.osmocom.org/6852

split scheduler_mframe.c from scheduler.c

There are use cases for the multiframe scheduler tables outside the
context of the entire scheduler. Let's prepare for that.

Related: OS#2978
Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
---
M include/osmo-bts/scheduler.h
M src/common/Makefile.am
M src/common/scheduler.c
A src/common/scheduler_mframe.c
4 files changed, 855 insertions(+), 816 deletions(-)


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

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 11a30fd..4d34315 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -188,7 +188,37 @@
 /* \brief close all logical channels and reset timeslots */
 void trx_sched_reset(struct l1sched_trx *l1t);
 
+
+/* frame structures */
+struct trx_sched_frame {
+   /*! \brief downlink TRX channel type */
+   enum trx_chan_type  dl_chan;
+   /*! \brief downlink block ID */
+   uint8_t dl_bid;
+   /*! \brief uplink TRX channel type */
+   enum trx_chan_type  ul_chan;
+   /*! \brief uplink block ID */
+   uint8_t ul_bid;
+};
+
+/* multiframe structure */
+struct trx_sched_multiframe {
+   /*! \brief physical channel config (channel combination) */
+   enum gsm_phys_chan_config   pchan;
+   /*! \brief applies to which timeslots? */
+   uint8_t slotmask;
+   /*! \brief repeats how many frames */
+   uint8_t period;
+   /*! \brief pointer to scheduling structure */
+   const struct trx_sched_frame*frames;
+   /*! \brief human-readable name */
+   const char  *name;
+};
+
+int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn);
+
 /*! Determine if given frame number contains SACCH (true) or other (false) 
burst */
 bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool 
uplink);
+extern const struct trx_sched_multiframe trx_sched_multiframes[];
 
 #endif /* TRX_SCHEDULER_H */
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 67f3e80..113ff2f 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -12,6 +12,6 @@
   load_indication.c pcu_sock.c handover.c msg_utils.c \
   tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \
   l1sap.c cbch.c power_control.c main.c phy_link.c \
-  dtx_dl_amr_fsm.c
+  dtx_dl_amr_fsm.c scheduler_mframe.c
 
 libl1sched_a_SOURCES = scheduler.c
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 4e48160..0e24778 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -565,821 +565,6 @@
return rts_tch_common(l1t, tn, fn, chan, ((fn % 26) >> 2) & 1);
 }
 
-/*
- * multiframe structure
- */
-
-/* frame structures */
-struct trx_sched_frame {
-   /*! \brief downlink TRX channel type */
-   enum trx_chan_type  dl_chan;
-   /*! \brief downlink block ID */
-   uint8_t dl_bid;
-   /*! \brief uplink TRX channel type */
-   enum trx_chan_type  ul_chan;
-   /*! \brief uplink block ID */
-   uint8_t ul_bid;
-};
-
-static const struct trx_sched_frame frame_bcch[51] = {
-/* dl_chan dl_bid  ul_chan ul_bid */
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_BCCH, 0,  TRXC_RACH,  0 }, { TRXC_BCCH,   1,  
TRXC_RACH,  0 }, { TRXC_BCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_BCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,