What are Action Profiles and Action Selectors, and Why do I need them?

Hello all,
I have problems at understanding the concepts of both Action Profiles and Action Selectors in the Portable Switch Architecture.
Can someone help me with a little example to show why and when I should use one of them instead of the normal actions.

I welcome contrasting views on these questions, but in my opinion:

(a) there is very little difference between using an Action Profile vs. using two P4 tables with a data dependency between them
(b) there is a bigger difference between using an Action Selector vs. using 3 or 4 P4 tables + hash calculation (more details below).

For more details on (a), I wrote an article about how one can use 2 P4 tables to implement the same behavior as an Action Selector, here: p4-guide/README-action-profile.md at master · jafingerhut/p4-guide (github.com)

The main use case of an Action Profile is to save space in the data plane, when you have one table with a large number of entries, but the number of possible different actions you want to support at one time is small. The extra level of indirection also allows you to atomically update an action profile member, and have that change immediately take effect for all entries of the large table that “point at” it. Both of these advantages are common to both approaches, i.e. you get those advantages regardless of whether you use an Action Selector extern, or 2 separate P4 tables.

The main differences that I know of are:

(a1) Some target devices might have special hardware for supporting an Action Profile that enable it to use fewer hardware resources, vs. using two P4 tables with a data dependency between them.
(a2) The control plane API for an Action Profile, at least in the P4Runtime API and perhaps other control plane APIs, stops you with an error if you try to “point at” a profile member that is not defined, whereas with two separate P4 tables nothing stops that from happening.

For (b), the main reasons to use an Action Selector are for features involving load balancing over multiple choices, e.g.

  • Selecting among multiple next hops in a routing table using ECMP [1] or WCMP [2]
  • Selecting among multiple physical ports configured in a LAG [3]
  • Selecting among multiple servers each running an identical application, although this case often requires remembering where the first packet of a TCP flow is sent to, and sending all future packets in the same connection to the same server, so an Action Selector extern is probably not enough on its own [4].

There is an article with several possible implementations of an Action Selector using multiple P4 tables and a hash calculation here: p4-guide/README-action-selector-variant-comparison.md at master · jafingerhut/p4-guide (github.com)

There are similar potential advantages to using an Action Selector, vs. 3 or 4 P4 tables + hash function, as there are for using an Action Profile vs. 2 P4 tables, as mentioned above.

[1] Equal-cost multi-path routing - Wikipedia
[2] WCMP | Proceedings of the Ninth European Conference on Computer Systems (acm.org)
[3] Link aggregation - Wikipedia
[4] [PDF] SilkRoad: Making Stateful Layer-4 Load Balancing Fast and Cheap Using Switching ASICs | Semantic Scholar

1 Like