summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-09-07 11:29:32 +0200
committerHarald Welte <laforge@gnumonks.org>2012-09-07 12:07:54 +0200
commitd8b476988d38f3ef2267594a46d0e4a9fc6eb6a1 (patch)
tree48a137af7ab51f59e60a9bd830a92f00269f1ea0
parent04f0989d1173bb8d2a8aa058eb18db41353352d4 (diff)
BSSGP: make bvc_ctx->fc a dynamic talloc allocation
this ensures that we can talloc the flow-control queue entries as siblings off the bvc_ctx.
-rw-r--r--include/osmocom/gprs/gprs_bssgp.h2
-rw-r--r--src/gb/gprs_bssgp.c12
-rw-r--r--tests/gb/bssgp_fc_tests.err100
3 files changed, 58 insertions, 56 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index 3a1b7613..eb4e7219 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -93,7 +93,7 @@ struct bssgp_bvc_ctx {
struct rate_ctr_group *ctrg;
- struct bssgp_flow_control fc;
+ struct bssgp_flow_control *fc;
/*! default maximum size of per-MS bucket in octets */
uint32_t bmax_default_ms;
/*! default bucket leak rate of per-MS bucket in octests/s */
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 70e2a1c5..e41c7efb 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -96,7 +96,9 @@ struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei)
ctx->nsei = nsei;
/* FIXME: BVCI is not unique, only BVCI+NSEI ?!? */
ctx->ctrg = rate_ctr_group_alloc(ctx, &bssgp_ctrg_desc, bvci);
- ctx->fc.out_cb = &_bssgp_tx_dl_ud;
+ ctx->fc = talloc_zero(ctx, struct bssgp_flow_control);
+ /* cofigure for 2Mbit, 30 packets in queue */
+ bssgp_fc_init(ctx->fc, 100000, 2*1024*1024/8, 30, &_bssgp_tx_dl_ud);
llist_add(&ctx->list, &bssgp_bvc_ctxts);
@@ -755,10 +757,10 @@ static int bssgp_rx_fc_bvc(struct msgb *msg, struct tlv_parsed *tp,
}
/* 11.3.5 Bucket Size in 100 octets unit */
- bctx->fc.bucket_size_max = 100 *
+ bctx->fc->bucket_size_max = 100 *
ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVC_BUCKET_SIZE));
/* 11.3.4 Bucket Leak Rate in 100 bits/sec unit */
- bctx->fc.bucket_leak_rate = 100 *
+ bctx->fc->bucket_leak_rate = 100 *
ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BUCKET_LEAK_RATE)) / 8;
/* 11.3.2 in octets */
bctx->bmax_default_ms =
@@ -1083,9 +1085,9 @@ int bssgp_tx_dl_ud(struct msgb *msg, uint16_t pdu_lifetime,
/* check if we have to go through per-ms flow control or can go
* directly to the per-BSS flow control */
if (dup->fc)
- return bssgp_fc_in(dup->fc, msg, msg_len, &bctx->fc);
+ return bssgp_fc_in(dup->fc, msg, msg_len, bctx->fc);
else
- return bssgp_fc_in(&bctx->fc, msg, msg_len, NULL);
+ return bssgp_fc_in(bctx->fc, msg, msg_len, NULL);
}
/* Send a single GMM-PAGING.req to a given NSEI/NS-BVCI */
diff --git a/tests/gb/bssgp_fc_tests.err b/tests/gb/bssgp_fc_tests.err
index 0a074f16..ae5d6f66 100644
--- a/tests/gb/bssgp_fc_tests.err
+++ b/tests/gb/bssgp_fc_tests.err
@@ -1,51 +1,51 @@
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:697 Single PDU (size=1000) is larger than maximum bucket size (100)!
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
-<0000> gprs_bssgp.c:554 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
+<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
 \ No newline at end of file