jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35048?usp=email )
Change subject: LAPD: Indicate sequence error after indicating received data
......................................................................
LAPD: Indicate sequence error after indicating received data
First indicated the received data in an I frame, if possible. Then
indicate the sequence error using MDL-ERROR-INDICATION. This way the
data is delivered before the error is handled by BSC.
Also there is no reason to indicate sequence error on supervisory
frames.
See §8.7.4 of 3GPP TS 44.006.
Related: OS#5968
Change-Id: I535c18018bf0df4124a5e9618238028fa31be289
---
M src/isdn/lapd_core.c
1 file changed, 34 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/35048/1
diff --git a/src/isdn/lapd_core.c b/src/isdn/lapd_core.c
index 925f209..516d0d1 100644
--- a/src/isdn/lapd_core.c
+++ b/src/isdn/lapd_core.c
@@ -796,8 +796,9 @@
lapd_start_t200(dl);
}
-/* 5.5.3.1: Common function to acknowlege frames up to the given N(R) value */
-static void lapd_acknowledge(struct lapd_msg_ctx *lctx)
+/* 5.5.3.1: Common function to acknowlege frames up to the given N(R) value
+ * In case of a sequence error, the cause is returned with negative sign. */
+static int lapd_acknowledge(struct lapd_msg_ctx *lctx)
{
struct lapd_datalink *dl = lctx->dl;
uint8_t nr = lctx->n_recv;
@@ -838,7 +839,7 @@
*/
if (sub_mod(nr, dl->v_ack, dl->v_range) > sub_mod(dl->v_send, dl->v_ack, dl->v_range)) {
LOGDL(dl, LOGL_NOTICE, "N(R) sequence error\n");
- mdl_error(MDL_CAUSE_SEQ_ERR, lctx);
+ return -MDL_CAUSE_SEQ_ERR;
}
}
@@ -861,6 +862,8 @@
/* Start T203, if T200 is not running in MF EST state, if enabled */
if (!lapd_is_t200_started(dl) && (dl->t203_sec || dl->t203_usec) && (dl->state == LAPD_STATE_MF_EST))
lapd_start_t203(dl);
+
+ return 0;
}
/* L1 -> L2 */
@@ -1576,6 +1579,7 @@
int length = lctx->length;
int rc;
bool i_frame_in_queue = false;
+ int mdl_cause = 0;
LOGDL(dl, LOGL_INFO, "I received in state %s on SAPI(%u)\n",
lapd_state_name(dl->state), lctx->sapi);
@@ -1652,7 +1656,9 @@
}
/* Even if N(s) sequence error, acknowledge to N(R)-1 */
/* 5.5.3.1: Acknowlege all transmitted frames up the N(R)-1 */
- lapd_acknowledge(lctx); /* V(A) is also set here */
+ mdl_cause = lapd_acknowledge(lctx); /* V(A) is also set here */
+ if (mdl_cause < 0)
+ mdl_error(-mdl_cause, lctx);
/* Send message, if possible due to acknowledged data */
lapd_send_i(dl, __LINE__, false);
@@ -1673,7 +1679,7 @@
}
/* 5.5.3.1: Acknowlege all transmitted frames up the the N(R)-1 */
- lapd_acknowledge(lctx); /* V(A) is also set here */
+ mdl_cause = lapd_acknowledge(lctx); /* V(A) is also set here */
/* Only if we are not in own receiver busy condition */
if (!dl->own_busy) {
@@ -1718,6 +1724,10 @@
} else
LOGDL(dl, LOGL_INFO, "I frame ignored during own receiver busy condition\n");
+ /* Indicate sequence error, if exists. */
+ if (mdl_cause < 0)
+ mdl_error(-mdl_cause, lctx);
+
/* Check for P bit */
if (lctx->p_f) {
/* 5.5.2.1 */
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35048?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I535c18018bf0df4124a5e9618238028fa31be289
Gerrit-Change-Number: 35048
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-MessageType: newchange
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35045?usp=email )
Change subject: [WIP] soft_uart: implement OSMO_SUART_RX_MODE_N_FRAMES
......................................................................
Patch Set 2:
(1 comment)
File include/osmocom/core/soft_uart.h:
https://gerrit.osmocom.org/c/libosmocore/+/35045/comment/feaa2f0c_67944841
PS2, Line 78: number of received UART frames for OSMO_SUART_RX_MODE_N_FRAMES; UART
: * will flush receive buffer via the receive call-back after indicated number
: * of UART frames had been received. *
how is this different from the existing behavior if you'd simply make the rx buffer size == rx_n_uart_frames?
The original code was written in a way that *normally* you would call the call-back whenever the buffer is full, but in casese that takes too long, we use the timeout as a fall-back.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35045?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib3249a06c84f3ddb2723d0787db51873c4707d81
Gerrit-Change-Number: 35045
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 16 Nov 2023 15:30:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35045?usp=email )
Change subject: [WIP] soft_uart: implement OSMO_SUART_RX_MODE_N_FRAMES
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
might be worth explaining the usage pattern. Also, if it does what I think it does, it might be easier to understand it as a "rx buffer fill threshold expressed in bytes" or the like?
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35045?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib3249a06c84f3ddb2723d0787db51873c4707d81
Gerrit-Change-Number: 35045
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 16 Nov 2023 15:22:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35044?usp=email )
Change subject: soft_uart: implement the transmitter
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File src/core/soft_uart.c:
https://gerrit.osmocom.org/c/libosmocore/+/35044/comment/805a3c8e_44104bba
PS2, Line 209: size_t osmo_soft_uart_tx(struct osmo_soft_uart *suart,
how does this reject any buffer overflows? It is difficult to manage transmission with a buffer, IMHO. I would suggest to let the user of this API manage the data and simply call a function every time the transmitter wants to pull data out of the application-side buffer. This way it's up to the application to manage the size of the buffer, any kind of prioritization of different data, the overflow/overrun semantics, etc.
Yes, that would mean one function call-back for each byte the transmitter pulls out of that buffer. If that really turns out to be a performance problem (probably with hundreds of parallel uarts, if we ever need that) we might want to pull multiple bytes at the same time. But in any case, I think we hve a fixed bit-rate consumer of data (the transmitter) and it should pull data.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35044?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibcd9643227e5616efd8bbd7a1430feda6fcef45c
Gerrit-Change-Number: 35044
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 16 Nov 2023 15:16:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35022?usp=email )
Change subject: soft_uart: rework osmo_uart_rx_bit() to use flow state
......................................................................
Patch Set 2: Code-Review+1
(1 comment)
Patchset:
PS2:
can be squashed
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35022?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I40ab5d12b6f7087daa51405468f5c4ea639561ea
Gerrit-Change-Number: 35022
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 16 Nov 2023 15:12:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment