[PATCH net-next 0/5] Add support for TC flower templates in Sparx5

From: Steen Hegelund
Date: Tue Mar 07 2023 - 08:42:54 EST


This adds support for the TC template mechanism in the Sparx5 flower filter
implementation.

Templates are as such handled by the TC framework, but when a template is
created (using a chain id) there are by definition no filters on this
chain (an error will be returned if there are any).

If the templates chain id is one that is represented by a VCAP lookup, then
when the template is created, we know that it is safe to use the keys
provided in the template to change the keyset configuration for the (port,
lookup) combination, if this is needed to improve the match on the
template.

The original port keyset configuration is captured in the template state
information which is kept per port, so that when the template is deleted
the port keyset configuration can be restored to its previous setting.

The template also provides the protocol parameter which is the basic
information that is used to find out which port keyset configuration needs
to be changed.

The VCAPs and lookups are slightly different when it comes to which keys,
keysets and protocol are supported and used for selection, so in some
cases a bit of tweaking is needed to find a useful match. This is done by
e.g. removing a key that prevents the best matching keyset from being
selected.

The debugfs output that is provided for a port allows inspection of the
currently used keyset in each of the VCAPs lookups. So when a template has
been created the debugfs output allows you to verify if the keyset
configuration has been changed successfully.

Steen Hegelund (5):
net: microchip: sparx5: Correct the spelling of the keysets in debugfs
net: microchip: sparx5: Provide rule count, key removal and keyset
select
net: microchip: sparx5: Add TC template list to a port
net: microchip: sparx5: Add port keyset changing functionality
net: microchip: sparx5: Add TC template support

.../ethernet/microchip/sparx5/sparx5_main.c | 1 +
.../ethernet/microchip/sparx5/sparx5_main.h | 1 +
.../microchip/sparx5/sparx5_tc_flower.c | 209 +++++++++++++-
.../microchip/sparx5/sparx5_vcap_debugfs.c | 2 +-
.../microchip/sparx5/sparx5_vcap_impl.c | 270 ++++++++++++++++++
.../microchip/sparx5/sparx5_vcap_impl.h | 6 +
.../net/ethernet/microchip/vcap/vcap_api.c | 61 ++++
.../ethernet/microchip/vcap/vcap_api_client.h | 11 +
8 files changed, 553 insertions(+), 8 deletions(-)

--
2.39.2