From patchwork Tue Jan 5 14:21:53 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: 7955291 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 E77AB9F38D for ; Tue, 5 Jan 2016 14:22:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF50D20384 for ; Tue, 5 Jan 2016 14:22:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D3372037E for ; Tue, 5 Jan 2016 14:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbcAEOWG (ORCPT ); Tue, 5 Jan 2016 09:22:06 -0500 Received: from mail-by2on0068.outbound.protection.outlook.com ([207.46.100.68]:47270 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751569AbcAEOWA (ORCPT ); Tue, 5 Jan 2016 09:22:00 -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=+XNmI7VObTpoOHw3IfIIjrRgxkLjBrgZzkB2d42Q8pI=; b=IUxhvD2RXbRl0CE8YltUH74oRcy5SaTCddsWuer2+WENvUZGJscZmEYHHjUV9e0+yxM8BU3l9wl/tHlxIqZpSSCGSQJAhGnH4Ni3h7gTSSEHhAkQACTMkY19NJadzuXyEUM3vX7h/gbo7xhHm/861bfFkzPv7bvVLt+AqcJkvEU= Received: from CY1PR0201CA0039.namprd02.prod.outlook.com (10.163.30.177) by BL2PR02MB290.namprd02.prod.outlook.com (10.141.90.145) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 14:21:57 +0000 Received: from BY2FFO11FD018.protection.gbl (2a01:111:f400:7c0c::112) by CY1PR0201CA0039.outlook.office365.com (2a01:111:e400:58b9::49) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 14:21:57 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BY2FFO11FD018.mail.protection.outlook.com (10.1.14.106) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 14:21:57 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 29.FD.02821.381DB865; Tue, 5 Jan 2016 06:21:55 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.248.2; Tue, 5 Jan 2016 06:21:55 -0800 X-AuditID: ac160a69-f797e6d000000b05-7d-568bd183cf6a Received: from [10.50.231.71] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id 72.EE.20697.281DB865; Tue, 5 Jan 2016 06:21:55 -0800 (PST) Subject: [PATCH 03/15] IB/srpt: Inline srpt_get_ch_state() To: Doug Ledford References: <568BD0FC.70207@sandisk.com> CC: Christoph Hellwig , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <568BD181.5040009@sandisk.com> Date: Tue, 5 Jan 2016 15:21:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <568BD0FC.70207@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsWyRoxnkW7zxe4wg52r1Cxenv/AarFy9VEm i2eHelkcmD1232xg83i/7yqbx+dNcgHMUVw2Kak5mWWpRfp2CVwZDy9OYCrYoVZxrLGFsYGx X76LkZNDQsBEYuKUtewQtpjEhXvr2boYuTiEBE4wSvz8e4AdwtnOKLFrx0QWmI5XR54zQSQ2 M0r82f+dDSQhLGAlce/nb7BRIgJqEpteLQKyOYCKNCTebc0CCTMLxEus+/SGEcRmEzCS+PZ+ JthMXgEtiQ37OsFsFgEViXtvL4ONERWIkPixYQkjRI2gxMmZT8BqOAU0Jf637gIbzwxkr9+l DzFeXmL72znMIKdJCCxjlehdCNErJKAucXLJfKYJjCKzkIyahdA+C0n7AkbmVYxiuZk5xbnp qQWGRnrFiXkpmcXZesn5uZsYwbHAlbmDccUk80OMAhyMSjy8HC+7woRYE8uKK3MPMUpwMCuJ 8L4+0h0mxJuSWFmVWpQfX1Sak1p8iFGag0VJnNe6RS1MSCA9sSQ1OzW1ILUIJsvEwSnVwGix vdV+B/cltxfub32WvfrzImwd89kbrBs5ZFhYtfMT3zwyXHSz5vf5ToXAbG3Omw2brCfMmBq3 +5/zZb/3kp5rD82qClsc/Xar6Jz/l2bXzmu+8y3zofSnZ91Kvxe8WKku+ra8q2HJ2YMT2+3n a248HMAZyOsf7Xf+5ir1vw/eKOjf2HVwoelfJZbijERDLeai4kQAOaXDC4ECAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsXCtZEjRbf5YneYwYIvYhYvz39gtVi5+iiT xbNDvSwOzB67bzawebzfd5XN4/MmuQDmKC6blNSczLLUIn27BK6MhxcnMBXsUKs41tjC2MDY L9/FyMkhIWAi8erIcyYIW0ziwr31bF2MXBxCAhsZJaZveMcKkhAWsJK49/M3O4gtIqAmsenV IiCbA6hIQ+Ld1iwQk1kgXuJuJ9gYNgEjiW/vZ7KA2LwCWhIb9nWC2SwCKhL33l4GmyIqECHx Y8MSRogaQYmTM5+A1XAKaEr8b90FVsMsoC7xZ94lZghbXmL72znMExj5ZyFpmYWkbBaSsgWM zKsYxXIzc4pz0zMLDI30ihPzUjKLs/WS83M3MYLDkTNqB+P1ieaHGJk4OKUaGE01gv2ZX89s L7zdvj9IhvH7kekNGz3U/F+tZWNR7GVPldswqdN24o8XO2xvc70I0O/8ui6irG/H1K5ZWQn3 N2r/f/1vW+SFEs0HE4K/6hwNXbSmq/bI6ym7WuZx3a3qvSTxyPOukuMDg1/nJwaK3cw7MIvj 4wcZAdcPrOmNp6xnKXct5XCewa7EUpyRaKjFXFScCABHPHoD9wEAAA== X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD018; 1:cumhagKwVzXsIa2DjOqRO5DznK3meXkZEMi3/rsDelOdMM9ISXDwXlH9hGqJ5Yiy15cM1puad8nAQdy6wEWtmXkYLtzsv0sSuBSBqM9/0Jn2AF5MKf0U98RgqHNjkjjV9DXhzM65I9N2LKWY90fHj/dtmfKbTrLPk+iA8T2Aa4bjhniXG0fTrHmiP9EG9SKiP5Ojyb8WAe4brMlXPZXvOTuf0LnYoUtbLJ6Or5474vQSXvVRfvULkmVQ+L8u/xk/bUQuJRPqvtbu71s14z13sQuddbBUVCCn2G3GAoNqiZywxCzrTtt8tPGu/sNM72defZvTv/Lxv91y+C8Oi6GDXA== X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(229853001)(64126003)(50466002)(106466001)(33656002)(1220700001)(65956001)(47776003)(80316001)(86362001)(586003)(54356999)(5001960100002)(50986999)(77096005)(59896002)(4001350100001)(23676002)(69596002)(65806001)(19580395003)(110136002)(83506001)(189998001)(87936001)(87266999)(5008740100001)(76176999)(65816999)(1096002)(19580405001)(97736004)(81156007)(4326007)(2950100001)(11100500001)(92566002)(36756003)(230700001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR02MB290; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB290; 2:pH4avWjvWEDaBlVDTgduRGkGo/idVu+DWgrylRbx3vuK6eWZ32EoadGH8wjhMJHLBqHGC1nU4ip2dDWgl7QaXMa6uyFk4J+I1eqaohte3ZJUB3rwsF2NfhkeJRVpmb1GdcZMvuTsCQmr1NyNJX+TGg==; 3:zI1SXdjQdBFjobxWR7PMs0xMWWG092oy2KKNGH7uo3IfzBpYjxwFvKFjMb4c1+UfuMgklHD5upx/HHdEmTSKgYujzc7LuitwELE7xvjpSWqzG88VTrxzz+uoQSH8Ky5zoPKtaxtx2ztUzgbaiFqrCh/dFWBsY1vuwOTDhJr/CX2zgwFc2FnBIQC7QId6riWArwQhI4LHxBA9XzyXSndXXKOfqsqgzIIMjaswbtRElSu9tbaUANpzkuq9ANg2pMAAvZ6JDAS/zFskZYgtjYzSGA==; 25:xtB/r0meclJUBMPkS++UEPQDg7aX/Ug1OXQoMr91ckk/iHgjYPmL4MM6kuameeU211/thNADXIbZ49WWHIHtHQaVnnKR1m084JuFPUcMBMiUa2b9IjtweGON8oIYWikbT+RX03t6JX/nvHIqtPchBvFJ++4IYmk3ydgJkXgwJ0WQWexHuv2hwX/6++vdweL/yJdToTn8r7r/ZCqWbTJZZw7LM46FPmqNzyyYavJsC1vYcWszbXPlIMu1pYEFx4KuW6MFDSAuQYK9PztoCzMkpQ== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BL2PR02MB290; X-Microsoft-Exchange-Diagnostics: 1; BL2PR02MB290; 20:tLp6FdR7t8TeLG4qUuIxC+ynDVlH8R2n/UFXnuc9zlJwPRaKVwdC6VZulYxayMZUK/gR570FEt6IT6hSjUk3pb/OXtPgD/O+iqET3l2AxBNlNMJ0/OyH6++Aqh5Httm4EjpD2hesFVsHsQAlvvZJHJjFI8oPcmmib7p/QYqAKLtAt3/4Gf/818SBg/s/pyU6J8pSH+6NMLAsARvo0vLAYxODVS07/btydWQGK4/rQpe8uz67+p52/9FLmFUmsBtzhRyUmDv3Xd/4IpsZj1XQge9vvMUDuWtL9nTNAvdCrGQiLZ40aUKPZVb53xW7Gl6SlMcasjt59qbZKV/gNW3y0UaqjPC+Q28TcMUiwHtZlV/QILCU1c8AZMn1GrU26G18oPsCQxgDupL4sh0Pe+jSPgmjaAU+GXGykYhbYrJaQST3gRoK5egd2uFVFQaWdCrWRfdcy44j3LZtoniEmM9mGxlJEAT+C1Eal3oRY+AznFLDpS7WDs/ZiiTQDMD+fcVi; 4:vR2LAxJzmnV5eDb0MNRsnbCJxieIxsTKjK+ejPkZrwONV/x4yghT2X+pmBh0CVHtIq7pRhjBN2IvaDbnk7TGnsnGaUqMRuCXhIXrxg+qSJsFyas+vyD/Iz6W78usdkL63ccshn40R9bA+A2j402HUZFRY9nnNsUcfEWtr0YCv5paTDhQscEmBRo7+DQknqAhYTWPP8XSBC7N+OQzj69IdJLUD7raxbwbexlScd2cu8dfzv1UW4YraGoi/yxLAF7IZlKmF6cPHKOAMNt7LT/Wp3O8lrC51eojBWXFwo6OmS2sUhlxkbVOwtpjzq+b23LJqr8SWkFcJg/rXeKHgptpZxB7XJ/nEPKpz57ruMJfwwaMA0/PgZKWUUG+KZl9EucKuAVM5YYiuP/qpxahrxAhsfbx1i3bA4qwzxaFoEd kixSK3xLrffJiIP1Zhh8Fa4iw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001); SRVR: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==; 24:1pfJnI/Om2645vSOjPo2tTMReScXo8vBkchOUFATGnKJ2o/7ezf81VMjBX7tgpLdptjKICSu1QB+ZVN5o+XfrRRk55o24Zan1XRSEo9T2u0=; 20:9YihvjHBBxRXXy8OHzc+A3TpMh8xeStmIioZ4wWOfKq/b1vIZLEZdU0qqNJ/SZy17AEvHmFIvNpFQwVKKd5sxssD+M3ARfgjm8gD1sxKRQziGikO6/Lhl/azGyVTdEvjUFVZVSKDFdwOsTVI+5B53UJp4q1UHKBlqovzxU0MQcqUnsHpb9YOosOJzCc3ddzpiVweouVsnDW6cJ6gB23I2uimpGD9UuD0ez189HUDry2YAyRunLJcMd5LOr9l/rkw SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 14:21:57.4323 (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.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR02MB290 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 The callers of srpt_get_ch_state() can access ch->state safely without using locking. Hence inline this function. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/infiniband/ulp/srpt/ib_srpt.c | 42 ++++++++++------------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 7abad26..cbcc73e 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -109,17 +109,6 @@ enum dma_data_direction opposite_dma_dir(enum dma_data_direction dir) } } -static enum rdma_ch_state srpt_get_ch_state(struct srpt_rdma_ch *ch) -{ - unsigned long flags; - enum rdma_ch_state state; - - spin_lock_irqsave(&ch->spinlock, flags); - state = ch->state; - spin_unlock_irqrestore(&ch->spinlock, flags); - return state; -} - static enum rdma_ch_state srpt_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state new_state) { @@ -216,7 +205,7 @@ static void srpt_srq_event(struct ib_event *event, void *ctx) static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch) { pr_debug("QP event %d on cm_id=%p sess_name=%s state=%d\n", - event->event, ch->cm_id, ch->sess_name, srpt_get_ch_state(ch)); + event->event, ch->cm_id, ch->sess_name, ch->state); switch (event->event) { case IB_EVENT_COMM_EST: @@ -228,7 +217,7 @@ static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch) srpt_release_channel(ch); else pr_debug("%s: state %d - ignored LAST_WQE.\n", - ch->sess_name, srpt_get_ch_state(ch)); + ch->sess_name, ch->state); break; default: pr_err("received unrecognized IB QP event %d\n", event->event); @@ -1784,7 +1773,6 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, struct srpt_send_ioctx *send_ioctx) { struct srp_cmd *srp_cmd; - enum rdma_ch_state ch_state; BUG_ON(!ch); BUG_ON(!recv_ioctx); @@ -1793,13 +1781,12 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, recv_ioctx->ioctx.dma, srp_max_req_size, DMA_FROM_DEVICE); - ch_state = srpt_get_ch_state(ch); - if (unlikely(ch_state == CH_CONNECTING)) { + if (unlikely(ch->state == CH_CONNECTING)) { list_add_tail(&recv_ioctx->wait_list, &ch->cmd_wait_list); goto out; } - if (unlikely(ch_state != CH_LIVE)) + if (unlikely(ch->state != CH_LIVE)) goto out; srp_cmd = recv_ioctx->ioctx.buf; @@ -1908,7 +1895,7 @@ static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc) out: while (!list_empty(&ch->cmd_wait_list) && - srpt_get_ch_state(ch) == CH_LIVE && + ch->state == CH_LIVE && (ioctx = srpt_get_send_ioctx(ch)) != NULL) { struct srpt_recv_ioctx *recv_ioctx; @@ -2314,17 +2301,14 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, && param->port == ch->sport->port && param->listen_id == ch->sport->sdev->cm_id && ch->cm_id) { - enum rdma_ch_state ch_state; - - ch_state = srpt_get_ch_state(ch); - if (ch_state != CH_CONNECTING - && ch_state != CH_LIVE) + if (ch->state != CH_CONNECTING + && ch->state != CH_LIVE) continue; /* found an existing channel */ pr_debug("Found existing channel %s" " cm_id= %p state= %d\n", - ch->sess_name, ch->cm_id, ch_state); + ch->sess_name, ch->cm_id, ch->state); __srpt_close_ch(ch); @@ -2566,7 +2550,7 @@ static void srpt_cm_dreq_recv(struct ib_cm_id *cm_id) ch = srpt_find_channel(cm_id->context, cm_id); BUG_ON(!ch); - pr_debug("cm_id= %p ch->state= %d\n", cm_id, srpt_get_ch_state(ch)); + pr_debug("cm_id= %p ch->state= %d\n", cm_id, ch->state); spin_lock_irqsave(&ch->spinlock, flags); switch (ch->state) { @@ -2750,7 +2734,6 @@ static int srpt_write_pending(struct se_cmd *se_cmd) struct srpt_rdma_ch *ch; struct srpt_send_ioctx *ioctx; enum srpt_command_state new_state; - enum rdma_ch_state ch_state; int ret; ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); @@ -2761,10 +2744,9 @@ static int srpt_write_pending(struct se_cmd *se_cmd) ch = ioctx->ch; BUG_ON(!ch); - ch_state = srpt_get_ch_state(ch); - switch (ch_state) { + switch (ch->state) { case CH_CONNECTING: - WARN(true, "unexpected channel state %d\n", ch_state); + WARN(true, "unexpected channel state %d\n", ch->state); ret = -EINVAL; goto out; case CH_LIVE: @@ -3235,7 +3217,7 @@ static void srpt_close_session(struct se_session *se_sess) ch = se_sess->fabric_sess_ptr; WARN_ON(ch->sess != se_sess); - pr_debug("ch %p state %d\n", ch, srpt_get_ch_state(ch)); + pr_debug("ch %p state %d\n", ch, ch->state); sdev = ch->sport->sdev; spin_lock_irq(&sdev->spinlock);