-
Notifications
You must be signed in to change notification settings - Fork 16
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 tx_provide
to ethernet driver handle_irq
#253
Conversation
7ca57d8
to
f655259
Compare
f655259
to
7adbc21
Compare
Can you also change the virtIO net driver to call |
Yes, I can add it to that driver too - although I don't think
But this results in the RX virt transferring the packets to the client, which necessarily results in the client eventually returning the free buffers back to the RX virt, which ultimately results in the RX virt adding more buffers to the driver's free ring, and notifying the driver again. This notification then makes the driver aware of the The difference between these two scenarios is that in the TX case, the TX virtualiser does not necessarily send another "active buffers available" notification unless the client subsequently decides to sent another packet (an event that can't be depended on, especially if it believes it already sent a packet and hasn't received a reply). Where as in the RX case, it is dependable behaviour for the client to return free RX buffers back to the virtualiser after they have been processed. In fact, RX virtualisers are assumed to be interfacing with copy components, which are trusted, and can therefore be depended upon to return free buffers which eventually triggers another "buffers available" notification to the driver. So the reason I didn't add |
Sure, makes sense. |
7adbc21
to
08f0537
Compare
Signed-off-by: Courtney Darville <courtneydarville94@outlook.com>
Signed-off-by: Courtney Darville <courtneydarville94@outlook.com>
Signed-off-by: Courtney Darville <courtneydarville94@outlook.com>
c73aa74
to
753a6a8
Compare
This PR adds a call to to
tx_provide()
aftertx_return()
in thehandle_irq()
function in the ethernet drivers. This prevents against a potential deadlock (in the worst case) or delayed transmission (in the best case).Since the HW rings are smaller than the number of transmit buffers in the system, the following trace of execution is problematic:
TX virt has
HW_RING_SIZE + x
buffers to transmit. It transfers the buffers into the driver's active queue. It then notifies the driver.Driver transfers
HW_RING_SIZE
buffers into the HW ring, leavingx
buffers remaining in its active ring.Ethernet device transmits
HW_RING_SIZE
buffers, sends an IRQ to the driver.Driver receives the IRQ, calls
tx_return()
.After this sequence of execution, the remaining
x
buffers do not necessarily get sent. Since the driver will not re-check the active ring unless notified again by the TX virtualiser, and the TX virtualiser believes that the driver is already aware of the remainingx
buffers, so it will not notify the driver again unless the client happens to send another packet (in this case it will notify prompted by the transfer of the other packet into the active ring).The fix in this PR stops this from occurring by forcing the driver to re-check the active ring each time packets have been re-transmitted.
Note that this PR is based off #252, and should be merged secondary to that.