All of lore.kernel.org
 help / color / mirror / Atom feed
From: Erez Shitrit <erezsh@mellanox.com>
To: dledford@redhat.com
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	valex@mellanox.com, leonro@mellanox.com, saedm@mellanox.com,
	erezsh@dev.mellanox.co.il, Erez Shitrit <erezsh@mellanox.com>
Subject: [RFC v1 for accelerated IPoIB 10/25] net/mlx5e: Support netdevice creation for IB link type
Date: Mon, 13 Mar 2017 20:31:21 +0200	[thread overview]
Message-ID: <1489429896-10781-11-git-send-email-erezsh@mellanox.com> (raw)
In-Reply-To: <1489429896-10781-1-git-send-email-erezsh@mellanox.com>


Implement required interface that will able the IB link to be run on top
of the ETH data structures.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 98 +++++++++++++++++++++++
 include/linux/mlx5/driver.h                       | 12 +++
 2 files changed, 110 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 88541f99d37b..3db0334cdba0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3843,6 +3843,104 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
 	mlx5_lag_remove(mdev);
 }
 
+static void mlx5i_nic_init(struct mlx5_core_dev *mdev,
+			   struct net_device *netdev,
+			   const struct mlx5e_profile *profile,
+			   void *ppriv)
+{
+	struct mlx5e_priv *priv = ipoib_dev_priv(netdev);
+
+	mlx5n_build_nic_netdev_priv_common(mdev, netdev, priv, profile, ppriv);
+}
+
+static int mlx5i_init_nic_rx(struct mlx5e_priv *priv)
+{
+	struct mlx5_core_dev *mdev = priv->mdev;
+	int err;
+
+	err = mlx5n_init_nic_rx_common(priv);
+	if (err) {
+		mlx5_core_warn(mdev, "failed create nic rx res, %d\n", err);
+		return err;
+	}
+
+	err = mlx5i_create_flow_steering(priv);
+	if (err) {
+		mlx5_core_warn(mdev, "create flow steering failed, %d\n", err);
+		return err;
+	}
+
+	return 0;
+}
+
+static void mlx5i_cleanup_nic_rx(struct mlx5e_priv *priv)
+{
+	mlx5i_destroy_flow_steering(priv);
+	mlx5n_cleanup_nic_rx_common(priv);
+}
+
+static const struct mlx5e_profile mlx5i_nic_profile = {
+	.init		   = mlx5i_nic_init,
+	.cleanup	   = NULL,
+	.init_rx	   = mlx5i_init_nic_rx,
+	.cleanup_rx	   = mlx5i_cleanup_nic_rx,
+	.init_tx	   = mlx5e_init_nic_tx,
+	.cleanup_tx	   = mlx5e_cleanup_nic_tx,
+	.enable		   = NULL,/*mlx5e_nic_enable,*/
+	.disable	   = NULL,
+	.update_stats	   = NULL,/*mlx5e_update_stats,*/
+	.max_nch	   = mlx5e_get_max_num_channels,
+	.max_tc		   = MLX5E_MAX_NUM_TC,
+};
+
+struct net_device *mlx5i_create_netdev(struct mlx5_core_dev *mdev,
+				       const char *name,
+				       void (*setup)(struct net_device *dev),
+				       struct mlx5i_create_ext_param *param)
+{
+	const struct mlx5e_profile *profile = &mlx5i_nic_profile;
+	int nch = profile->max_nch(mdev);
+	struct net_device *netdev;
+	struct mlx5e_priv *priv;
+
+	if (mlx5e_check_required_hca_cap(mdev, MLX5_INTERFACE_PROTOCOL_IB))
+		return NULL;
+
+	netdev = alloc_netdev_mqs(sizeof(struct mlx5e_priv) + param->size_base_priv,
+				  name, NET_NAME_UNKNOWN,
+				  setup,
+				  nch * MLX5E_MAX_NUM_TC,
+				  nch);
+	if (!netdev) {
+		pr_err("alloc_netdev_mqs failed\n");
+		return NULL;
+	}
+
+	if (profile->init)
+		profile->init(mdev, netdev, profile, &param->size_base_priv);
+
+	netif_carrier_off(netdev);
+
+	priv = ipoib_dev_priv(netdev);
+
+	priv->underlay_qpn = param->qpn;
+
+	priv->wq = create_singlethread_workqueue("mlx5i");
+	if (!priv->wq)
+		goto err_cleanup_nic;
+
+	return netdev;
+
+err_cleanup_nic:
+	if (profile->cleanup)
+		profile->cleanup(priv);
+
+	free_netdev(netdev);
+
+	return NULL;
+}
+EXPORT_SYMBOL(mlx5i_create_netdev);
+
 static const struct mlx5e_profile mlx5e_nic_profile = {
 	.init		   = mlx5e_nic_init,
 	.cleanup	   = mlx5e_nic_cleanup,
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 886ff2b00500..d0060cfb2a4f 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -48,6 +48,7 @@
 #include <linux/mlx5/device.h>
 #include <linux/mlx5/doorbell.h>
 #include <linux/mlx5/srq.h>
+#include <rdma/ib_ipoib_accel_ops.h>
 
 enum {
 	MLX5_BOARD_ID_LEN = 64,
@@ -1127,4 +1128,15 @@ enum {
 	MLX5_TRIGGERED_CMD_COMP = (u64)1 << 32,
 };
 
+struct mlx5i_create_ext_param {
+	int	size_base_priv;
+	u32	qpn;
+};
+
+struct net_device *mlx5i_create_netdev(struct mlx5_core_dev *mdev,
+				       const char *name,
+				       void (*setup)(struct net_device *dev),
+				       struct mlx5i_create_ext_param *param);
+int mlx5i_attach(struct mlx5_core_dev *mdev, void *vpriv);
+void mlx5i_detach(struct mlx5_core_dev *mdev, void *vpriv);
 #endif /* MLX5_DRIVER_H */
-- 
1.8.3.1

  parent reply	other threads:[~2017-03-13 18:31 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 18:31 [RFC v1 for accelerated IPoIB 00/25] Enhanced mode for IPoIB driver Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 01/25] IB/ipoib: Separate control and data related initializations Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 02/25] IB/ipoib: separate control from HW operation on ipoib_open/stop ndo Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 03/25] IB/ipoib: Rename qpn to dqpn in ipoib_send and post_send functions Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 04/25] IB/verb: Add ipoib_options struct and API Erez Shitrit
     [not found]   ` <1489429896-10781-5-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-03-13 20:01     ` Jason Gunthorpe
