net: microchip: sparx5: add support for PCP rewrite
authorDaniel Machon <daniel.machon@microchip.com>
Wed, 18 Jan 2023 21:08:29 +0000 (22:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Jan 2023 09:33:22 +0000 (09:33 +0000)
commit2234879f4ca127d5288046fe0469d9ac63988c0b
tree93b23ecdec3acdb214b3dc8143e0e66c4736240f
parent1df99338e6d4e96178b68b3e17bab33e9f1eb628
net: microchip: sparx5: add support for PCP rewrite

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>
drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c
drivers/net/ethernet/microchip/sparx5/sparx5_main_regs.h
drivers/net/ethernet/microchip/sparx5/sparx5_port.c
drivers/net/ethernet/microchip/sparx5/sparx5_port.h