net: microchip: sparx5: Writing rules to the IS2 VCAP
authorSteen Hegelund <steen.hegelund@microchip.com>
Thu, 20 Oct 2022 13:09:02 +0000 (15:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Oct 2022 09:37:43 +0000 (10:37 +0100)
commit683e05c03275d79e603d7e0211d7aed410b0e65b
tree918f6ffee2f27ec8ccba569944a8673895e768b1
parent8e10490b006477c42874d43a2ab4d4c6d51ccb63
net: microchip: sparx5: Writing rules to the IS2 VCAP

This adds rule encoding functionality to the VCAP API.

A rule consists of keys and actions in separate cache sections.

The maximum size of the keyset or actionset determines the size of the
rule.

The VCAP hardware need to be able to distinguish different rule sizes from
each other, and for that purpose some extra typegroup bits are added to the
rule when it is encoded.

The API provides a bit stream iterator that allows highlevel encoding
functionality to add key and action value bits independent of typegroup
bits.

This is handled by letting the concrete VCAP model provide the typegroup
table for the different rule sizes.
After the key and action values have been added to the encoding bit streams
the typegroup bits are set to their correct values just before the rule is
written to the VCAP hardware.

The key and action offsets provided in the VCAP model are the offset before
adding the typegroup bits.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Tested-by: Casper Andersson <casper.casan@gmail.com>
Reviewed-by: Casper Andersson <casper.casan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/vcap/vcap_api.c