org-arl / unet-contrib

Unet user contributions
BSD 3-Clause "New" or "Revised" License
11 stars 15 forks source link

Adding the MacReserver class #102

Open notthetup opened 1 month ago

notthetup commented 1 month ago

Adding the MacReserver Agent.

notthetup commented 1 month ago

I guess that depends on the MAC implementation. But that's what will happen for the default CSMA implementation in UnetStack.

The original idea here was that this agent would effectively "hog" the MAC until the user indicated that they were done using the channel, at which point this agent give up the MAC some time and the re-acquire and repeat.

But you're right if LINK has already requested a reservation while this agent was "hogging" the MAC, LINK will get the reservation before this Agent's reservation is accepted.

One way to work around that, albeit evil, is to keep sending ClearReq to the MAC service to clear it's queues. But it'll cause the higher layers to timeout.

mchitre commented 1 month ago

The ReservationNtf mechanism that we have for other agents to tell MAC of inferred reservation may still work for this use case. Send ReservationNtf with a long duration and that will block MAC. Then send a ReservationNtf with duration 0 and that will unblock it.

P.S. We may want to change the semantics of ReservationNtf in UnetStack 5 as the current semantics are quite restrictive. But this will work for now in UnetStack 4.