HomeFreeBSD

ena: Properly unmap last socket chain in netmap

Description

ena: Properly unmap last socket chain in netmap

In case ena_com_prepare_tx() fails within the netmap tx flow,
the driver will unmap the last socket chain.
Currently, the driver unmaps the wrong socket within
ena_netmap_unmap_last_socket_chain().

Illustration of the flow:

1- ena_netmap_tx_frames()
2- ena_netmap_tx_frame()
3- ena_netmap_tx_map_slots()
3.1- Map slot
3.2- Advance to the next socket
4- ena_com_prepare_tx()
4.1- ena_com_prepare_tx() fails
5- ena_netmap_unmap_last_socket_chain()

In step 5, where the driver unmaps the socket, the netmap
index already points at the next entry, meaning we're unmapping the
wrong socket in case ena_com_prepare_tx() fails.
In order to fix that, the driver should first update the netmap index to
point at the previous entry and only then update the socket parameters.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit f236e544a2ff685ae151f3232e3785a6a9aab035)

Details

Provenance
osamaabb_amazon.comAuthored on Aug 7 2024, 6:24 AM
Parents
rGd38362c0eed0: ena: Make global counters style unified
Branches
Unknown
Tags
Unknown