[MERGED] osmo-pcu[master]: Move multislot table to separate file

2017-11-21 Thread Max
Max has submitted this change and it was merged.

Change subject: Move multislot table to separate file
..


Move multislot table to separate file

To facilitate testing and addition of support for new multislot classes,
hide multislot class struct internals:

* introduce mslot_class_get_*() functions
* use those functions instead of direct access to array of structs
* use ms_class as a parameter to find_multi_slot() instead of entire
  object

Change-Id: Id796bcff1322b1e273a0e3236c66c23b9da8fac6
---
M src/Makefile.am
M src/gprs_rlcmac_ts_alloc.cpp
A src/mslot_class.c
A src/mslot_class.h
4 files changed, 221 insertions(+), 109 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Holger Freyther: Looks good to me, approved



diff --git a/src/Makefile.am b/src/Makefile.am
index 1543851..a6e98e5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -49,6 +49,7 @@
pcu_l1_if.cpp \
pcu_vty.c \
pcu_vty_functions.cpp \
+   mslot_class.c \
tbf.cpp \
tbf_ul.cpp \
tbf_dl.cpp \
@@ -81,6 +82,7 @@
gsm_timer.h \
pcu_vty.h \
pcu_vty_functions.h \
+   mslot_class.h \
tbf.h \
bts.h \
poll_controller.h \
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index dac9e63..5e670d7 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -29,58 +29,12 @@
 #include 
 #include 
 
+extern "C" {
+#include "mslot_class.h"
+}
+
 /* Consider a PDCH as idle if has at most this number of TBFs assigned to it */
 #define PDCH_IDLE_TBF_THRESH   1
-
-/* 3GPP TS 05.02 Annex B.1 */
-
-#define MS_NA  255 /* N/A */
-#define MS_A   254 /* 1 with hopping, 0 without */
-#define MS_B   253 /* 1 with hopping, 0 without (change Rx to Tx)*/
-#define MS_C   252 /* 1 with hopping, 0 without (change Tx to Rx)*/
-
-struct gprs_ms_multislot_class {
-   uint8_t rx, tx, sum;/* Maximum Number of Slots: RX, Tx, Sum Rx+Tx */
-   uint8_t ta, tb, ra, rb; /* Minimum Number of Slots */
-   uint8_t type; /* Type of Mobile */
-};
-
-static const struct gprs_ms_multislot_class gprs_ms_multislot_class[32] = {
-   /* M-S Class |  Max # of slots |   Min # of slots  | Type */
-   /*   | Rx Tx   Sum |  TtaTtbTraTrb |  */
-   /* N/A */ { MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA, MS_NA },
-   /*  1 */  {   1, 1, 2, 3, 2, 4, 2, 1 },
-   /*  2 */  {   2, 1, 3, 3, 2, 3, 1, 1 },
-   /*  3 */  {   2, 2, 3, 3, 2, 3, 1, 1 },
-   /*  4 */  {   3, 1, 4, 3, 1, 3, 1, 1 },
-   /*  5 */  {   2, 2, 4, 3, 1, 3, 1, 1 },
-   /*  6 */  {   3, 2, 4, 3, 1, 3, 1, 1 },
-   /*  7 */  {   3, 3, 4, 3, 1, 3, 1, 1 },
-   /*  8 */  {   4, 1, 5, 3, 1, 2, 1, 1 },
-   /*  9 */  {   3, 2, 5, 3, 1, 2, 1, 1 },
-   /* 10 */  {   4, 2, 5, 3, 1, 2, 1, 1 },
-   /* 11 */  {   4, 3, 5, 3, 1, 2, 1, 1 },
-   /* 12 */  {   4, 4, 5, 2, 1, 2, 1, 1 },
-   /* 13 */  {   3, 3,   MS_NA, MS_NA, MS_A,3,   MS_A,2 },
-   /* 14 */  {   4, 4,   MS_NA, MS_NA, MS_A,3,   MS_A,2 },
-   /* 15 */  {   5, 5,   MS_NA, MS_NA, MS_A,3,   MS_A,2 },
-   /* 16 */  {   6, 6,   MS_NA, MS_NA, MS_A,2,   MS_A,2 },
-   /* 17 */  {   7, 7,   MS_NA, MS_NA, MS_A,1, 0, 2 },
-   /* 18 */  {   8, 8,   MS_NA, MS_NA,   0, 0, 0, 2 },
-   /* 19 */  {   6, 2,   MS_NA,   3,   MS_B,2,   MS_C,1 },
-   /* 20 */  {   6, 3,   MS_NA,   3,   MS_B,2,   MS_C,1 },
-   /* 21 */  {   6, 4,   MS_NA,   3,   MS_B,2,   MS_C,1 },
-   /* 22 */  {   6, 4,   MS_NA,   2,   MS_B,2,   MS_C,1 },
-   /* 23 */  {   6, 6,   MS_NA,   2,   MS_B,2,   MS_C,1 },
-   /* 24 */  {   8, 2,   MS_NA,   3,   MS_B,2,   MS_C,1 },
-   /* 25 */  {   8, 3,   MS_NA,   3,   MS_B,2,   MS_C,1 },
-   /* 26 */  {   8, 4,   MS_NA,   3,   MS_B,2,   MS_C,1 },
-   /* 27 */  {   8, 4,   MS_NA,   2,   MS_B,2,   MS_C,1 },
-   /* 28 */  {   8, 6,   MS_NA,   2,   MS_B,2,   MS_C,1 },
-   /* 29 */  {   8, 8,   MS_NA,   2,   MS_B,2,   MS_C,1 },
-/* N/A */  { MS_NA,MS_NA,  MS_NA,  MS_NA,  MS_NA,  MS_NA,  MS_NA,  MS_NA },
-/* N/A */  { MS_NA,MS_NA,  MS_NA,  MS_NA,  MS_NA,  MS_NA,  MS_NA,  MS_NA },
-};
 
 static char *set_flag_chars(char *buf, uint8_t val, char set_char, char 
unset_char = 0)
 {
@@ -489,10 +443,8 @@
return 0;
 }
 
-static int find_multi_slots(struct 

osmo-pcu[master]: Move multislot table to separate file

2017-11-21 Thread Max

Patch Set 1:

> What information does this have?

Same as gprs_rlcmac_ts_alloc.cpp which I've used as an example. What 
information should it have?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id796bcff1322b1e273a0e3236c66c23b9da8fac6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmo-pcu[master]: Move multislot table to separate file

2017-11-21 Thread Holger Freyther

Patch Set 1: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/4635/1/src/mslot_class.c
File src/mslot_class.c:

Line 1: /* mslot_class.c
What information does this have?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id796bcff1322b1e273a0e3236c66c23b9da8fac6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes