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>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net-next V3 06/16] net/mlx5: E-Switch, Add offloads table
Date: Fri, 1 Jul 2016 14:50:59 +0300 [thread overview]
Message-ID: <1467373869-22746-7-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1467373869-22746-1-git-send-email-saeedm@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Belongs to the NIC offloads name-space, and to be used as part of the
SRIOV offloads logic to steer packets that hit the e-switch miss rule
to the TIR of the relevant VF representor.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 5 ++++
.../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 31 ++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index b7fabd1..32db37a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -155,6 +155,10 @@ enum {
SRIOV_OFFLOADS
};
+struct mlx5_esw_offload {
+ struct mlx5_flow_table *ft_offloads;
+};
+
struct mlx5_eswitch {
struct mlx5_core_dev *dev;
struct mlx5_l2_table l2_table;
@@ -169,6 +173,7 @@ struct mlx5_eswitch {
*/
struct mutex state_lock;
struct esw_mc_addr *mc_promisc;
+ struct mlx5_esw_offload offloads;
int mode;
};
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 8964f71..e895c6f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -212,3 +212,34 @@ void esw_destroy_offloads_fdb_table(struct mlx5_eswitch *esw)
mlx5_destroy_flow_table(esw->fdb_table.fdb);
}
+
+static int esw_create_offloads_table(struct mlx5_eswitch *esw)
+{
+ struct mlx5_flow_namespace *ns;
+ struct mlx5_flow_table *ft_offloads;
+ struct mlx5_core_dev *dev = esw->dev;
+ int err = 0;
+
+ ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_OFFLOADS);
+ if (!ns) {
+ esw_warn(esw->dev, "Failed to get offloads flow namespace\n");
+ return -ENOMEM;
+ }
+
+ ft_offloads = mlx5_create_flow_table(ns, 0, dev->priv.sriov.num_vfs + 2, 0);
+ if (IS_ERR(ft_offloads)) {
+ err = PTR_ERR(ft_offloads);
+ esw_warn(esw->dev, "Failed to create offloads table, err %d\n", err);
+ return err;
+ }
+
+ esw->offloads.ft_offloads = ft_offloads;
+ return 0;
+}
+
+static void esw_destroy_offloads_table(struct mlx5_eswitch *esw)
+{
+ struct mlx5_esw_offload *offloads = &esw->offloads;
+
+ mlx5_destroy_flow_table(offloads->ft_offloads);
+}
--
2.8.0
next prev parent reply other threads:[~2016-07-01 12:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 11:50 [PATCH net-next V3 00/16] Mellanox 100G SRIOV E-Switch offload and VF representors Saeed Mahameed
2016-07-01 11:50 ` [PATCH net-next V3 01/16] net/mlx5: E-Switch, Add operational mode to the SRIOV e-Switch Saeed Mahameed
2016-07-01 11:50 ` [PATCH net-next V3 02/16] net/mlx5: E-Switch, Add support for the sriov offloads mode Saeed Mahameed
2016-07-01 11:50 ` [PATCH net-next V3 03/16] net/mlx5: E-Switch, Add miss rule for " Saeed Mahameed
2016-07-01 11:50 ` [PATCH net-next V3 04/16] net/mlx5: E-Switch, Add API to create send-to-vport rules Saeed Mahameed
2016-07-01 11:50 ` [PATCH net-next V3 05/16] net/mlx5: Introduce offloads steering namespace Saeed Mahameed
2016-07-01 11:50 ` Saeed Mahameed [this message]
2016-07-01 11:51 ` [PATCH net-next V3 07/16] net/mlx5: E-Switch, Add API to create vport rx rules Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 08/16] net/devlink: Add E-Switch mode control Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 09/16] net/mlx5: Add devlink interface Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 10/16] net/mlx5e: Add devlink based SRIOV mode changes Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 11/16] net/mlx5e: Create NIC global resources only once Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 12/16] net/mlx5e: TIRs management refactoring Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 13/16] net/mlx5e: Mark enabled RQTs instances explicitly Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 14/16] net/mlx5e: Add support for multiple profiles Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 15/16] net/mlx5: Add Representors registration API Saeed Mahameed
2016-07-01 11:51 ` [PATCH net-next V3 16/16] net/mlx5e: Introduce SRIOV VF representors Saeed Mahameed
2016-07-02 18:42 ` [PATCH net-next V3 00/16] Mellanox 100G SRIOV E-Switch offload and " 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=1467373869-22746-7-git-send-email-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--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).