summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-20net: microchip: sparx5: add support for DSCP rewriteDaniel Machon1-0/+35
Add support for DSCP rewrite in Sparx5 driver. On egress DSCP is rewritten from either classified DSCP, or frame DSCP. Classified DSCP is determined by the Analyzer Classifier on ingress, and is mapped from classified QoS class and DP level. Classification of DSCP is by default enabled for all ports. It is required that DSCP is trusted for the egress port *and* rewrite table is not empty, in order to rewrite DSCP based on classified DSCP, otherwise DSCP is always rewritten from frame DSCP. classified_dscp = qos_dscp_map[8 * dp_level + qos_class]; if (active_mappings && dscp_is_trusted) rewritten_dscp = classified_dscp else rewritten_dscp = frame_dscp To rewrite DSCP to 20 for any frames with priority 7: $ dcb apptrust set dev eth0 order dscp $ dcb rewr add dev eth0 7:20 <-- not in iproute2/dcb yet Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2023-01-20net: microchip: sparx5: add support for PCP rewriteDaniel Machon1-12/+74
Add support for rewrite of PCP and DEI, based on classified Quality of Service (QoS) class and Drop-Precedence (DP) level. The DCB rewrite table is queried for mappings between priority and PCP/DEI. The classified DP level is then encoded in the DEI bit, if a mapping for DEI exists. Sparx5 has four DP levels, where by default, 0 is mapped to DE0 and 1-3 are mapped to DE1. If a mapping exists where DEI=1, then all classified DP levels mapped to DE1 will set the DEI bit. The other way around for DEI=0. Effectively, this means that the tagged DEI bit will reflect the DP level for any mappings where DEI=1. Map priority=1 to PCP=1 and DEI=1: $ dcb rewr add dev eth0 pcp-prio 1:1de Map priority=7 to PCP=2 and DEI=0 $ dcb rewr add dev eth0 pcp-prio 7:2nd Also, sparx5_dcb_ieee_dscp_setdel() has been refactored, to work for both APP and rewrite entries. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-21net: microchip: sparx5: prevent uninitialized variableDan Carpenter1-1/+1
Smatch complains that: drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c:112 sparx5_dcb_apptrust_validate() error: uninitialized symbol 'match'. This would only happen if the: if (sparx5_dcb_apptrust_policies[i].nselectors != nselectors) condition is always true (they are not equal). The "nselectors" variable comes from dcbnl_ieee_set() and it is a number between 0-256. This seems like a probably a real bug. Fixes: 23f8382cd95d ("net: microchip: sparx5: add support for apptrust") Signed-off-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-11-03net: microchip: sparx5: add support for offloading default prioDaniel Machon1-0/+12
Add support for offloading default prio {ETHERTYPE, 0, prio}. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-11-03net: microchip: sparx5: add support for offloading dscp tableDaniel Machon1-3/+63
Add support for offloading dscp app entries. Dscp values are global for all ports on the sparx5 switch. Therefore, we replicate each dscp app entry per-port. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-11-03net: microchip: sparx5: add support for apptrustDaniel Machon1-0/+122
Make use of set/getapptrust() to implement per-selector trust and trust order. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-11-03net: microchip: sparx5: add support for offloading pcp tableDaniel Machon1-0/+116
Add new registers and functions to support offload of pcp app entries. Signed-off-by: Daniel Machon <daniel.machon@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>