blob: 53e76e3a8402a4da26db80cb30fdce78da2454b8 [file] [log] [blame]
Harald Welte17a892f2020-12-07 21:39:03 +01001#pragma once
2#include <stdint.h>
3
4#include <osmocom/gprs/protocol/gsm_08_18.h>
5#include <osmocom/gprs/gprs_ns2.h>
6
Harald Welte4394bb92020-12-08 20:40:44 +01007struct bssgp2_flow_ctrl;
Harald Welte17a892f2020-12-07 21:39:03 +01008struct gprs_ns2_inst;
9struct gprs_ra_id;
10struct msgb;
11
Harald Welte4394bb92020-12-08 20:40:44 +010012struct bssgp2_flow_ctrl {
13 uint8_t tag;
14 /* maximum bucket size (Bmax) in bytes */
15 uint64_t bucket_size_max;
16 /*! bucket leak rate in _bytes_ per second */
17 uint64_t bucket_leak_rate;
18 /* percentage how full the given bucket is */
19 uint8_t bucket_full_ratio;
20 bool bucket_full_ratio_present;
21 union {
22 /*! FC-BVC specifi members */
23 struct {
24 /*! default maximum bucket size per MS in bytes */
25 uint64_t bmax_default_ms;
26 /*! default bucket leak rate (R) for MS flow control bucket */
27 uint64_t r_default_ms;
28
29 /*! average milliseconds of queueing delay for a BVC */
30 uint32_t measurement;
31 bool measurement_present;
32 } bvc;
33 /*! FC-MS specifi members */
34 struct {
35 /*! TLLI of the MS */
36 uint32_t tlli;
37 } ms;
38 } u;
39};
40
41
Harald Welte17a892f2020-12-07 21:39:03 +010042int bssgp2_nsi_tx_ptp(struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci,
43 struct msgb *msg, uint32_t lsp);
44
45int bssgp2_nsi_tx_sig(struct gprs_ns2_inst *nsi, uint16_t nsei, struct msgb *msg, uint32_t lsp);
46
47struct msgb *bssgp2_enc_bvc_block(uint16_t bvci, enum gprs_bssgp_cause cause);
48
49struct msgb *bssgp2_enc_bvc_block_ack(uint16_t bvci);
50
51struct msgb *bssgp2_enc_bvc_unblock(uint16_t bvci);
52
53struct msgb *bssgp2_enc_bvc_unblock_ack(uint16_t bvci);
54
55struct msgb *bssgp2_enc_bvc_reset(uint16_t bvci, enum gprs_bssgp_cause cause,
56 const struct gprs_ra_id *ra_id, uint16_t cell_id,
57 const uint8_t *feat_bm, const uint8_t *ext_feat_bm);
58
59struct msgb *bssgp2_enc_bvc_reset_ack(uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id,
60 const uint8_t *feat_bm, const uint8_t *ext_feat_bm);
61
Alexander Couzens71ad5302022-09-28 16:22:29 +020062struct msgb *bssgp2_enc_flush_ll(uint32_t tlli, uint16_t old_bvci,
63 const uint16_t *new_bvci, const uint16_t *nsei);
Daniel Willmannfa632b82021-02-12 01:57:52 +010064struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg, uint16_t max_pdu_len);
Harald Welte4394bb92020-12-08 20:40:44 +010065
66
67int bssgp2_dec_fc_bvc(struct bssgp2_flow_ctrl *fc, const struct tlv_parsed *tp);
68struct msgb *bssgp2_enc_fc_bvc(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran);
69struct msgb *bssgp2_enc_fc_bvc_ack(uint8_t tag);
70int bssgp2_dec_fc_ms(struct bssgp2_flow_ctrl *fc, struct tlv_parsed *tp);
71struct msgb *bssgp2_enc_fc_ms(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran);
72struct msgb *bssgp2_enc_fc_ms_ack(uint32_t tlli, uint8_t tag);