From patchwork Mon Apr 10 08:22:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 9672069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1DB8B60244 for ; Mon, 10 Apr 2017 08:22:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D9BC22701 for ; Mon, 10 Apr 2017 08:22:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02BBB26530; Mon, 10 Apr 2017 08:22:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CEA722701 for ; Mon, 10 Apr 2017 08:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdDJIWU (ORCPT ); Mon, 10 Apr 2017 04:22:20 -0400 Received: from mail.kernel.org ([198.145.29.136]:33772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751801AbdDJIWU (ORCPT ); Mon, 10 Apr 2017 04:22:20 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01BD52035B; Mon, 10 Apr 2017 08:22:19 +0000 (UTC) Received: from localhost (unknown [213.57.247.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C8362034A; Mon, 10 Apr 2017 08:22:15 +0000 (UTC) From: Leon Romanovsky To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Niranjana Vishwanathapura , Alex Vesker , Erez Shitrit , Leon Romanovsky Subject: [PATCH rdma-next V2 1/6] IB/IPoIB: Introduce RDMA netdev interface and IPoIB structs Date: Mon, 10 Apr 2017 11:22:25 +0300 Message-Id: <20170410082230.10662-2-leonro@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170410082230.10662-1-leonro@mellanox.com> References: <20170410082230.10662-1-leonro@mellanox.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Niranjana Vishwanathapura 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: Erez Shitrit Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Leon Romanovsky --- include/rdma/ib_verbs.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- 2.12.0 -- 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 diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 99e4423eb2b8..c155762cc2b4 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -1862,6 +1863,35 @@ 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; @@ -2115,6 +2145,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;