You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
5.2 KiB
163 lines
5.2 KiB
From 13d9574432dadefa6a706a4d523082b56bb4d200 Mon Sep 17 00:00:00 2001
|
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
Date: Sun, 10 May 2020 15:03:57 -0400
|
|
Subject: [PATCH 080/312] [netdrv] net/mlx5: E-switch, Legacy introduce and use
|
|
per vport acl tables APIs
|
|
|
|
Message-id: <20200510150452.10307-33-ahleihel@redhat.com>
|
|
Patchwork-id: 306657
|
|
Patchwork-instance: patchwork
|
|
O-Subject: [RHEL8.3 BZ 1789380 v2 32/87] net/mlx5: E-switch, Legacy introduce and use per vport acl tables APIs
|
|
Bugzilla: 1789380
|
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/1789380
|
|
Upstream: v5.5-rc1
|
|
|
|
commit f5d0c01d65adba2b898836894d200e85c8a8def3
|
|
Author: Parav Pandit <parav@mellanox.com>
|
|
Date: Mon Oct 28 23:35:17 2019 +0000
|
|
|
|
net/mlx5: E-switch, Legacy introduce and use per vport acl tables APIs
|
|
|
|
Introduce and use per vport ACL tables creation and destroy APIs, so that
|
|
subsequently patch can use them during enabling/disabling a vport in
|
|
unified way for legacy vs offloads mode.
|
|
|
|
Signed-off-by: Parav Pandit <parav@mellanox.com>
|
|
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
|
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
---
|
|
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 73 +++++++++++++++++++----
|
|
1 file changed, 60 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
|
|
index 2ecb993545f9..f854750a15c5 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
|
|
@@ -1658,12 +1658,6 @@ static void esw_apply_vport_conf(struct mlx5_eswitch *esw,
|
|
SET_VLAN_STRIP | SET_VLAN_INSERT : 0;
|
|
modify_esw_vport_cvlan(esw->dev, vport_num, vport->info.vlan, vport->info.qos,
|
|
flags);
|
|
-
|
|
- /* Only legacy mode needs ACLs */
|
|
- if (esw->mode == MLX5_ESWITCH_LEGACY) {
|
|
- esw_vport_ingress_config(esw, vport);
|
|
- esw_vport_egress_config(esw, vport);
|
|
- }
|
|
}
|
|
|
|
static void esw_legacy_vport_create_drop_counters(struct mlx5_vport *vport)
|
|
@@ -1701,10 +1695,59 @@ static void esw_legacy_vport_destroy_drop_counters(struct mlx5_vport *vport)
|
|
mlx5_fc_destroy(dev, vport->egress.legacy.drop_counter);
|
|
}
|
|
|
|
+static int esw_vport_create_legacy_acl_tables(struct mlx5_eswitch *esw,
|
|
+ struct mlx5_vport *vport)
|
|
+{
|
|
+ int ret;
|
|
+
|
|
+ /* Only non manager vports need ACL in legacy mode */
|
|
+ if (mlx5_esw_is_manager_vport(esw, vport->vport))
|
|
+ return 0;
|
|
+
|
|
+ ret = esw_vport_ingress_config(esw, vport);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ ret = esw_vport_egress_config(esw, vport);
|
|
+ if (ret)
|
|
+ esw_vport_disable_ingress_acl(esw, vport);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+static int esw_vport_setup_acl(struct mlx5_eswitch *esw,
|
|
+ struct mlx5_vport *vport)
|
|
+{
|
|
+ if (esw->mode == MLX5_ESWITCH_LEGACY)
|
|
+ return esw_vport_create_legacy_acl_tables(esw, vport);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static void esw_vport_destroy_legacy_acl_tables(struct mlx5_eswitch *esw,
|
|
+ struct mlx5_vport *vport)
|
|
+
|
|
+{
|
|
+ if (mlx5_esw_is_manager_vport(esw, vport->vport))
|
|
+ return;
|
|
+
|
|
+ esw_vport_disable_egress_acl(esw, vport);
|
|
+ esw_vport_disable_ingress_acl(esw, vport);
|
|
+ esw_legacy_vport_destroy_drop_counters(vport);
|
|
+}
|
|
+
|
|
+static void esw_vport_cleanup_acl(struct mlx5_eswitch *esw,
|
|
+ struct mlx5_vport *vport)
|
|
+{
|
|
+ if (esw->mode == MLX5_ESWITCH_LEGACY)
|
|
+ esw_vport_destroy_legacy_acl_tables(esw, vport);
|
|
+}
|
|
+
|
|
static int esw_enable_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
|
|
enum mlx5_eswitch_vport_event enabled_events)
|
|
{
|
|
u16 vport_num = vport->vport;
|
|
+ int ret;
|
|
|
|
mutex_lock(&esw->state_lock);
|
|
WARN_ON(vport->enabled);
|
|
@@ -1719,6 +1762,10 @@ static int esw_enable_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
|
|
/* Restore old vport configuration */
|
|
esw_apply_vport_conf(esw, vport);
|
|
|
|
+ ret = esw_vport_setup_acl(esw, vport);
|
|
+ if (ret)
|
|
+ goto done;
|
|
+
|
|
/* Attach vport to the eswitch rate limiter */
|
|
if (esw_vport_enable_qos(esw, vport, vport->info.max_rate,
|
|
vport->qos.bw_share))
|
|
@@ -1739,8 +1786,9 @@ static int esw_enable_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
|
|
|
|
esw->enabled_vports++;
|
|
esw_debug(esw->dev, "Enabled VPORT(%d)\n", vport_num);
|
|
+done:
|
|
mutex_unlock(&esw->state_lock);
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
|
|
static void esw_disable_vport(struct mlx5_eswitch *esw,
|
|
@@ -1765,16 +1813,15 @@ static void esw_disable_vport(struct mlx5_eswitch *esw,
|
|
esw_vport_change_handle_locked(vport);
|
|
vport->enabled_events = 0;
|
|
esw_vport_disable_qos(esw, vport);
|
|
- if (!mlx5_esw_is_manager_vport(esw, vport_num) &&
|
|
- esw->mode == MLX5_ESWITCH_LEGACY) {
|
|
+
|
|
+ if (!mlx5_esw_is_manager_vport(esw, vport->vport) &&
|
|
+ esw->mode == MLX5_ESWITCH_LEGACY)
|
|
mlx5_modify_vport_admin_state(esw->dev,
|
|
MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
|
|
vport_num, 1,
|
|
MLX5_VPORT_ADMIN_STATE_DOWN);
|
|
- esw_vport_disable_egress_acl(esw, vport);
|
|
- esw_vport_disable_ingress_acl(esw, vport);
|
|
- esw_legacy_vport_destroy_drop_counters(vport);
|
|
- }
|
|
+
|
|
+ esw_vport_cleanup_acl(esw, vport);
|
|
esw->enabled_vports--;
|
|
|
|
done:
|
|
--
|
|
2.13.6
|
|
|