> From: Ajit Khaparde <ajit.khapa...@broadcom.com> On Tuesday, October 12, 2021 > 22:27 > To: Alexander Kozyrev <akozy...@nvidia.com> > > > > > From: Ivan Malov <ivan.ma...@oktetlabs.ru> On Wednesday, October 6, > 2021 13:25 > > > On 06/10/2021 07:48, Alexander Kozyrev wrote: > > > > Treating every single flow rule as a completely independent and > separate > > > > entity negatively impacts the flow rules insertion rate. Oftentimes in > > > > an > > > > application, many flow rules share a common structure (the same item > > > mask > > > > and/or action list) so they can be grouped and classified together. > > > > This knowledge may be used as a source of optimization by a PMD/HW. > > > > > > > > The item template defines common matching fields (the item mask) > > > without > > > > values. The action template holds a list of action types that will be > > > > used > > > > together in the same rule. The specific values for items and actions > > > > will > > > > be given only during the rule creation. > > > > > > > > A table combines item and action templates along with shared flow rule > > > > attributes (group ID, priority and traffic direction). This way a PMD/HW > > > > can prepare all the resources needed for efficient flow rules creation > > > > in > > > > the datapath. To avoid any hiccups due to memory reallocation, the > > > maximum > > > > number of flow rules is defined at table creation time. > > > > > > > > The flow rule creation is done by selecting a table, an item template > > > > and an action template (which are bound to the table), and setting > unique > > > > values for the items and actions. > > For the life cycle of the template - > Is a template supposed to be destroyed immediately after its use? > Can there be multiple templates active at a time? > In which case will the application maintain the templates? > And how to identify one template from another? Or that will not be needed?
A template must be active until there are no more tables referencing it. This, in turn, means that all the rules using it must be destroyed before that as well. The application gets a template handle and stores it in a table for future usage. There can be many templates stored in a single/multiple tables as needed.