Adding Sparx5 IS0 VCAP support
Subsystems (3)
Steen Hegelund
maintainerv2 cover Adding Sparx5 IS0 VCAP support
This provides the Ingress Stage 0 (IS0) VCAP (Versatile Content-Aware Processor) support for the Sparx5 platform.
The IS0 VCAP (also known in the datasheet as CLM) is a classifier VCAP that mainly extracts frame information to metadata that follows the frame in the Sparx5 processing flow all the way to the egress port.
The IS0 VCAP has 4 lookups and they are accessible with a TC chain id:
- chain 1000000: IS0 Lookup 0
- chain 1100000: IS0 Lookup 1
- chain 1200000: IS0 Lookup 2
- chain 1300000: IS0 Lookup 3
- chain 1400000: IS0 Lookup 4
- chain 1500000: IS0 Lookup 5
Each of these lookups have their own port keyset configuration that decides which keys will be used for matching on which traffic type.
The IS0 VCAP has these traffic classifications:
- IPv4 frames
- IPv6 frames
- Unicast MPLS frames (ethertype = 0x8847)
- Multicast MPLS frames (ethertype = 0x8847)
- Other frame types than MPLS, IPv4 and IPv6
The IS0 VCAP has an action that allows setting the value of a PAG (Policy Association Group) key field in the frame metadata, and this can be used for matching in an IS2 VCAP rule.
This allow rules in the IS0 VCAP to be linked to rules in the IS2 VCAP.
The linking is exposed by using the TC "goto chain" action with an offset from the IS2 chain ids.
As an example a "goto chain 8000001" will use a PAG value of 1 to chain to a rule in IS2 Lookup 0.
Version History:
================
v2 Added corrections suggested by Dan Carpenter.
v1 Initial version
Steen Hegelund (8):
net: microchip: sparx5: Add IS0 VCAP model and updated KUNIT VCAP
model
net: microchip: sparx5: Add IS0 VCAP keyset configuration for Sparx5
net: microchip: sparx5: Add actionset type id information to rule
net: microchip: sparx5: Add TC support for IS0 VCAP
net: microchip: sparx5: Add TC filter chaining support for IS0 and IS2
VCAPs
net: microchip: sparx5: Add automatic selection of VCAP rule actionset
net: microchip: sparx5: Add support for IS0 VCAP ethernet protocol
types
net: microchip: sparx5: Add support for IS0 VCAP CVLAN TC keys
.../microchip/sparx5/sparx5_main_regs.h | 64 +- .../microchip/sparx5/sparx5_tc_flower.c | 227 +- .../microchip/sparx5/sparx5_vcap_ag_api.c | 1110 ++++++++- .../microchip/sparx5/sparx5_vcap_debugfs.c | 131 +- .../microchip/sparx5/sparx5_vcap_impl.c | 401 +++- .../microchip/sparx5/sparx5_vcap_impl.h | 61 + .../net/ethernet/microchip/vcap/vcap_ag_api.h | 336 +-- .../net/ethernet/microchip/vcap/vcap_api.c | 184 +- .../net/ethernet/microchip/vcap/vcap_api.h | 7 + .../ethernet/microchip/vcap/vcap_api_client.h | 2 + .../ethernet/microchip/vcap/vcap_api_kunit.c | 2 +- .../microchip/vcap/vcap_model_kunit.c | 1994 ++--------------- 12 files changed, 2360 insertions(+), 2159 deletions(-)
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 1/8 net: microchip: sparx5: Add IS0 VCAP model and updated KUNIT VCAP model
This provides the IS0 (Ingress Stage 0) or CLM VCAP model for Sparx5. This VCAP provides classification actions for Sparx5.
--- .../microchip/sparx5/sparx5_vcap_ag_api.c | 1110 ++++++++- .../net/ethernet/microchip/vcap/vcap_ag_api.h | 336 +-- .../ethernet/microchip/vcap/vcap_api_kunit.c | 2 +- .../microchip/vcap/vcap_model_kunit.c | 1994 ++--------------- 4 files changed, 1383 insertions(+), 2059 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_ag_api.c +1048 -62
@@ -3,8 +3,8 @@* Microchip VCAP API */ -/* This file is autogenerated by cml-utils 2022-10-13 10:04:41 +0200. -* Commit ID: fd7cafd175899f0672c73afb3a30fc872500ae86 +/* This file is autogenerated by cml-utils 2022-12-06 12:43:54 +0100. +* Commit ID: 3db2ac730f134c160496f2b9f10915e347d871cb */ #include <linux/types.h>
@@ -14,6 +14,372 @@#include "sparx5_vcap_ag_api.h" /* keyfields */ +static const struct vcap_field is0_normal_7tuple_keyfield[] = { + [VCAP_KF_TYPE ] = { + .type =VCAP_FIELD_BIT , + .offset =0 , + .width =1 , + }, + [VCAP_KF_LOOKUP_FIRST_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =1 , + .width =1 , + }, + [VCAP_KF_LOOKUP_GEN_IDX_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =2 , + .width =2 , + }, + [VCAP_KF_LOOKUP_GEN_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =4 , + .width =12 , + }, + [VCAP_KF_IF_IGR_PORT_MASK_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =16 , + .width =2 , + }, + [VCAP_KF_IF_IGR_PORT_MASK ] = { + .type =VCAP_FIELD_U72 , + .offset =18 , + .width =65 , + }, + [VCAP_KF_L2_MC_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =83 , + .width =1 , + }, + [VCAP_KF_L2_BC_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =84 , + .width =1 , + }, + [VCAP_KF_8021Q_VLAN_TAGS ] = { + .type =VCAP_FIELD_U32 , + .offset =85 , + .width =3 , + }, + [VCAP_KF_8021Q_TPID0 ] = { + .type =VCAP_FIELD_U32 , + .offset =88 , + .width =3 , + }, + [VCAP_KF_8021Q_PCP0 ] = { + .type =VCAP_FIELD_U32 , + .offset =91 , + .width =3 , + }, + [VCAP_KF_8021Q_DEI0 ] = { + .type =VCAP_FIELD_BIT , + .offset =94 , + .width =1 , + }, + [VCAP_KF_8021Q_VID0 ] = { + .type =VCAP_FIELD_U32 , + .offset =95 , + .width =12 , + }, + [VCAP_KF_8021Q_TPID1 ] = { + .type =VCAP_FIELD_U32 , + .offset =107 , + .width =3 , + }, + [VCAP_KF_8021Q_PCP1 ] = { + .type =VCAP_FIELD_U32 , + .offset =110 , + .width =3 , + }, + [VCAP_KF_8021Q_DEI1 ] = { + .type =VCAP_FIELD_BIT , + .offset =113 , + .width =1 , + }, + [VCAP_KF_8021Q_VID1 ] = { + .type =VCAP_FIELD_U32 , + .offset =114 , + .width =12 , + }, + [VCAP_KF_8021Q_TPID2 ] = { + .type =VCAP_FIELD_U32 , + .offset =126 , + .width =3 , + }, + [VCAP_KF_8021Q_PCP2 ] = { + .type =VCAP_FIELD_U32 , + .offset =129 , + .width =3 , + }, + [VCAP_KF_8021Q_DEI2 ] = { + .type =VCAP_FIELD_BIT , + .offset =132 , + .width =1 , + }, + [VCAP_KF_8021Q_VID2 ] = { + .type =VCAP_FIELD_U32 , + .offset =133 , + .width =12 , + }, + [VCAP_KF_L2_DMAC ] = { + .type =VCAP_FIELD_U48 , + .offset =145 , + .width =48 , + }, + [VCAP_KF_L2_SMAC ] = { + .type =VCAP_FIELD_U48 , + .offset =193 , + .width =48 , + }, + [VCAP_KF_IP_MC_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =241 , + .width =1 , + }, + [VCAP_KF_ETYPE_LEN_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =242 , + .width =1 , + }, + [VCAP_KF_ETYPE ] = { + .type =VCAP_FIELD_U32 , + .offset =243 , + .width =16 , + }, + [VCAP_KF_IP_SNAP_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =259 , + .width =1 , + }, + [VCAP_KF_IP4_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =260 , + .width =1 , + }, + [VCAP_KF_L3_FRAGMENT_TYPE ] = { + .type =VCAP_FIELD_U32 , + .offset =261 , + .width =2 , + }, + [VCAP_KF_L3_FRAG_INVLD_L4_LEN ] = { + .type =VCAP_FIELD_BIT , + .offset =263 , + .width =1 , + }, + [VCAP_KF_L3_OPTIONS_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =264 , + .width =1 , + }, + [VCAP_KF_L3_DSCP ] = { + .type =VCAP_FIELD_U32 , + .offset =265 , + .width =6 , + }, + [VCAP_KF_L3_IP6_DIP ] = { + .type =VCAP_FIELD_U128 , + .offset =271 , + .width =128 , + }, + [VCAP_KF_L3_IP6_SIP ] = { + .type =VCAP_FIELD_U128 , + .offset =399 , + .width =128 , + }, + [VCAP_KF_TCP_UDP_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =527 , + .width =1 , + }, + [VCAP_KF_TCP_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =528 , + .width =1 , + }, + [VCAP_KF_L4_SPORT ] = { + .type =VCAP_FIELD_U32 , + .offset =529 , + .width =16 , + }, + [VCAP_KF_L4_RNG ] = { + .type =VCAP_FIELD_U32 , + .offset =545 , + .width =8 , + }, +}; + +static const struct vcap_field is0_normal_5tuple_ip4_keyfield[] = { + [VCAP_KF_TYPE ] = { + .type =VCAP_FIELD_U32 , + .offset =0 , + .width =2 , + }, + [VCAP_KF_LOOKUP_FIRST_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =2 , + .width =1 , + }, + [VCAP_KF_LOOKUP_GEN_IDX_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =3 , + .width =2 , + }, + [VCAP_KF_LOOKUP_GEN_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =5 , + .width =12 , + }, + [VCAP_KF_IF_IGR_PORT_MASK_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =17 , + .width =2 , + }, + [VCAP_KF_IF_IGR_PORT_MASK ] = { + .type =VCAP_FIELD_U72 , + .offset =19 , + .width =65 , + }, + [VCAP_KF_L2_MC_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =84 , + .width =1 , + }, + [VCAP_KF_L2_BC_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =85 , + .width =1 , + }, + [VCAP_KF_8021Q_VLAN_TAGS ] = { + .type =VCAP_FIELD_U32 , + .offset =86 , + .width =3 , + }, + [VCAP_KF_8021Q_TPID0 ] = { + .type =VCAP_FIELD_U32 , + .offset =89 , + .width =3 , + }, + [VCAP_KF_8021Q_PCP0 ] = { + .type =VCAP_FIELD_U32 , + .offset =92 , + .width =3 , + }, + [VCAP_KF_8021Q_DEI0 ] = { + .type =VCAP_FIELD_BIT , + .offset =95 , + .width =1 , + }, + [VCAP_KF_8021Q_VID0 ] = { + .type =VCAP_FIELD_U32 , + .offset =96 , + .width =12 , + }, + [VCAP_KF_8021Q_TPID1 ] = { + .type =VCAP_FIELD_U32 , + .offset =108 , + .width =3 , + }, + [VCAP_KF_8021Q_PCP1 ] = { + .type =VCAP_FIELD_U32 , + .offset =111 , + .width =3 , + }, + [VCAP_KF_8021Q_DEI1 ] = { + .type =VCAP_FIELD_BIT , + .offset =114 , + .width =1 , + }, + [VCAP_KF_8021Q_VID1 ] = { + .type =VCAP_FIELD_U32 , + .offset =115 , + .width =12 , + }, + [VCAP_KF_8021Q_TPID2 ] = { + .type =VCAP_FIELD_U32 , + .offset =127 , + .width =3 , + }, + [VCAP_KF_8021Q_PCP2 ] = { + .type =VCAP_FIELD_U32 , + .offset =130 , + .width =3 , + }, + [VCAP_KF_8021Q_DEI2 ] = { + .type =VCAP_FIELD_BIT , + .offset =133 , + .width =1 , + }, + [VCAP_KF_8021Q_VID2 ] = { + .type =VCAP_FIELD_U32 , + .offset =134 , + .width =12 , + }, + [VCAP_KF_IP_MC_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =146 , + .width =1 , + }, + [VCAP_KF_IP4_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =147 , + .width =1 , + }, + [VCAP_KF_L3_FRAGMENT_TYPE ] = { + .type =VCAP_FIELD_U32 , + .offset =148 , + .width =2 , + }, + [VCAP_KF_L3_FRAG_INVLD_L4_LEN ] = { + .type =VCAP_FIELD_BIT , + .offset =150 , + .width =1 , + }, + [VCAP_KF_L3_OPTIONS_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =151 , + .width =1 , + }, + [VCAP_KF_L3_DSCP ] = { + .type =VCAP_FIELD_U32 , + .offset =152 , + .width =6 , + }, + [VCAP_KF_L3_IP4_DIP ] = { + .type =VCAP_FIELD_U32 , + .offset =158 , + .width =32 , + }, + [VCAP_KF_L3_IP4_SIP ] = { + .type =VCAP_FIELD_U32 , + .offset =190 , + .width =32 , + }, + [VCAP_KF_L3_IP_PROTO ] = { + .type =VCAP_FIELD_U32 , + .offset =222 , + .width =8 , + }, + [VCAP_KF_TCP_UDP_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =230 , + .width =1 , + }, + [VCAP_KF_TCP_IS ] = { + .type =VCAP_FIELD_BIT , + .offset =231 , + .width =1 , + }, + [VCAP_KF_L4_RNG ] = { + .type =VCAP_FIELD_U32 , + .offset =232 , + .width =8 , + }, + [VCAP_KF_IP_PAYLOAD_5TUPLE ] = { + .type =VCAP_FIELD_U32 , + .offset =240 , + .width =32 , + }, +}; +static const struct vcap_field is2_mac_etype_keyfield[] = { [VCAP_KF_TYPE ] = { .type =VCAP_FIELD_U32 ,
@@ -945,83 +1311,405 @@ static const struct vcap_field is2_ip_7tuple_keyfield[] = { .offset = 538, .width = 1, }, - [VCAP_KF_L4_PSH] = { + [VCAP_KF_L4_PSH] = { + .type = VCAP_FIELD_BIT, + .offset = 539, + .width = 1, + }, + [VCAP_KF_L4_ACK] = { + .type = VCAP_FIELD_BIT, + .offset = 540, + .width = 1, + }, + [VCAP_KF_L4_URG] = { + .type = VCAP_FIELD_BIT, + .offset = 541, + .width = 1, + }, + [VCAP_KF_L4_PAYLOAD] = { + .type = VCAP_FIELD_U64, + .offset = 542, + .width = 64, + }, +}; + +/* keyfield_set */ +static const struct vcap_set is0_keyfield_set[] = { + [VCAP_KFS_NORMAL_7TUPLE ] = { + .type_id =0 , + .sw_per_item =12 , + .sw_cnt =1 , + }, + [VCAP_KFS_NORMAL_5TUPLE_IP4 ] = { + .type_id =2 , + .sw_per_item =6 , + .sw_cnt =2 , + }, +}; + +static const struct vcap_set is2_keyfield_set[] = { + [VCAP_KFS_MAC_ETYPE ] = { + .type_id =0 , + .sw_per_item =6 , + .sw_cnt =2 , + }, + [VCAP_KFS_ARP ] = { + .type_id =3 , + .sw_per_item =6 , + .sw_cnt =2 , + }, + [VCAP_KFS_IP4_TCP_UDP ] = { + .type_id =4 , + .sw_per_item =6 , + .sw_cnt =2 , + }, + [VCAP_KFS_IP4_OTHER ] = { + .type_id =5 , + .sw_per_item =6 , + .sw_cnt =2 , + }, + [VCAP_KFS_IP6_STD ] = { + .type_id =6 , + .sw_per_item =6 , + .sw_cnt =2 , + }, + [VCAP_KFS_IP_7TUPLE ] = { + .type_id =1 , + .sw_per_item =12 , + .sw_cnt =1 , + }, +}; + +/* keyfield_set map */ +static const struct vcap_field *is0_keyfield_set_map[] = { + [VCAP_KFS_NORMAL_7TUPLE ] = is0_normal_7tuple_keyfield, + [VCAP_KFS_NORMAL_5TUPLE_IP4 ] = is0_normal_5tuple_ip4_keyfield, +}; + +static const struct vcap_field *is2_keyfield_set_map[] = { + [VCAP_KFS_MAC_ETYPE ] = is2_mac_etype_keyfield, + [VCAP_KFS_ARP ] = is2_arp_keyfield, + [VCAP_KFS_IP4_TCP_UDP ] = is2_ip4_tcp_udp_keyfield, + [VCAP_KFS_IP4_OTHER ] = is2_ip4_other_keyfield, + [VCAP_KFS_IP6_STD ] = is2_ip6_std_keyfield, + [VCAP_KFS_IP_7TUPLE ] = is2_ip_7tuple_keyfield, +}; + +/* keyfield_set map sizes */ +static int is0_keyfield_set_map_size[] = { + [VCAP_KFS_NORMAL_7TUPLE ] =ARRAY_SIZE (is0_normal_7tuple_keyfield), + [VCAP_KFS_NORMAL_5TUPLE_IP4 ] =ARRAY_SIZE (is0_normal_5tuple_ip4_keyfield), +}; + +static int is2_keyfield_set_map_size[] = { + [VCAP_KFS_MAC_ETYPE ] =ARRAY_SIZE (is2_mac_etype_keyfield), + [VCAP_KFS_ARP ] =ARRAY_SIZE (is2_arp_keyfield), + [VCAP_KFS_IP4_TCP_UDP ] =ARRAY_SIZE (is2_ip4_tcp_udp_keyfield), + [VCAP_KFS_IP4_OTHER ] =ARRAY_SIZE (is2_ip4_other_keyfield), + [VCAP_KFS_IP6_STD ] =ARRAY_SIZE (is2_ip6_std_keyfield), + [VCAP_KFS_IP_7TUPLE ] =ARRAY_SIZE (is2_ip_7tuple_keyfield), +}; + +/* actionfields */ +static const struct vcap_field is0_classification_actionfield[] = { + [VCAP_AF_TYPE ] = { + .type =VCAP_FIELD_BIT , + .offset =0 , + .width =1 , + }, + [VCAP_AF_DSCP_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =1 , + .width =1 , + }, + [VCAP_AF_DSCP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =2 , + .width =6 , + }, + [VCAP_AF_QOS_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =12 , + .width =1 , + }, + [VCAP_AF_QOS_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =13 , + .width =3 , + }, + [VCAP_AF_DP_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =16 , + .width =1 , + }, + [VCAP_AF_DP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =17 , + .width =2 , + }, + [VCAP_AF_DEI_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =19 , + .width =1 , + }, + [VCAP_AF_DEI_VAL ] = { + .type =VCAP_FIELD_BIT , + .offset =20 , + .width =1 , + }, + [VCAP_AF_PCP_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =21 , + .width =1 , + }, + [VCAP_AF_PCP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =22 , + .width =3 , + }, + [VCAP_AF_MAP_LOOKUP_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =25 , + .width =2 , + }, + [VCAP_AF_MAP_KEY ] = { + .type =VCAP_FIELD_U32 , + .offset =27 , + .width =3 , + }, + [VCAP_AF_MAP_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =30 , + .width =9 , + }, + [VCAP_AF_CLS_VID_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =39 , + .width =3 , + }, + [VCAP_AF_VID_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =45 , + .width =13 , + }, + [VCAP_AF_ISDX_ADD_REPLACE_SEL ] = { + .type =VCAP_FIELD_BIT , + .offset =68 , + .width =1 , + }, + [VCAP_AF_ISDX_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =69 , + .width =12 , + }, + [VCAP_AF_PAG_OVERRIDE_MASK ] = { + .type =VCAP_FIELD_U32 , + .offset =109 , + .width =8 , + }, + [VCAP_AF_PAG_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =117 , + .width =8 , + }, + [VCAP_AF_NXT_IDX_CTRL ] = { + .type =VCAP_FIELD_U32 , + .offset =171 , + .width =3 , + }, + [VCAP_AF_NXT_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =174 , + .width =12 , + }, +}; + +static const struct vcap_field is0_full_actionfield[] = { + [VCAP_AF_DSCP_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =0 , + .width =1 , + }, + [VCAP_AF_DSCP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =1 , + .width =6 , + }, + [VCAP_AF_QOS_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =11 , + .width =1 , + }, + [VCAP_AF_QOS_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =12 , + .width =3 , + }, + [VCAP_AF_DP_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =15 , + .width =1 , + }, + [VCAP_AF_DP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =16 , + .width =2 , + }, + [VCAP_AF_DEI_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =18 , + .width =1 , + }, + [VCAP_AF_DEI_VAL ] = { + .type =VCAP_FIELD_BIT , + .offset =19 , + .width =1 , + }, + [VCAP_AF_PCP_ENA ] = { + .type =VCAP_FIELD_BIT , + .offset =20 , + .width =1 , + }, + [VCAP_AF_PCP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =21 , + .width =3 , + }, + [VCAP_AF_MAP_LOOKUP_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =24 , + .width =2 , + }, + [VCAP_AF_MAP_KEY ] = { + .type =VCAP_FIELD_U32 , + .offset =26 , + .width =3 , + }, + [VCAP_AF_MAP_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =29 , + .width =9 , + }, + [VCAP_AF_CLS_VID_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =38 , + .width =3 , + }, + [VCAP_AF_VID_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =44 , + .width =13 , + }, + [VCAP_AF_ISDX_ADD_REPLACE_SEL ] = { + .type =VCAP_FIELD_BIT , + .offset =67 , + .width =1 , + }, + [VCAP_AF_ISDX_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =68 , + .width =12 , + }, + [VCAP_AF_MASK_MODE ] = { + .type =VCAP_FIELD_U32 , + .offset =80 , + .width =3 , + }, + [VCAP_AF_PORT_MASK ] = { + .type =VCAP_FIELD_U72 , + .offset =83 , + .width =65 , + }, + [VCAP_AF_PAG_OVERRIDE_MASK ] = { + .type =VCAP_FIELD_U32 , + .offset =204 , + .width =8 , + }, + [VCAP_AF_PAG_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =212 , + .width =8 , + }, + [VCAP_AF_NXT_IDX_CTRL ] = { + .type =VCAP_FIELD_U32 , + .offset =298 , + .width =3 , + }, + [VCAP_AF_NXT_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =301 , + .width =12 , + }, +}; + +static const struct vcap_field is0_class_reduced_actionfield[] = { + [VCAP_AF_TYPE ] = { .type =VCAP_FIELD_BIT , - .offset = 539, + .offset =0 , .width =1 , }, - [VCAP_KF_L4_ACK] = { + [VCAP_AF_QOS_ENA ] = { .type =VCAP_FIELD_BIT , - .offset = 540, + .offset =5 , .width =1 , }, - [VCAP_KF_L4_URG] = { + [VCAP_AF_QOS_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =6 , + .width =3 , + }, + [VCAP_AF_DP_ENA ] = { .type =VCAP_FIELD_BIT , - .offset = 541, + .offset =9 , .width =1 , }, - [VCAP_KF_L4_PAYLOAD] = { - .type = VCAP_FIELD_U64, - .offset = 542, - .width = 64, + [VCAP_AF_DP_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =10 , + .width =2 , }, -}; - -/* keyfield_set */ -static const struct vcap_set is2_keyfield_set[] = { - [VCAP_KFS_MAC_ETYPE ] = { - .type_id =0 , - .sw_per_item =6 , - .sw_cnt =2 , + [VCAP_AF_MAP_LOOKUP_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =12 , + .width =2 , }, - [VCAP_KFS_ARP ] = { - .type_id =3 , - .sw_per_item =6 , - .sw_cnt =2 , + [VCAP_AF_MAP_KEY ] = { + .type =VCAP_FIELD_U32 , + .offset =14 , + .width =3 , }, - [VCAP_KFS_IP4_TCP_UDP ] = { - .type_id =4 , - .sw_per_item =6 , - .sw_cnt =2 , + [VCAP_AF_CLS_VID_SEL ] = { + .type =VCAP_FIELD_U32 , + .offset =17 , + .width =3 , }, - [VCAP_KFS_IP4_OTHER ] = { - .type_id =5 , - .sw_per_item =6 , - .sw_cnt =2 , + [VCAP_AF_VID_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =23 , + .width =13 , }, - [VCAP_KFS_IP6_STD ] = { - .type_id =6 , - .sw_per_item =6 , - .sw_cnt =2 , + [VCAP_AF_ISDX_ADD_REPLACE_SEL ] = { + .type =VCAP_FIELD_BIT , + .offset =46 , + .width =1 , }, - [VCAP_KFS_IP_7TUPLE ] = { - .type_id =1 , - .sw_per_item =12 , - .sw_cnt =1 , + [VCAP_AF_ISDX_VAL ] = { + .type =VCAP_FIELD_U32 , + .offset =47 , + .width =12 , + }, + [VCAP_AF_NXT_IDX_CTRL ] = { + .type =VCAP_FIELD_U32 , + .offset =90 , + .width =3 , + }, + [VCAP_AF_NXT_IDX ] = { + .type =VCAP_FIELD_U32 , + .offset =93 , + .width =12 , }, }; -/* keyfield_set map */ -static const struct vcap_field *is2_keyfield_set_map[] = { - [VCAP_KFS_MAC_ETYPE ] = is2_mac_etype_keyfield, - [VCAP_KFS_ARP ] = is2_arp_keyfield, - [VCAP_KFS_IP4_TCP_UDP ] = is2_ip4_tcp_udp_keyfield, - [VCAP_KFS_IP4_OTHER ] = is2_ip4_other_keyfield, - [VCAP_KFS_IP6_STD ] = is2_ip6_std_keyfield, - [VCAP_KFS_IP_7TUPLE ] = is2_ip_7tuple_keyfield, -}; - -/* keyfield_set map sizes */ -static int is2_keyfield_set_map_size[] = { - [VCAP_KFS_MAC_ETYPE ] =ARRAY_SIZE (is2_mac_etype_keyfield), - [VCAP_KFS_ARP ] =ARRAY_SIZE (is2_arp_keyfield), - [VCAP_KFS_IP4_TCP_UDP ] =ARRAY_SIZE (is2_ip4_tcp_udp_keyfield), - [VCAP_KFS_IP4_OTHER ] =ARRAY_SIZE (is2_ip4_other_keyfield), - [VCAP_KFS_IP6_STD ] =ARRAY_SIZE (is2_ip6_std_keyfield), - [VCAP_KFS_IP_7TUPLE ] =ARRAY_SIZE (is2_ip_7tuple_keyfield), -}; - -/* actionfields */ static const struct vcap_field is2_base_type_actionfield[] = { [VCAP_AF_PIPELINE_FORCE_ENA ] = { .type =VCAP_FIELD_BIT ,
@@ -1111,6 +1799,24 @@ static const struct vcap_field is2_base_type_actionfield[] = { };/* actionfield_set */ +static const struct vcap_set is0_actionfield_set[] = { + [VCAP_AFS_CLASSIFICATION ] = { + .type_id =1 , + .sw_per_item =2 , + .sw_cnt =6 , + }, + [VCAP_AFS_FULL ] = { + .type_id =-1 , + .sw_per_item =3 , + .sw_cnt =4 , + }, + [VCAP_AFS_CLASS_REDUCED ] = { + .type_id =1 , + .sw_per_item =1 , + .sw_cnt =12 , + }, +}; +static const struct vcap_set is2_actionfield_set[] = { [VCAP_AFS_BASE_TYPE ] = { .type_id =-1 ,
@@ -1120,16 +1826,138 @@ static const struct vcap_set is2_actionfield_set[] = { };/* actionfield_set map */ +static const struct vcap_field *is0_actionfield_set_map[] = { + [VCAP_AFS_CLASSIFICATION ] = is0_classification_actionfield, + [VCAP_AFS_FULL ] = is0_full_actionfield, + [VCAP_AFS_CLASS_REDUCED ] = is0_class_reduced_actionfield, +}; +static const struct vcap_field *is2_actionfield_set_map[] = { [VCAP_AFS_BASE_TYPE ] = is2_base_type_actionfield, };/* actionfield_set map size */ +static int is0_actionfield_set_map_size[] = { + [VCAP_AFS_CLASSIFICATION ] =ARRAY_SIZE (is0_classification_actionfield), + [VCAP_AFS_FULL ] =ARRAY_SIZE (is0_full_actionfield), + [VCAP_AFS_CLASS_REDUCED ] =ARRAY_SIZE (is0_class_reduced_actionfield), +}; +static int is2_actionfield_set_map_size[] = { [VCAP_AFS_BASE_TYPE ] =ARRAY_SIZE (is2_base_type_actionfield), };/* Type Groups */ +static const struct vcap_typegroup is0_x12_keyfield_set_typegroups[] = { + { + .offset =0 , + .width =5 , + .value =16 , + }, + { + .offset =52 , + .width =1 , + .value =0 , + }, + { + .offset =104 , + .width =2 , + .value =0 , + }, + { + .offset =156 , + .width =3 , + .value =0 , + }, + { + .offset =208 , + .width =2 , + .value =0 , + }, + { + .offset =260 , + .width =1 , + .value =0 , + }, + { + .offset =312 , + .width =4 , + .value =0 , + }, + { + .offset =364 , + .width =1 , + .value =0 , + }, + { + .offset =416 , + .width =2 , + .value =0 , + }, + { + .offset =468 , + .width =3 , + .value =0 , + }, + { + .offset =520 , + .width =2 , + .value =0 , + }, + { + .offset =572 , + .width =1 , + .value =0 , + }, + {} +}; + +static const struct vcap_typegroup is0_x6_keyfield_set_typegroups[] = { + { + .offset =0 , + .width =4 , + .value =8 , + }, + { + .offset =52 , + .width =1 , + .value =0 , + }, + { + .offset =104 , + .width =2 , + .value =0 , + }, + { + .offset =156 , + .width =3 , + .value =0 , + }, + { + .offset =208 , + .width =2 , + .value =0 , + }, + { + .offset =260 , + .width =1 , + .value =0 , + }, + {} +}; + +static const struct vcap_typegroup is0_x3_keyfield_set_typegroups[] = { + {} +}; + +static const struct vcap_typegroup is0_x2_keyfield_set_typegroups[] = { + {} +}; + +static const struct vcap_typegroup is0_x1_keyfield_set_typegroups[] = { + {} +}; +static const struct vcap_typegroup is2_x12_keyfield_set_typegroups[] = { { .offset =0 ,
@@ -1176,6 +2004,15 @@ static const struct vcap_typegroup is2_x1_keyfield_set_typegroups[] = { {} }; +static const struct vcap_typegroup *is0_keyfield_set_typegroups[] = { + [12 ] = is0_x12_keyfield_set_typegroups, + [6 ] = is0_x6_keyfield_set_typegroups, + [3 ] = is0_x3_keyfield_set_typegroups, + [2 ] = is0_x2_keyfield_set_typegroups, + [1 ] = is0_x1_keyfield_set_typegroups, + [13 ] =NULL , +}; +static const struct vcap_typegroup *is2_keyfield_set_typegroups[] = { [12 ] = is2_x12_keyfield_set_typegroups, [6 ] = is2_x6_keyfield_set_typegroups,
@@ -1184,6 +2021,48 @@ static const struct vcap_typegroup *is2_keyfield_set_typegroups[] = { [13] = NULL, }; +static const struct vcap_typegroup is0_x3_actionfield_set_typegroups[] = { + { + .offset =0 , + .width =3 , + .value =4 , + }, + { + .offset =110 , + .width =2 , + .value =0 , + }, + { + .offset =220 , + .width =2 , + .value =0 , + }, + {} +}; + +static const struct vcap_typegroup is0_x2_actionfield_set_typegroups[] = { + { + .offset =0 , + .width =2 , + .value =2 , + }, + { + .offset =110 , + .width =1 , + .value =0 , + }, + {} +}; + +static const struct vcap_typegroup is0_x1_actionfield_set_typegroups[] = { + { + .offset =0 , + .width =1 , + .value =1 , + }, + {} +}; +static const struct vcap_typegroup is2_x3_actionfield_set_typegroups[] = { { .offset =0 ,
@@ -1207,6 +2086,13 @@ static const struct vcap_typegroup is2_x1_actionfield_set_typegroups[] = { {} }; +static const struct vcap_typegroup *is0_actionfield_set_typegroups[] = { + [3 ] = is0_x3_actionfield_set_typegroups, + [2 ] = is0_x2_actionfield_set_typegroups, + [1 ] = is0_x1_actionfield_set_typegroups, + [13 ] =NULL , +}; +static const struct vcap_typegroup *is2_actionfield_set_typegroups[] = { [3 ] = is2_x3_actionfield_set_typegroups, [1 ] = is2_x1_actionfield_set_typegroups,
@@ -1219,24 +2105,50 @@ static const char * const vcap_keyfield_set_names[] = { [VCAP_KFS_ARP] = "VCAP_KFS_ARP", [VCAP_KFS_IP4_OTHER] = "VCAP_KFS_IP4_OTHER", [VCAP_KFS_IP4_TCP_UDP] = "VCAP_KFS_IP4_TCP_UDP", + [VCAP_KFS_IP6_OTHER] = "VCAP_KFS_IP6_OTHER", [VCAP_KFS_IP6_STD] = "VCAP_KFS_IP6_STD", + [VCAP_KFS_IP6_TCP_UDP] = "VCAP_KFS_IP6_TCP_UDP", [VCAP_KFS_IP_7TUPLE] = "VCAP_KFS_IP_7TUPLE", [VCAP_KFS_MAC_ETYPE] = "VCAP_KFS_MAC_ETYPE", + [VCAP_KFS_MAC_LLC] = "VCAP_KFS_MAC_LLC", + [VCAP_KFS_MAC_SNAP] = "VCAP_KFS_MAC_SNAP", + [VCAP_KFS_NORMAL_5TUPLE_IP4] = "VCAP_KFS_NORMAL_5TUPLE_IP4", + [VCAP_KFS_NORMAL_7TUPLE] = "VCAP_KFS_NORMAL_7TUPLE", + [VCAP_KFS_OAM] = "VCAP_KFS_OAM", + [VCAP_KFS_SMAC_SIP4] = "VCAP_KFS_SMAC_SIP4", + [VCAP_KFS_SMAC_SIP6] = "VCAP_KFS_SMAC_SIP6", };/* Actionfieldset names */ static const char *const vcap_actionfield_set_names[] = { [VCAP_AFS_NO_VALUE ] ="(None)" , [VCAP_AFS_BASE_TYPE ] ="VCAP_AFS_BASE_TYPE" , + [VCAP_AFS_CLASSIFICATION ] ="VCAP_AFS_CLASSIFICATION" , + [VCAP_AFS_CLASS_REDUCED ] ="VCAP_AFS_CLASS_REDUCED" , + [VCAP_AFS_FULL ] ="VCAP_AFS_FULL" , + [VCAP_AFS_SMAC_SIP ] ="VCAP_AFS_SMAC_SIP" , };/* Keyfield names */ static const char *const vcap_keyfield_names[] = { [VCAP_KF_NO_VALUE ] ="(None)" , + [VCAP_KF_8021Q_DEI0 ] ="8021Q_DEI0" , + [VCAP_KF_8021Q_DEI1 ] ="8021Q_DEI1" , + [VCAP_KF_8021Q_DEI2 ] ="8021Q_DEI2" , [VCAP_KF_8021Q_DEI_CLS ] ="8021Q_DEI_CLS" , + [VCAP_KF_8021Q_PCP0 ] ="8021Q_PCP0" , + [VCAP_KF_8021Q_PCP1 ] ="8021Q_PCP1" , + [VCAP_KF_8021Q_PCP2 ] ="8021Q_PCP2" , [VCAP_KF_8021Q_PCP_CLS ] ="8021Q_PCP_CLS" , + [VCAP_KF_8021Q_TPID0 ] ="8021Q_TPID0" , + [VCAP_KF_8021Q_TPID1 ] ="8021Q_TPID1" , + [VCAP_KF_8021Q_TPID2 ] ="8021Q_TPID2" , + [VCAP_KF_8021Q_VID0 ] ="8021Q_VID0" , + [VCAP_KF_8021Q_VID1 ] ="8021Q_VID1" , + [VCAP_KF_8021Q_VID2 ] ="8021Q_VID2" , [VCAP_KF_8021Q_VID_CLS ] ="8021Q_VID_CLS" , [VCAP_KF_8021Q_VLAN_TAGGED_IS ] ="8021Q_VLAN_TAGGED_IS" , + [VCAP_KF_8021Q_VLAN_TAGS ] ="8021Q_VLAN_TAGS" , [VCAP_KF_ARP_ADDR_SPACE_OK_IS ] ="ARP_ADDR_SPACE_OK_IS" , [VCAP_KF_ARP_LEN_OK_IS ] ="ARP_LEN_OK_IS" , [VCAP_KF_ARP_OPCODE ] ="ARP_OPCODE" ,
@@ -1246,23 +2158,37 @@ static const char * const vcap_keyfield_names[] = { [VCAP_KF_ARP_TGT_MATCH_IS] = "ARP_TGT_MATCH_IS", [VCAP_KF_ETYPE] = "ETYPE", [VCAP_KF_ETYPE_LEN_IS] = "ETYPE_LEN_IS", + [VCAP_KF_HOST_MATCH] = "HOST_MATCH", + [VCAP_KF_IF_IGR_PORT] = "IF_IGR_PORT", [VCAP_KF_IF_IGR_PORT_MASK] = "IF_IGR_PORT_MASK", [VCAP_KF_IF_IGR_PORT_MASK_L3] = "IF_IGR_PORT_MASK_L3", [VCAP_KF_IF_IGR_PORT_MASK_RNG] = "IF_IGR_PORT_MASK_RNG", [VCAP_KF_IF_IGR_PORT_MASK_SEL] = "IF_IGR_PORT_MASK_SEL", [VCAP_KF_IP4_IS] = "IP4_IS", + [VCAP_KF_IP_MC_IS] = "IP_MC_IS", + [VCAP_KF_IP_PAYLOAD_5TUPLE] = "IP_PAYLOAD_5TUPLE", + [VCAP_KF_IP_SNAP_IS] = "IP_SNAP_IS", [VCAP_KF_ISDX_CLS] = "ISDX_CLS", [VCAP_KF_ISDX_GT0_IS] = "ISDX_GT0_IS", [VCAP_KF_L2_BC_IS] = "L2_BC_IS", [VCAP_KF_L2_DMAC] = "L2_DMAC", + [VCAP_KF_L2_FRM_TYPE] = "L2_FRM_TYPE", [VCAP_KF_L2_FWD_IS] = "L2_FWD_IS", + [VCAP_KF_L2_LLC] = "L2_LLC", [VCAP_KF_L2_MC_IS] = "L2_MC_IS", + [VCAP_KF_L2_PAYLOAD0] = "L2_PAYLOAD0", + [VCAP_KF_L2_PAYLOAD1] = "L2_PAYLOAD1", + [VCAP_KF_L2_PAYLOAD2] = "L2_PAYLOAD2", [VCAP_KF_L2_PAYLOAD_ETYPE] = "L2_PAYLOAD_ETYPE", [VCAP_KF_L2_SMAC] = "L2_SMAC", + [VCAP_KF_L2_SNAP] = "L2_SNAP", [VCAP_KF_L3_DIP_EQ_SIP_IS] = "L3_DIP_EQ_SIP_IS", + [VCAP_KF_L3_DSCP] = "L3_DSCP", [VCAP_KF_L3_DST_IS] = "L3_DST_IS", + [VCAP_KF_L3_FRAGMENT] = "L3_FRAGMENT", [VCAP_KF_L3_FRAGMENT_TYPE] = "L3_FRAGMENT_TYPE", [VCAP_KF_L3_FRAG_INVLD_L4_LEN] = "L3_FRAG_INVLD_L4_LEN", + [VCAP_KF_L3_FRAG_OFS_GT0] = "L3_FRAG_OFS_GT0", [VCAP_KF_L3_IP4_DIP] = "L3_IP4_DIP", [VCAP_KF_L3_IP4_SIP] = "L3_IP4_SIP", [VCAP_KF_L3_IP6_DIP] = "L3_IP6_DIP",
@@ -1273,6 +2199,8 @@ static const char * const vcap_keyfield_names[] = { [VCAP_KF_L3_RT_IS] = "L3_RT_IS", [VCAP_KF_L3_TOS] = "L3_TOS", [VCAP_KF_L3_TTL_GT0] = "L3_TTL_GT0", + [VCAP_KF_L4_1588_DOM] = "L4_1588_DOM", + [VCAP_KF_L4_1588_VER] = "L4_1588_VER", [VCAP_KF_L4_ACK] = "L4_ACK", [VCAP_KF_L4_DPORT] = "L4_DPORT", [VCAP_KF_L4_FIN] = "L4_FIN",
@@ -1286,8 +2214,16 @@ static const char * const vcap_keyfield_names[] = { [VCAP_KF_L4_SYN] = "L4_SYN", [VCAP_KF_L4_URG] = "L4_URG", [VCAP_KF_LOOKUP_FIRST_IS] = "LOOKUP_FIRST_IS", + [VCAP_KF_LOOKUP_GEN_IDX] = "LOOKUP_GEN_IDX", + [VCAP_KF_LOOKUP_GEN_IDX_SEL] = "LOOKUP_GEN_IDX_SEL", [VCAP_KF_LOOKUP_PAG] = "LOOKUP_PAG", [VCAP_KF_OAM_CCM_CNTS_EQ0] = "OAM_CCM_CNTS_EQ0", + [VCAP_KF_OAM_DETECTED] = "OAM_DETECTED", + [VCAP_KF_OAM_FLAGS] = "OAM_FLAGS", + [VCAP_KF_OAM_MEL_FLAGS] = "OAM_MEL_FLAGS", + [VCAP_KF_OAM_MEPID] = "OAM_MEPID", + [VCAP_KF_OAM_OPCODE] = "OAM_OPCODE", + [VCAP_KF_OAM_VER] = "OAM_VER", [VCAP_KF_OAM_Y1731_IS] = "OAM_Y1731_IS", [VCAP_KF_TCP_IS] = "TCP_IS", [VCAP_KF_TCP_UDP_IS] = "TCP_UDP_IS",
@@ -1297,27 +2233,77 @@ static const char * const vcap_keyfield_names[] = {/* Actionfield names */ static const char *const vcap_actionfield_names[] = { [VCAP_AF_NO_VALUE ] ="(None)" , + [VCAP_AF_ACL_ID ] ="ACL_ID" , + [VCAP_AF_CLS_VID_SEL ] ="CLS_VID_SEL" , [VCAP_AF_CNT_ID ] ="CNT_ID" , [VCAP_AF_CPU_COPY_ENA ] ="CPU_COPY_ENA" , [VCAP_AF_CPU_QUEUE_NUM ] ="CPU_QUEUE_NUM" , + [VCAP_AF_DEI_ENA ] ="DEI_ENA" , + [VCAP_AF_DEI_VAL ] ="DEI_VAL" , + [VCAP_AF_DP_ENA ] ="DP_ENA" , + [VCAP_AF_DP_VAL ] ="DP_VAL" , + [VCAP_AF_DSCP_ENA ] ="DSCP_ENA" , + [VCAP_AF_DSCP_VAL ] ="DSCP_VAL" , + [VCAP_AF_FWD_KILL_ENA ] ="FWD_KILL_ENA" , [VCAP_AF_HIT_ME_ONCE ] ="HIT_ME_ONCE" , + [VCAP_AF_HOST_MATCH ] ="HOST_MATCH" , [VCAP_AF_IGNORE_PIPELINE_CTRL ] ="IGNORE_PIPELINE_CTRL" , [VCAP_AF_INTR_ENA ] ="INTR_ENA" , + [VCAP_AF_ISDX_ADD_REPLACE_SEL ] ="ISDX_ADD_REPLACE_SEL" , + [VCAP_AF_ISDX_ENA ] ="ISDX_ENA" , + [VCAP_AF_ISDX_VAL ] ="ISDX_VAL" , [VCAP_AF_LRN_DIS ] ="LRN_DIS" , + [VCAP_AF_MAP_IDX ] ="MAP_IDX" , + [VCAP_AF_MAP_KEY ] ="MAP_KEY" , + [VCAP_AF_MAP_LOOKUP_SEL ] ="MAP_LOOKUP_SEL" , [VCAP_AF_MASK_MODE ] ="MASK_MODE" , [VCAP_AF_MATCH_ID ] ="MATCH_ID" , [VCAP_AF_MATCH_ID_MASK ] ="MATCH_ID_MASK" , + [VCAP_AF_MIRROR_ENA ] ="MIRROR_ENA" , [VCAP_AF_MIRROR_PROBE ] ="MIRROR_PROBE" , + [VCAP_AF_NXT_IDX ] ="NXT_IDX" , + [VCAP_AF_NXT_IDX_CTRL ] ="NXT_IDX_CTRL" , + [VCAP_AF_PAG_OVERRIDE_MASK ] ="PAG_OVERRIDE_MASK" , + [VCAP_AF_PAG_VAL ] ="PAG_VAL" , + [VCAP_AF_PCP_ENA ] ="PCP_ENA" , + [VCAP_AF_PCP_VAL ] ="PCP_VAL" , [VCAP_AF_PIPELINE_FORCE_ENA ] ="PIPELINE_FORCE_ENA" , [VCAP_AF_PIPELINE_PT ] ="PIPELINE_PT" , [VCAP_AF_POLICE_ENA ] ="POLICE_ENA" , [VCAP_AF_POLICE_IDX ] ="POLICE_IDX" , + [VCAP_AF_POLICE_VCAP_ONLY ] ="POLICE_VCAP_ONLY" , [VCAP_AF_PORT_MASK ] ="PORT_MASK" , + [VCAP_AF_QOS_ENA ] ="QOS_ENA" , + [VCAP_AF_QOS_VAL ] ="QOS_VAL" , + [VCAP_AF_REW_OP ] ="REW_OP" , [VCAP_AF_RT_DIS ] ="RT_DIS" , + [VCAP_AF_TYPE ] ="TYPE" , + [VCAP_AF_VID_VAL ] ="VID_VAL" , };/* VCAPs */ const struct vcap_info sparx5_vcaps[] = { + [VCAP_TYPE_IS0 ] = { + .name ="is0" , + .rows =1024 , + .sw_count =12 , + .sw_width =52 , + .sticky_width =1 , + .act_width =110 , + .default_cnt =140 , + .require_cnt_dis =0 , + .version =1 , + .keyfield_set = is0_keyfield_set, + .keyfield_set_size =ARRAY_SIZE (is0_keyfield_set), + .actionfield_set = is0_actionfield_set, + .actionfield_set_size =ARRAY_SIZE (is0_actionfield_set), + .keyfield_set_map = is0_keyfield_set_map, + .keyfield_set_map_size = is0_keyfield_set_map_size, + .actionfield_set_map = is0_actionfield_set_map, + .actionfield_set_map_size = is0_actionfield_set_map_size, + .keyfield_set_typegroups = is0_keyfield_set_typegroups, + .actionfield_set_typegroups = is0_actionfield_set_typegroups, + }, [VCAP_TYPE_IS2 ] = { .name ="is2" , .rows =256 ,
@@ -1343,7 +2329,7 @@ const struct vcap_info sparx5_vcaps[] = {const struct vcap_statistics sparx5_vcap_stats = { .name ="sparx5" , - .count =1 , + .count =2 , .keyfield_set_names = vcap_keyfield_set_names, .actionfield_set_names = vcap_actionfield_set_names, .keyfield_names = vcap_keyfield_names,
drivers/net/ethernet/microchip/vcap/vcap_ag_api.h +124 -212
638 lines not on this page · raw message
drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c +1 -1
@@ -296,7 +296,7 @@ test_vcap_xn_rule_creator(struct kunit *test, int cid, enum vcap_user user, ret =vcap_set_rule_set_keyset (rule, keyset);/* Add rule actions : there must be at least one action */ - ret =vcap_rule_add_action_u32 (rule,VCAP_AF_COSID_VAL ,0 ); + ret =vcap_rule_add_action_u32 (rule,VCAP_AF_ISDX_VAL ,0 );/* Override rule actionset */ ret =vcap_set_rule_set_actionset (rule, actionset);
drivers/net/ethernet/microchip/vcap/vcap_model_kunit.c +210 -1784
1,074 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.39.1
Part of the diff is not shown here. View the raw message.
Steen Hegelund
maintainerPATCH v2 2/8 net: microchip: sparx5: Add IS0 VCAP keyset configuration for Sparx5
In reply to Steen HegelundThis adds the IS0 VCAP port keyset configuration for Sparx5 and also updates the debugFS support to show the keyset configuration.
--- .../microchip/sparx5/sparx5_main_regs.h | 64 ++- .../microchip/sparx5/sparx5_vcap_debugfs.c | 131 ++++++- .../microchip/sparx5/sparx5_vcap_impl.c | 365 +++++++++++++++--- .../microchip/sparx5/sparx5_vcap_impl.h | 58 +++ 4 files changed, 564 insertions(+), 54 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_main_regs.h +62 -2
@@ -4,8 +4,8 @@* Copyright (c) 2021 Microchip Technology Inc. */ -/* This file is autogenerated by cml-utils 2022-11-04 11:22:22 +0100. -* Commit ID: 498242727be5db9b423cc0923bc966fc7b40607e +/* This file is autogenerated by cml-utils 2022-12-06 15:28:38 +0100. +* Commit ID: 3db2ac730f134c160496f2b9f10915e347d871cb */ #ifndef _SPARX5_MAIN_REGS_H_
@@ -843,6 +843,66 @@ enum sparx5_target {/* ANA_CL:PORT:CAPTURE_BPDU_CFG */ #define ANA_CL_CAPTURE_BPDU_CFG (g) __REG(TARGET_ANA_CL, 0, 1, 131072, g, 70, 512, 196, 0, 1, 4) +/* ANA_CL:PORT:ADV_CL_CFG_2 */ +#define ANA_CL_ADV_CL_CFG_2 (g, r) __REG(TARGET_ANA_CL, 0, 1, 131072, g, 70, 512, 200, r, 6, 4) + +#define ANA_CL_ADV_CL_CFG_2_USE_CL_TCI0_ENA BIT(1) +#define ANA_CL_ADV_CL_CFG_2_USE_CL_TCI0_ENA_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_2_USE_CL_TCI0_ENA, x) +#define ANA_CL_ADV_CL_CFG_2_USE_CL_TCI0_ENA_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_2_USE_CL_TCI0_ENA, x) + +#define ANA_CL_ADV_CL_CFG_2_USE_CL_DSCP_ENA BIT(0) +#define ANA_CL_ADV_CL_CFG_2_USE_CL_DSCP_ENA_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_2_USE_CL_DSCP_ENA, x) +#define ANA_CL_ADV_CL_CFG_2_USE_CL_DSCP_ENA_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_2_USE_CL_DSCP_ENA, x) + +/* ANA_CL:PORT:ADV_CL_CFG */ +#define ANA_CL_ADV_CL_CFG (g, r) __REG(TARGET_ANA_CL, 0, 1, 131072, g, 70, 512, 224, r, 6, 4) + +#define ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL GENMASK(30, 26) +#define ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL, x) +#define ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_IP4_CLM_KEY_SEL, x) + +#define ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL GENMASK(25, 21) +#define ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL, x) +#define ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_IP6_CLM_KEY_SEL, x) + +#define ANA_CL_ADV_CL_CFG_MPLS_UC_CLM_KEY_SEL GENMASK(20, 16) +#define ANA_CL_ADV_CL_CFG_MPLS_UC_CLM_KEY_SEL_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_MPLS_UC_CLM_KEY_SEL, x) +#define ANA_CL_ADV_CL_CFG_MPLS_UC_CLM_KEY_SEL_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_MPLS_UC_CLM_KEY_SEL, x) + +#define ANA_CL_ADV_CL_CFG_MPLS_MC_CLM_KEY_SEL GENMASK(15, 11) +#define ANA_CL_ADV_CL_CFG_MPLS_MC_CLM_KEY_SEL_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_MPLS_MC_CLM_KEY_SEL, x) +#define ANA_CL_ADV_CL_CFG_MPLS_MC_CLM_KEY_SEL_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_MPLS_MC_CLM_KEY_SEL, x) + +#define ANA_CL_ADV_CL_CFG_MLBS_CLM_KEY_SEL GENMASK(10, 6) +#define ANA_CL_ADV_CL_CFG_MLBS_CLM_KEY_SEL_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_MLBS_CLM_KEY_SEL, x) +#define ANA_CL_ADV_CL_CFG_MLBS_CLM_KEY_SEL_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_MLBS_CLM_KEY_SEL, x) + +#define ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL GENMASK(5, 1) +#define ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL, x) +#define ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_ETYPE_CLM_KEY_SEL, x) + +#define ANA_CL_ADV_CL_CFG_LOOKUP_ENA BIT(0) +#define ANA_CL_ADV_CL_CFG_LOOKUP_ENA_SET (x)\ + FIELD_PREP(ANA_CL_ADV_CL_CFG_LOOKUP_ENA, x) +#define ANA_CL_ADV_CL_CFG_LOOKUP_ENA_GET (x)\ + FIELD_GET(ANA_CL_ADV_CL_CFG_LOOKUP_ENA, x) +/* ANA_CL:COMMON:OWN_UPSID */ #define ANA_CL_OWN_UPSID (r) __REG(TARGET_ANA_CL, 0, 1, 166912, 0, 1, 756, 0, r, 3, 4)
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_debugfs.c +122 -9
148 lines not on this page · raw message
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c +322 -43
488 lines not on this page · raw message
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.h +58 -0
70 lines not on this page · raw message
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 3/8 net: microchip: sparx5: Add actionset type id information to rule
In reply to Steen HegelundThis adds the actionset type id to the rule information. This is needed as we now have more than one actionset in a VCAP instance (IS0).
--- .../net/ethernet/microchip/vcap/vcap_api.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/net/ethernet/microchip/vcap/vcap_api.c +34 -0
@@ -1673,6 +1673,39 @@ static int vcap_add_type_keyfield(struct vcap_rule *rule)return 0 ; } +/* Add the actionset typefield to the list of rule actionfields */ +static int vcap_add_type_actionfield (struct vcap_rule *rule) +{ +enum vcap_actionfield_set actionset = rule->actionset; +struct vcap_rule_internal *ri =to_intrule (rule); +enum vcap_type vt = ri->admin->vtype; +const struct vcap_field *fields; +const struct vcap_set *aset; +int ret = -EINVAL ; + + aset =vcap_actionfieldset (ri->vctrl, vt, actionset); +if (!aset) +return ret; +if (aset->type_id == (u8)-1 )/* No type field is needed */ +return 0 ; + + fields =vcap_actionfields (ri->vctrl, vt, actionset); +if (!fields) +return -EINVAL ; +if (fields[VCAP_AF_TYPE ].width >1 ) { + ret =vcap_rule_add_action_u32 (rule,VCAP_AF_TYPE , + aset->type_id); + }else { +if (aset->type_id) + ret =vcap_rule_add_action_bit (rule,VCAP_AF_TYPE , +VCAP_BIT_1 ); +else + ret =vcap_rule_add_action_bit (rule,VCAP_AF_TYPE , +VCAP_BIT_0 ); + } +return ret; +} +/* Add a keyset to a keyset list */ bool vcap_keyset_list_add (struct vcap_keyset_list *keysetlist,enum vcap_keyfield_set keyset)
@@ -1856,6 +1889,7 @@ int vcap_val_rule(struct vcap_rule *rule, u16 l3_proto)return -EINVAL ; }vcap_add_type_keyfield (rule); +vcap_add_type_actionfield (rule);/* Add default fields to this rule */ ri->vctrl->ops->add_default_fields (ri->ndev, ri->admin, rule);
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 4/8 net: microchip: sparx5: Add TC support for IS0 VCAP
In reply to Steen HegelundThis enables the TC command to use the Sparx5 IS0 VCAP
--- .../microchip/sparx5/sparx5_tc_flower.c | 54 +++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +45 -9
@@ -30,6 +30,7 @@ struct sparx5_tc_flower_parse_usage {struct flow_cls_offload *fco;struct flow_rule *frule;struct vcap_rule *vrule; +struct vcap_admin *admin;u16 l3_proto;u8 l4_proto;unsigned int used_keys;
@@ -304,6 +305,13 @@ sparx5_tc_flower_handler_basic_usage(struct sparx5_tc_flower_parse_usage *st) VCAP_BIT_0);if (err) goto out; +if (st->admin->vtype ==VCAP_TYPE_IS0 ) { + err =vcap_rule_add_key_bit (st->vrule, +VCAP_KF_TCP_UDP_IS , +VCAP_BIT_1 ); +if (err) + goto out; + } }else { err = vcap_rule_add_key_u32(st->vrule, VCAP_KF_L3_IP_PROTO,
@@ -542,6 +550,7 @@ static int sparx5_tc_use_dissectors(struct flow_cls_offload *fco, .fco = fco, .vrule = vrule, .l3_proto = ETH_P_ALL, + .admin = admin, };int idx, err =0 ;
@@ -623,18 +632,21 @@ static int sparx5_tc_flower_action_check(struct vcap_control *vctrl,return 0 ; } -/* Add a rule counter action - only IS2 is considered for now */ +/* Add a rule counter action */ static int sparx5_tc_add_rule_counter (struct vcap_admin *admin,struct vcap_rule *vrule) {int err; - err =vcap_rule_mod_action_u32 (vrule,VCAP_AF_CNT_ID , vrule->id); -if (err) -return err; +if (admin->vtype ==VCAP_TYPE_IS2 ) { + err =vcap_rule_mod_action_u32 (vrule,VCAP_AF_CNT_ID , + vrule->id); +if (err) +return err; +vcap_rule_set_counter_id (vrule, vrule->id); + } -vcap_rule_set_counter_id (vrule, vrule->id); -return err; +return 0 ; }/* Collect all port keysets and apply the first of them, possibly wildcarded */
@@ -815,6 +827,29 @@ static int sparx5_tc_add_remaining_rules(struct vcap_control *vctrl,return err; } +/* Add the actionset that is the default for the VCAP type */ +static int sparx5_tc_set_actionset (struct vcap_admin *admin, +struct vcap_rule *vrule) +{ +enum vcap_actionfield_set aset; +int err =0 ; + +switch (admin->vtype) { +case VCAP_TYPE_IS0 : + aset =VCAP_AFS_CLASSIFICATION ; +break ; +case VCAP_TYPE_IS2 : + aset =VCAP_AFS_BASE_TYPE ; +break ; +default : +return -EINVAL ; + } +/* Do not overwrite any current actionset */ +if (vrule->actionset ==VCAP_AFS_NO_VALUE ) + err =vcap_set_rule_set_actionset (vrule, aset); +return err; +} +static int sparx5_tc_flower_replace (struct net_device *ndev,struct flow_cls_offload *fco,struct vcap_admin *admin)
@@ -874,13 +909,14 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, goto out;break ;case FLOW_ACTION_ACCEPT : -/* For now the actionset is hardcoded */ - err =vcap_set_rule_set_actionset (vrule, -VCAP_AFS_BASE_TYPE ); + err =sparx5_tc_set_actionset (admin, vrule);if (err) goto out;break ;case FLOW_ACTION_GOTO : + err =sparx5_tc_set_actionset (admin, vrule); +if (err) + goto out;/* Links between VCAPs will be added later */ break ;default :
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 5/8 net: microchip: sparx5: Add TC filter chaining support for IS0 and IS2 VCAPs
In reply to Steen HegelundThis allows rules to be chained between VCAP instances, e.g. from IS0 Lookup 0 to IS0 Lookup 1, or from one of the IS0 Lookups to one of the IS2 Lookups.
Chaining from an IS2 Lookup to another IS2 Lookup is not supported in the hardware.
--- .../microchip/sparx5/sparx5_tc_flower.c | 93 ++++++++++++++++++- .../net/ethernet/microchip/vcap/vcap_api.c | 43 ++++++++- .../ethernet/microchip/vcap/vcap_api_client.h | 2 + 3 files changed, 136 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +92 -1
@@ -850,6 +850,84 @@ static int sparx5_tc_set_actionset(struct vcap_admin *admin,return err; } +/* Add the VCAP key to match on for a rule target value */ +static int sparx5_tc_add_rule_link_target (struct vcap_admin *admin, +struct vcap_rule *vrule, +int target_cid) +{ +int link_val = target_cid %VCAP_CID_LOOKUP_SIZE ; +int err; + +if (!link_val) +return 0 ; + +switch (admin->vtype) { +case VCAP_TYPE_IS0 : +/* Add NXT_IDX key for chaining rules between IS0 instances */ + err =vcap_rule_add_key_u32 (vrule,VCAP_KF_LOOKUP_GEN_IDX_SEL , +1 ,/* enable */ + ~0 ); +if (err) +return err; +return vcap_rule_add_key_u32 (vrule,VCAP_KF_LOOKUP_GEN_IDX , + link_val,/* target */ + ~0 ); +case VCAP_TYPE_IS2 : +/* Add PAG key for chaining rules from IS0 */ +return vcap_rule_add_key_u32 (vrule,VCAP_KF_LOOKUP_PAG , + link_val,/* target */ + ~0 ); +default : +break ; + } +return 0 ; +} + +/* Add the VCAP action that adds a target value to a rule */ +static int sparx5_tc_add_rule_link (struct vcap_control *vctrl, +struct vcap_admin *admin, +struct vcap_rule *vrule, +int from_cid,int to_cid) +{ +struct vcap_admin *to_admin =vcap_find_admin (vctrl, to_cid); +int diff, err =0 ; + + diff =vcap_chain_offset (vctrl, from_cid, to_cid); +if (!(to_admin && diff >0 )) { +pr_err ("%s:%d: unsupported chain direction: %d\n" , + __func__, __LINE__, to_cid); +return -EINVAL ; + } +if (admin->vtype ==VCAP_TYPE_IS0 && + to_admin->vtype ==VCAP_TYPE_IS0 ) { +/* Between IS0 instances the G_IDX value is used */ + err =vcap_rule_add_action_u32 (vrule,VCAP_AF_NXT_IDX , diff); +if (err) + goto out; + err =vcap_rule_add_action_u32 (vrule,VCAP_AF_NXT_IDX_CTRL , +1 );/* Replace */ +if (err) + goto out; + }else if (admin->vtype ==VCAP_TYPE_IS0 && + to_admin->vtype ==VCAP_TYPE_IS2 ) { +/* Between IS0 and IS2 the PAG value is used */ + err =vcap_rule_add_action_u32 (vrule,VCAP_AF_PAG_VAL , diff); +if (err) + goto out; + err =vcap_rule_add_action_u32 (vrule, +VCAP_AF_PAG_OVERRIDE_MASK , +0xff ); +if (err) + goto out; + }else { +pr_err ("%s:%d: unsupported chain destination: %d\n" , + __func__, __LINE__, to_cid); + err = -EOPNOTSUPP ; + } +out: +return err; +} +static int sparx5_tc_flower_replace (struct net_device *ndev,struct flow_cls_offload *fco,struct vcap_admin *admin)
@@ -885,10 +963,21 @@ static int sparx5_tc_flower_replace(struct net_device *ndev,if (err) goto out; + err =sparx5_tc_add_rule_link_target (admin, vrule, + fco->common.chain_index); +if (err) + goto out; + frule =flow_cls_offload_flow_rule (fco);flow_action_for_each (idx, act, &frule->action) {switch (act->id) {case FLOW_ACTION_TRAP : +if (admin->vtype !=VCAP_TYPE_IS2 ) { +NL_SET_ERR_MSG_MOD (fco->common.extack, +"Trap action not supported in this VCAP" ); + err = -EOPNOTSUPP ; + goto out; + } err =vcap_rule_add_action_bit (vrule,VCAP_AF_CPU_COPY_ENA ,VCAP_BIT_1 );
@@ -917,7 +1006,9 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, err =sparx5_tc_set_actionset (admin, vrule);if (err) goto out; -/* Links between VCAPs will be added later */ +sparx5_tc_add_rule_link (vctrl, admin, vrule, + fco->common.chain_index, + act->chain_index);break ;default : NL_SET_ERR_MSG_MOD(fco->common.extack,
drivers/net/ethernet/microchip/vcap/vcap_api.c +42 -1
68 lines not on this page · raw message
drivers/net/ethernet/microchip/vcap/vcap_api_client.h +2 -0
@@ -217,6 +217,8 @@ const struct vcap_field *vcap_lookup_keyfield(struct vcap_rule *rule, enum vcap_key_field key);/* Find a rule id with a provided cookie */ int vcap_lookup_rule_by_cookie (struct vcap_control *vctrl,u64 cookie); +/* Calculate the value used for chaining VCAP rules */ +int vcap_chain_offset (struct vcap_control *vctrl,int from_cid,int to_cid);/* Is the next chain id in the following lookup, possible in another VCAP */ bool vcap_is_next_lookup (struct vcap_control *vctrl,int cur_cid,int next_cid);/* Is this chain id the last lookup of all VCAPs */
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 6/8 net: microchip: sparx5: Add automatic selection of VCAP rule actionset
In reply to Steen HegelundWith more than one possible actionset in a VCAP instance, the VCAP API will now use the actions in a VCAP rule to select the actionset that fits these actions the best possible way.
--- .../microchip/sparx5/sparx5_tc_flower.c | 5 - .../net/ethernet/microchip/vcap/vcap_api.c | 107 +++++++++++++++++- .../net/ethernet/microchip/vcap/vcap_api.h | 7 ++ 3 files changed, 109 insertions(+), 10 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +0 -5
@@ -991,11 +991,6 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, SPX5_PMM_REPLACE_ALL);if (err) goto out; -/* For now the actionset is hardcoded */ - err =vcap_set_rule_set_actionset (vrule, -VCAP_AFS_BASE_TYPE ); -if (err) - goto out;break ;case FLOW_ACTION_ACCEPT : err =sparx5_tc_set_actionset (admin, vrule);
drivers/net/ethernet/microchip/vcap/vcap_api.c +102 -5
125 lines not on this page · raw message
drivers/net/ethernet/microchip/vcap/vcap_api.h +7 -0
@@ -201,6 +201,13 @@ struct vcap_keyset_list {enum vcap_keyfield_set *keysets;/* the list of keysets */ }; +/* List of actionsets */ +struct vcap_actionset_list { +int max;/* size of the actionset list */ +int cnt;/* count of actionsets actually in the list */ +enum vcap_actionfield_set *actionsets;/* the list of actionsets */ +}; +/* Client output printf-like function with destination */ struct vcap_output_print { __printf(2, 3)
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 7/8 net: microchip: sparx5: Add support for IS0 VCAP ethernet protocol types
In reply to Steen HegelundThis allows the IS0 VCAP to have its own list of supported ethernet protocol types matching what is supported by the VCAPs port lookup classification.
--- .../microchip/sparx5/sparx5_tc_flower.c | 24 +--------- .../microchip/sparx5/sparx5_vcap_impl.c | 46 ++++++++++++++++--- .../microchip/sparx5/sparx5_vcap_impl.h | 3 ++ 3 files changed, 43 insertions(+), 30 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +1 -23
@@ -36,16 +36,6 @@ struct sparx5_tc_flower_parse_usage {unsigned int used_keys; }; -/* These protocols have dedicated keysets in IS2 and a TC dissector -* ETH_P_ARP does not have a TC dissector -*/ -static u16 sparx5_tc_known_etypes[] = { -ETH_P_ALL , -ETH_P_ARP , -ETH_P_IP , -ETH_P_IPV6 , -}; -enum sparx5_is2_arp_opcode {SPX5_IS2_ARP_REQUEST ,SPX5_IS2_ARP_REPLY ,
@@ -59,18 +49,6 @@ enum tc_arp_opcode { TC_ARP_OP_REPLY, }; -static bool sparx5_tc_is_known_etype (u16 etype) -{ -int idx; - -/* For now this only knows about IS2 traffic classification */ -for (idx =0 ; idx <ARRAY_SIZE (sparx5_tc_known_etypes); ++idx) -if (sparx5_tc_known_etypes[idx] == etype) -return true; - -return false; -} -static int sparx5_tc_flower_handler_ethaddr_usage (struct sparx5_tc_flower_parse_usage *st) {enum vcap_key_field smac_key =VCAP_KF_L2_SMAC ;
@@ -273,7 +251,7 @@ sparx5_tc_flower_handler_basic_usage(struct sparx5_tc_flower_parse_usage *st)if (mt.mask->n_proto) { st->l3_proto =be16_to_cpu (mt.key->n_proto); -if (!sparx5_tc_is_known_etype (st->l3_proto)) { +if (!sparx5_vcap_is_known_etype (st->admin, st->l3_proto)) { err =vcap_rule_add_key_u32 (st->vrule,VCAP_KF_ETYPE , st->l3_proto, ~0 );if (err)
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c +39 -7
71 lines not on this page · raw message
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.h +3 -0
@@ -136,4 +136,7 @@ int sparx5_vcap_get_port_keyset(struct net_device *ndev,u16 l3_proto, struct vcap_keyset_list *kslist); +/* Check if the ethertype is supported by the vcap port classification */ +bool sparx5_vcap_is_known_etype (struct vcap_admin *admin,u16 etype); +#endif /* __SPARX5_VCAP_IMPL_H__ */
Signature · 1 line
2.39.1
Steen Hegelund
maintainerPATCH v2 8/8 net: microchip: sparx5: Add support for IS0 VCAP CVLAN TC keys
In reply to Steen HegelundThis adds support for parsing and matching on the CVLAN tags in the Sparx5 IS0 VCAP.
--- .../microchip/sparx5/sparx5_tc_flower.c | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+)
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +51 -0
@@ -308,6 +308,51 @@ sparx5_tc_flower_handler_basic_usage(struct sparx5_tc_flower_parse_usage *st)return err; } +static int +sparx5_tc_flower_handler_cvlan_usage (struct sparx5_tc_flower_parse_usage *st) +{ +enum vcap_key_field vid_key =VCAP_KF_8021Q_VID0 ; +enum vcap_key_field pcp_key =VCAP_KF_8021Q_PCP0 ; +struct flow_match_vlan mt; +u16 tpid; +int err; + +if (st->admin->vtype !=VCAP_TYPE_IS0 ) +return -EINVAL ; + +flow_rule_match_cvlan (st->frule, &mt); + + tpid =be16_to_cpu (mt.key->vlan_tpid); + +if (tpid ==ETH_P_8021Q ) { + vid_key =VCAP_KF_8021Q_VID1 ; + pcp_key =VCAP_KF_8021Q_PCP1 ; + } + +if (mt.mask->vlan_id) { + err =vcap_rule_add_key_u32 (st->vrule, vid_key, + mt.key->vlan_id, + mt.mask->vlan_id); +if (err) + goto out; + } + +if (mt.mask->vlan_priority) { + err =vcap_rule_add_key_u32 (st->vrule, pcp_key, + mt.key->vlan_priority, + mt.mask->vlan_priority); +if (err) + goto out; + } + + st->used_keys |=BIT (FLOW_DISSECTOR_KEY_CVLAN ); + +return 0 ; +out: +NL_SET_ERR_MSG_MOD (st->fco->common.extack,"cvlan parse error" ); +return err; +} +static int sparx5_tc_flower_handler_vlan_usage (struct sparx5_tc_flower_parse_usage *st) {
@@ -318,6 +363,11 @@ sparx5_tc_flower_handler_vlan_usage(struct sparx5_tc_flower_parse_usage *st)flow_rule_match_vlan (st->frule, &mt); +if (st->admin->vtype ==VCAP_TYPE_IS0 ) { + vid_key =VCAP_KF_8021Q_VID0 ; + pcp_key =VCAP_KF_8021Q_PCP0 ; + } +if (mt.mask->vlan_id) { err = vcap_rule_add_key_u32(st->vrule, vid_key, mt.key->vlan_id,
@@ -513,6 +563,7 @@ static int (*sparx5_tc_flower_usage_handlers[])(struct sparx5_tc_flower_parse_us [FLOW_DISSECTOR_KEY_CONTROL] = sparx5_tc_flower_handler_control_usage, [FLOW_DISSECTOR_KEY_PORTS] = sparx5_tc_flower_handler_portnum_usage, [FLOW_DISSECTOR_KEY_BASIC] = sparx5_tc_flower_handler_basic_usage, + [FLOW_DISSECTOR_KEY_CVLAN] = sparx5_tc_flower_handler_cvlan_usage, [FLOW_DISSECTOR_KEY_VLAN] = sparx5_tc_flower_handler_vlan_usage, [FLOW_DISSECTOR_KEY_TCP] = sparx5_tc_flower_handler_tcp_usage, [FLOW_DISSECTOR_KEY_ARP] = sparx5_tc_flower_handler_arp_usage,
Signature · 1 line
2.39.1
Quoted 36 lines · Steen Hegelund
This provides the Ingress Stage 0 (IS0) VCAP (Versatile Content-Aware Processor) support for the Sparx5 platform.
The IS0 VCAP (also known in the datasheet as CLM) is a classifier VCAP that mainly extracts frame information to metadata that follows the frame in the Sparx5 processing flow all the way to the egress port.
The IS0 VCAP has 4 lookups and they are accessible with a TC chain id:
- chain 1000000: IS0 Lookup 0
- chain 1100000: IS0 Lookup 1
- chain 1200000: IS0 Lookup 2
- chain 1300000: IS0 Lookup 3
- chain 1400000: IS0 Lookup 4
- chain 1500000: IS0 Lookup 5Each of these lookups have their own port keyset configuration that decides which keys will be used for matching on which traffic type.
The IS0 VCAP has these traffic classifications:
- IPv4 frames
- IPv6 frames
- Unicast MPLS frames (ethertype =0x8847)
- Multicast MPLS frames (ethertype =0x8847)
- Other frame types than MPLS, IPv4 and IPv6The IS0 VCAP has an action that allows setting the value of a PAG (Policy Association Group) key field in the frame metadata, and this can be used for matching in an IS2 VCAP rule.
This allow rules in the IS0 VCAP to be linked to rules in the IS2 VCAP.
The linking is exposed by using the TC "goto chain" action with an offset from the IS2 chain ids.
Quoted 6 lines
As an example a "goto chain 8000001" will use a PAG value of 1 to chain to a rule in IS2 Lookup 0.
Version History:
================
v2 Added corrections suggested by Dan Carpenter.
Thanks!
regards,
dan carpenter
This series was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Tue, 24 Jan 2023 11:45:03 +0100 you wrote:
This provides the Ingress Stage 0 (IS0) VCAP (Versatile Content-Aware Processor) support for the Sparx5 platform.
The IS0 VCAP (also known in the datasheet as CLM) is a classifier VCAP that mainly extracts frame information to metadata that follows the frame in the Sparx5 processing flow all the way to the egress port.
[...]
Here is the summary with links:
- [net-next,v2,1/8] net: microchip: sparx5: Add IS0 VCAP model and updated KUNIT VCAP model
https://git.kernel.org/netdev/net-next/c/f274a659fb08 - [net-next,v2,2/8] net: microchip: sparx5: Add IS0 VCAP keyset configuration for Sparx5 https://git.kernel.org/netdev/net-next/c/545609fd4e7f - [net-next,v2,3/8] net: microchip: sparx5: Add actionset type id information to rule https://git.kernel.org/netdev/net-next/c/7306fcd17c0c - [net-next,v2,4/8] net: microchip: sparx5: Add TC support for IS0 VCAP https://git.kernel.org/netdev/net-next/c/542e6e2c20e5 - [net-next,v2,5/8] net: microchip: sparx5: Add TC filter chaining support for IS0 and IS2 VCAPs https://git.kernel.org/netdev/net-next/c/88bd9ea70b2e - [net-next,v2,6/8] net: microchip: sparx5: Add automatic selection of VCAP rule actionset https://git.kernel.org/netdev/net-next/c/81e164c4aec5 - [net-next,v2,7/8] net: microchip: sparx5: Add support for IS0 VCAP ethernet protocol types https://git.kernel.org/netdev/net-next/c/63e3564507ea - [net-next,v2,8/8] net: microchip: sparx5: Add support for IS0 VCAP CVLAN TC keys https://git.kernel.org/netdev/net-next/c/52df82cc9199
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html