diff mbox

[rdma-next,1/6] IB/IPoIB: Introduce RDMA netdev interface and IPoIB structs

Message ID 20170404191732.31895-2-leon@kernel.org (mailing list archive)
State Superseded
Headers show

Commit Message

Leon Romanovsky April 4, 2017, 7:17 p.m. UTC
Add RDMA netdev interface to ib device structure allowing RDMA netdev
devices to be allocated by ib clients.

The idea is to allow to providers to optimize IPoIB data path.
New struct that includes functions and data member is exposed.
It exposes set of callback functions for handling data path flows
in IPoIB driver.

Each provider can support these set of functions in order to optimize its
specific data path, and let IPoIB to leverage its data path.

There is an assumption, that providers should give the full set of functions
and not only part of them, in order to work properly.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
---
 include/rdma/ib_verbs.h | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

Comments

Jason Gunthorpe April 4, 2017, 7:37 p.m. UTC | #1
On Tue, Apr 04, 2017 at 10:17:27PM +0300, Leon Romanovsky wrote:
>  struct ib_device {
> +	/* Do not access @dma_device directly from ULP nor from HW drivers. */
> +	struct device                *dma_device;
> +

Why is this hunk in this patch? I thought Bart was taking care of this
topic?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche April 4, 2017, 7:48 p.m. UTC | #2
On Tue, 2017-04-04 at 13:37 -0600, Jason Gunthorpe wrote:
> On Tue, Apr 04, 2017 at 10:17:27PM +0300, Leon Romanovsky wrote:
> >  struct ib_device {
> > +	/* Do not access @dma_device directly from ULP nor from HW drivers. */
> > +	struct device                *dma_device;
> > +
> 
> Why is this hunk in this patch? I thought Bart was taking care of this
> topic?

That hunk is already upstream. See also commit 0957c29f78af.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky April 4, 2017, 7:56 p.m. UTC | #3
On Tue, Apr 04, 2017 at 01:37:30PM -0600, Jason Gunthorpe wrote:
> On Tue, Apr 04, 2017 at 10:17:27PM +0300, Leon Romanovsky wrote:
> >  struct ib_device {
> > +	/* Do not access @dma_device directly from ULP nor from HW drivers. */
> > +	struct device                *dma_device;
> > +
>
> Why is this hunk in this patch? I thought Bart was taking care of this
> topic?

This patch set is based on -rc3, Bart's commit is available in -rc4.
➜  linux-rdma git:(topic/ipoib-accel) git describe 0957c29f78af
v4.11-rc3-10-g0957c29f78af

>
> Jason
diff mbox

Patch

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0f1813c13687..d3b104a96b58 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -55,6 +55,7 @@ 
 #include <net/ip.h>
 #include <linux/string.h>
 #include <linux/slab.h>
+#include <linux/netdevice.h>
 
 #include <linux/if_link.h>
 #include <linux/atomic.h>
@@ -1862,7 +1863,38 @@  struct ib_port_immutable {
 	u32                           max_mad_size;
 };
 
+/* rdma netdev type - specifies protocol type */
+enum rdma_netdev_t {
+	RDMA_NETDEV_IPOIB,
+};
+
+/*
+ * struct rdma_netdev - rdma netdev
+ * For cases where netstack interfacing is required.
+ */
+struct rdma_netdev {
+	void *clnt_priv;
+
+	/* control functions */
+	void (*set_id)(struct net_device *netdev, int id);
+	/* send packet */
+	int (*send)(struct net_device *dev, struct sk_buff *skb,
+		    struct ib_ah *address, u32 dqpn);
+	/* multicast */
+	int (*attach_mcast)(struct net_device *dev, struct ib_device *hca,
+			    union ib_gid *gid, u16 mlid,
+			    int set_qkey, u32 qkey);
+	int (*detach_mcast)(struct net_device *dev, struct ib_device *hca,
+			    union ib_gid *gid, u16 mlid);
+
+	/* rdma-netdev private members */
+	struct ib_device *hca;
+};
+
 struct ib_device {
+	/* Do not access @dma_device directly from ULP nor from HW drivers. */
+	struct device                *dma_device;
+
 	char                          name[IB_DEVICE_NAME_MAX];
 
 	struct list_head              event_handler_list;
@@ -2112,6 +2144,15 @@  struct ib_device {
 							   struct ib_rwq_ind_table_init_attr *init_attr,
 							   struct ib_udata *udata);
 	int                        (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *wq_ind_table);
+	/* rdma netdev operations */
+	struct net_device *(*alloc_rdma_netdev)(
+					struct ib_device *device,
+					u8 port_num,
+					enum rdma_netdev_t type,
+					const char *name,
+					unsigned char name_assign_type,
+					void (*setup)(struct net_device *));
+	void (*free_rdma_netdev)(struct net_device *netdev);
 
 	struct module               *owner;
 	struct device                dev;