From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Leon Romanovsky <leonro@mellanox.com>,
Ilan Tayari <ilant@mellanox.com>,
Boris Pismenny <borisp@mellanox.com>,
Yevgeny Kliteynik <kliteyn@mellanox.com>,
Yossi Kuperman <yossiku@mellanox.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Sowmini Varadhan <sowmini.varadhan@oracle.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 03/16] net/mlx5: Add support for multiple RoCE enable
Date: Tue, 27 Jun 2017 17:28:43 +0300 [thread overview]
Message-ID: <20170627142856.9448-4-saeedm@mellanox.com> (raw)
In-Reply-To: <20170627142856.9448-1-saeedm@mellanox.com>
From: Ilan Tayari <ilant@mellanox.com>
Previously, only mlx5_ib enabled RoCE on the port, but FPGA needs it as
well.
Add support for counting number of enables, so that FPGA and IB can work
in parallel and independently.
Program the HW to enable RoCE on the first enable call, and program to
disable RoCE on the last disable call.
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/vport.c | 4 ++++
include/linux/mlx5/driver.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
index 06019d00ab7b..5abfec1c3399 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c
@@ -926,12 +926,16 @@ static int mlx5_nic_vport_update_roce_state(struct mlx5_core_dev *mdev,
int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev)
{
+ if (atomic_inc_return(&mdev->roce.roce_en) != 1)
+ return 0;
return mlx5_nic_vport_update_roce_state(mdev, MLX5_VPORT_ROCE_ENABLED);
}
EXPORT_SYMBOL_GPL(mlx5_nic_vport_enable_roce);
int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev)
{
+ if (atomic_dec_return(&mdev->roce.roce_en) != 0)
+ return 0;
return mlx5_nic_vport_update_roce_state(mdev, MLX5_VPORT_ROCE_DISABLED);
}
EXPORT_SYMBOL_GPL(mlx5_nic_vport_disable_roce);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 08e99bd2cd77..32b0835d4491 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -777,6 +777,7 @@ struct mlx5_core_dev {
struct mlx5e_resources mlx5e_res;
struct {
struct mlx5_rsvd_gids reserved_gids;
+ atomic_t roce_en;
} roce;
#ifdef CONFIG_MLX5_FPGA
struct mlx5_fpga_device *fpga;
--
2.11.0
next prev parent reply other threads:[~2017-06-27 14:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 14:28 [pull request][net-next 00/16] Mellanox, mlx5 Innova IPsec offload Saeed Mahameed
2017-06-27 14:28 ` [net-next 01/16] net/mlx5: Set interface flags before cleanup in unload_one Saeed Mahameed
2017-06-27 14:28 ` [net-next 02/16] net/mlx5: Add reserved-gids support Saeed Mahameed
2017-06-27 14:28 ` Saeed Mahameed [this message]
2017-06-27 14:28 ` [net-next 04/16] IB/mlx5: Respect mlx5_core reserved GIDs Saeed Mahameed
2017-06-27 14:28 ` [net-next 05/16] net/mlx5: Make get_cqe routine not ethernet-specific Saeed Mahameed
2017-06-27 14:28 ` [net-next 06/16] net/mlx5: Add QP WQ support Saeed Mahameed
2017-06-27 14:28 ` [net-next 07/16] net/mlx5: FPGA, Move FPGA init/cleanup to init_once Saeed Mahameed
2017-06-27 14:28 ` [net-next 08/16] net/mlx5: FPGA, Add FW commands for FPGA QPs Saeed Mahameed
2017-06-27 14:28 ` [net-next 09/16] net/mlx5: FPGA, Add high-speed connection routines Saeed Mahameed
2017-06-27 14:28 ` [net-next 10/16] net/mlx5: FPGA, Add SBU bypass and reset flows Saeed Mahameed
2017-06-27 14:28 ` [net-next 11/16] net/mlx5: FPGA, Add SBU infrastructure Saeed Mahameed
2017-06-27 14:28 ` [net-next 12/16] net/mlx5: Accel, Add IPSec acceleration interface Saeed Mahameed
2017-06-27 14:28 ` [net-next 13/16] net/mlx5e: IPSec, Innova IPSec offload infrastructure Saeed Mahameed
2017-06-27 14:28 ` [net-next 14/16] net/mlx5e: IPSec, Add Innova IPSec offload RX data path Saeed Mahameed
2017-06-27 14:28 ` [net-next 15/16] net/mlx5e: IPSec, Add Innova IPSec offload TX " Saeed Mahameed
2017-06-27 14:28 ` [net-next 16/16] net/mlx5e: IPSec, Add IPSec ethtool stats Saeed Mahameed
2017-06-29 16:34 ` [pull request][net-next 00/16] Mellanox, mlx5 Innova IPsec offload 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=20170627142856.9448-4-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=borisp@mellanox.com \
--cc=davem@davemloft.net \
--cc=ilant@mellanox.com \
--cc=kliteyn@mellanox.com \
--cc=leonro@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
--cc=steffen.klassert@secunet.com \
--cc=yossiku@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).