Skip to contentSkip to conversation

net/mlx5: fix switchdev mode recognition

PATCH In review Viacheslav Ovsiienko 3 participants 3 messages Jun 11, 2021 – Jun 15, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix switchdev mode recognition

The new kernels might add the switch_id attribute to the Netlink replies and this caused the wrong recognition of the E-Switch presence. The single uplink device was erroneously recognized as master and it caused the extending match for source vport index on all installed flows, including the default ones, and adding extra hops in the steering engine, that affected the maximal throughput packet rate.

The extra check for the new device name format (it supposes the new kernel) and the device is only one is added. If this check succeeds the E-Switch presence is considered as wrongly detected and overridden.

Fixes 30a86157f6d5 ("net/mlx5: support PF representor")
---
 drivers/net/mlx5/linux/mlx5_os.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/mlx5/linux/mlx5_os.c +12 -0
index 54e4a1fe60..92b3009786 100644
@@ -2290,6 +2290,18 @@ mlx5_os_pci_probe_pf(struct rte_pci_device *pci_dev,
 			ret = -rte_errno;
 			goto exit;
 		}
+		/*
+		 * New kernels may add the switch_id attribute for the case
+		 * there is no E-Switch and we wrongly recognized the
+		 * only device as master. Override this if there is the
+		 * single device with single port and new device name
+		 * format present.
+		 */
+		if (nd == 1 &&
+		    list[0].info.name_type == MLX5_PHYS_PORT_NAME_TYPE_UPLINK) {
+			list[0].info.master = 0;
+			list[0].info.representor = 0;
+		}
 	}
 	MLX5_ASSERT(ns);
 	/*
Signature · 1 line
2.18.1
Acked-by on v1 1/1
#1 lore raw

From: Slava Ovsiienko

Quoted 7 lines

The new kernels might add the switch_id attribute to the Netlink replies and this caused the wrong recognition of the E-Switch presence. The single uplink device was erroneously recognized as master and it caused the extending match for source vport index on all installed flows, including the default ones, and adding extra hops in the steering engine, that affected the maximal throughput packet rate.

Quoted 8 lines

The extra check for the new device name format (it supposes the new kernel) and the device is only one is added. If this check succeeds the E- Switch presence is considered as wrongly detected and overridden.

Fixes 30a86157f6d5 ("net/mlx5: support PF representor")
#2 lore raw
In reply to Viacheslav Ovsiienko

Hi,

Quoted 15 lines

-----Original Message-----
From: Slava Ovsiienko <[email protected]>
Sent: Friday, June 11, 2021 6:37 PM
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Matan Azrad <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix switchdev mode recognition

The new kernels might add the switch_id attribute to the Netlink replies and this caused the wrong recognition of the E-Switch presence. The single uplink device was erroneously recognized as master and it caused the extending match for source vport index on all installed flows, including the default ones, and adding extra hops in the steering engine, that affected the maximal throughput packet rate.

Quoted 8 lines

The extra check for the new device name format (it supposes the new kernel) and the device is only one is added. If this check succeeds the E- Switch presence is considered as wrongly detected and overridden.

Fixes 30a86157f6d5 ("net/mlx5: support PF representor")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh