-
Notifications
You must be signed in to change notification settings - Fork 963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new ROUTER_LATE role #5528
base: master
Are you sure you want to change the base?
Add new ROUTER_LATE role #5528
Conversation
@thebentern Did you intend to merge 33494c3 into this PR, or was that a mistake? It doesn't seem related at all... |
Hi @erayd , don't panic! This is just us keeping your development branch in-sync with upstream master so it can merge more easily. If you have a look at the Files tab, you'll see nothing about your patch has changed. |
@fifieldt Thanks for the clarification, and that makes sense 🙂. It was just unexpected, so I was wondering if they had accidentally merged into the wrong branch. |
Looking very good already! However, I had it slightly differently in my mind. To make sure you are not still sending faster than busy routers/clients, I think we really need to restart the timer with the original delay. For example, when receiving a packet with a long airtime in between (or even when you had already multiple packets to be transmitted in the queue), you might already pass the remaining transmit delay when the packet is in front of the queue, and then you start transmitting directly after the delay from I think it makes sense to change firmware/src/mesh/RadioLibInterface.cpp Line 262 in f81d3b0
and here: firmware/src/mesh/RadioLibInterface.cpp Line 267 in f81d3b0
to setTransmitDelay() , for all roles. This is actually more correct, since it will determine the delay based on SNR (if available), instead of channel utilization. It won’t affect current firmware much, because the delay range is still the same.
Then, with this, you can just check whether the packet in front of the queue has the The downside is that sometimes indeed you might start it over and that creates additional latency, but I think that's justified, because this usually only happens when the mesh is busy. |
The problem with doing this is when multiple of these are involved that can overhear each other, the latency added can be quite considerable. The problem then becomes DoS via excessive delay. Would resuming with |
Sounds good, considering this is an edge case for not so busy meshes anyway. Although a DoS is a big word, because it's already an additional service compared to a normal client. So if you're using the new |
Sweet, will implement accordingly.
DoS seems applicable here, because these things fill an essential role in routing around terrain. They need to not get delayed so long as to be rendered useless (e.g. to cause remote admin packets to time out etc). The reason they are in the late window isn't because they are unimportant, but because they have rather poor coverage characteristics, and should give better placed sites a shot at rebroadcasting first.
I'm using both, for different purposes. |
True, but this risk is still there, because it only gets the minimum priority after adding the delay, so if someone is sending multiple packets after each other, the newer packet gets inserted before one that already is being delayed. (So perhaps a re-ordering is also needed after setting the priority to minimum?)
Since the |
Good point. Yes.
That works 🙂 |
@GUVWAF Have made a bunch of changes to the timing & the queuing following our discussion above. Is this now more in line with what you were expecting? The queuing changes are to ensure that late packets go to the back of the queue, but can still have their priority respected within that domain. |
The current approach will not actually use the additional delay after transmitting or receiving another packet. It only applies this when the channel is active, but it’s likely that this will result in an Rx interrupt, which will overwrite the delay, and call What if you just always use The reason I am so picky about this is that if we want this to be a general available role, we should really make sure it does not actually transmit faster than routers/clients, and it shouldn’t increase the chance of collisions too much (so also ensure it’s really outside of the window for regular routers/clients). |
Thanks - good catch 🙂
I like this approach. Yes.
This still seems to be necessary. During testing, TX_DELAY_COMPLETED often seems to fire when the requested delay has not yet expired (maybe due to interrupts?), so i think the check is important unless we can find and prevent whatever is causing it to return early.
Picky is good (and I agree with your reasoning). It's important that this be robust 🙂 |
If you're wondering where the commit that implements the above changes is... it's coming, but there is an odd bug I need to fix first. Will push it once I have nailed this down. The Bug: |
Hmm, I'm assuming you applied all the protobuf changes on top of the latest release, right? If the I don't see how this could happen otherwise. |
Pretty sure I have. It compiles properly with code that refers to those fields, which IMO is an indication that the changes are there... I'd expect to see build errors otherwise. With that said, it seems like a good place for me to look. I might try a full clean & rebuild, and see what that does - maybe there's a bit of the old version lurking around somewhere that shouldn't be.
Yeah, it's confusing as heck. The data is clearly originating somewhere, and given it's not getting there via assignment to |
Have you been able to figure it out? At least with the current state of your |
I've been extremely short on time the last few days, so haven't yet had the opportunity to dig into it. Hoping to do so either this evening or tomorrow.
Thanks - will add a check for this 🙂 |
Definitely interested in this new role, it would help out in the region I'm in that's a mix of mountains and hills. Hills are the easy part but so far there's been some issues trying to get packets to reliably get around mountains that aren't able to have regular Router nodes on them. |
@GUVWAF What do you reckon now? The memory stomp appears resolved following full protobuf rebuild & adding that null check after |
Good to hear! It looks good to me now, thanks for your cooperation. Let's wait for more approvals on the protobuf definitions. |
Sounds good. Thanks very much for your input and assistance with this feature 😁 |
8de1024
to
bbc2a0e
Compare
Have squashed the commits to make it easier to wrangle. |
Protobufs appear merged |
bbc2a0e
to
7dc330d
Compare
They're merged in the protobuf repo master branch. Not yet in the firmware repo though. Do you want the protobuf update in this repo to happen separately, or should I add a commit for that here (bumping the submodule commit & regen update) as part of this PR? |
Ah! let me trigger that job, moment. |
( #5658 ) |
7dc330d
to
f92c5e4
Compare
Will always rebroadcast packets, but will do so after all other modes. Intended for router nodes that are there to provide additional coverage in areas not already covered by other routers, or to bridge around problematic terrain, but should not be given priority over other routers in order to avoid unnecessaraily consuming hops. By default, this role will rebroadcast during the normal client window. However, if another node is overheard rebroadcasting the packet, then it will be moved to a second window *after* the normal client one, with the same timing behaviour.
f92c5e4
to
1a7adf9
Compare
This PR adds a new
ROUTER_LATE
role.This role will always rebroadcast packets, but will do so after all other modes. Intended for router nodes that are there to provide additional coverage in areas not already covered by other routers, or to bridge around problematic terrain, but should not be given priority over other routers in order to avoid unnecessaraily consuming hops (basically the "we need this thing to always rebroadcast, but it isn't a 'real' high site" scenario).
By default, this role will rebroadcast during the normal client window. However, if another node is overheard rebroadcasting the packet, then it will be moved to a second window after the normal client one, with the same timing behaviour.
Relevant discussion with @GUVWAF on Discord is here. This feature originally started life as just a configurable delay, and following that discussion has morphed into this new role 🙂.
Please note that this PR requires that these protobuf changes are applied first. I have omitted the protobuf regen commit from this PR, as I'm unsure whether you want it bundled or would prefer to apply those changes separately beforehand.
To assist with testing, a directly buildable version of this based on v2.5.15 with the protobuf regen commit included can be found here.