diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-09-07 11:29:32 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-09-07 12:07:54 +0200 |
commit | d8b476988d38f3ef2267594a46d0e4a9fc6eb6a1 (patch) | |
tree | 48a137af7ab51f59e60a9bd830a92f00269f1ea0 /src/gb/gprs_bssgp.c | |
parent | 04f0989d1173bb8d2a8aa058eb18db41353352d4 (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.
Diffstat (limited to 'src/gb/gprs_bssgp.c')
-rw-r--r-- | src/gb/gprs_bssgp.c | 12 |
1 files changed, 7 insertions, 5 deletions
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 */ |