Skip to contentSkip to conversation

mlx5 fixes 2020-12-01

GIT PULL New Saeed Mahameed 3 participants 8 messages Dec 3, 2020

Subsystems (6)
lore
Share & tools
lore

Saeed Mahameed

author maintainer
#0 lore raw

Hi Jakub,

This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem.

For the DR steering patch I will need it in net-next as well, I would appreciate it if you will take this small series before your pr to linus.

For -stable v5.4:
('net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering')

For -stable v5.8
('net/mlx5: Fix wrong address reclaim when command interface is down')

For -stable v5.9
('net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled')

Thanks,
Saeed.

---
The following changes since commit 14483cbf040fcb38113497161088a1ce8ce5d713:

net: broadcom CNIC: requires MMU (2020-12-01 11:44:02 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2020-12-01

for you to fetch changes up to c20289e64bfc0fc4bca0242d60839b9ca2e28e64:

net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering (2020-12-01 15:02:59 -0800)

----------------------------------------------------------------
mlx5-fixes-2020-12-01

----------------------------------------------------------------
Eran Ben Elisha (1):
net/mlx5: Fix wrong address reclaim when command interface is down

Randy Dunlap (1):
net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled

Tariq Toukan (1):
net/mlx5e: kTLS, Enforce HW TX csum offload with kTLS

Yevgeny Kliteynik (1):
net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering

 .../ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c  |  2 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    | 22 +++++++++++++++-------
 .../net/ethernet/mellanox/mlx5/core/pagealloc.c    | 21 +++++++++++++++++++--
 .../ethernet/mellanox/mlx5/core/steering/dr_cmd.c  |  1 +
 .../mellanox/mlx5/core/steering/dr_domain.c        |  5 +++++
 .../mellanox/mlx5/core/steering/dr_types.h         |  1 +
 include/linux/mlx5/mlx5_ifc.h                      |  9 ++++++++-
 7 files changed, 51 insertions(+), 10 deletions(-)
author maintainer
#1 lore raw

PATCH 1/4 net/mlx5: Fix wrong address reclaim when command interface is down

From: Eran Ben Elisha <[email protected]>

When command interface is down, driver to reclaim all 4K page chucks that were hold by the Firmeware. Fix a bug for 64K page size systems, where driver repeatedly released only the first chunk of the page.

Define helper function to fill 4K chunks for a given Firmware pages. Iterate over all unreleased Firmware pages and call the hepler per each.

Fixes 5adff6a08862 ("net/mlx5: Fix incorrect page count when in internal error")
---
 .../ethernet/mellanox/mlx5/core/pagealloc.c   | 21 +++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +19 -2
index 150638814517..4d7f8a357df7 100644
@@ -422,6 +422,24 @@ static void release_all_pages(struct mlx5_core_dev *dev, u32 func_id,
 		      npages, ec_function, func_id);
 }
 
+static u32 fwp_fill_manage_pages_out(struct fw_page *fwp, u32 *out, u32 index,
+				     u32 npages)
+{
+	u32 pages_set = 0;
+	unsigned int n;
+
+	for_each_clear_bit(n, &fwp->bitmask, MLX5_NUM_4K_IN_PAGE) {
+		MLX5_ARRAY_SET64(manage_pages_out, out, pas, index + pages_set,
+				 fwp->addr + (n * MLX5_ADAPTER_PAGE_SIZE));
+		pages_set++;
+
+		if (!--npages)
+			break;
+	}
+
+	return pages_set;
+}
+
 static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
 			     u32 *in, int in_size, u32 *out, int out_size)
 {
@@ -448,8 +466,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
 		fwp = rb_entry(p, struct fw_page, rb_node);
 		p = rb_next(p);
 
-		MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr);
-		i++;
+		i += fwp_fill_manage_pages_out(fwp, out, i, npages - i);
 	}
 
 	MLX5_SET(manage_pages_out, out, output_num_entries, i);
Signature · 1 line
2.26.2
author maintainer
#2 lore raw

PATCH 2/4 net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled

In reply to Saeed Mahameed

From: Randy Dunlap <[email protected]>

Fix build when CONFIG_IPV6 is not enabled by making a function be built conditionally.

Fixes these build errors and warnings:

../drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c: In function 'accel_fs_tcp_set_ipv6_flow':
../include/net/sock.h:380:34: error: 'struct sock_common' has no member named 'skc_v6_daddr'; did you mean 'skc_daddr'?
380 | #define sk_v6_daddr __sk_common.skc_v6_daddr

      |                                  ^~~~~~~~~~~~
../drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c:55:14: note: in expansion of macro 'sk_v6_daddr'
   55 |         &sk->sk_v6_daddr, 16);
      |              ^~~~~~~~~~~

At top level:
../drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c:47:13: warning: 'accel_fs_tcp_set_ipv6_flow' defined but not used [-Wunused-function]
47 | static void accel_fs_tcp_set_ipv6_flow(struct mlx5_flow_spec *spec, struct sock *sk)

Fixes 5229a96e59ec ("net/mlx5e: Accel, Expose flow steering API for rules add/del")
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c +2 -0
index 97f1594cee11..e51f60b55daa 100644
@@ -44,6 +44,7 @@ static void accel_fs_tcp_set_ipv4_flow(struct mlx5_flow_spec *spec, struct sock
 			 outer_headers.dst_ipv4_dst_ipv6.ipv4_layout.ipv4);
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
 static void accel_fs_tcp_set_ipv6_flow(struct mlx5_flow_spec *spec, struct sock *sk)
 {
 	MLX5_SET_TO_ONES(fte_match_param, spec->match_criteria, outer_headers.ip_protocol);
@@ -63,6 +64,7 @@ static void accel_fs_tcp_set_ipv6_flow(struct mlx5_flow_spec *spec, struct sock
 			    outer_headers.dst_ipv4_dst_ipv6.ipv6_layout.ipv6),
 	       0xff, 16);
 }
+#endif
 
 void mlx5e_accel_fs_del_sk(struct mlx5_flow_handle *rule)
 {
Signature · 1 line
2.26.2
author maintainer
#3 lore raw

PATCH 3/4 net/mlx5e: kTLS, Enforce HW TX csum offload with kTLS

In reply to Saeed Mahameed

From: Tariq Toukan <[email protected]>

Checksum calculation cannot be done in SW for TX kTLS HW offloaded packets.
Offload it to the device, disregard the declared state of the TX csum offload feature.

Fixes d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
---
 .../net/ethernet/mellanox/mlx5/core/en_tx.c   | 22 +++++++++++++------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +15 -7
index 6dd3ea3cbbed..d97203cf6a00 100644
@@ -161,7 +161,9 @@ ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 }
 
 static inline void
-mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg)
+mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
+			    struct mlx5e_accel_tx_state *accel,
+			    struct mlx5_wqe_eth_seg *eseg)
 {
 	if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
 		eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
@@ -173,6 +175,11 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct
 			eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
 			sq->stats->csum_partial++;
 		}
+#ifdef CONFIG_MLX5_EN_TLS
+	} else if (unlikely(accel && accel->tls.tls_tisn)) {
+		eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM;
+		sq->stats->csum_partial++;
+#endif
 	} else if (unlikely(eseg->flow_table_metadata & cpu_to_be32(MLX5_ETH_WQE_FT_META_IPSEC))) {
 		ipsec_txwqe_build_eseg_csum(sq, skb, eseg);
 
@@ -607,12 +614,13 @@ void mlx5e_tx_mpwqe_ensure_complete(struct mlx5e_txqsq *sq)
 }
 
 static bool mlx5e_txwqe_build_eseg(struct mlx5e_priv *priv, struct mlx5e_txqsq *sq,
-				   struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg)
+				   struct sk_buff *skb, struct mlx5e_accel_tx_state *accel,
+				   struct mlx5_wqe_eth_seg *eseg)
 {
 	if (unlikely(!mlx5e_accel_tx_eseg(priv, skb, eseg)))
 		return false;
 
-	mlx5e_txwqe_build_eseg_csum(sq, skb, eseg);
+	mlx5e_txwqe_build_eseg_csum(sq, skb, accel, eseg);
 
 	return true;
 }
@@ -639,7 +647,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
 		if (mlx5e_tx_skb_supports_mpwqe(skb, &attr)) {
 			struct mlx5_wqe_eth_seg eseg = {};
 
-			if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &eseg)))
+			if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &accel, &eseg)))
 				return NETDEV_TX_OK;
 
 			mlx5e_sq_xmit_mpwqe(sq, skb, &eseg, netdev_xmit_more());
@@ -656,7 +664,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* May update the WQE, but may not post other WQEs. */
 	mlx5e_accel_tx_finish(sq, wqe, &accel,
 			      (struct mlx5_wqe_inline_seg *)(wqe->data + wqe_attr.ds_cnt_inl));
-	if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &wqe->eth)))
+	if (unlikely(!mlx5e_txwqe_build_eseg(priv, sq, skb, &accel, &wqe->eth)))
 		return NETDEV_TX_OK;
 
 	mlx5e_sq_xmit_wqe(sq, skb, &attr, &wqe_attr, wqe, pi, netdev_xmit_more());
@@ -675,7 +683,7 @@ void mlx5e_sq_xmit_simple(struct mlx5e_txqsq *sq, struct sk_buff *skb, bool xmit
 	mlx5e_sq_calc_wqe_attr(skb, &attr, &wqe_attr);
 	pi = mlx5e_txqsq_get_next_pi(sq, wqe_attr.num_wqebbs);
 	wqe = MLX5E_TX_FETCH_WQE(sq, pi);
-	mlx5e_txwqe_build_eseg_csum(sq, skb, &wqe->eth);
+	mlx5e_txwqe_build_eseg_csum(sq, skb, NULL, &wqe->eth);
 	mlx5e_sq_xmit_wqe(sq, skb, &attr, &wqe_attr, wqe, pi, xmit_more);
 }
 
@@ -944,7 +952,7 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 
 	mlx5i_txwqe_build_datagram(av, dqpn, dqkey, datagram);
 
-	mlx5e_txwqe_build_eseg_csum(sq, skb, eseg);
+	mlx5e_txwqe_build_eseg_csum(sq, skb, NULL, eseg);
 
 	eseg->mss = attr.mss;
 
Signature · 1 line
2.26.2
author maintainer
#4 lore raw

PATCH 4/4 net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering

In reply to Saeed Mahameed

From: Yevgeny Kliteynik <[email protected]>

STEs format for Connect-X5 and Connect-X6DX different. Currently, on Connext-X6DX the SW steering would break at some point when building STEs w/o giving a proper error message. Fix this by checking the STE format of the current device when initializing domain: add mlx5_ifc definitions for Connect-X6DX SW steering, read FW capability to get the current format version, and check this version when domain is being created.

Fixes 26d688e33f88 ("net/mlx5: DR, Add Steering entry (STE) utilities")
---
 .../net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c    | 1 +
 .../net/ethernet/mellanox/mlx5/core/steering/dr_domain.c | 5 +++++
 .../net/ethernet/mellanox/mlx5/core/steering/dr_types.h  | 1 +
 include/linux/mlx5/mlx5_ifc.h                            | 9 ++++++++-
 4 files changed, 15 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +1 -0
index 6bd34b293007..51bbd88ff021 100644
@@ -92,6 +92,7 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
 	caps->eswitch_manager	= MLX5_CAP_GEN(mdev, eswitch_manager);
 	caps->gvmi		= MLX5_CAP_GEN(mdev, vhca_id);
 	caps->flex_protocols	= MLX5_CAP_GEN(mdev, flex_parser_protocols);
+	caps->sw_format_ver	= MLX5_CAP_GEN(mdev, steering_format_version);
 
 	if (mlx5dr_matcher_supp_flex_parser_icmp_v4(caps)) {
 		caps->flex_parser_id_icmp_dw0 = MLX5_CAP_GEN(mdev, flex_parser_id_icmp_dw0);
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c +5 -0
index 890767a2a7cb..aa2c2d6c44e6 100644
@@ -223,6 +223,11 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev,
 	if (ret)
 		return ret;
 
+	if (dmn->info.caps.sw_format_ver != MLX5_STEERING_FORMAT_CONNECTX_5) {
+		mlx5dr_err(dmn, "SW steering is not supported on this device\n");
+		return -EOPNOTSUPP;
+	}
+
 	ret = dr_domain_query_fdb_caps(mdev, dmn);
 	if (ret)
 		return ret;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +1 -0
index f50f3b107aa3..cf62ea4f882e 100644
@@ -625,6 +625,7 @@ struct mlx5dr_cmd_caps {
 	u8 max_ft_level;
 	u16 roce_min_src_udp;
 	u8 num_esw_ports;
+	u8 sw_format_ver;
 	bool eswitch_manager;
 	bool rx_sw_owner;
 	bool tx_sw_owner;
include/linux/mlx5/mlx5_ifc.h +8 -1
index a092346c7b2d..233352447b1a 100644
@@ -1223,6 +1223,11 @@ enum mlx5_fc_bulk_alloc_bitmask {
 
 #define MLX5_FC_BULK_NUM_FCS(fc_enum) (MLX5_FC_BULK_SIZE_FACTOR * (fc_enum))
 
+enum {
+	MLX5_STEERING_FORMAT_CONNECTX_5   = 0,
+	MLX5_STEERING_FORMAT_CONNECTX_6DX = 1,
+};
+
 struct mlx5_ifc_cmd_hca_cap_bits {
 	u8         reserved_at_0[0x30];
 	u8         vhca_id[0x10];
@@ -1521,7 +1526,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
 
 	u8         general_obj_types[0x40];
 
-	u8         reserved_at_440[0x20];
+	u8         reserved_at_440[0x4];
+	u8         steering_format_version[0x4];
+	u8         create_qp_start_hint[0x18];
 
 	u8         reserved_at_460[0x3];
 	u8         log_max_uctx[0x5];
Signature · 1 line
2.26.2
maintainer
#5 lore raw
In reply to Saeed Mahameed
Quoted 8 lines · On Wed, 2 Dec 2020 20:39:42 -0800 Saeed Mahameed wrote:

Hi Jakub,

This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem.

For the DR steering patch I will need it in net-next as well, I would appreciate it if you will take this small series before your pr to linus.

Quoted 8 lines

For -stable v5.4:
('net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering')

For -stable v5.8
('net/mlx5: Fix wrong address reclaim when command interface is down')

For -stable v5.9
('net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled')

Your tree is missing your signoff on:

Commit 3041429da89b ("net/mlx5e: kTLS, Enforce HW TX csum offload with kTLS")
committer Signed-off-by missing
author email: [email protected]
committer email: [email protected]

You can fix it or I'll just apply the patches from the ML.

maintainer
#6 lore raw
Quoted 20 lines · On Thu, 3 Dec 2020 10:52:39 -0800 Jakub Kicinski wrote:
Quoted 8 lines · On Wed, 2 Dec 2020 20:39:42 -0800 Saeed Mahameed wrote:

Hi Jakub,

This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem.

For the DR steering patch I will need it in net-next as well, I would appreciate it if you will take this small series before your pr to linus.

Quoted 8 lines

For -stable v5.4:
('net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering')

For -stable v5.8
('net/mlx5: Fix wrong address reclaim when command interface is down')

For -stable v5.9
('net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled')

Your tree is missing your signoff on:

Quoted 7 lines

Commit 3041429da89b ("net/mlx5e: kTLS, Enforce HW TX csum offload with kTLS")
committer Signed-off-by missing
author email: [email protected]
committer email: [email protected]

You can fix it or I'll just apply the patches from the ML.

Well, it's the last thing I got in the queue before I prep the PR so let me just apply from the ML.

Thanks!

#7 lore raw
Quoted 32 lines · Jakub Kicinski
Quoted 31 lines · On Thu, 3 Dec 2020 10:52:39 -0800 Jakub Kicinski wrote:
Quoted 14 lines · On Wed, 2 Dec 2020 20:39:42 -0800 Saeed Mahameed wrote:

Hi Jakub,

This series introduces some fixes to mlx5 driver. Please pull and let me know if there is any problem.

For the DR steering patch I will need it in net-next as well, I would
appreciate it if you will take this small series before your pr to linus.

For -stable v5.4:
('net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW
steering')

Quoted 6 lines

For -stable v5.8
('net/mlx5: Fix wrong address reclaim when command interface is
down')

For -stable v5.9
('net: mlx5e: fix fs_tcp.c build when IPV6 is not enabled')

Your tree is missing your signoff on:

Commit 3041429da89b ("net/mlx5e: kTLS, Enforce HW TX csum offload with kTLS")
committer Signed-off-by missing
author email: [email protected]
committer email: [email protected]

Quoted 6 lines
Quoted 1 line

You can fix it or I'll just apply the patches from the ML.

Well, it's the last thing I got in the queue before I prep the PR so let me just apply from the ML.

Thanks!

That works too, Sorry for the inconvenience !
Tariq did the maintainer review on this patch, so this patch didn't go through my normal submission queue and i forgot to explicitly sign it off :/ .. I will fix my patch flow.

Thanks!