Message ID | 20221006145927.32731-7-isak.westin@loytec.com (mailing list archive) |
---|---|
State | Accepted |
Commit | dabf32b313c1dbfcbb434778541e4ab03bb2121e |
Headers | show |
Series | Mesh: Fixes for PTS issues | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/checkpatch | success | Checkpatch PASS |
tedd_an/gitlint | success | Gitlint PASS |
Hi Isak, On Thu, 2022-10-06 at 16:59 +0200, Isak Westin wrote: > The message cache should be a strict ring buffer, suppressed message > should not move to the front of the queue. > --- > mesh/net.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mesh/net.c b/mesh/net.c > index e95ae5114..8be45e61a 100644 > --- a/mesh/net.c > +++ b/mesh/net.c > @@ -1028,12 +1028,11 @@ static bool msg_in_cache(struct mesh_net > *net, uint16_t src, uint32_t seq, > .mic = mic, > }; > > - msg = l_queue_remove_if(net->msg_cache, match_cache, &tst); > + msg = l_queue_find(net->msg_cache, match_cache, &tst); > > if (msg) { > l_debug("Supressing duplicate %4.4x + %6.6x + %8.8x", > src, seq, > mic); > - l_queue_push_head(net->msg_cache, msg); The purpose of this bit of code was to maintain a cache of the X most recently received packets in the order most recently seen, which was why the re-ordering took place. Was this causing incorrect behavior, or are you doing this as a streamline? > return true; > } >
Hi Brian, > Hi Isak, > > On Thu, 2022-10-06 at 16:59 +0200, Isak Westin wrote: > > The message cache should be a strict ring buffer, suppressed message > > should not move to the front of the queue. > > --- > > mesh/net.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/mesh/net.c b/mesh/net.c > > index e95ae5114..8be45e61a 100644 > > --- a/mesh/net.c > > +++ b/mesh/net.c > > @@ -1028,12 +1028,11 @@ static bool msg_in_cache(struct mesh_net *net, > > uint16_t src, uint32_t seq, > > .mic = mic, > > }; > > > > - msg = l_queue_remove_if(net->msg_cache, match_cache, &tst); > > + msg = l_queue_find(net->msg_cache, match_cache, &tst); > > > > if (msg) { > > l_debug("Supressing duplicate %4.4x + %6.6x + %8.8x", > > src, seq, > > mic); > > - l_queue_push_head(net->msg_cache, msg); > > The purpose of this bit of code was to maintain a cache of the X most recently > received packets in the order most recently seen, which was why the re-ordering > took place. Was this causing incorrect behavior, or are you doing this as a > streamline? PTS is testing specifically that the message cache is a ring buffer (in test MESH/NODE/RLY/BV-02-C). The test goes like this (specified cache size = 4): Send msg 1 <-- relay expected Send msg 2 <-- relay expected Send msg 3 <-- relay expected Send msg 4 <-- relay expected Send msg 1 <-- relay *not* expected Send msg 5 <-- relay expected Send msg 1 <-- relay expected So the test failed with current behaviour. That is however the only reason for the patch. > > > return true; > > } > > > >
6th patch of 6 applied. Still considering patch 5. On Thu, 2022-10-06 at 16:59 +0200, Isak Westin wrote: > The message cache should be a strict ring buffer, suppressed message > should not move to the front of the queue. > --- > mesh/net.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/mesh/net.c b/mesh/net.c > index e95ae5114..8be45e61a 100644 > --- a/mesh/net.c > +++ b/mesh/net.c > @@ -1028,12 +1028,11 @@ static bool msg_in_cache(struct mesh_net > *net, uint16_t src, uint32_t seq, > .mic = mic, > }; > > - msg = l_queue_remove_if(net->msg_cache, match_cache, &tst); > + msg = l_queue_find(net->msg_cache, match_cache, &tst); > > if (msg) { > l_debug("Supressing duplicate %4.4x + %6.6x + %8.8x", > src, seq, > mic); > - l_queue_push_head(net->msg_cache, msg); > return true; > } >
diff --git a/mesh/net.c b/mesh/net.c index e95ae5114..8be45e61a 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -1028,12 +1028,11 @@ static bool msg_in_cache(struct mesh_net *net, uint16_t src, uint32_t seq, .mic = mic, }; - msg = l_queue_remove_if(net->msg_cache, match_cache, &tst); + msg = l_queue_find(net->msg_cache, match_cache, &tst); if (msg) { l_debug("Supressing duplicate %4.4x + %6.6x + %8.8x", src, seq, mic); - l_queue_push_head(net->msg_cache, msg); return true; }