2017-03-14  7:01       ` Vishwanathapura, Niranjana
2017-03-14 13:25         ` Erez Shitrit
2017-03-14 16:11         ` Jason Gunthorpe
     [not found]           ` <20170314161149.GA15752-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-15  6:30             ` Leon Romanovsky
2017-03-15  6:30               ` Leon Romanovsky
     [not found]               ` <20170315063043.GC2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-15 16:40                 ` Vishwanathapura, Niranjana
     [not found]                   ` <20170315164050.GA81782-wPcXA7LoDC+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-03-15 16:52                     ` Erez Shitrit
     [not found]       ` <20170313200136.GA2738-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-14 13:25         ` Erez Shitrit
     [not found]           ` <CAAk-MO8dZJKYgpWT8p1fz0O6y2wTx4jxoJhYf21ikMOef_xUMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-14 19:03             ` Vishwanathapura, Niranjana
     [not found]               ` <20170314190300.GA80705-wPcXA7LoDC+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-03-15  6:27                 ` Leon Romanovsky
     [not found]                   ` <20170315062728.GB2079-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-15 16:42                     ` Vishwanathapura, Niranjana
2017-03-16 15:17       ` Erez Shitrit
2017-03-16 16:04         ` Jason Gunthorpe
2017-03-14  6:44     ` Vishwanathapura, Niranjana
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 05/25] IB/ipoib: Support ipoib acceleration options callbacks Erez Shitrit
2017-03-13 20:10   ` Jason Gunthorpe
     [not found]     ` <20170313201049.GB2738-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-14 14:39       ` Erez Shitrit
     [not found]         ` <CAAk-MO8-bnWRu7BDtYDhNePj+76X4Vb7gFNhED8irLNtqR7tCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-14 16:06           ` Jason Gunthorpe
     [not found]             ` <20170314160616.GE3244-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-15 16:27               ` Erez Shitrit
     [not found]                 ` <CAAk-MO96BbTnn=gzdZhRpQUENn=AVUJv1JhPbrSYrNHOrbFVeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-15 16:46                   ` Jason Gunthorpe
     [not found]   ` <1489429896-10781-6-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-03-14  6:35     ` Vishwanathapura, Niranjana
     [not found]       ` <20170314063538.GB79937-wPcXA7LoDC+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-03-14 14:42         ` Erez Shitrit
2017-03-14 16:00           ` Jason Gunthorpe
     [not found]             ` <20170314160021.GD3244-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-15  6:47               ` Leon Romanovsky
2017-03-15  6:47                 ` Leon Romanovsky
2017-03-15 15:58                 ` Jason Gunthorpe
     [not found]                   ` <20170315155802.GB29562-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-15 17:39                     ` Leon Romanovsky
2017-03-15 17:39                       ` Leon Romanovsky
2017-03-15 10:11               ` Erez Shitrit
2017-03-14 15:44       ` Jason Gunthorpe
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 06/25] hw/mlx5: Add New bit to check over QP creation Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 07/25] linux/mlx5/mlx5_ifc.h: Add underlay_qpn field to PRM objects Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 08/25] net/mlx5e: Refactor EN code to support IB link Erez Shitrit
2017-03-13 18:31 ` Erez Shitrit [this message]
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 14/25] net/mlx5: Enable flow-steering for " Erez Shitrit
2017-03-15 18:56   ` Leon Romanovsky
2017-03-15 18:56     ` Leon Romanovsky
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 15/25] net/mlx5e: Enhanced flow table creation to support ETH and IB links Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 16/25] net/mlx5e: Change cleanup API in order to enable IB link Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 21/25] net/mlx5e: Export send function for IB link type Erez Shitrit
     [not found] ` <1489429896-10781-1-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 09/25] net/mlx5e: Creating and Destroying flow-steering tables for IB link Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 11/25] net/mlx5e: Refactor attach_netdev API Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 12/25] net/mlx5e: Use underlay_qpn in tis creation Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 13/25] net/mlx5e: Export resource creation function to be used in IB link Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 17/25] net/mlx5e: Change mlx5e_open_locked and mlx5e_close_locked api Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 18/25] net/mlx5e: Export open/close api for IB link Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 19/25] include/linux/mlx5: Add mlx5_wqe_eth_pad and enhanced-ipoib-qp-mode Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 20/25] net/mlx5e: Refactor TX send flow Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 22/25] net/mlx5e: New function pointer for build_rx_skb is Erez Shitrit
2017-03-13 18:31   ` [RFC v1 for accelerated IPoIB 23/25] net/mlx5e: Change the function that checks the packet type Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 24/25] net/mlx5e: Add support for build_rx_skb for packet from IB type Erez Shitrit
2017-03-13 18:31 ` [RFC v1 for accelerated IPoIB 25/25] mlx5_ib: skeleton for mlx5_ib to support ipoib_ops Erez Shitrit
     [not found]   ` <1489429896-10781-26-git-send-email-erezsh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-03-13 20:27     ` Jason Gunthorpe
     [not found]       ` <20170313202720.GC2738-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-14 14:53         ` Erez Shitrit
2017-03-14 16:10           ` Jason Gunthorpe
2017-03-14 16:37             ` Erez Shitrit
     [not found]             ` <20170314161013.GF3244-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-15  8:42               ` Erez Shitrit
2017-03-14  6:07   ` Vishwanathapura, Niranjana
     [not found]     ` <20170314060730.GA79937-wPcXA7LoDC+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2017-03-14 14:55       ` Erez Shitrit

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=1489429896-10781-11-git-send-email-erezsh@mellanox.com \
    --to=erezsh@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=erezsh@dev.mellanox.co.il \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saedm@mellanox.com \
    --cc=valex@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.