[MERGED] osmo-ttcn3-hacks[master]: WIP: Work towards a more real DL TBF receiver implementation
Harald Welte has submitted this change and it was merged. Change subject: WIP: Work towards a more real DL TBF receiver implementation .. WIP: Work towards a more real DL TBF receiver implementation Change-Id: I300312734d99f2b8a406f39e04b4f738940f7579 --- M library/RLCMAC_Types.ttcn M pcu/GPRS_TBF.ttcn 2 files changed, 161 insertions(+), 17 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn index 3ae1203..c946594 100644 --- a/library/RLCMAC_Types.ttcn +++ b/library/RLCMAC_Types.ttcn @@ -113,7 +113,14 @@ boolean e } with { variant (e) "FIELDLENGTH(1)" + encode "RAW" }; + + external function enc_LlcBlockHdr(in LlcBlockHdr si) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_LlcBlockHdr(in octetstring stream) return LlcBlockHdr + with { extension "prototype(convert) decode(RAW)" }; + type record LlcBlock { /* Header is only present if LI field was present */ LlcBlockHdr hdr optional, diff --git a/pcu/GPRS_TBF.ttcn b/pcu/GPRS_TBF.ttcn index a35c780..3e8658e 100644 --- a/pcu/GPRS_TBF.ttcn +++ b/pcu/GPRS_TBF.ttcn @@ -18,8 +18,25 @@ import from LLC_Types all; import from GPRS_Context all; -/* input parameters into TBF (mostly mode/cs + LLC PDUs */ +private const integer RLC_GPRS_SNS := 128; +private const integer RLC_GPRS_WS := 64; +private const integer RLC_EGPRS_MIN_WS := 64; +private const integer RLC_EGPRS_MAX_WS := 1024; +private const integer RLC_EGPRS_SNS := 2048; +private const integer RLC_EGPRS_MAX_BSN_DELTA := 512; +private const integer RLC_MAX_SNS := RLC_EGPRS_SNS; +private const integer RLC_MAX_WS := RLC_EGPRS_MAX_WS; +private const integer RLC_MAX_LEN := 74 /* MCS-9 data unit */ +private const integer sns_half := (RLC_MAX_SNS / 2); +private const integer mod_sns_half := (RLC_MAX_SNS / 2) - 1; + + +/*** + * Uplink TBF handling + ***/ + +/* input parameters into TBF (mostly mode/cs + LLC PDUs */ type record UlTbfPars { /* Acknowledged mode (true) or unacknowledged (false) */ boolean ack_mode, @@ -45,22 +62,6 @@ ep.v_a := 0; ep.v_b := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ } - -type record RlcEndpointRx { - /* receive state variable V(R) (9.1.5): BSN one higher than highest BSN yet received (mod SNS) */ - integer v_r, - /* receive window state variable V(Q) (9.1.6): Lowest BSN not yet received (mod SNS) */ - integer v_q, - /* receive state array V(N) (9.1.7) */ - bitstring v_n -} - -private function f_RlcEndpointRx_init(inout RlcEndpointRx ep) { - ep.v_r := 0; - ep.v_q := 0; - ep.v_n := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ -} - type record UlTbfState { /* "const" input state with TBF Data */ @@ -360,6 +361,142 @@ } } +/*** + * Downlink TBF handling + ***/ + +type record RlcEndpointRx { + /* receive state variable V(R) (9.1.5): BSN one higher than highest BSN yet received (mod SNS) */ + integer v_r, + /* receive window state variable V(Q) (9.1.6): Lowest BSN not yet received (mod SNS) */ + integer v_q, + /* receive state array V(N) (9.1.7) */ + bitstring v_n +} + +private function f_RlcEndpointRx_init(inout RlcEndpointRx ep) { + ep.v_r := 0; + ep.v_q := 0; + ep.v_n := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ +} + +type record DlTbfPars { + /* Acknowledged mode (true) or unacknowledged (false) */ + boolean ack_mode, + /* Coding Scheme for transmission, determines block size */ + GprsCodingSchemeinitial_cs, + /* Sequence Number Space */ + integer sns, + /* Window Size */ + integer ws +} + +type record DlTbfState { + /* "const" input state with TBF Data */ + DlTbfPars tbf, + uint8_t num_ts, + + RlcEndpointRx er, + + integer tfi, + + /* list of abstract/decoded RLC PDUs */ + record of RlcmacDlBlock rlc_received +} + +function f_dl_tbf_mod_sns(DlTbfState ds, integer val) return integer +{ + return (val mod ds.tbf.sns); +} + +function f_dl_tbf_is_in_window(integer bsn) return boolean { + setverdict(fail, "pleaes implement me"); +
osmo-ttcn3-hacks[master]: WIP: Work towards a more real DL TBF receiver implementation
Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7230 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I300312734d99f2b8a406f39e04b4f738940f7579 Gerrit-PatchSet: 3 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-ttcn3-hacks[master]: WIP: Work towards a more real DL TBF receiver implementation
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7230 to look at the new patch set (#3). WIP: Work towards a more real DL TBF receiver implementation Change-Id: I300312734d99f2b8a406f39e04b4f738940f7579 --- M library/RLCMAC_Types.ttcn M pcu/GPRS_TBF.ttcn 2 files changed, 161 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/30/7230/3 diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn index 3ae1203..c946594 100644 --- a/library/RLCMAC_Types.ttcn +++ b/library/RLCMAC_Types.ttcn @@ -113,7 +113,14 @@ boolean e } with { variant (e) "FIELDLENGTH(1)" + encode "RAW" }; + + external function enc_LlcBlockHdr(in LlcBlockHdr si) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_LlcBlockHdr(in octetstring stream) return LlcBlockHdr + with { extension "prototype(convert) decode(RAW)" }; + type record LlcBlock { /* Header is only present if LI field was present */ LlcBlockHdr hdr optional, diff --git a/pcu/GPRS_TBF.ttcn b/pcu/GPRS_TBF.ttcn index a35c780..3e8658e 100644 --- a/pcu/GPRS_TBF.ttcn +++ b/pcu/GPRS_TBF.ttcn @@ -18,8 +18,25 @@ import from LLC_Types all; import from GPRS_Context all; -/* input parameters into TBF (mostly mode/cs + LLC PDUs */ +private const integer RLC_GPRS_SNS := 128; +private const integer RLC_GPRS_WS := 64; +private const integer RLC_EGPRS_MIN_WS := 64; +private const integer RLC_EGPRS_MAX_WS := 1024; +private const integer RLC_EGPRS_SNS := 2048; +private const integer RLC_EGPRS_MAX_BSN_DELTA := 512; +private const integer RLC_MAX_SNS := RLC_EGPRS_SNS; +private const integer RLC_MAX_WS := RLC_EGPRS_MAX_WS; +private const integer RLC_MAX_LEN := 74 /* MCS-9 data unit */ +private const integer sns_half := (RLC_MAX_SNS / 2); +private const integer mod_sns_half := (RLC_MAX_SNS / 2) - 1; + + +/*** + * Uplink TBF handling + ***/ + +/* input parameters into TBF (mostly mode/cs + LLC PDUs */ type record UlTbfPars { /* Acknowledged mode (true) or unacknowledged (false) */ boolean ack_mode, @@ -45,22 +62,6 @@ ep.v_a := 0; ep.v_b := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ } - -type record RlcEndpointRx { - /* receive state variable V(R) (9.1.5): BSN one higher than highest BSN yet received (mod SNS) */ - integer v_r, - /* receive window state variable V(Q) (9.1.6): Lowest BSN not yet received (mod SNS) */ - integer v_q, - /* receive state array V(N) (9.1.7) */ - bitstring v_n -} - -private function f_RlcEndpointRx_init(inout RlcEndpointRx ep) { - ep.v_r := 0; - ep.v_q := 0; - ep.v_n := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ -} - type record UlTbfState { /* "const" input state with TBF Data */ @@ -360,6 +361,142 @@ } } +/*** + * Downlink TBF handling + ***/ + +type record RlcEndpointRx { + /* receive state variable V(R) (9.1.5): BSN one higher than highest BSN yet received (mod SNS) */ + integer v_r, + /* receive window state variable V(Q) (9.1.6): Lowest BSN not yet received (mod SNS) */ + integer v_q, + /* receive state array V(N) (9.1.7) */ + bitstring v_n +} + +private function f_RlcEndpointRx_init(inout RlcEndpointRx ep) { + ep.v_r := 0; + ep.v_q := 0; + ep.v_n := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ +} + +type record DlTbfPars { + /* Acknowledged mode (true) or unacknowledged (false) */ + boolean ack_mode, + /* Coding Scheme for transmission, determines block size */ + GprsCodingSchemeinitial_cs, + /* Sequence Number Space */ + integer sns, + /* Window Size */ + integer ws +} + +type record DlTbfState { + /* "const" input state with TBF Data */ + DlTbfPars tbf, + uint8_t num_ts, + + RlcEndpointRx er, + + integer tfi, + + /* list of abstract/decoded RLC PDUs */ + record of RlcmacDlBlock rlc_received +} + +function f_dl_tbf_mod_sns(DlTbfState ds, integer val) return integer +{ + return (val mod ds.tbf.sns); +} + +function f_dl_tbf_is_in_window(integer bsn) return boolean { + setverdict(fail, "pleaes implement me"); + self.stop; +} + +function f_dl_tbf_is_received(inout
osmo-ttcn3-hacks[master]: WIP: Work towards a more real DL TBF receiver implementation
Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/7230 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I300312734d99f2b8a406f39e04b4f738940f7579 Gerrit-PatchSet: 2 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-ttcn3-hacks[master]: WIP: Work towards a more real DL TBF receiver implementation
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7230 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I300312734d99f2b8a406f39e04b4f738940f7579 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-HasComments: No
[PATCH] osmo-ttcn3-hacks[master]: WIP: Work towards a more real DL TBF receiver implementation
Review at https://gerrit.osmocom.org/7230 WIP: Work towards a more real DL TBF receiver implementation Change-Id: I300312734d99f2b8a406f39e04b4f738940f7579 --- M library/RLCMAC_Types.ttcn M pcu/GPRS_TBF.ttcn 2 files changed, 154 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/30/7230/1 diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn index 3ae1203..c946594 100644 --- a/library/RLCMAC_Types.ttcn +++ b/library/RLCMAC_Types.ttcn @@ -113,7 +113,14 @@ boolean e } with { variant (e) "FIELDLENGTH(1)" + encode "RAW" }; + + external function enc_LlcBlockHdr(in LlcBlockHdr si) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_LlcBlockHdr(in octetstring stream) return LlcBlockHdr + with { extension "prototype(convert) decode(RAW)" }; + type record LlcBlock { /* Header is only present if LI field was present */ LlcBlockHdr hdr optional, diff --git a/pcu/GPRS_TBF.ttcn b/pcu/GPRS_TBF.ttcn index a35c780..d30f4c7 100644 --- a/pcu/GPRS_TBF.ttcn +++ b/pcu/GPRS_TBF.ttcn @@ -18,8 +18,24 @@ import from LLC_Types all; import from GPRS_Context all; -/* input parameters into TBF (mostly mode/cs + LLC PDUs */ +private const integer RLC_GPRS_SNS := 128; +private const integer RLC_GPRS_WS := 64; +private const integer RLC_EGPRS_MIN_WS := 64; +private const integer RLC_EGPRS_MAX_WS := 1024; +private const integer RLC_EGPRS_SNS := 2048; +private const integer RLC_EGPRS_MAX_BSN_DELTA := 512; +private const integer RLC_MAX_SNS := RLC_EGPRS_SNS; +private const integer RLC_MAX_WS := RLC_EGPRS_MAX_WS; +private const integer RLC_MAX_LEN := 74 /* MCS-9 data unit */ +private const integer mod_sns_half := (RLC_MAX_SNS / 2) - 1; + + +/*** + * Uplink TBF handling + ***/ + +/* input parameters into TBF (mostly mode/cs + LLC PDUs */ type record UlTbfPars { /* Acknowledged mode (true) or unacknowledged (false) */ boolean ack_mode, @@ -45,22 +61,6 @@ ep.v_a := 0; ep.v_b := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ } - -type record RlcEndpointRx { - /* receive state variable V(R) (9.1.5): BSN one higher than highest BSN yet received (mod SNS) */ - integer v_r, - /* receive window state variable V(Q) (9.1.6): Lowest BSN not yet received (mod SNS) */ - integer v_q, - /* receive state array V(N) (9.1.7) */ - bitstring v_n -} - -private function f_RlcEndpointRx_init(inout RlcEndpointRx ep) { - ep.v_r := 0; - ep.v_q := 0; - ep.v_n := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ -} - type record UlTbfState { /* "const" input state with TBF Data */ @@ -360,6 +360,136 @@ } } +/*** + * Downlink TBF handling + ***/ + +type record RlcEndpointRx { + /* receive state variable V(R) (9.1.5): BSN one higher than highest BSN yet received (mod SNS) */ + integer v_r, + /* receive window state variable V(Q) (9.1.6): Lowest BSN not yet received (mod SNS) */ + integer v_q, + /* receive state array V(N) (9.1.7) */ + bitstring v_n +} + +private function f_RlcEndpointRx_init(inout RlcEndpointRx ep) { + ep.v_r := 0; + ep.v_q := 0; + ep.v_n := int2bit(0, 128); /* FIXME: EGPRS 2048 bits length */ +} + +type record DlTbfPars { + /* Acknowledged mode (true) or unacknowledged (false) */ + boolean ack_mode, + /* Coding Scheme for transmission, determines block size */ + GprsCodingSchemeinitial_cs, + /* Sequence Number Space */ + integer sns, + /* Window Size */ + integer ws +} + +type record DlTbfState { + /* "const" input state with TBF Data */ + DlTbfPars tbf, + uint8_t num_ts, + + RlcEndpointRx er, + + integer tfi, + + /* list of abstract/decoded RLC PDUs */ + record of RlcmacDlBlock rlc_received +} + +function f_dl_tbf_mod_sns(DlTbfState ds, integer val) return integer +{ + return (val mod ds.tbf.sns); +} + +function f_dl_tbf_is_received(inout DlTbfstate ds, integer bsn) return boolean { + var integer offset_v_r; + + if (not f_dl_tbf_is_in_window(bsn) { + return false; + } + + /* offset to the end of the received window */ + offset_v_r := f_dl_tbf_mod_sns(ds, ds.er.v_r - 1 - bsn); +