laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27798 )
Change subject: RIFO: Minor typo/comment fixes
......................................................................
RIFO: Minor typo/comment fixes
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: I9b6181f9136b7963681c472b017d005022d27e6e
---
M src/octoi/frame_rifo.c
M tests/rifo/rifo_test.c
2 files changed, 1 insertion(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/octoi/frame_rifo.c b/src/octoi/frame_rifo.c
index fbcbbfa..ae10ff2 100644
--- a/src/octoi/frame_rifo.c
+++ b/src/octoi/frame_rifo.c
@@ -2,7 +2,7 @@
* frame_rifo.c
*
* This is for the IP -> E1 direction, where IP packets may arrive with
- * re-ordering. So this "Random [order] In, First Out' is reconstructing
+ * re-ordering. So this "Random [order] In, First Out" is reconstructing
* the original order.
*
* (C) 2022 by Harald Welte <laforge(a)osmocom.org>
diff --git a/tests/rifo/rifo_test.c b/tests/rifo/rifo_test.c
index 5dac5ba..22ffa73 100644
--- a/tests/rifo/rifo_test.c
+++ b/tests/rifo/rifo_test.c
@@ -146,5 +146,4 @@
// re-run all tests at the edge of a framenumber rollover
init_next_out_fn = 0xFFFFFFFF - 5;
run_all_tests();
-
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27798
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I9b6181f9136b7963681c472b017d005022d27e6e
Gerrit-Change-Number: 27798
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
Attention is currently required from: tnt.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27799 )
Change subject: RIFO: Fix operator precedence issue in the math for bucket_for_fn
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27799
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Iff91cfe93e8c7b53998b1b4dd73684292c105cc8
Gerrit-Change-Number: 27799
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: tnt <tnt(a)246tNt.com>
Gerrit-Comment-Date: Thu, 14 Apr 2022 20:23:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27798 )
Change subject: RIFO: Minor typo/comment fixes
......................................................................
RIFO: Minor typo/comment fixes
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: I9b6181f9136b7963681c472b017d005022d27e6e
---
M src/octoi/frame_rifo.c
M tests/rifo/rifo_test.c
2 files changed, 1 insertion(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/98/27798/1
diff --git a/src/octoi/frame_rifo.c b/src/octoi/frame_rifo.c
index fbcbbfa..ae10ff2 100644
--- a/src/octoi/frame_rifo.c
+++ b/src/octoi/frame_rifo.c
@@ -2,7 +2,7 @@
* frame_rifo.c
*
* This is for the IP -> E1 direction, where IP packets may arrive with
- * re-ordering. So this "Random [order] In, First Out' is reconstructing
+ * re-ordering. So this "Random [order] In, First Out" is reconstructing
* the original order.
*
* (C) 2022 by Harald Welte <laforge(a)osmocom.org>
diff --git a/tests/rifo/rifo_test.c b/tests/rifo/rifo_test.c
index 5dac5ba..22ffa73 100644
--- a/tests/rifo/rifo_test.c
+++ b/tests/rifo/rifo_test.c
@@ -146,5 +146,4 @@
// re-run all tests at the edge of a framenumber rollover
init_next_out_fn = 0xFFFFFFFF - 5;
run_all_tests();
-
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27798
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I9b6181f9136b7963681c472b017d005022d27e6e
Gerrit-Change-Number: 27798
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-MessageType: newchange
tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/27800 )
Change subject: RIFO: Fix issue in frame number bounds checking
......................................................................
RIFO: Fix issue in frame number bounds checking
You can't have a 'min' and 'max' FN because of the wrap
around this needs to be checked "all at once".
Signed-off-by: Sylvain Munaut <tnt(a)246tNt.com>
Change-Id: Ie9024f84f79b458248786bca2343a1f8bffb9994
---
M src/octoi/frame_rifo.c
M src/octoi/frame_rifo.h
2 files changed, 5 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/00/27800/1
diff --git a/src/octoi/frame_rifo.c b/src/octoi/frame_rifo.c
index 7e8ddf7..9f25cf0 100644
--- a/src/octoi/frame_rifo.c
+++ b/src/octoi/frame_rifo.c
@@ -112,7 +112,7 @@
uint32_t bucket;
uint8_t *dst;
- if (fn > frame_rifo_max_in_fn(rifo) && fn < frame_rifo_min_in_fn(rifo))
+ if (!frame_rifo_fn_in_range(rifo, fn))
{
return -ERANGE;
}
diff --git a/src/octoi/frame_rifo.h b/src/octoi/frame_rifo.h
index f107537..6988710 100644
--- a/src/octoi/frame_rifo.h
+++ b/src/octoi/frame_rifo.h
@@ -13,16 +13,11 @@
indexed by physical offset in buf */
};
-/* maximum frame number we currently can store in the rifo */
-static inline uint32_t frame_rifo_max_in_fn(const struct frame_rifo *ff)
+/* can this frame number be stores in the rifo */
+static inline bool frame_rifo_fn_in_range(const struct frame_rifo *ff, uint32_t fn)
{
- return ff->next_out_fn + FRAMES_PER_FIFO - 1;
-}
-
-/* minimum frame number we currently can store in the rifo */
-static inline uint32_t frame_rifo_min_in_fn(const struct frame_rifo *ff)
-{
- return ff->next_out_fn - 1;
+ uint32_t d = fn - ff->next_out_fn;
+ return d < FRAMES_PER_FIFO;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27800
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Ie9024f84f79b458248786bca2343a1f8bffb9994
Gerrit-Change-Number: 27800
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt(a)246tNt.com>
Gerrit-MessageType: newchange