All of lore.kernel.org
 help / color / mirror / Atom feed
* [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24
@ 2020-01-24 20:20 Saeed Mahameed
  2020-01-24 20:20 ` [net 1/9] net/mlx5: Fix lowest FDB pool size Saeed Mahameed
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

This series introduces some fixes to mlx5 driver.

Please pull and let me know if there is any problem.

Merge conflict: once merge with net-next, a contextual conflict will
appear in drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
since the code moved in net-next.
To resolve, just delete ALL of the conflicting hunk from net.
So sorry for the small mess .. 

For -stable v5.4:
 ('net/mlx5: Update the list of the PCI supported devices')
 ('net/mlx5: Fix lowest FDB pool size')
 ('net/mlx5e: kTLS, Fix corner-case checks in TX resync flow')
 ('net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path')
 ('net/mlx5: Eswitch, Prevent ingress rate configuration of uplink rep')
 ('net/mlx5e: kTLS, Remove redundant posts in TX resync flow')
 ('net/mlx5: DR, Enable counter on non-fwd-dest objects')
 ('net/mlx5: DR, use non preemptible call to get the current cpu number')

Thanks,
Saeed.

---
The following changes since commit 623c8d5c74c69a41573da5a38bb59e8652113f56:

  Merge branch 'netdev-seq_file-next-functions-should-increase-position-index' (2020-01-24 11:42:18 +0100)

are available in the Git repository at:

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

for you to fetch changes up to 342508c1c7540e281fd36151c175ba5ff954a99f:

  net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path (2020-01-24 12:04:40 -0800)

----------------------------------------------------------------
mlx5-fixes-2020-01-24

----------------------------------------------------------------
Dmytro Linkin (1):
      net/mlx5e: Clear VF config when switching modes

Eli Cohen (1):
      net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep

Erez Shitrit (2):
      net/mlx5: DR, Enable counter on non-fwd-dest objects
      net/mlx5: DR, use non preemptible call to get the current cpu number

Meir Lichtinger (1):
      net/mlx5: Update the list of the PCI supported devices

Paul Blakey (1):
      net/mlx5: Fix lowest FDB pool size

Tariq Toukan (3):
      net/mlx5e: kTLS, Fix corner-case checks in TX resync flow
      net/mlx5e: kTLS, Remove redundant posts in TX resync flow
      net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path

 .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 49 +++++++++++++---------
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  9 +++-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c  |  4 +-
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 13 ++++--
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |  1 +
 .../ethernet/mellanox/mlx5/core/steering/dr_send.c |  3 +-
 .../ethernet/mellanox/mlx5/core/steering/fs_dr.c   | 42 +++++++++++++------
 7 files changed, 80 insertions(+), 41 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [net 1/9] net/mlx5: Fix lowest FDB pool size
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
@ 2020-01-24 20:20 ` Saeed Mahameed
  2020-01-24 20:20 ` [net 2/9] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Paul Blakey, Roi Dayan, Saeed Mahameed

From: Paul Blakey <paulb@mellanox.com>

The pool sizes represent the pool sizes in the fw. when we request
a pool size from fw, it will return the next possible group.
We track how many pools the fw has left and start requesting groups
from the big to the small.
When we start request 4k group, which doesn't exists in fw, fw
wants to allocate the next possible size, 64k, but will fail since
its exhausted. The correct smallest pool size in fw is 128 and not 4k.

Fixes: e52c28024008 ("net/mlx5: E-Switch, Add chains and priorities")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 243a5440867e..b8fe44ea44c3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -866,7 +866,7 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
  */
 #define ESW_SIZE (16 * 1024 * 1024)
 const unsigned int ESW_POOLS[4] = { 4 * 1024 * 1024, 1 * 1024 * 1024,
-				    64 * 1024, 4 * 1024 };
+				    64 * 1024, 128 };
 
 static int
 get_sz_from_pool(struct mlx5_eswitch *esw)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 2/9] net/mlx5: Update the list of the PCI supported devices
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
  2020-01-24 20:20 ` [net 1/9] net/mlx5: Fix lowest FDB pool size Saeed Mahameed
@ 2020-01-24 20:20 ` Saeed Mahameed
  2020-01-24 20:20 ` [net 3/9] net/mlx5: DR, Enable counter on non-fwd-dest objects Saeed Mahameed
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Meir Lichtinger, Eran Ben Elisha, Saeed Mahameed

From: Meir Lichtinger <meirl@mellanox.com>

Add the upcoming ConnectX-7 device ID.

Fixes: 85327a9c4150 ("net/mlx5: Update the list of the PCI supported devices")
Signed-off-by: Meir Lichtinger <meirl@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index cf7b8da0f010..f554cfddcf4e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1563,6 +1563,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = {
 	{ PCI_VDEVICE(MELLANOX, 0x101d) },			/* ConnectX-6 Dx */
 	{ PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF},	/* ConnectX Family mlx5Gen Virtual Function */
 	{ PCI_VDEVICE(MELLANOX, 0x101f) },			/* ConnectX-6 LX */
+	{ PCI_VDEVICE(MELLANOX, 0x1021) },			/* ConnectX-7 */
 	{ PCI_VDEVICE(MELLANOX, 0xa2d2) },			/* BlueField integrated ConnectX-5 network controller */
 	{ PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF},	/* BlueField integrated ConnectX-5 network controller VF */
 	{ PCI_VDEVICE(MELLANOX, 0xa2d6) },			/* BlueField-2 integrated ConnectX-6 Dx network controller */
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 3/9] net/mlx5: DR, Enable counter on non-fwd-dest objects
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
  2020-01-24 20:20 ` [net 1/9] net/mlx5: Fix lowest FDB pool size Saeed Mahameed
  2020-01-24 20:20 ` [net 2/9] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
@ 2020-01-24 20:20 ` Saeed Mahameed
  2020-01-24 20:20 ` [net 4/9] net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep Saeed Mahameed
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:20 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Erez Shitrit, Hamdan Igbaria, Alex Vesker, Saeed Mahameed

From: Erez Shitrit <erezsh@mellanox.com>

The current code handles only counters that attached to dest, we still
have the cases where we have counter on non-dest, like over drop etc.

Fixes: 6a48faeeca10 ("net/mlx5: Add direct rule fs_cmd implementation")
Signed-off-by: Hamdan Igbaria <hamdani@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../mellanox/mlx5/core/steering/fs_dr.c       | 42 +++++++++++++------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
index 3d587d0bdbbe..1e32e2443f73 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
@@ -352,26 +352,16 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
 	if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
 		list_for_each_entry(dst, &fte->node.children, node.list) {
 			enum mlx5_flow_destination_type type = dst->dest_attr.type;
-			u32 id;
 
 			if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
 				err = -ENOSPC;
 				goto free_actions;
 			}
 
-			switch (type) {
-			case MLX5_FLOW_DESTINATION_TYPE_COUNTER:
-				id = dst->dest_attr.counter_id;
+			if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
+				continue;
 
-				tmp_action =
-					mlx5dr_action_create_flow_counter(id);
-				if (!tmp_action) {
-					err = -ENOMEM;
-					goto free_actions;
-				}
-				fs_dr_actions[fs_dr_num_actions++] = tmp_action;
-				actions[num_actions++] = tmp_action;
-				break;
+			switch (type) {
 			case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
 				tmp_action = create_ft_action(dev, dst);
 				if (!tmp_action) {
@@ -397,6 +387,32 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
 		}
 	}
 
+	if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
+		list_for_each_entry(dst, &fte->node.children, node.list) {
+			u32 id;
+
+			if (dst->dest_attr.type !=
+			    MLX5_FLOW_DESTINATION_TYPE_COUNTER)
+				continue;
+
+			if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
+				err = -ENOSPC;
+				goto free_actions;
+			}
+
+			id = dst->dest_attr.counter_id;
+			tmp_action =
+				mlx5dr_action_create_flow_counter(id);
+			if (!tmp_action) {
+				err = -ENOMEM;
+				goto free_actions;
+			}
+
+			fs_dr_actions[fs_dr_num_actions++] = tmp_action;
+			actions[num_actions++] = tmp_action;
+		}
+	}
+
 	params.match_sz = match_sz;
 	params.match_buf = (u64 *)fte->val;
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 4/9] net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2020-01-24 20:20 ` [net 3/9] net/mlx5: DR, Enable counter on non-fwd-dest objects Saeed Mahameed
@ 2020-01-24 20:20 ` Saeed Mahameed
  2020-01-24 20:20 ` [net 5/9] net/mlx5: DR, use non preemptible call to get the current cpu number Saeed Mahameed
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eli Cohen, Roi Dayan, Saeed Mahameed

From: Eli Cohen <eli@mellanox.com>

Since the implementation relies on limiting the VF transmit rate to
simulate ingress rate limiting, and since either uplink representor or
ecpf are not associated with a VF, we limit the rate limit configuration
for those ports.

Fixes: fcb64c0f5640 ("net/mlx5: E-Switch, add ingress rate support")
Signed-off-by: Eli Cohen <eli@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 024e1cddfd0e..7e32b9e3667c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4036,6 +4036,13 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate,
 	u32 rate_mbps;
 	int err;
 
+	vport_num = rpriv->rep->vport;
+	if (vport_num >= MLX5_VPORT_ECPF) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "Ingress rate limit is supported only for Eswitch ports connected to VFs");
+		return -EOPNOTSUPP;
+	}
+
 	esw = priv->mdev->priv.eswitch;
 	/* rate is given in bytes/sec.
 	 * First convert to bits/sec and then round to the nearest mbit/secs.
@@ -4044,8 +4051,6 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate,
 	 * 1 mbit/sec.
 	 */
 	rate_mbps = rate ? max_t(u32, (rate * 8 + 500000) / 1000000, 1) : 0;
-	vport_num = rpriv->rep->vport;
-
 	err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps);
 	if (err)
 		NL_SET_ERR_MSG_MOD(extack, "failed applying action to hardware");
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 5/9] net/mlx5: DR, use non preemptible call to get the current cpu number
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2020-01-24 20:20 ` [net 4/9] net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep Saeed Mahameed
@ 2020-01-24 20:20 ` Saeed Mahameed
  2020-01-24 20:21 ` [net 6/9] net/mlx5e: Clear VF config when switching modes Saeed Mahameed
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Erez Shitrit, Saeed Mahameed

From: Erez Shitrit <erezsh@mellanox.com>

Use raw_smp_processor_id instead of smp_processor_id() otherwise we will
get the following trace in debug-kernel:
	BUG: using smp_processor_id() in preemptible [00000000] code: devlink
	caller is dr_create_cq.constprop.2+0x31d/0x970 [mlx5_core]
	Call Trace:
	dump_stack+0x9a/0xf0
	debug_smp_processor_id+0x1f3/0x200
	dr_create_cq.constprop.2+0x31d/0x970
	genl_family_rcv_msg+0x5fd/0x1170
	genl_rcv_msg+0xb8/0x160
	netlink_rcv_skb+0x11e/0x340

Fixes: 297cccebdc5a ("net/mlx5: DR, Expose an internal API to issue RDMA operations")
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
index 51803eef13dd..c7f10d4f8f8d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 /* Copyright (c) 2019 Mellanox Technologies. */
 
+#include <linux/smp.h>
 #include "dr_types.h"
 
 #define QUEUE_SIZE 128
@@ -729,7 +730,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev,
 	if (!in)
 		goto err_cqwq;
 
-	vector = smp_processor_id() % mlx5_comp_vectors_count(mdev);
+	vector = raw_smp_processor_id() % mlx5_comp_vectors_count(mdev);
 	err = mlx5_vector2eqn(mdev, vector, &eqn, &irqn);
 	if (err) {
 		kvfree(in);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 6/9] net/mlx5e: Clear VF config when switching modes
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2020-01-24 20:20 ` [net 5/9] net/mlx5: DR, use non preemptible call to get the current cpu number Saeed Mahameed
@ 2020-01-24 20:21 ` Saeed Mahameed
  2020-01-24 20:21 ` [net 7/9] net/mlx5e: kTLS, Fix corner-case checks in TX resync flow Saeed Mahameed
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Dmytro Linkin, Roi Dayan, Saeed Mahameed

From: Dmytro Linkin <dmitrolin@mellanox.com>

Currently VF in LEGACY mode are not able to go up. Also in OFFLOADS
mode, when switching to it first time, VF can go up independently to
his representor, which is not expected.
Perform clearing of VF config when switching modes and set link state
to AUTO as default value. Also, when switching to OFFLOADS mode set
link state to DOWN, which allow VF link state to be controlled by its
REP.

Fixes: 1ab2068a4c66 ("net/mlx5: Implement vports admin state backup/restore")
Fixes: 556b9d16d3f5 ("net/mlx5: Clear VF's configuration on disabling SRIOV")
Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c     |  4 +++-
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c    | 11 ++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 2c965ad0d744..3df3604e8929 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1928,8 +1928,10 @@ static void mlx5_eswitch_clear_vf_vports_info(struct mlx5_eswitch *esw)
 	struct mlx5_vport *vport;
 	int i;
 
-	mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs)
+	mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) {
 		memset(&vport->info, 0, sizeof(vport->info));
+		vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO;
+	}
 }
 
 /* Public E-Switch API */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index b8fe44ea44c3..3e6412783078 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1377,7 +1377,7 @@ static int esw_offloads_start(struct mlx5_eswitch *esw,
 		return -EINVAL;
 	}
 
-	mlx5_eswitch_disable(esw, false);
+	mlx5_eswitch_disable(esw, true);
 	mlx5_eswitch_update_num_of_vfs(esw, esw->dev->priv.sriov.num_vfs);
 	err = mlx5_eswitch_enable(esw, MLX5_ESWITCH_OFFLOADS);
 	if (err) {
@@ -2220,7 +2220,8 @@ int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, unsigned long type
 
 int esw_offloads_enable(struct mlx5_eswitch *esw)
 {
-	int err;
+	struct mlx5_vport *vport;
+	int err, i;
 
 	if (MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, reformat) &&
 	    MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, decap))
@@ -2237,6 +2238,10 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
 	if (err)
 		goto err_vport_metadata;
 
+	/* Representor will control the vport link state */
+	mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs)
+		vport->info.link_state = MLX5_VPORT_ADMIN_STATE_DOWN;
+
 	err = mlx5_eswitch_enable_pf_vf_vports(esw, MLX5_VPORT_UC_ADDR_CHANGE);
 	if (err)
 		goto err_vports;
@@ -2266,7 +2271,7 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw,
 {
 	int err, err1;
 
-	mlx5_eswitch_disable(esw, false);
+	mlx5_eswitch_disable(esw, true);
 	err = mlx5_eswitch_enable(esw, MLX5_ESWITCH_LEGACY);
 	if (err) {
 		NL_SET_ERR_MSG_MOD(extack, "Failed setting eswitch to legacy");
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 7/9] net/mlx5e: kTLS, Fix corner-case checks in TX resync flow
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2020-01-24 20:21 ` [net 6/9] net/mlx5e: Clear VF config when switching modes Saeed Mahameed
@ 2020-01-24 20:21 ` Saeed Mahameed
  2020-01-24 20:21 ` [net 8/9] net/mlx5e: kTLS, Remove redundant posts " Saeed Mahameed
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Boris Pismenny, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

There are the following cases:

1. Packet ends before start marker: bypass offload.
2. Packet starts before start marker and ends after it: drop,
   not supported, breaks contract with kernel.
3. packet ends before tls record info starts: drop,
   this packet was already acknowledged and its record info
   was released.

Add the above as comment in code.

Mind possible wraparounds of the TCP seq, replace the simple comparison
with a call to the TCP before() method.

In addition, remove logic that handles negative sync_len values,
as it became impossible.

Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
Fixes: 46a3ea98074e ("net/mlx5e: kTLS, Enhance TX resync flow")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../mellanox/mlx5/core/en_accel/ktls_tx.c     | 33 +++++++++++--------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
index 778dab1af8fc..8dbb92176bd7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
@@ -180,7 +180,7 @@ mlx5e_ktls_tx_post_param_wqes(struct mlx5e_txqsq *sq,
 
 struct tx_sync_info {
 	u64 rcd_sn;
-	s32 sync_len;
+	u32 sync_len;
 	int nr_frags;
 	skb_frag_t frags[MAX_SKB_FRAGS];
 };
@@ -193,13 +193,14 @@ enum mlx5e_ktls_sync_retval {
 
 static enum mlx5e_ktls_sync_retval
 tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
-		 u32 tcp_seq, struct tx_sync_info *info)
+		 u32 tcp_seq, int datalen, struct tx_sync_info *info)
 {
 	struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
 	enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
 	struct tls_record_info *record;
 	int remaining, i = 0;
 	unsigned long flags;
+	bool ends_before;
 
 	spin_lock_irqsave(&tx_ctx->lock, flags);
 	record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
@@ -209,9 +210,21 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
 		goto out;
 	}
 
