• Steen Hegelund's avatar
    net: microchip: sparx5: Writing rules to the IS2 VCAP · 683e05c0
    Steen Hegelund authored
    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: default avatarSteen Hegelund <steen.hegelund@microchip.com>
    Tested-by: default avatarCasper Andersson <casper.casan@gmail.com>
    Reviewed-by: default avatarCasper Andersson <casper.casan@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    683e05c0
vcap_api.c 33.8 KB