From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Tal Alon <talal@mellanox.com>,
Eran Ben Elisha <eranbe@mellanox.com>,
Mohamad Haj Yahia <mohamad@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net-next 08/12] net/mlx5: E-Switch, Enable/disable ACL tables on demand
Date: Mon, 2 May 2016 19:43:40 +0300 [thread overview]
Message-ID: <1462207424-4463-9-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1462207424-4463-1-git-send-email-saeedm@mellanox.com>
From: Mohamad Haj Yahia <mohamad@mellanox.com>
Enable ingress/egress ACL tables only when we need to configure ACL
rules.
Disable ingress/egress ACL tables once all ACL rules are removed.
All VF outgoing/incoming traffic need to go through the ingress/egress ACL
tables.
Adding/Removing these tables on demand will save unnecessary hops in the
flow steering when the ACL tables are empty.
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 33 ++++++++++-------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 17d093c..48c8919 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -728,7 +728,8 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw,
int table_size = 2;
int err = 0;
- if (!MLX5_CAP_ESW_EGRESS_ACL(dev, ft_support))
+ if (!MLX5_CAP_ESW_EGRESS_ACL(dev, ft_support) ||
+ !IS_ERR_OR_NULL(vport->egress.acl))
return;
esw_debug(dev, "Create vport[%d] egress ACL log_max_size(%d)\n",
@@ -841,7 +842,8 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw,
int table_size = 4;
int err = 0;
- if (!MLX5_CAP_ESW_INGRESS_ACL(dev, ft_support))
+ if (!MLX5_CAP_ESW_INGRESS_ACL(dev, ft_support) ||
+ !IS_ERR_OR_NULL(vport->ingress.acl))
return;
esw_debug(dev, "Create vport[%d] ingress ACL log_max_size(%d)\n",
@@ -989,13 +991,6 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
int err = 0;
u8 *smac_v;
- if (IS_ERR_OR_NULL(vport->ingress.acl)) {
- esw_warn(esw->dev,
- "vport[%d] configure ingress rules failed, ingress acl is not initialized!\n",
- vport->vport);
- return -EPERM;
- }
-
if (vport->spoofchk) {
err = mlx5_query_nic_vport_mac_address(esw->dev, vport->vport, smac);
if (err) {
@@ -1015,8 +1010,12 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
esw_vport_cleanup_ingress_rules(esw, vport);
- if (!vport->vlan && !vport->qos && !vport->spoofchk)
+ if (!vport->vlan && !vport->qos && !vport->spoofchk) {
+ esw_vport_disable_ingress_acl(esw, vport);
return 0;
+ }
+
+ esw_vport_enable_ingress_acl(esw, vport);
esw_debug(esw->dev,
"vport[%d] configure ingress rules, vlan(%d) qos(%d)\n",
@@ -1091,16 +1090,14 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
u32 *match_c;
int err = 0;
- if (IS_ERR_OR_NULL(vport->egress.acl)) {
- esw_warn(esw->dev, "vport[%d] configure rgress rules failed, egress acl is not initialized!\n",
- vport->vport);
- return -EPERM;
- }
-
esw_vport_cleanup_egress_rules(esw, vport);
- if (!vport->vlan && !vport->qos)
+ if (!vport->vlan && !vport->qos) {
+ esw_vport_disable_egress_acl(esw, vport);
return 0;
+ }
+
+ esw_vport_enable_egress_acl(esw, vport);
esw_debug(esw->dev,
"vport[%d] configure egress rules, vlan(%d) qos(%d)\n",
@@ -1169,8 +1166,6 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, int vport_num,
esw_debug(esw->dev, "Enabling VPORT(%d)\n", vport_num);
if (vport_num) { /* Only VFs need ACLs for VST and spoofchk filtering */
- esw_vport_enable_ingress_acl(esw, vport);
- esw_vport_enable_egress_acl(esw, vport);
esw_vport_ingress_config(esw, vport);
esw_vport_egress_config(esw, vport);
}
--
2.8.0
next prev parent reply other threads:[~2016-05-02 16:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 16:43 [PATCH net-next 00/12] Mellanox 100G ethernet SRIOV Upgrades Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 01/12] net/mlx5e: Fix aRFS compilation dependency Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 02/12] net/mlx5: Flow steering, Add vport ACL support Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 03/12] net/mlx5: E-Switch, Replace vport spin lock with synchronize_irq() Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 04/12] net/mlx5: E-Switch, Fix error flow memory leak Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 05/12] net/mlx5: E-Switch, Introduce VST vport ingress/egress ACLs Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 06/12] net/mlx5: E-Switch, Vport ingress/egress ACLs rules for VST mode Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 07/12] net/mlx5: E-Switch, Vport ingress/egress ACLs rules for spoofchk Saeed Mahameed
2016-05-02 16:43 ` Saeed Mahameed [this message]
2016-05-02 16:43 ` [PATCH net-next 09/12] net/mlx5: E-Switch, Use vport event handler for vport cleanup Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 10/12] net/mlx5: E-Switch, Add promiscuous and allmulti FDB flowtable groups Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 11/12] net/mlx5: E-Switch, Implement promiscuous rx modes vf request handling Saeed Mahameed
2016-05-02 16:43 ` [PATCH net-next 12/12] net/mlx5: E-Switch, Implement trust vf ndo Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462207424-4463-9-git-send-email-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=davem@davemloft.net \
--cc=eranbe@mellanox.com \
--cc=mohamad@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=talal@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).