-	if (unlikely(tcp_seq < tls_record_start_seq(record))) {
-		ret = tls_record_is_start_marker(record) ?
-			MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
+	/* There are the following cases:
+	 * 1. packet ends before start marker: bypass offload.
+	 * 2. packet starts before start marker and ends after it: drop,
+	 *    not supported, breaks contract with kernel.
+	 * 3. packet ends before tls record info starts: drop,
+	 *    this packet was already acknowledged and its record info
+	 *    was released.
+	 */
+	ends_before = before(tcp_seq + datalen, tls_record_start_seq(record));
+
+	if (unlikely(tls_record_is_start_marker(record))) {
+		ret = ends_before ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
+		goto out;
+	} else if (ends_before) {
+		ret = MLX5E_KTLS_SYNC_FAIL;
 		goto out;
 	}
 
@@ -337,7 +350,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
 	u8 num_wqebbs;
 	int i = 0;
 
-	ret = tx_sync_info_get(priv_tx, seq, &info);
+	ret = tx_sync_info_get(priv_tx, seq, datalen, &info);
 	if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) {
 		if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) {
 			stats->tls_skip_no_sync_data++;
@@ -351,14 +364,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
 		goto err_out;
 	}
 
-	if (unlikely(info.sync_len < 0)) {
-		if (likely(datalen <= -info.sync_len))
-			return MLX5E_KTLS_SYNC_DONE;
-
-		stats->tls_drop_bypass_req++;
-		goto err_out;
-	}
-
 	stats->tls_ooo++;
 
 	tx_post_resync_params(sq, priv_tx, info.rcd_sn);
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 8/9] net/mlx5e: kTLS, Remove redundant posts in TX resync flow
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2020-01-24 20:21 ` [net 7/9] net/mlx5e: kTLS, Fix corner-case checks in TX resync flow Saeed Mahameed
@ 2020-01-24 20:21 ` Saeed Mahameed
  2020-01-24 20:21 ` [net 9/9] net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path Saeed Mahameed
  2020-01-25 12:49 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 David Miller
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Boris Pismenny, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

The call to tx_post_resync_params() is done earlier in the flow,
the post of the control WQEs is unnecessarily repeated. Remove it.

Fixes: 700ec4974240 ("net/mlx5e: kTLS, Fix missing SQ edge fill")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
index 8dbb92176bd7..592e921aa167 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
@@ -383,8 +383,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
 	if (unlikely(contig_wqebbs_room < num_wqebbs))
 		mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
 
-	tx_post_resync_params(sq, priv_tx, info.rcd_sn);
-
 	for (; i < info.nr_frags; i++) {
 		unsigned int orig_fsz, frag_offset = 0, n = 0;
 		skb_frag_t *f = &info.frags[i];
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [net 9/9] net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (7 preceding siblings ...)
  2020-01-24 20:21 ` [net 8/9] net/mlx5e: kTLS, Remove redundant posts " Saeed Mahameed
