aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-12-08 20:40:44 +0100
committerHarald Welte <laforge@osmocom.org>2020-12-09 22:56:07 +0100
commit4394bb96291fabbdb102afd5d681ad720d75ab94 (patch)
tree29ba1c10511d639cfd5ab269b60dcde561d42c5a /include
parent4c0e1a1f4cf00577e1aa047a13250e8ee9a290b0 (diff)
bssgp2: Encoding + Decoding functions for BVC and MS flow control
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/gprs/gprs_bssgp2.h39
-rw-r--r--include/osmocom/gprs/protocol/gsm_08_18.h8
2 files changed, 47 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp2.h b/include/osmocom/gprs/gprs_bssgp2.h
index 0ab36191..bf814cb7 100644
--- a/include/osmocom/gprs/gprs_bssgp2.h
+++ b/include/osmocom/gprs/gprs_bssgp2.h
@@ -4,10 +4,41 @@
#include <osmocom/gprs/protocol/gsm_08_18.h>
#include <osmocom/gprs/gprs_ns2.h>
+struct bssgp2_flow_ctrl;
struct gprs_ns2_inst;
struct gprs_ra_id;
struct msgb;
+struct bssgp2_flow_ctrl {
+ uint8_t tag;
+ /* maximum bucket size (Bmax) in bytes */
+ uint64_t bucket_size_max;
+ /*! bucket leak rate in _bytes_ per second */
+ uint64_t bucket_leak_rate;
+ /* percentage how full the given bucket is */
+ uint8_t bucket_full_ratio;
+ bool bucket_full_ratio_present;
+ union {
+ /*! FC-BVC specifi members */
+ struct {
+ /*! default maximum bucket size per MS in bytes */
+ uint64_t bmax_default_ms;
+ /*! default bucket leak rate (R) for MS flow control bucket */
+ uint64_t r_default_ms;
+
+ /*! average milliseconds of queueing delay for a BVC */
+ uint32_t measurement;
+ bool measurement_present;
+ } bvc;
+ /*! FC-MS specifi members */
+ struct {
+ /*! TLLI of the MS */
+ uint32_t tlli;
+ } ms;
+ } u;
+};
+
+
int bssgp2_nsi_tx_ptp(struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci,
struct msgb *msg, uint32_t lsp);
@@ -29,3 +60,11 @@ struct msgb *bssgp2_enc_bvc_reset_ack(uint16_t bvci, const struct gprs_ra_id *ra
const uint8_t *feat_bm, const uint8_t *ext_feat_bm);
struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg);
+
+
+int bssgp2_dec_fc_bvc(struct bssgp2_flow_ctrl *fc, const struct tlv_parsed *tp);
+struct msgb *bssgp2_enc_fc_bvc(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran);
+struct msgb *bssgp2_enc_fc_bvc_ack(uint8_t tag);
+int bssgp2_dec_fc_ms(struct bssgp2_flow_ctrl *fc, struct tlv_parsed *tp);
+struct msgb *bssgp2_enc_fc_ms(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran);
+struct msgb *bssgp2_enc_fc_ms_ack(uint32_t tlli, uint8_t tag);
diff --git a/include/osmocom/gprs/protocol/gsm_08_18.h b/include/osmocom/gprs/protocol/gsm_08_18.h
index 0ce28f55..466b0c51 100644
--- a/include/osmocom/gprs/protocol/gsm_08_18.h
+++ b/include/osmocom/gprs/protocol/gsm_08_18.h
@@ -341,3 +341,11 @@ enum gprs_bssgp_cause {
#define BSSGP_XFEAT_DCN 0x20 /* Dedicated CN */
#define BSSGP_XFEAT_eDRX 0x40 /* eDRX */
#define BSSGP_XFEAT_MSAD 0x80 /* MS-assisted Dedicated CN selection */
+
+/* Flow Control Granularity (Section 11.3.102) */
+enum bssgp_fc_granularity {
+ BSSGP_FC_GRAN_100 = 0,
+ BSSGP_FC_GRAN_1000 = 1,
+ BSSGP_FC_GRAN_10000 = 2,
+ BSSGP_FC_GRAN_100000 = 3,
+};