From patchwork Fri Jan 29 23:16:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 8168671 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3ECED9F96D for ; Fri, 29 Jan 2016 23:18:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F394F20381 for ; Fri, 29 Jan 2016 23:18:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7C6420328 for ; Fri, 29 Jan 2016 23:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754786AbcA2XSb (ORCPT ); Fri, 29 Jan 2016 18:18:31 -0500 Received: from mail-by2on0075.outbound.protection.outlook.com ([207.46.100.75]:12125 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753397AbcA2XS3 (ORCPT ); Fri, 29 Jan 2016 18:18:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wmD9mbw3EgdJy/MVCQt51FoNDHEsv/x+3rG9oNyxtA8=; b=QA7LZNiVm9QyOIXwFv/RdrtTPtNouHBCJn2uKh9CYzXGY1kU5IV/X9ls+fhifXylT6/itb3UxfNdA/cIrc1Rjc8U96xTpGY9/wDbWmth9f3BScTyhTUO7HHu0d0UaKaUR20jX0rnIEkr0dehNe2cCE9jOpN3fKt5jj5fTE6nT8I= Received: from BN1PR02CA0032.namprd02.prod.outlook.com (10.141.56.32) by BN1PR0201MB0820.namprd02.prod.outlook.com (10.160.170.152) with Microsoft SMTP Server (TLS) id 15.1.390.13; Fri, 29 Jan 2016 23:18:26 +0000 Received: from BN1BFFO11FD050.protection.gbl (2a01:111:f400:7c10::1:109) by BN1PR02CA0032.outlook.office365.com (2a01:111:e400:2a::32) with Microsoft SMTP Server (TLS) id 15.1.390.13 via Frontend Transport; Fri, 29 Jan 2016 23:18:26 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.172) smtp.mailfrom=sandisk.com; mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.172 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.172; helo=milsmgep11.sandisk.com; Received: from milsmgep11.sandisk.com (63.163.107.172) by BN1BFFO11FD050.mail.protection.outlook.com (10.58.145.5) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Fri, 29 Jan 2016 23:18:26 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by (Symantec Messaging Gateway) with SMTP id F7.50.29304.143FBA65; Fri, 29 Jan 2016 15:18:25 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Fri, 29 Jan 2016 15:16:31 -0800 X-AuditID: ac160a68-f37ff70000007278-bb-56abf341d8ee Received: from [10.60.52.49] ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 7A.9C.03910.FC2FBA65; Fri, 29 Jan 2016 15:16:31 -0800 (PST) Subject: [PATCH v2 15/22] IB/srpt: Eliminate srpt_find_channel() To: Doug Ledford References: <56ABF16E.7070006@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , "Alex Estrin" , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <56ABF2CF.7040007@sandisk.com> Date: Fri, 29 Jan 2016 15:16:31 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <56ABF16E.7070006@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKLMWRmVeSWpSXmKPExsWyRoxnka7j59VhBmtXKFlcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGsVlk5Kak1mW WqRvl8CV8f3pbqaCw/oVpzbMZGtgvKvWxcjBISFgIjHpbwGIKSSwiVFie1UXIxeQuYNR4vyf iUxdjJxgJbtP/GKBSMxhlPjQdpQRJCEs4CDx+vVXsCIRATWJTa8WsYPYQgJaEucufGEHaWAW WMUosenqdbAEm4CRxLf3M1lAbF6gondPXoI1swioShyZOg1sqKhAhMThzi52iBpBiZMzn4DV cwpoSyyZfYEF5FJmAU2J9bv0QcLMAvIS29/OYQbZJSFwkFVi3t5+Rogj1CVOLpnPNIFReBaS UbMQ2mchaV/AyLyKUSw3M6c4Nz21wNBQrzgxLyWzOFsvOT93EyM4MrgydjBunWR+iFGAg1GJ h9dj2eowIdbEsuLK3EOMEhzMSiK8dS+AQrwpiZVVqUX58UWlOanFhxilOViUxHmtW9TChATS E0tSs1NTC1KLYLJMHJxSDYwcUjc/y59bbTJ5Ls8PJYf3X7+V3988uVVzztZzwdubGwyzn39R bMk4KR/2KohT92Ejy/up8xNUhF99/5n3PszfZdv6d788p980XifZ1/j1nwzDE7kFNf0SSrdP uAWXrC5mE7KoWqA3+YmovUInT1iVqpz+g/OzdfZaR2TI921eKVnXosrtZ6nEUpyRaKjFXFSc CAAwaFiiiAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPJMWRmVeSWpSXmKPExsXCtZEjRff8p9VhBnvmSlhcePqdyeLl+Q+s FitXH2WyeHaol8XiRtsDNgdWj8V7XjJ57L7ZwObxbPphJo/3+66yeXzeJBfAGs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; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(2980300002)(438002)(189002)(199003)(4326007)(47776003)(1096002)(50466002)(19580405001)(80316001)(189998001)(87936001)(33656002)(83506001)(92566002)(2906002)(23676002)(86362001)(59896002)(5001960100002)(65806001)(11100500001)(1220700001)(87266999)(36756003)(64126003)(230700001)(110136002)(54356999)(2950100001)(106466001)(76176999)(77096005)(19580395003)(65956001)(4001350100001)(65816999)(50986999)(586003)(5008740100001)(229853001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0820; H:milsmgep11.sandisk.com; FPR:; SPF:Pass; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 2:YeGcD1JNgQKkTWgkUQc3klto8f96NvU7b7Mb5UBYexe2QmIg/S3/uEjrh/A/LtJ6CuqHxHKOvqrA3lDkqt04aN+MIwBs5l90o6fQ5xOsv0kF/XvGSgFWHiSB540V/fdOrGveEOWRljlHKOm+ECZ16Q==; 3:Xy0UqiMxZADdv83s4XV87bzfBvRdMzWPb448fzcPghcDjx9fl1bz8+7rlLnnKhyJqxGX4JJckpg8crClRyYGuJvJDToaqutZoIyt0FBKBNca+jZ8Yq6vOMRHUW2iwDzoosJsLHMWCyN+aX41EY2Tm2MwhgK98gJj1puXyq72v/pSy3fZgCtxqC6yDPWP4rAWpNHw2ql6J7LgcsA7iAj7ML0IxD0nqgmI8FSZ7eqePqCwYQdvXIiFot321ZHrzIf8/yW2OIs2MEPVZvt+bLzX0Q==; 25:GhMFtvdscVpmz/qYh8lDJd77EZnmDEP4pXFE2kLIk24PXlSOLDbiNQFbO5LEWYNN7vIg+7zkl0/4HLXKukHz+Y0LVLmjcMh4Bm5jknLLHGmGpmAH21fWpldG33ooz3T7Y+6DWcQUwmPaTzyuRsPjMFHlY03fJvCckpcBZujcQesnVb7PqP31LLwy5Lg+NAL9MQ4aoqwI73xV+o8zxjeeAlL61E28BvZJS/n4JB0cqzvSby6QuBuTMq5ZU05EGoQM X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BN1PR0201MB0820; X-MS-Office365-Filtering-Correlation-Id: 2fca74f0-c830-4708-c264-08d329027dc2 X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 20:AYCr6ZVGNsgdrBhSrk8qkm6U6XIe6yxQddfyLpKYa3DHxqRGaxVHlRrZ4ag4OxAeYnBvR0XHvghfFaleTdDBl5liSkaVIo5HuKWudjfnh4zuRubq8U2NXjR7dOWinePIbHDUa6p5rUQmzhuJzxDPk6s9zyRDwrJT1rEXYVSlRW4SxWTjEHCjIiOcutI1AITzLsyWqKWJIr7Z8tkkeCnMRtpirnsoUuy4rYY6Cz3XddM9anN5MCRD51ONj9TFaAOUaYrzusN+M88NB+cRGTpqQWolt1xVG11fBEv9SMjiH5NhiAOLAmVqMKvxQQ1xoCyQJ2c1sYUhuN6TdDZqx2S9sJC3/4onAL3Hkyk3+rdM4BbqcUgUQjbWYu3CBPWjWXxTvMOxRknWfalHctP60gszIbWkJbGaBj+Gkkiq/dsumIu+9dZK8DJmutnZ9WJgZbHmV50VQulxlCur68C98Ao7gf+ZfivYAIq0heTCkXHcpZyKYTbA7OiKUX7SSs+hBQeN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(34787635062028)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13024025)(8121501046)(13023025)(13015025)(5005006)(13017025)(3002001)(10201501046); SRVR:BN1PR0201MB0820; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0820; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 4:zqgj7aa9y41KNBkfgQ5Q/Nbt9iuVjL74dvsVnaNm/Irfo4KHjf18vR1T9zkbw0ytFbYLnIALCsEFKsqyMthONPXbHBDOSYeLj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BYnMxamlLZW05Smw5?= =?utf-8?B?czhtaEFNL1U5anhRNkYyYXlxOUEySEorV09CSWlxVGxrYmFBNC91N1pvbUZ3?= =?utf-8?B?Rkg1Ri81T1dRd2ZEbURDeVRmM0QyY2xlSTZRWS8yeFRuTGk5OTlvU0lLelFj?= =?utf-8?B?NVRpLy8rR01MOWtjbURzV3dzQUNiNXJLcHhCc1c0TWo5d09VZGpuTllZNGtZ?= =?utf-8?B?ZHJpcGdEWUdZM3lReXJ4TThuODJHeC93cUJMbmhpa25WbUdwMjFWU1VYNTUx?= =?utf-8?Q?WlrQd1nZxVD/MLIYLC4CSz?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0820; 5:b/H1IB/UIZEk/SrhPtRLt63eotbyc0NjK36xrwavwNEWb87wLtM5M/DDcWXUTxnEar7kqbPN3FEhUZspW/3L7rqrciXgtyTuZMKwYqDcGB7sKptfxn+AxIrP23LgGdXqYZMkQDlIFmkVBhnGN8hTKw==; 24:xd+wnXzwQMNwr5bKcvGSQ5+uj1lhk2+137liESG5FW7fzSgNGzsuSUxkuRHGZT2nnmnlXEQgVZv453LgT5F1n675+WhoH8pQDpCt9owQeQo=; 20:3t+TMcsicUMwkiGMWLeHBO8ON49fgPmN3xxGmGAB/ywa6qXvH/xL2kWLpW7t4k49xPspJGGvpHpxYw+4n22qkEbAfYHoVFGoN5ArXcx1sTC/ebzkdHOgRK6kHb7XQbmZyVHbuOpwIIFJ5uMRgk7SJzzpaknlACYuF4eMZlxTYIWqxWiL3gGt1IPCs1jOSK49uaZQufefKUsjjFuS43OeVwKCS/xc536oFoSMpb+QM3SMMs6v7jQHZVz/aZ0pYXbM SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2016 23:18:26.0501 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.172]; Helo=[milsmgep11.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0820 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the CM REQ message handler, store the channel pointer in cm_id->context such that the function srpt_find_channel() is no longer needed. Additionally, make the CM event messages more informative. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg Reviewed-by: Christoph Hellwig --- drivers/infiniband/ulp/srpt/ib_srpt.c | 94 +++++++++++------------------------ 1 file changed, 29 insertions(+), 65 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 5e4fee7..93f6800 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1890,25 +1890,14 @@ static int srpt_shutdown_session(struct se_session *se_sess) * ib_destroy_cm_id(), which locks the cm_id spinlock and hence waits until * this function has finished). */ -static void srpt_drain_channel(struct ib_cm_id *cm_id) +static void srpt_drain_channel(struct srpt_rdma_ch *ch) { - struct srpt_device *sdev; - struct srpt_rdma_ch *ch; int ret; bool do_reset = false; WARN_ON_ONCE(irqs_disabled()); - sdev = cm_id->context; - BUG_ON(!sdev); - spin_lock_irq(&sdev->spinlock); - list_for_each_entry(ch, &sdev->rch_list, list) { - if (ch->cm_id == cm_id) { - do_reset = srpt_set_ch_state(ch, CH_DRAINING); - break; - } - } - spin_unlock_irq(&sdev->spinlock); + do_reset = srpt_set_ch_state(ch, CH_DRAINING); if (do_reset) { if (ch->sess) @@ -1922,34 +1911,6 @@ static void srpt_drain_channel(struct ib_cm_id *cm_id) } /** - * srpt_find_channel() - Look up an RDMA channel. - * @cm_id: Pointer to the CM ID of the channel to be looked up. - * - * Return NULL if no matching RDMA channel has been found. - */ -static struct srpt_rdma_ch *srpt_find_channel(struct srpt_device *sdev, - struct ib_cm_id *cm_id) -{ - struct srpt_rdma_ch *ch; - bool found; - - WARN_ON_ONCE(irqs_disabled()); - BUG_ON(!sdev); - - found = false; - spin_lock_irq(&sdev->spinlock); - list_for_each_entry(ch, &sdev->rch_list, list) { - if (ch->cm_id == cm_id) { - found = true; - break; - } - } - spin_unlock_irq(&sdev->spinlock); - - return found ? ch : NULL; -} - -/** * srpt_release_channel() - Release channel resources. * * Schedules the actual release because: @@ -2131,6 +2092,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, memcpy(ch->t_port_id, req->target_port_id, 16); ch->sport = &sdev->port[param->port - 1]; ch->cm_id = cm_id; + cm_id->context = ch; /* * Avoid QUEUE_FULL conditions by limiting the number of buffers used * for the SRP protocol to the command queue size. @@ -2280,10 +2242,14 @@ out: return ret; } -static void srpt_cm_rej_recv(struct ib_cm_id *cm_id) +static void srpt_cm_rej_recv(struct srpt_rdma_ch *ch, + enum ib_cm_rej_reason reason, + const u8 *private_data, + u8 private_data_len) { - pr_info("Received IB REJ for cm_id %p.\n", cm_id); - srpt_drain_channel(cm_id); + pr_info("Received CM REJ for ch %s-%d; reason %d.\n", + ch->sess_name, ch->qp->qp_num, reason); + srpt_drain_channel(ch); } /** @@ -2292,14 +2258,10 @@ static void srpt_cm_rej_recv(struct ib_cm_id *cm_id) * An IB_CM_RTU_RECEIVED message indicates that the connection is established * and that the recipient may begin transmitting (RTU = ready to use). */ -static void srpt_cm_rtu_recv(struct ib_cm_id *cm_id) +static void srpt_cm_rtu_recv(struct srpt_rdma_ch *ch) { - struct srpt_rdma_ch *ch; int ret; - ch = srpt_find_channel(cm_id->context, cm_id); - BUG_ON(!ch); - if (srpt_set_ch_state(ch, CH_LIVE)) { struct srpt_recv_ioctx *ioctx, *ioctx_tmp; @@ -2318,16 +2280,13 @@ static void srpt_cm_rtu_recv(struct ib_cm_id *cm_id) /** * srpt_cm_dreq_recv() - Process reception of a DREQ message. */ -static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id) +static void srpt_cm_dreq_recv(struct srpt_rdma_ch *ch) { - struct srpt_rdma_ch *ch; unsigned long flags; bool send_drep = false; - ch = srpt_find_channel(cm_id->context, cm_id); - BUG_ON(!ch); - - pr_debug("cm_id= %p ch->state= %d\n", cm_id, ch->state); + pr_debug("ch %s-%d state %d\n", ch->sess_name, ch->qp->qp_num, + ch->state); spin_lock_irqsave(&ch->spinlock, flags); switch (ch->state) { @@ -2364,6 +2323,7 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id) */ static int srpt_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) { + struct srpt_rdma_ch *ch = cm_id->context; int ret; ret = 0; @@ -2373,27 +2333,31 @@ static int srpt_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) event->private_data); break; case IB_CM_REJ_RECEIVED: - srpt_cm_rej_recv(cm_id); + srpt_cm_rej_recv(ch, event->param.rej_rcvd.reason, + event->private_data, + IB_CM_REJ_PRIVATE_DATA_SIZE); break; case IB_CM_RTU_RECEIVED: case IB_CM_USER_ESTABLISHED: - srpt_cm_rtu_recv(cm_id); + srpt_cm_rtu_recv(ch); break; case IB_CM_DREQ_RECEIVED: - srpt_cm_dreq_recv(cm_id); + srpt_cm_dreq_recv(ch); break; case IB_CM_DREP_RECEIVED: - pr_info("Received InfiniBand DREP message for cm_id %p.\n", - cm_id); - srpt_drain_channel(cm_id); + pr_info("Received InfiniBand DREP message for ch %s-%d.\n", + ch->sess_name, ch->qp->qp_num); + srpt_drain_channel(ch); break; case IB_CM_TIMEWAIT_EXIT: - pr_info("Received IB TimeWait exit for cm_id %p.\n", cm_id); - srpt_drain_channel(cm_id); + pr_info("Received CM TimeWait exit for ch %s-%d.\n", + ch->sess_name, ch->qp->qp_num); + srpt_drain_channel(ch); break; case IB_CM_REP_ERROR: - pr_info("Received IB REP error for cm_id %p.\n", cm_id); - srpt_drain_channel(cm_id); + pr_info("Received CM REP error for ch %s-%d.\n", ch->sess_name, + ch->qp->qp_num); + srpt_drain_channel(ch); break; case IB_CM_DREQ_ERROR: pr_info("Received IB DREQ ERROR event.\n");