@ 2020-01-24 20:21 ` Saeed Mahameed
  2020-01-25 12:49 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 David Miller
  9 siblings, 0 replies; 11+ messages in thread
From: Saeed Mahameed @ 2020-01-24 20:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Boris Pismenny, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

When TCP out-of-order is identified (unexpected tcp seq mismatch), driver
analyzes the packet and decides what handling should it get:
1. go to accelerated path (to be encrypted in HW),
2. go to regular xmit path (send w/o encryption),
3. drop.

Packets marked with skb->decrypted by the TLS stack in the TX flow skips
SW encryption, and rely on the HW offload.
Verify that such packets are never sent un-encrypted on the wire.
Add a WARN to catch such bugs, and prefer dropping the packet in these cases.

Fixes: 46a3ea98074e ("net/mlx5e: kTLS, Enhance TX resync flow")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
index 592e921aa167..f260dd96873b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
@@ -458,12 +458,18 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev,
 		enum mlx5e_ktls_sync_retval ret =
 			mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq);
 
-		if (likely(ret == MLX5E_KTLS_SYNC_DONE))
+		switch (ret) {
+		case MLX5E_KTLS_SYNC_DONE:
 			*wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
-		else if (ret == MLX5E_KTLS_SYNC_FAIL)
+			break;
+		case MLX5E_KTLS_SYNC_SKIP_NO_DATA:
+			if (likely(!skb->decrypted))
+				goto out;
+			WARN_ON_ONCE(1);
+			/* fall-through */
+		default: /* MLX5E_KTLS_SYNC_FAIL */
 			goto err_out;
-		else /* ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA */
-			goto out;
+		}
 	}
 
 	priv_tx->expected_seq = seq + datalen;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24
  2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
                   ` (8 preceding siblings ...)
  2020-01-24 20:21 ` [net 9/9] net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path Saeed Mahameed
@ 2020-01-25 12:49 ` David Miller
  9 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2020-01-25 12:49 UTC (permalink / raw)
  To: saeedm; +Cc: netdev

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Fri, 24 Jan 2020 20:20:50 +0000

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

