Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4110b282 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'switchdev-transaction-item-queue'



Jiri Pirko says:

====================
switchdev: transaction item queue and cleanup
====================

Acked-by: default avatarScott Feldman <sfeldma@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents aee2f545 f623ab7f
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -369,3 +369,22 @@ The driver can monitor for updates to arp_tbl using the netevent notifier
NETEVENT_NEIGH_UPDATE.  The device can be programmed with resolved nexthops
for the routes as arp_tbl updates.  The driver implements ndo_neigh_destroy
to know when arp_tbl neighbor entries are purged from the port.

Transaction item queue
^^^^^^^^^^^^^^^^^^^^^^

For switchdev ops attr_set and obj_add, there is a 2 phase transaction model
used. First phase is to "prepare" anything needed, including various checks,
memory allocation, etc. The goal is to handle the stuff that is not unlikely
to fail here. The second phase is to "commit" the actual changes.

Switchdev provides an inftrastructure for sharing items (for example memory
allocations) between the two phases.

The object created by a driver in "prepare" phase and it is queued up by:
switchdev_trans_item_enqueue()
During the "commit" phase, the driver gets the object by:
switchdev_trans_item_dequeue()

If a transaction is aborted during "prepare" phase, switchdev code will handle
cleanup of the queued-up objects.