From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Hadar Hen-Zion <hadarh@mellanox.com>,
Jiri Pirko <jiri@mellanox.com>,
Andy Gospodarek <gospo@cumulusnetworks.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
John Fastabend <john.r.fastabend@intel.com>,
Amir Vadai <amir@vadai.me>, Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net-next V2 09/10] net/mlx5e: Add TC HW support for FDB (SRIOV e-switch) offloads
Date: Thu, 14 Jul 2016 10:32:45 +0300 [thread overview]
Message-ID: <1468481566-29859-10-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1468481566-29859-1-git-send-email-saeedm@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Enhance the TC offload code such that when the eswitch exists and it's
mode being SRIOV offloads, we do TC actions parsing and setup targeted
for eswitch. Next, we add the offloaded flow to the HW e-switch (fdb).
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 5 ++++
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 35 ++++++++++++++++++++----
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 5ef02f0..fdaf2fa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -36,6 +36,7 @@
#include "eswitch.h"
#include "en.h"
+#include "en_tc.h"
static const char mlx5e_rep_driver_name[] = "mlx5e_rep";
@@ -201,6 +202,10 @@ void mlx5e_nic_rep_unload(struct mlx5_eswitch *esw,
if (test_bit(MLX5E_STATE_OPENED, &priv->state))
mlx5e_remove_sqs_fwd_rules(priv);
+
+ /* clean (and re-init) existing uplink offloaded TC rules */
+ mlx5e_tc_cleanup(priv);
+ mlx5e_tc_init(priv);
}
static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 9a66441..0f19b01 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -112,6 +112,22 @@ err_create_ft:
return rule;
}
+static struct mlx5_flow_rule *mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
+ struct mlx5_flow_spec *spec,
+ u32 action, u32 dst_vport)
+{
+ struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
+ struct mlx5_eswitch_rep *rep = priv->ppriv;
+ u32 src_vport;
+
+ if (rep->vport) /* set source vport for the flow */
+ src_vport = rep->vport;
+ else
+ src_vport = FDB_UPLINK_VPORT;
+
+ return mlx5_eswitch_add_offloaded_rule(esw, spec, action, src_vport, dst_vport);
+}
+
static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
struct mlx5_flow_rule *rule)
{
@@ -397,11 +413,11 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
{
struct mlx5e_tc_table *tc = &priv->fs.tc;
int err = 0;
- u32 flow_tag;
- u32 action;
+ u32 flow_tag, action, dest_vport = 0;
struct mlx5e_tc_flow *flow;
struct mlx5_flow_spec *spec;
struct mlx5_flow_rule *old = NULL;
+ struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
flow = rhashtable_lookup_fast(&tc->ht, &f->cookie,
tc->ht_params);
@@ -422,11 +438,18 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
if (err < 0)
goto err_free;
- err = parse_tc_nic_actions(priv, f->exts, &action, &flow_tag);
- if (err < 0)
- goto err_free;
+ if (esw && esw->mode == SRIOV_OFFLOADS) {
+ err = parse_tc_fdb_actions(priv, f->exts, &action, &dest_vport);
+ if (err < 0)
+ goto err_free;
+ flow->rule = mlx5e_tc_add_fdb_flow(priv, spec, action, dest_vport);
+ } else {
+ err = parse_tc_nic_actions(priv, f->exts, &action, &flow_tag);
+ if (err < 0)
+ goto err_free;
+ flow->rule = mlx5e_tc_add_nic_flow(priv, spec, action, flow_tag);
+ }
- flow->rule = mlx5e_tc_add_nic_flow(priv, spec, action, flow_tag);
if (IS_ERR(flow->rule)) {
err = PTR_ERR(flow->rule);
goto err_free;
--
2.8.0
next prev parent reply other threads:[~2016-07-14 7:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 7:32 [PATCH net-next V2 00/10] Mellanox 100G mlx5 Bulk flow statistics and SRIOV TC offloads Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 01/10] net/mlx5: Store counters in rbtree instead of list Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 02/10] net/mlx5: Introduce bulk reading of flow counters Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 03/10] net/mlx5e: Offload TC flow counters only when supported Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 04/10] net/mlx5: E-Switch, Use two priorities for SRIOV offloads mode Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 05/10] net/mlx5: E-Switch, Add API to configure rules for the offloaded mode Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 06/10] net/mlx5e: Adjustments in the TC offload code towards reuse for SRIOV Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 07/10] net/switchdev: Export the same parent ID service function Saeed Mahameed
2016-07-14 7:32 ` [PATCH net-next V2 08/10] net/mlx5e: Add TC drop and mirred/redirect action parsing for SRIOV offloads Saeed Mahameed
2016-07-14 7:32 ` Saeed Mahameed [this message]
2016-07-14 7:32 ` [PATCH net-next V2 10/10] net/mlx5e: Add TC offload support for the VF representors netdevice Saeed Mahameed
2016-07-14 20:34 ` [PATCH net-next V2 00/10] Mellanox 100G mlx5 Bulk flow statistics and SRIOV TC offloads David Miller
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=1468481566-29859-10-git-send-email-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=amir@vadai.me \
--cc=davem@davemloft.net \
--cc=gospo@cumulusnetworks.com \
--cc=hadarh@mellanox.com \
--cc=jesse.brandeburg@intel.com \
--cc=jiri@mellanox.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@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).