Pulled.

> Merge conflict: once merge with net-next, a contextual conflict will
> appear in drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> since the code moved in net-next.
> To resolve, just delete ALL of the conflicting hunk from net.
> So sorry for the small mess .. 

Thanks for the heads up.

> For -stable v5.4:
>  ('net/mlx5: Update the list of the PCI supported devices')
>  ('net/mlx5: Fix lowest FDB pool size')
>  ('net/mlx5e: kTLS, Fix corner-case checks in TX resync flow')
>  ('net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path')
>  ('net/mlx5: Eswitch, Prevent ingress rate configuration of uplink rep')
>  ('net/mlx5e: kTLS, Remove redundant posts in TX resync flow')
>  ('net/mlx5: DR, Enable counter on non-fwd-dest objects')
>  ('net/mlx5: DR, use non preemptible call to get the current cpu number')

Queued up.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-01-25 12:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24 20:20 [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 Saeed Mahameed
2020-01-24 20:20 ` [net 1/9] net/mlx5: Fix lowest FDB pool size Saeed Mahameed
2020-01-24 20:20 ` [net 2/9] net/mlx5: Update the list of the PCI supported devices Saeed Mahameed
2020-01-24 20:20 ` [net 3/9] net/mlx5: DR, Enable counter on non-fwd-dest objects Saeed Mahameed
2020-01-24 20:20 ` [net 4/9] net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep Saeed Mahameed
2020-01-24 20:20 ` [net 5/9] net/mlx5: DR, use non preemptible call to get the current cpu number Saeed Mahameed
2020-01-24 20:21 ` [net 6/9] net/mlx5e: Clear VF config when switching modes Saeed Mahameed
2020-01-24 20:21 ` [net 7/9] net/mlx5e: kTLS, Fix corner-case checks in TX resync flow Saeed Mahameed
2020-01-24 20:21 ` [net 8/9] net/mlx5e: kTLS, Remove redundant posts " Saeed Mahameed
2020-01-24 20:21 ` [net 9/9] net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path Saeed Mahameed
2020-01-25 12:49 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2020-01-24 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.