From patchwork Fri Jan 21 11:41:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Walukiewicz, Miroslaw" X-Patchwork-Id: 494811 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0LBdkvv016318 for ; Fri, 21 Jan 2011 11:41:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753847Ab1AULlu (ORCPT ); Fri, 21 Jan 2011 06:41:50 -0500 Received: from mga11.intel.com ([192.55.52.93]:14033 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752954Ab1AULlt convert rfc822-to-8bit (ORCPT ); Fri, 21 Jan 2011 06:41:49 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 21 Jan 2011 03:41:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.60,357,1291622400"; d="scan'208";a="649638348" Received: from irsmsx601.ger.corp.intel.com ([163.33.7.164]) by fmsmga002.fm.intel.com with ESMTP; 21 Jan 2011 03:41:47 -0800 Received: from irsmsx501.ger.corp.intel.com (163.33.7.70) by irsmsx601.ger.corp.intel.com (163.33.7.164) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 21 Jan 2011 11:41:47 +0000 Received: from irsmsx503.ger.corp.intel.com ([163.33.7.254]) by irsmsx501.ger.corp.intel.com ([163.33.7.70]) with mapi; Fri, 21 Jan 2011 11:41:46 +0000 From: "Walukiewicz, Miroslaw" To: Roland Dreier CC: Or Gerlitz , Jason Gunthorpe , "Hefty, Sean" , "linux-rdma@vger.kernel.org" Date: Fri, 21 Jan 2011 11:41:44 +0000 Subject: RE: ibv_post_send/recv kernel path optimizations Thread-Topic: ibv_post_send/recv kernel path optimizations Thread-Index: AcuxBlwVd0XDwEXRRdmv0U1CyDgmLwIWFkfg Message-ID: References: <20101013091312.GB6060@bicker> <20101123071025.GI1522@bicker> <20101124221845.GH2369@obsidianresearch.com> <20101125041337.GA11049@obsidianresearch.com> <4CEE7A22.2040706@voltaire.com> <4CF60343.7050602@voltaire.com> <20101214181735.GA2506@obsidianresearch.com> <4D1888CB.2010101@Voltaire.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 21 Jan 2011 11:41:51 +0000 (UTC) --- ../SOURCES_19012011/ofa_kernel-1.5.3/drivers/infiniband/core/uverbs_cmd.c 2011-01-19 05:37:55.000000000 +0100 +++ ofa_kernel-1.5.3_idr_qp/drivers/infiniband/core/uverbs_cmd.c 2011-01-21 04:10:07.000000000 +0100 @@ -1449,15 +1449,29 @@ if (cmd.wqe_size < sizeof (struct ib_uverbs_send_wr)) return -EINVAL; + qp = idr_read_qp(cmd.qp_handle, file->ucontext); + if (!qp) + goto out_raw_qp; + + if (qp->qp_type == IB_QPT_RAW_ETH) { + resp.bad_wr = 0; + ret = qp->device->post_send(qp, NULL, NULL); + if (ret) + resp.bad_wr = cmd.wr_count; + + if (copy_to_user((void __user *) (unsigned long) + cmd.response, + &resp, + sizeof resp)) + ret = -EFAULT; + put_qp_read(qp); + goto out_raw_qp; + } user_wr = kmalloc(cmd.wqe_size, GFP_KERNEL); if (!user_wr) return -ENOMEM; - qp = idr_read_qp(cmd.qp_handle, file->ucontext); - if (!qp) - goto out; - is_ud = qp->qp_type == IB_QPT_UD; sg_ind = 0; last = NULL; @@ -1577,9 +1591,8 @@ wr = next; } -out: kfree(user_wr); - +out_raw_qp: return ret ? ret : in_len; } @@ -1681,16 +1694,31 @@ if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; + qp = idr_read_qp(cmd.qp_handle, file->ucontext); + if (!qp) + goto out_raw_qp; + + if (qp->qp_type == IB_QPT_RAW_ETH) { + resp.bad_wr = 0; + ret = qp->device->post_recv(qp, NULL, NULL); + if (ret) + resp.bad_wr = cmd.wr_count; + + if (copy_to_user((void __user *) (unsigned long) + cmd.response, + &resp, + sizeof resp)) + ret = -EFAULT; + put_qp_read(qp); + goto out_raw_qp; + } + wr = ib_uverbs_unmarshall_recv(buf + sizeof cmd, in_len - sizeof cmd, cmd.wr_count, cmd.sge_count, cmd.wqe_size); if (IS_ERR(wr)) return PTR_ERR(wr); - qp = idr_read_qp(cmd.qp_handle, file->ucontext); - if (!qp) - goto out; - resp.bad_wr = 0; ret = qp->device->post_recv(qp, wr, &bad_wr); @@ -1707,13 +1735,13 @@ &resp, sizeof resp)) ret = -EFAULT; -out: while (wr) { next = wr->next; kfree(wr); wr = next; } +out_raw_qp: return ret ? ret : in_len; }