mlxsw: Fixes for Spectrum-4
Subsystems (4)
Petr Machata
maintainercover mlxsw: Fixes for Spectrum-4
This patchset contains an assortment of fixes for mlxsw Spectrum-4 support.
Amit Cohen (1):
mlxsw: Fix the size of 'VIRT_ROUTER_MSB'
Danielle Ratson (1):
mlxsw: pci: Set time stamp fields also when its type is MIRROR_UTC
Ido Schimmel (2):
mlxsw: reg: Fix SSPR register layout
selftests: mlxsw: Fix test failure on Spectrum-4
.../ethernet/mellanox/mlxsw/core_acl_flex_keys.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/pci.c | 8 ++++++-- drivers/net/ethernet/mellanox/mlxsw/reg.h | 9 --------- .../ethernet/mellanox/mlxsw/spectrum2_mr_tcam.c | 2 +- .../mellanox/mlxsw/spectrum_acl_flex_keys.c | 4 ++-- .../selftests/drivers/net/mlxsw/sharedbuffer.sh | 16 ++++++---------- 6 files changed, 17 insertions(+), 26 deletions(-)
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 1/4 mlxsw: pci: Set time stamp fields also when its type is MIRROR_UTC
From: Danielle Ratson <[email protected]>
Currently, in Spectrum-2 and above, time stamps are extracted from the CQE into the time stamp fields in 'struct mlxsw_skb_cb', only when the CQE time stamp type is UTC. The time stamps are read directly from the CQE and software can get the time stamp in UTC format using CQEv2.
From Spectrum-4, the time stamps that are read from the CQE are allowed to be also from MIRROR_UTC type.
Therefore, we get a warning [1] from the driver that the time stamp fields were not set, when LLDP control packet is sent.
Allow the time stamp type to be MIRROR_UTC and set the time stamp in this case as well.
[1]
WARNING: CPU: 11 PID: 0 at drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c:1409 mlxsw_sp2_ptp_hwtstamp_fill+0x1f/0x70 [mlxsw_spectrum] [...] Call Trace: <IRQ> mlxsw_sp2_ptp_receive+0x3c/0x80 [mlxsw_spectrum] mlxsw_core_skb_receive+0x119/0x190 [mlxsw_core] mlxsw_pci_cq_tasklet+0x3c9/0x780 [mlxsw_pci] tasklet_action_common.constprop.0+0x9f/0x110 __do_softirq+0xbb/0x296 irq_exit_rcu+0x79/0xa0 common_interrupt+0x86/0xa0 </IRQ> <TASK>
--- drivers/net/ethernet/mellanox/mlxsw/pci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/pci.c +6 -2
@@ -517,11 +517,15 @@ static void mlxsw_pci_skb_cb_ts_set(struct mlxsw_pci *mlxsw_pci,struct sk_buff *skb, enum mlxsw_pci_cqe_v cqe_v, char *cqe) { + u8 ts_type; +if (cqe_v !=MLXSW_PCI_CQE_V2 )return ; -if (mlxsw_pci_cqe2_time_stamp_type_get (cqe) != -MLXSW_PCI_CQE_TIME_STAMP_TYPE_UTC ) + ts_type =mlxsw_pci_cqe2_time_stamp_type_get (cqe); + +if (ts_type !=MLXSW_PCI_CQE_TIME_STAMP_TYPE_UTC && + ts_type !=MLXSW_PCI_CQE_TIME_STAMP_TYPE_MIRROR_UTC )return ;mlxsw_skb_cb (skb)->cqe_ts.sec =mlxsw_pci_cqe2_time_stamp_sec_get (cqe);
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 2/4 mlxsw: reg: Fix SSPR register layout
In reply to Petr MachataFrom: Ido Schimmel <[email protected]>
The two most significant bits of the "local_port" field in the SSPR register are always cleared since they are overwritten by the deprecated and overlapping "sub_port" field.
On systems with more than 255 local ports (e.g., Spectrum-4), this results in the firmware maintaining invalid mappings between system port and local port. Specifically, two different systems ports (0x1 and 0x101) point to the same local port (0x1), which eventually leads to firmware errors.
Fix by removing the deprecated "sub_port" field.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 9 --------- 1 file changed, 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/reg.h +0 -9
@@ -97,14 +97,6 @@ MLXSW_ITEM32(reg, sspr, m, 0x00, 31, 1);*/ MLXSW_ITEM32_LP (reg, sspr,0x00 ,16 ,0x00 ,12 ); -/* reg_sspr_sub_port -* Virtual port within the physical port. -* Should be set to 0 when virtual ports are not enabled on the port. -* -* Access: RW -*/ -MLXSW_ITEM32 (reg, sspr, sub_port,0x00 ,8 ,8 ); -/* reg_sspr_system_port * Unique identifier within the stacking domain that represents all the ports * that are available in the system (external ports).
@@ -120,7 +112,6 @@ static inline void mlxsw_reg_sspr_pack(char *payload, u16 local_port)MLXSW_REG_ZERO (sspr, payload);mlxsw_reg_sspr_m_set (payload,1 );mlxsw_reg_sspr_local_port_set (payload, local_port); -mlxsw_reg_sspr_sub_port_set (payload,0 );mlxsw_reg_sspr_system_port_set (payload, local_port); }
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 3/4 mlxsw: Fix the size of 'VIRT_ROUTER_MSB'
In reply to Petr MachataFrom: Amit Cohen <[email protected]>
The field 'virtual router' was extended to 12 bits in Spectrum-4. Therefore, the element 'MLXSW_AFK_ELEMENT_VIRT_ROUTER_MSB' needs 3 bits for Spectrum < 4 and 4 bits for Spectrum >= 4.
The elements are stored in an internal storage scratchpad. Currently, the MSB is defined there as 3 bits. It means that for Spectrum-4, only 2K VRFs can be used for multicast routing, as the highest bit is not really used by the driver. Fix the definition of 'VIRT_ROUTER_MSB' to use 4 bits. Adjust the definitions of 'virtual router' field in the blocks accordingly - use '_avoid_size_check' for Spectrum-2 instead of for Spectrum-4. Fix the mask in parse function to use 4 bits.
--- drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/spectrum2_mr_tcam.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.c +2 -2
@@ -32,8 +32,8 @@ static const struct mlxsw_afk_element_info mlxsw_afk_element_infos[] = {MLXSW_AFK_ELEMENT_INFO_U32 (IP_TTL_ ,0x18 ,0 ,8 ),MLXSW_AFK_ELEMENT_INFO_U32 (IP_ECN ,0x18 ,9 ,2 ),MLXSW_AFK_ELEMENT_INFO_U32 (IP_DSCP ,0x18 ,11 ,6 ), -MLXSW_AFK_ELEMENT_INFO_U32 (VIRT_ROUTER_MSB ,0x18 ,17 ,3 ), -MLXSW_AFK_ELEMENT_INFO_U32 (VIRT_ROUTER_LSB ,0x18 ,20 ,8 ), +MLXSW_AFK_ELEMENT_INFO_U32 (VIRT_ROUTER_MSB ,0x18 ,17 ,4 ), +MLXSW_AFK_ELEMENT_INFO_U32 (VIRT_ROUTER_LSB ,0x18 ,21 ,8 ),MLXSW_AFK_ELEMENT_INFO_BUF (SRC_IP_96_127 ,0x20 ,4 ),MLXSW_AFK_ELEMENT_INFO_BUF (SRC_IP_64_95 ,0x24 ,4 ), MLXSW_AFK_ELEMENT_INFO_BUF(SRC_IP_32_63, 0x28, 4),
drivers/net/ethernet/mellanox/mlxsw/spectrum2_mr_tcam.c +1 -1
@@ -193,7 +193,7 @@ mlxsw_sp2_mr_tcam_rule_parse(struct mlxsw_sp_acl_rule *rule, key->vrid, GENMASK(7, 0));mlxsw_sp_acl_rulei_keymask_u32 (rulei,MLXSW_AFK_ELEMENT_VIRT_ROUTER_MSB , - key->vrid >>8 ,GENMASK (2 ,0 )); + key->vrid >>8 ,GENMASK (3 ,0 ));switch (key->proto) {case MLXSW_SP_L3_PROTO_IPV4 :return mlxsw_sp2_mr_tcam_rule_parse4 (rulei, key);
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.c +2 -2
@@ -173,7 +173,7 @@ static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_2[] = {static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_4[] = {MLXSW_AFK_ELEMENT_INST_U32 (VIRT_ROUTER_LSB ,0x04 ,24 ,8 ), -MLXSW_AFK_ELEMENT_INST_U32 (VIRT_ROUTER_MSB ,0x00 ,0 ,3 ), +MLXSW_AFK_ELEMENT_INST_EXT_U32 (VIRT_ROUTER_MSB ,0x00 ,0 ,3 ,0 , true), };static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_0[] = {
@@ -324,7 +324,7 @@ static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_mac_5b[] = {static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_4b[] = {MLXSW_AFK_ELEMENT_INST_U32 (VIRT_ROUTER_LSB ,0x04 ,13 ,8 ), -MLXSW_AFK_ELEMENT_INST_EXT_U32 (VIRT_ROUTER_MSB ,0x04 ,21 ,4 ,0 , true), +MLXSW_AFK_ELEMENT_INST_U32 (VIRT_ROUTER_MSB ,0x04 ,21 ,4 ), };static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_2b[] = {
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 4/4 selftests: mlxsw: Fix test failure on Spectrum-4
In reply to Petr MachataFrom: Ido Schimmel <[email protected]>
Remove assumptions about shared buffer cell size and instead query the cell size from devlink. Adjust the test to send small packets that fit inside a single cell.
Tested on Spectrum-{1,2,3,4}.
--- .../selftests/drivers/net/mlxsw/sharedbuffer.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
tools/testing/selftests/drivers/net/mlxsw/sharedbuffer.sh +6 -10
@@ -98,12 +98,12 @@ sb_occ_etc_check() port_pool_test() { - local exp_max_occ=288 + local exp_max_occ=$(devlink_cell_size_get) local max_occ devlink sb occupancy clearmax $DEVLINK_DEV - $MZ $h1 -c 1 -p 160 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \ + $MZ $h1 -c 1 -p 10 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \ -t ip -q devlink sb occupancy snapshot $DEVLINK_DEV
@@ -126,12 +126,12 @@ port_pool_test() port_tc_ip_test() { - local exp_max_occ=288 + local exp_max_occ=$(devlink_cell_size_get) local max_occ devlink sb occupancy clearmax $DEVLINK_DEV - $MZ $h1 -c 1 -p 160 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \ + $MZ $h1 -c 1 -p 10 -a $h1mac -b $h2mac -A 192.0.1.1 -B 192.0.1.2 \ -t ip -q devlink sb occupancy snapshot $DEVLINK_DEV
@@ -154,16 +154,12 @@ port_tc_ip_test() port_tc_arp_test() { - local exp_max_occ=96 + local exp_max_occ=$(devlink_cell_size_get) local max_occ - if [[ $MLXSW_CHIP != "mlxsw_spectrum" ]]; then - exp_max_occ=144 - fi - devlink sb occupancy clearmax $DEVLINK_DEV - $MZ $h1 -c 1 -p 160 -a $h1mac -A 192.0.1.1 -t arp -q + $MZ $h1 -c 1 -p 10 -a $h1mac -A 192.0.1.1 -t arp -q devlink sb occupancy snapshot $DEVLINK_DEV
Signature · 1 line
2.41.0
Quoted 11 lines · Petr Machata
This patchset contains an assortment of fixes for mlxsw Spectrum-4 support.
Amit Cohen (1):
mlxsw: Fix the size of 'VIRT_ROUTER_MSB'Danielle Ratson (1):
mlxsw: pci: Set time stamp fields also when its type isMIRROR_UTCIdo Schimmel (2):
mlxsw: reg: Fix SSPR register layout
selftests: mlxsw: Fix test failure on Spectrum-4
For series,
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 17 Aug 2023 15:58:21 +0200 you wrote:
This patchset contains an assortment of fixes for mlxsw Spectrum-4 support.
Amit Cohen (1):
mlxsw: Fix the size of 'VIRT_ROUTER_MSB'Danielle Ratson (1):
mlxsw: pci: Set time stamp fields also when its type isMIRROR_UTC[...]
Here is the summary with links:
- [net,1/4] mlxsw: pci: Set time stamp fields also when its type is MIRROR_UTC
https://git.kernel.org/netdev/net/c/bc2de151ab6a - [net,2/4] mlxsw: reg: Fix SSPR register layout https://git.kernel.org/netdev/net/c/0dc63b9cfd4c - [net,3/4] mlxsw: Fix the size of 'VIRT_ROUTER_MSB' https://git.kernel.org/netdev/net/c/348c976be0a5 - [net,4/4] selftests: mlxsw: Fix test failure on Spectrum-4 https://git.kernel.org/netdev/net/c/f520489e99a3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html